docs/go/ai-integration.md
Encore is built for AI-assisted development. Encore-specific rules and MCP integration let AI understand your architecture and generate type-safe code that follows your patterns. Run encore run to start your app; Encore provisions local infrastructure automatically.
For production, self-host or use Encore Cloud to provision infrastructure in your own AWS or GCP account.
Encore's declarative APIs and infrastructure primitives give AI a clear model to work with. AI can add databases, pub/sub topics, and other resources with built-in guardrails, and use MCP to introspect your app—services, APIs, databases, and traces—so it can suggest accurate, pattern-consistent code.
<video autoPlay playsInline loop controls muted className="w-full h-full"> <source src="https://encore.cloud/assets/docs/claude-skills.mp4" type="video/mp4" /> </video>There are two ways to set up AI support:
New projects: When you run encore app create, you'll be prompted to select an AI tool. Encore generates the appropriate configuration files for your chosen tool.
Existing projects: Run encore llm-rules init to add AI support:
encore llm-rules init
This prompts you to select a tool and generates the appropriate configuration file (.cursorrules, CLAUDE.md, etc.).
Both commands also set up MCP server configuration for tools that support it (Cursor, Claude Code). If you want to set up MCP manually, see MCP Server below.
Supported tools: Cursor, Claude Code, VS Code, AGENTS.md, and Zed.
Use the Encore skills package which works with Cursor, Claude Code, GitHub Copilot, and 10+ other AI agents:
npx add-skill encoredev/skills
You can also install specific skills or target specific agents:
# List available skills
npx add-skill encoredev/skills --list
# Install to specific agents
npx add-skill encoredev/skills -a cursor -a claude-code
The skills package includes a migration skill that can automatically migrate your existing backend to Encore Go. See the Migrate using AI agent guide to learn more.
Encore's Model Context Protocol (MCP) server gives AI agents deep introspection into your application: querying databases, calling APIs, inspecting services, and analyzing traces.
From your Encore app directory:
encore mcp start
This displays connection information. Keep it running while using your AI tools.
Quick setup: Use this button (update your-app-id to your actual app ID):
<a href="https://cursor.com/en/install-mcp?name=encore-local&config=eyJjb21tYW5kIjoiZW5jb3JlIG1jcCBydW4gLS1hcHA9eW91ci1hcHAtaWQifQ%3D%3D"></a>
Manual setup: Create .cursor/mcp.json:
{
"mcpServers": {
"encore-local": {
"command": "encore",
"args": ["mcp", "run", "--app=your-app-id"]
}
}
}
Find your app ID in the encore.app file or in the Encore dashboard.
From your Encore app directory:
claude mcp add --transport stdio encore-local -- encore mcp run --app=your-app-id
Verify with claude mcp list. You should see encore-local in the list.
With Encore skills and MCP connected, AI can:
encore run to test with real infrastructure, not mocksAI can access Encore's distributed tracing via MCP to debug issues intelligently. Instead of guessing, AI can view actual request traces, analyze timing across services, and inspect span details to pinpoint exactly where things went wrong. This creates a powerful feedback loop: generate code, test it, analyze the traces, and iterate.
AI can query your actual database schema and data via MCP. This means AI understands your real data model and can generate accurate queries, suggest schema changes, and debug data issues by inspecting actual records.
When you run encore run, Encore provisions real local infrastructure (databases, pub/sub, etc.). AI can generate code and immediately test it against real services, catching issues early and ensuring the code works before you deploy.
Example prompts: