What is MCP in Cursor?
Cursor is an AI-first code editor built on VS Code that integrates the Model Context Protocol (MCP) to connect to external tools and data sources. Instead of explaining your project structure repeatedly, you can integrate directly with your tools.
Write MCP servers in any language that can print to stdout or serve an HTTP endpoint—Python, JavaScript, Go, and more. Cursor will connect to them using the MCP protocol.
MCP servers expose capabilities through the protocol, connecting Cursor to external tools or data sources. Once configured, Agent automatically uses MCP tools when relevant to your prompts, making your AI assistant significantly more capable.
Transport Types
Cursor supports three transport methods for MCP servers:
| Transport | Execution | Authentication | Description |
|---|---|---|---|
| stdio | Local | Manual (env vars) | Local command-line servers managed by Cursor. Best for single-user, local development scenarios. |
| SSE | Local/Remote | OAuth supported | Server-Sent Events transport for real-time streaming. Works with local or remote servers. |
| Streamable HTTP | Local/Remote | OAuth supported | Standard HTTP with streaming capabilities. Ideal for cloud-hosted, multi-user deployments. |
Protocol Support
Cursor supports all major MCP protocol capabilities:
Tools
Functions for the AI model to execute
Prompts
Templated messages and workflows
Resources
Structured data sources
Roots
Server-initiated URI/filesystem inquiries
Elicitation
Server-initiated user information requests
One-Click Installation
The easiest way to install MCP servers in Cursor is through the built-in collection:
- Open Cursor Settings (Cmd+Shift+J)
- Navigate to Features → Model Context Protocol
- Browse available MCP servers
- Click “Add to Cursor” to install
- Authenticate with OAuth if required
Tip
MCP servers installed via one-click show up in the MCP Tools section of your chat. You can toggle individual tools on/off by clicking their names.
Configuring mcp.json
For custom MCP servers or advanced configuration, use the mcp.json file:
Configuration Locations
Project Configuration
.cursor/mcp.jsonProject-specific tools available only in this workspace.
Global Configuration
~/.cursor/mcp.jsonTools available everywhere across all projects.
Configuration Examples
Node.js CLI Server
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"],
"env": {
"API_KEY": "your-key"
}
}
}
}Python CLI Server
{
"mcpServers": {
"my-python-server": {
"command": "python",
"args": ["mcp-server.py"],
"env": {
"API_KEY": "your-key"
}
}
}
}Remote HTTP Server
{
"mcpServers": {
"remote-api": {
"url": "https://api.example.com/mcp",
"headers": {
"Authorization": "Bearer ${env:MY_TOKEN}"
}
}
}
}STDIO Server Configuration
For local command-line servers, configure these fields in your mcp.json:
| Field | Required | Description | Examples |
|---|---|---|---|
| type | Yes | Server connection type | "stdio" |
| command | Yes | Command to start the server | "npx", "python", "docker" |
| args | No | Arguments passed to command | ["server.py", "--port", "3000"] |
| env | No | Environment variables | {"API_KEY": "${env:key}"} |
| envFile | No | Path to .env file | ".env", "${workspaceFolder}/.env" |
Variable Interpolation
Cursor supports variable interpolation in mcp.json values. Variables can be used incommand,args,env,url, andheaders fields:
| Syntax | Description |
|---|---|
| ${env:NAME} | Environment variables from your system |
| ${userHome} | Path to your home folder |
| ${workspaceFolder} | Project root (folder containing .cursor/mcp.json) |
| ${workspaceFolderBasename} | Name of the project root folder |
| ${pathSeparator} or ${/} | OS-specific path separator |
Example with Variables
{
"mcpServers": {
"local-server": {
"command": "python",
"args": ["${workspaceFolder}/tools/mcp_server.py"],
"env": {
"API_KEY": "${env:API_KEY}",
"HOME_DIR": "${userHome}"
}
},
"remote-server": {
"url": "https://api.example.com/mcp",
"headers": {
"Authorization": "Bearer ${env:MY_SERVICE_TOKEN}"
}
}
}
}Using MCP in Chat
Once configured, Agent automatically uses MCP tools listed under “Available Tools” when relevant. This includes Plan Mode.
Toggling Tools
Enable or disable MCP tools directly from the chat interface. Click a tool name in the tools list to toggle it. Disabled tools won't be loaded into context or available to Agent.
Tool Approval
Agent asks for approval before using MCP tools by default. Click the arrow next to the tool name to see arguments before approving.
Auto-Run Mode
Enable auto-run for Agent to use MCP tools without asking. This works similarly to terminal commands and can be configured per-tool or globally in settings.
Image Support
MCP servers can return images (screenshots, diagrams, etc.) as base64 encoded strings. If the model supports images, it will analyse them automatically.
Security Considerations
When installing MCP servers, follow these security practices:
- Verify the source: Only install MCP servers from trusted developers and repositories.
- Review permissions: Check what data and APIs the server will access.
- Limit API keys: Use restricted API keys with minimal required permissions.
- Audit code: For critical integrations, review the server's source code.
Important
MCP servers can access external services and execute code on your behalf. Always understand what a server does before installation.
Troubleshooting
How do I debug MCP server issues?
- Open the Output panel in Cursor (Cmd+Shift+U)
- Select “MCP Logs” from the dropdown
- Check for connection errors, authentication issues, or server crashes
Can I temporarily disable an MCP server?
- Open Settings (Cmd+Shift+J)
- Go to Features → Model Context Protocol
- Click the toggle next to any server to enable/disable
How do I update an MCP server?
For npm-based servers:
- Remove the server from settings
- Clear npm cache:
npm cache clean --force - Re-add the server to get the latest version
What happens if an MCP server crashes?
- • Cursor shows an error message in chat
- • The tool call is marked as failed
- • You can retry the operation or check logs
- • Other MCP servers continue working normally
Ready to Extend Cursor?
MCP transforms Cursor from a powerful AI editor into an extensible development platform. Start with the one-click installation for popular servers, then explore custom configurations as your needs grow.
Frequently Asked Questions
References & Further Reading
- Cursor MCP Documentation- Official guide to MCP in Cursor
- Model Context Protocol - Official Documentation- Complete MCP specification and guides
- Official MCP Servers Repository- Reference implementations and pre-built servers
- Cursor IDE- AI-first code editor built on VS Code
- Building MCP Servers- Guide to creating custom MCP servers
- MCP SDK on npm- TypeScript/JavaScript SDK for building servers
- MCP Inspector Tool- Interactive debugging tool for MCP servers

