docs/ts/cli/mcp.md
Encore provides an MCP server that implements the Model Context Protocol, an open standard that enables large language models (LLMs) to access contextual information about your application. Think of MCP as a standardized interface—like a "USB-C port for AI applications"—that connects your Encore app's data and functionality to any LLM that supports the protocol.
You can connect to Encore's MCP server from any MCP host (such as Claude Desktop, IDEs, or other AI tools) using either Server-Sent Events (SSE) or stdio transport. To set up this connection, simply run:
cd my-encore-app
encore mcp start
MCP Service is running!
MCP SSE URL: http://localhost:9900/sse?app=your-app-id
MCP stdio Command: encore mcp run --app=your-app-id
Copy the appropriate URL or command to your MCP host's configuration, and you're ready to give your AI assistants rich context about your application.
Cursor is one of the most popular AI powered IDE's, and it's simple to use Encore's MCP server together with Cursor.
In order to add the Encore MCP server to Cursor, the fastest way is via the button below (make sure to update your-app-id in the configuration to your actual Encore app ID).
<a href="https://cursor.com/en/install-mcp?name=encore-local&config=eyJjb21tYW5kIjoiZW5jb3JlIG1jcCBydW4gLS1hcHA9eW91ci1hcHAtaWQifQ%3D%3D"></a>
If you prefer to configure it manually, create the file .cursor/mcp.json with the following settings:
{
"mcpServers": {
"encore-local": {
"command": "encore",
"args": ["mcp", "run", "--app=your-app-id"]
}
}
}
Learn more in Cursor's MCP docs
Now when using Cursor's Agent mode, you can ask it to do advanced actions, such as:
"Add an endpoint that publishes to a pub/sub topic, call it and verify that the publish is in the traces"
Starts an SSE-based MCP server and displays connection information.
$ encore mcp start [--app=<app-id>]
Establishes an stdio-based MCP session. This command is typically used by MCP hosts to communicate with the server through standard input/output streams.
$ encore mcp run [--app=<app-id>]
Encore's MCP server exposes the following tools that provide AI models with detailed context about your application. These tools enable LLMs to understand your application's structure, retrieve relevant information, and take actions within your system.