Skip to content

SOP-012: MCP Server Setup

Document Control

FieldValue
SOP IDSOP-012
Version1.0
StatusActive
Last Updated2024-12

Purpose

This SOP covers setting up Model Context Protocol (MCP) servers to connect Cursor to external tools and data sources.

Scope

  • One-click MCP installation
  • Manual configuration with mcp.json
  • Transport types (STDIO, SSE, HTTP)
  • Security considerations

Prerequisites

  • Cursor installed and configured
  • For CLI servers: Node.js or Python installed

Procedure

MCP Overview

Architecture: Cursor Agent ↔ MCP Protocol ↔ MCP Server ↔ External Services (Database, APIs)

Transport Types:

TypeDescription
STDIOLocal command-line servers
SSEServer-sent events (local/remote)
HTTPStreamable HTTP (local/remote)

Step 1: One-Click Installation

Browse available servers at cursor.com/docs/context/mcp/directory

Popular MCP Servers:

ServerPurpose
NotionNotes, docs, project management
FigmaDesign files and components
LinearIssue tracking
PlaywrightBrowser automation
Context7Documentation lookup

Install Process:

  1. Visit MCP Directory
  2. Click "Add to Cursor" on desired server
  3. Authenticate if required (OAuth)
  4. Server appears in chat

Step 2: Manual Configuration (mcp.json)

For servers not in directory or custom setups.

Configuration Locations:

ScopePath
Project.cursor/mcp.json
Global~/.cursor/mcp.json

Step 3: Configure STDIO Server

For local command-line servers:

Node.js Example:

json
{
  "mcpServers": {
    "my-database": {
      "command": "npx",
      "args": ["-y", "@my-org/db-mcp-server"],
      "env": {
        "DATABASE_URL": "${env:DATABASE_URL}"
      }
    }
  }
}

Python Example:

json
{
  "mcpServers": {
    "data-processor": {
      "command": "python",
      "args": ["${workspaceFolder}/tools/mcp_server.py"],
      "env": {
        "API_KEY": "${env:API_KEY}"
      }
    }
  }
}

Configuration Fields:

FieldRequiredDescription
typeNo"stdio" (default for command-based)
commandYesExecutable to run
argsNoCommand arguments
envNoEnvironment variables
envFileNoPath to .env file

Step 4: Configure Remote Server

For HTTP/SSE endpoints:

json
{
  "mcpServers": {
    "my-api": {
      "url": "https://api.example.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:API_TOKEN}"
      }
    }
  }
}

Step 5: Use Config Variables

Supported interpolation:

VariableDescription
${env:NAME}Environment variable
${userHome}Home directory
${workspaceFolder}Project root
${workspaceFolderBasename}Project folder name
${pathSeparator} or ${/}OS path separator

Example with Variables:

json
{
  "mcpServers": {
    "project-tools": {
      "command": "node",
      "args": ["${workspaceFolder}/scripts/mcp-server.js"],
      "env": {
        "HOME": "${userHome}",
        "PROJECT": "${workspaceFolderBasename}"
      }
    }
  }
}

Using MCP in Chat

Toggle Servers

  1. Start a chat session
  2. Click "Available Tools" in chat
  3. Toggle servers on/off by clicking their names

Tool Approval

By default, Agent asks before using MCP tools:

Agent wants to use: my-database.query

Arguments: { "sql": "SELECT * FROM users" }

Options: [Run] [Skip]

Auto-Run MCP Tools

Add to allowlist in Settings → Cursor Settings → Agents → MCP Allowlist


Protocol Capabilities

FeatureSupportDescription
ToolsFunctions AI can call
PromptsTemplates for workflows
ResourcesStructured data sources
RootsFilesystem boundaries
ElicitationServer requests for info

Security Best Practices

  • Verify source - Install from trusted developers only
  • Review permissions - Check what data/APIs server accesses
  • Limit API keys - Use restricted keys with minimal permissions
  • Audit code - Review source for critical integrations
  • Use environment variables - Never hardcode secrets
  • Monitor usage - Check what tools are being called

Debugging MCP Issues

View Server Status:

  1. Open Command Palette
  2. Search "MCP: Show Servers"
  3. View status and logs

Common Issues:

IssueSolution
Server not startingCheck command path, dependencies
Authentication failedVerify API keys, re-authenticate
Tool not appearingCheck mcp.json syntax, restart
Timeout errorsCheck network, increase timeout

Verification Checklist

  • [ ] mcp.json created in correct location
  • [ ] Server appears in Available Tools
  • [ ] Can toggle server on/off
  • [ ] Tool calls work as expected
  • [ ] Environment variables resolved correctly
  • [ ] Authentication works (if required)

Troubleshooting

IssueSolution
Server won't connectCheck mcp.json syntax
Command not foundVerify command is in PATH
Env vars not workingUse correct ${env:VAR} syntax
OAuth failingClear cache, re-authenticate
Server crashesCheck logs, review server code

See Also

Built with VitePress | Powered by Claude AI