What is MCP?

Model Context Protocol (MCP) is a protocol for connecting Cursor to external tools and data sources.

Why use MCP?

MCP connects Cursor to external systems and data. Instead of explaining your project structure repeatedly, integrate directly with your tools.

Write MCP servers in any language that can print to stdout or serve an HTTP endpoint - Python, JavaScript, Go, etc.

How it works

MCP servers expose capabilities through the protocol, connecting Cursor to external tools or data sources.

Cursor supports three transport methods:

TransportExecution environmentDeploymentUsersInputAuth
stdioLocalCursor managesSingle userShell commandManual
SSELocal/RemoteDeploy as serverMultiple usersURL to an SSE endpointOAuth
Streamable HTTPLocal/RemoteDeploy as serverMultiple usersURL to an HTTP endpointOAuth

Installing MCP servers

One-click installation

Install MCP servers from our collection and authenticate with OAuth.

Using mcp.json

Configure custom MCP servers with a JSON file:

{
  "mcpServers": {
    "server-name": {
      "command": "npx",
      "args": ["-y", "mcp-server"],
      "env": {
        "API_KEY": "value"
      }
    }
  }
}

Configuration locations

Project Configuration

Create .cursor/mcp.json in your project for project-specific tools.

Global Configuration

Create ~/.cursor/mcp.json in your home directory for tools available everywhere.

Authentication

MCP servers use environment variables for authentication. Pass API keys and tokens through the config.

Cursor supports OAuth for servers that require it.

Using MCP in chat

The Composer Agent automatically uses MCP tools listed under Available Tools when relevant. Ask for a specific tool by name or describe what you need. Enable or disable tools from settings.

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.

Auto-run

Enable auto-run for Agent to use MCP tools without asking. Works like terminal commands. Read more about Yolo mode here.

Tool response

Cursor shows the response in chat with expandable views of arguments and responses:

Images as context

MCP servers can return images - screenshots, diagrams, etc. Return them as base64 encoded strings:

const RED_CIRCLE_BASE64 = "/9j/4AAQSkZJRgABAgEASABIAAD/2w..." 
// ^ full base64 clipped for readability

server.tool("generate_image", async (params) => {
  return {
    content: [
      {
        type: "image",
        data: RED_CIRCLE_BASE64,
        mimeType: "image/jpeg",
      },
    ],
  };
});

See this example server for implementation details. Cursor attaches returned images to the chat. If the model supports images, it analyzes them.

Security considerations

When installing MCP servers, consider 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

Remember that MCP servers can access external services and execute code on your behalf. Always understand what a server does before installation.

Real-world examples

For practical examples of MCP in action, see our Web Development guide which demonstrates integrating Linear, Figma, and browser tools into your development workflow.

FAQ

What is MCP?

Model Context Protocol (MCP) is a protocol for connecting Cursor to external tools and data sources.

Why use MCP?

MCP connects Cursor to external systems and data. Instead of explaining your project structure repeatedly, integrate directly with your tools.

Write MCP servers in any language that can print to stdout or serve an HTTP endpoint - Python, JavaScript, Go, etc.

How it works

MCP servers expose capabilities through the protocol, connecting Cursor to external tools or data sources.

Cursor supports three transport methods:

TransportExecution environmentDeploymentUsersInputAuth
stdioLocalCursor managesSingle userShell commandManual
SSELocal/RemoteDeploy as serverMultiple usersURL to an SSE endpointOAuth
Streamable HTTPLocal/RemoteDeploy as serverMultiple usersURL to an HTTP endpointOAuth

Installing MCP servers

One-click installation

Install MCP servers from our collection and authenticate with OAuth.

Using mcp.json

Configure custom MCP servers with a JSON file:

{
  "mcpServers": {
    "server-name": {
      "command": "npx",
      "args": ["-y", "mcp-server"],
      "env": {
        "API_KEY": "value"
      }
    }
  }
}

Configuration locations

Project Configuration

Create .cursor/mcp.json in your project for project-specific tools.

Global Configuration

Create ~/.cursor/mcp.json in your home directory for tools available everywhere.

Authentication

MCP servers use environment variables for authentication. Pass API keys and tokens through the config.

Cursor supports OAuth for servers that require it.

Using MCP in chat

The Composer Agent automatically uses MCP tools listed under Available Tools when relevant. Ask for a specific tool by name or describe what you need. Enable or disable tools from settings.

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.

Auto-run

Enable auto-run for Agent to use MCP tools without asking. Works like terminal commands. Read more about Yolo mode here.

Tool response

Cursor shows the response in chat with expandable views of arguments and responses:

Images as context

MCP servers can return images - screenshots, diagrams, etc. Return them as base64 encoded strings:

const RED_CIRCLE_BASE64 = "/9j/4AAQSkZJRgABAgEASABIAAD/2w..." 
// ^ full base64 clipped for readability

server.tool("generate_image", async (params) => {
  return {
    content: [
      {
        type: "image",
        data: RED_CIRCLE_BASE64,
        mimeType: "image/jpeg",
      },
    ],
  };
});

See this example server for implementation details. Cursor attaches returned images to the chat. If the model supports images, it analyzes them.

Security considerations

When installing MCP servers, consider 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

Remember that MCP servers can access external services and execute code on your behalf. Always understand what a server does before installation.

Real-world examples

For practical examples of MCP in action, see our Web Development guide which demonstrates integrating Linear, Figma, and browser tools into your development workflow.

FAQ