</>MCP Agents Market

How to Install an MCP Server in Cursor

This guide walks you through installing and configuring an MCP (Model Context Protocol) server in Cursor, the AI-powered code editor. By the end, you'll have a working MCP server connected to Cursor, enabling your AI assistant to access external tools, databases, APIs, and services directly from your editor.

MCP servers act as bridges between Cursor's AI capabilities and the resources your code depends on. Whether you need database access, file system operations, or API integrations, installing the right MCP server extends what your AI assistant can do without leaving your workflow.

What You Need Before You Install MCP Server in Cursor

Before starting the installation process, ensure you have:

  • Cursor IDE installed (version 0.40 or later recommended)
  • Node.js 18+ or Python 3.10+ (depending on the server you're installing)
  • Basic command line familiarity
  • Access to the MCP server package or repository you want to install

Most MCP servers are distributed via npm for Node.js or PyPI for Python. Some are available as standalone binaries. Check the MCP Agents Market directory to find servers that match your needs.

Understanding Cursor's MCP Configuration

Cursor stores MCP server configurations in a JSON file specific to your operating system:

  • macOS/Linux: ~/.cursor/mcp.json
  • Windows: %APPDATA%\Cursor\mcp.json

This configuration file tells Cursor which MCP servers to launch, how to start them, and what permissions they have. Each server entry includes a command to execute and optional environment variables.

Step 1: Choose and Prepare Your MCP Server

First, identify which MCP server you need. Common types include:

  • Database servers for querying PostgreSQL, MySQL, or SQLite
  • Filesystem servers for reading and writing project files
  • API integration servers for external services
  • Development tool servers for build systems and testing frameworks

For this example, we'll install a filesystem MCP server using npx. The process is similar for other servers, with variations in the command and arguments.

If your chosen server requires installation (not runnable via npx), install it globally:

bash npm install -g @modelcontextprotocol/server-filesystem

Or for Python-based servers:

bash pip install mcp-server-example

Step 2: Locate or Create Your MCP Configuration File

Open your terminal and navigate to Cursor's configuration directory. If the mcp.json file doesn't exist yet, you'll create it.

On macOS or Linux:

bash mkdir -p ~/.cursor touch ~/.cursor/mcp.json

On Windows (PowerShell):

powershell New-Item -ItemType Directory -Force -Path "$env:APPDATA\Cursor" New-Item -ItemType File -Force -Path "$env:APPDATA\Cursor\mcp.json"

Step 3: Add Your MCP Server Configuration

Open mcp.json in any text editor. The file should contain a JSON object with an mcpServers key. Here's how to install an MCP server in Cursor's config:

{ "mcpServers": { "filesystem": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory" ] } } }

Replace /path/to/allowed/directory with the actual path you want the server to access. For workspace-relative paths, use your project root.

Adding Multiple MCP Servers

You can configure multiple servers in the same file:

{ "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "./"] }, "postgres": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-postgres"], "env": { "DATABASE_URL": "postgresql://user:pass@localhost/db" } } } }

Step 4: Configure Environment Variables and Permissions

Many MCP servers require environment variables for API keys, database credentials, or configuration:

{ "mcpServers": { "api-server": { "command": "node", "args": ["/path/to/server.js"], "env": { "API_KEY": "your-api-key-here", "API_ENDPOINT": "https://api.example.com" } } } }

Security note: Never commit API keys directly in your config. Use environment variable references or a secrets management system for production setups.

Step 5: Restart Cursor and Verify Installation

After saving your mcp.json file:

  1. Completely quit Cursor (not just close the window)
  2. Relaunch Cursor
  3. Open any project or file
  4. Trigger the AI assistant (Cmd+K or Ctrl+K)

Cursor will attempt to start all configured MCP servers on launch. You can verify successful installation by:

  • Checking if the AI assistant can access server capabilities (try asking it to list files if you installed a filesystem server)
  • Looking for MCP-related messages in Cursor's developer console (Help > Toggle Developer Tools)

Troubleshooting Common Installation Issues

Server Fails to Start

