🤖 Lich MCP Integration¶
47 MCP Tools - Full Control for AI Assistants
Lich MCP (Model Context Protocol) enables AI coding assistants to directly interact with your Lich project - generating code, running tests, deploying, and more.
🎯 Quick Setup¶
1. Install Lich CLI¶
2. Configure Your AI Tool¶
Recommended: Run lich setup antigravity to automatically configure.
Manual Configuration:
Create/Edit ~/.gemini/antigravity/mcp_config.json:
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"lich": {
"command": "lich",
"args": ["serve"],
"cwd": "/path/to/your/lich-project"
}
}
}
Then restart Claude Desktop.
Add to Cursor settings:
🚀 Recommended Setup Flow¶
After installing Lich, follow these steps to integrate with your AI tool:
Step 1: Run Setup Command¶
This interactive command will:
- Detect your operating system
- Ask which AI tools you want to configure
- Automatically update the correct config files
Step 2: Restart Your AI Tool¶
Important
After setup completes, you must completely quit and relaunch your AI tool (Antigravity, Claude, Cursor, etc.)
Step 3: First Prompt to AI¶
Start with this prompt to verify connection:
"Do you know the Lich MCP server?"
If yes, follow up with:
"Go read AGENTS.md completely to update yourself based on the project."
This ensures your AI assistant understands the project architecture and rules.
⬆️ Upgrading Lich¶
To upgrade to the latest version:
After upgrade:
- Run
lich setupagain to update AI tool configurations - Restart your AI tool completely
🛠️ Available Tools (47 Total)¶
Project Management¶
| Tool | Description |
|---|---|
lich_init |
Create a new Lich project |
lich_check_project |
Validate project structure |
lich_version |
Show Lich version |
lich_upgrade |
Upgrade project to latest |
lich_adopt |
Adopt existing Python project |
Code Generation (10 tools)¶
| Tool | Description |
|---|---|
lich_make_entity |
Create domain entity |
lich_make_service |
Create service (use case) |
lich_make_api |
Create API controller |
lich_make_dto |
Create DTO |
lich_make_factory |
Create test factory |
lich_make_middleware |
Create middleware |
lich_make_event |
Create domain event |
lich_make_listener |
Create event listener |
lich_make_job |
Create background job |
lich_make_policy |
Create authorization policy |
Database Operations¶
| Tool | Description |
|---|---|
lich_migration_init |
Initialize Alembic |
lich_migration_create |
Create new migration |
lich_migration_up |
Apply migrations |
lich_migration_down |
Rollback migrations |
lich_migration_status |
Show migration status |
lich_migration_heads |
Show migration heads |
lich_seed |
Seed database |
lich_seed_list |
List available seeders |
lich_routes |
List all API routes |
Git Workflow¶
| Tool | Description |
|---|---|
lich_git_commit |
Create semantic commit |
lich_git_tag |
Create version tag |
lich_git_push |
Push to remote |
Quality Assurance¶
| Tool | Description |
|---|---|
lich_lint_backend |
Run Python linter (Ruff) |
lich_lint_frontend |
Run ESLint |
lich_test |
Run pytest |
lich_security_scan |
Run security scans |
lich_ci_all |
Run all CI checks |
lich_ci_backend |
Run backend CI |
lich_ci_web |
Run web app CI |
lich_ci_admin |
Run admin CI |
lich_production_ready_check |
Check production readiness |
lich_production_ready_fix |
Auto-fix issues |
Secret Management¶
| Tool | Description |
|---|---|
lich_secret_generate |
Generate secure secrets |
lich_secret_rotate |
Rotate existing secrets |
lich_secret_check |
Check secret strength |
Middleware Management¶
| Tool | Description |
|---|---|
lich_middleware_list |
List all middlewares |
lich_middleware_enable |
Enable a middleware |
lich_middleware_disable |
Disable a middleware |
Development Environment¶
| Tool | Description |
|---|---|
lich_dev_start |
Start dev environment |
lich_dev_stop |
Stop dev environment |
Deployment¶
| Tool | Description |
|---|---|
lich_deploy |
Deploy via Ansible |
lich_backup |
Database backup operations |
💬 Example Conversations¶
Creating a New Feature¶
You → AI
"Create a new Product entity with name, price, and stock fields, then create a ProductService and API endpoint."
The AI will use:
lich_make_entity→ CreatesProductentitylich_make_service→ CreatesProductServicelich_make_api→ Creates Product API controllerlich_make_dto→ Creates request/response DTOslich_migration_create→ Creates database migration
Deploying to Production¶
You → AI
"Check if the project is production-ready, fix any issues, then deploy to staging."
The AI will use:
lich_production_ready_check→ Scans for issueslich_production_ready_fix→ Auto-fixes problemslich_secret_check→ Validates secretslich_ci_all→ Runs all quality checkslich_deploy→ Deploys to staging
Database Changes¶
You → AI
"Add a new email_verified field to the User entity and update the database."
The AI will use:
- Edit the entity file
lich_migration_create→ Creates migrationlich_migration_up→ Applies migrationlich_migration_status→ Verifies success
🔒 Security Notes¶
Production Deployments
By default, deployment tools run in dry_run mode. The AI must explicitly set dry_run=False for real deployments.
Secret Rotation
Secret rotation also defaults to dry_run=True. Always review proposed changes before applying.
🧪 Testing Your Setup¶
After configuring MCP, ask your AI:
"What Lich tools are available?"
The AI should list all 47 tools with descriptions.
Then try:
"Check if this is a valid Lich project"
The AI should use lich_check_project and report the result.
🐛 Troubleshooting¶
"lich command not found"¶
Make sure Lich is installed and in your PATH:
"Not a Lich project"¶
Most tools require being in a Lich project directory. Either:
- Set the correct
cwdin your MCP config - Navigate to a Lich project before using tools
MCP Server Won't Start¶
Check if the server starts manually:
You should see: 🤖 Lich MCP Server Starting...