Skip to main content
← Back to Learn
beginner10 min read

Connect Cursor to MCP Servers

Cursor has native MCP support. This guide shows you exactly how to configure it, add any MCP server, and get your AI coding assistant working with external tools and data sources.

What Cursor MCP Integration Gives You

Cursor's Agent mode (Cmd/Ctrl + I) can call MCP tools directly during code generation. This means the AI can query your database, read your documentation, call your APIs, or interact with any service — all without leaving the editor.

Database queries
Connect a Postgres or SQLite MCP server so Cursor can read schema and run queries while generating code.
Documentation lookup
Add a docs MCP server to give Cursor access to internal wikis, OpenAPI specs, or custom knowledge bases.
External APIs
Expose REST APIs, GitHub, JIRA, or any service through MCP so Cursor can create issues, read PRs, and more.

Step 1 — Open Cursor MCP Settings

Cursor stores MCP configuration in a dedicated settings file (separate from VS Code's settings.json). There are two ways to open it:

Option A — Settings UI

1. Open Cursor Settings (Cmd + ,)

2. Navigate to Features → MCP Servers

3. Click "Edit in settings.json"

Option B — Direct file edit

macOS: ~/.cursor/mcp.json

Windows: %USERPROFILE%\.cursor\mcp.json

Linux: ~/.cursor/mcp.json

Project-level config: You can also create a .cursor/mcp.json file in your project root to define MCP servers that are only active for that project. This is great for team setups checked into version control.

Step 2 — Add an MCP Server

The MCP configuration file uses the same format as Claude Desktop. Here's the basic structure:

~/.cursor/mcp.json
{
  "mcpServers": {
    "server-name": {
      "command": "node",
      "args": ["/path/to/server/index.js"],
      "env": {
        "API_KEY": "your-api-key-here"
      }
    }
  }
}

Each server entry has:

  • key — a unique name for the server (shown in Cursor UI)
  • command — the executable to run (node, python, npx, uvx, etc.)
  • args — array of arguments passed to the command
  • env — optional environment variables (for API keys, etc.)

Real examples

Filesystem server (via npx)

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/you/projects"
      ]
    }
  }
}

Python MCP server (via uv)

{
  "mcpServers": {
    "my-python-server": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/my-mcp-server",
        "run",
        "server.py"
      ]
    }
  }
}

HTTP/SSE server (remote)

{
  "mcpServers": {
    "remote-server": {
      "url": "https://your-mcp-server.example.com/sse"
    }
  }
}

Step 3 — Enable and Test

After saving your mcp.json, reload Cursor. MCP servers start automatically when Cursor launches.

1

Check server status

Open Cursor Settings → Features → MCP Servers. You should see your server listed with a green dot. If it shows red, hover for the error message.

2

Open Agent mode

Press Cmd + I (macOS) or Ctrl + I (Windows/Linux) to open Cursor Agent.

3

Ask it to use a tool

Type something like "list the files in my project root" (if using filesystem server). Cursor will show a tool call prompt — approve it and see the result.

Troubleshooting

Server shows as "failed" or red

Hover over the server name in Settings to see the full error. Common causes:

  • Wrong path to command or script (must be absolute)
  • Missing dependency (npm package or Python module not installed)
  • Port conflict if using HTTP transport
Tools not appearing in Agent

Cursor only shows MCP tools when the server is healthy. Also check:

  • You're in Agent mode, not regular Chat (Cmd+I not Cmd+L)
  • Try fully restarting Cursor after config changes
Environment variables not working

Cursor launches MCP servers with a clean environment. Pass all required variables in the env object in your config, rather than relying on your shell's env.

JSON parse error on startup

Your mcp.json has a syntax error. Validate it with cat ~/.cursor/mcp.json | python3 -m json.tool.

Ready to build your own MCP server?

Now that Cursor is configured, build a custom MCP server to give it access to your tools.