If your MCP server doesn't start:

  • Check the command path: Ensure npx, node, python, or your binary is in your system PATH
  • Verify arguments: Typos in args array will prevent startup
  • Review permissions: Some servers need read/write access to specific directories
  • Check logs: Open Developer Tools in Cursor to see error messages

Configuration Not Loading

If Cursor ignores your config:

  • Validate JSON syntax: Use a JSON validator to check for syntax errors
  • Check file location: Ensure mcp.json is in the correct directory for your OS
  • Restart completely: Some changes require a full application restart

Server Runs But AI Can't Access It

If the server starts but the AI doesn't use it:

  • Check server compatibility: Ensure the server implements the MCP protocol correctly
  • Verify capabilities: Some servers need specific prompts to activate
  • Review server logs: The server itself may log connection issues

Installing Python-Based MCP Servers

For Python MCP servers, the process differs slightly:

{ "mcpServers": { "python-server": { "command": "python", "args": [ "-m", "mcp_server_module", "--config", "config.json" ] } } }

Or using uvx for isolated Python environments:

{ "mcpServers": { "python-server": { "command": "uvx", "args": ["mcp-server-package"] } } }

Testing Your MCP Server Installation

Once installed, test your server by asking Cursor's AI to perform tasks the server enables:

  • Filesystem server: "List all TypeScript files in the src directory"
  • Database server: "Show me the schema for the users table"
  • API server: "Fetch the latest data from the API endpoint"

The AI should recognize it has access to these capabilities and execute them through your MCP server.

Finding More MCP Servers to Install

The MCP Agents Market directory catalogs dozens of MCP servers across categories like databases, APIs, development tools, and productivity services. Each listing includes installation instructions and configuration examples.

Popular server categories include:

  • Data & databases for persistent storage access
  • Browser automation for web scraping and testing
  • Cloud services for AWS, Google Cloud, and Azure integrations
  • Developer tools for Git, Docker, and build systems

Best Practices for Managing MCP Servers in Cursor

As you install multiple MCP servers:

  • Use descriptive names in your config (the key in mcpServers) to remember what each does
  • Comment your configuration by maintaining a separate README documenting each server's purpose
  • Version control wisely: Commit mcp.json to your team repo but use environment variables for secrets
  • Monitor performance: Too many servers can slow Cursor's startup time
  • Update regularly: Check for server updates to get new features and security patches

Next Steps After Installation

With your MCP server installed in Cursor, you can:

  • Explore the server's full capabilities by reviewing its documentation
  • Combine multiple servers for complex workflows
  • Create custom prompts that leverage your server's unique features
  • Share your configuration with teammates for consistent development environments

The MCP ecosystem is rapidly growing. As you become comfortable with basic installation, consider building your own MCP servers to automate project-specific tasks or integrate proprietary tools.

Frequently Asked Questions

Where is the MCP configuration file for Cursor?+

The MCP configuration file is located at ~/.cursor/mcp.json on macOS and Linux, or %APPDATA%\Cursor\mcp.json on Windows. This JSON file defines which MCP servers Cursor should launch and how to configure them.

Do I need to restart Cursor after installing an MCP server?+

Yes, you must completely quit and restart Cursor after modifying mcp.json for changes to take effect. Cursor reads the configuration file only on startup and launches the configured servers at that time.

Can I run multiple MCP servers simultaneously in Cursor?+

Yes, you can configure multiple MCP servers in the same mcp.json file. Each server runs independently and provides its own set of capabilities to Cursor's AI assistant. Just add additional entries under the mcpServers object.

How do I know if my MCP server installed correctly in Cursor?+

You can verify installation by asking Cursor's AI to perform tasks the server enables (like listing files for a filesystem server), or by checking Cursor's Developer Tools console (Help > Toggle Developer Tools) for startup messages or errors.

What's the difference between npx and installing MCP servers globally?+

Using npx runs the latest version of a server without permanent installation, which is convenient for testing. Global installation (npm install -g) downloads the package once and runs faster on subsequent starts, better for servers you use regularly.

Can I use environment variables in Cursor's MCP configuration?+

Yes, add an env object to your server configuration with key-value pairs for any environment variables the server needs. This is essential for passing API keys, database credentials, and other configuration to your MCP servers.