18 min read

Setting Up MCP in Cursor: Complete Configuration Guide

Cursor is one of the most popular AI-first code editors, built on VS Code with deep AI integration. This guide covers everything you need to configure MCP servers in Cursor—from one-click installation to advanced mcp.json configuration with variable interpolation and OAuth support.

Cursor IDE MCP configuration - AI-powered code editor

Connect Cursor to external tools with MCP

Key Takeaways

  • Cursor supports three transport types: stdio (local), SSE, and Streamable HTTP (both local/remote).
  • Install MCP servers via one-click installation from Cursor's collection or manually through mcp.json.
  • Use variable interpolation (${env:NAME}) for secure credential management.
  • Agent automatically uses available MCP tools when relevant, with optional auto-approval for trusted servers.

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:

TransportExecutionAuthenticationDescription
stdioLocalManual (env vars)Local command-line servers managed by Cursor. Best for single-user, local development scenarios.
SSELocal/RemoteOAuth supportedServer-Sent Events transport for real-time streaming. Works with local or remote servers.
Streamable HTTPLocal/RemoteOAuth supportedStandard 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:

  1. Open Cursor Settings (Cmd+Shift+J)
  2. Navigate to FeaturesModel Context Protocol
  3. Browse available MCP servers
  4. Click “Add to Cursor” to install
  5. 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.json

Project-specific tools available only in this workspace.

Global Configuration

~/.cursor/mcp.json

Tools available everywhere across all projects.

Configuration Examples

Node.js CLI Server

JSON
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"],
      "env": {
        "API_KEY": "your-key"
      }
    }
  }
}

Python CLI Server

JSON
{
  "mcpServers": {
    "my-python-server": {
      "command": "python",
      "args": ["mcp-server.py"],
      "env": {
        "API_KEY": "your-key"
      }
    }
  }
}

Remote HTTP Server

JSON
{
  "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:

FieldRequiredDescriptionExamples
typeYesServer connection type"stdio"
commandYesCommand to start the server"npx", "python", "docker"
argsNoArguments passed to command["server.py", "--port", "3000"]
envNoEnvironment variables{"API_KEY": "${env:key}"}
envFileNoPath 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:

SyntaxDescription
${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

JSON
{
  "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?

  1. Open the Output panel in Cursor (Cmd+Shift+U)
  2. Select “MCP Logs” from the dropdown
  3. Check for connection errors, authentication issues, or server crashes

Can I temporarily disable an MCP server?

  1. Open Settings (Cmd+Shift+J)
  2. Go to Features → Model Context Protocol
  3. Click the toggle next to any server to enable/disable

How do I update an MCP server?

For npm-based servers:

  1. Remove the server from settings
  2. Clear npm cache: npm cache clean --force
  3. 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

Cursor uses mcp.json for MCP configuration. For project-specific settings, place it at .cursor/mcp.json in your project root. For global settings available across all projects, use ~/.cursor/mcp.json in your home directory.
Open the Output panel (Cmd+Shift+U), select "MCP Logs" from the dropdown, and check for connection errors, authentication issues, or server crashes. You can also try running the MCP server command manually in your terminal to see detailed error output.
Yes, you can configure multiple MCP servers in your mcp.json file. Each server is defined as a separate entry under the mcpServers object. Cursor will load all configured servers, and you can toggle individual tools on/off in the chat interface.
Cursor supports three transport types: stdio for local command-line servers, SSE (Server-Sent Events) for real-time streaming from local or remote servers, and Streamable HTTP for standard HTTP with streaming capabilities, ideal for cloud-hosted deployments.
Use variable interpolation with the ${env:NAME} syntax to reference environment variables. This keeps sensitive credentials out of your configuration files. You can also use envFile to load variables from a .env file.

References & Further Reading

Related Articles

Ayodele Ajayi

Senior DevOps Engineer based in Kent, UK. Specialising in cloud infrastructure, DevSecOps, and platform engineering. Passionate about AI-assisted development and sharing knowledge through technical writing.