Skip to content
Rate AI Agent
Open menu

How to set up MCP servers in Cursor

27 Oct 2026 · Rate AI Agent

Cursor reads MCP servers from a small JSON file. Once a server is configured, Cursor's agent can call its tools the same way it edits files or runs commands. This guide shows where the file goes, what to put in it, and how to check the server is working. New to MCP? Start with what MCP is.

Project or global?

  • One project: create .cursor/mcp.json in the repository. Everyone who opens the project gets the same servers, so keep secrets out of it.
  • Every project: use ~/.cursor/mcp.json in your home folder. Good for general tools and for servers that use your personal credentials.

You can also add servers from Cursor's settings, which writes to the same files.

A local server

Local servers are started by Cursor as a command. This example adds Playwright MCP for browser automation:

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp@latest"]
    }
  }
}

The key under mcpServers is a name you choose. command and args are exactly what you would type in a terminal, split into the program and its arguments. If the server needs a token, add an env object with the variable it expects.

A remote server

Hosted servers need only a URL, which the publisher documents. Servers that need an account usually prompt you to sign in from Cursor the first time:

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

Check that it works

  1. Open Cursor's settings and find the MCP section. Each server shows whether it is connected and lists its tools.
  2. If a server is off, turn it on there. You can also switch individual tools off.
  3. In an agent chat, ask for something only that server can do. Cursor asks for approval before running a tool unless you have changed that setting.

When a server shows as offline

  • Invalid JSON. A trailing comma or a missing quote stops the whole file loading. Paste it into a JSON checker.
  • The command doesn't run. Try it in a terminal first. A missing Node.js install or a wrong package name shows up straight away.
  • Missing environment variables. Apps launched from the dock don't always see variables set in your shell profile, so put them in the server's env block.
  • Changes not picked up. Toggle the server off and on, or restart Cursor.

Cursor's settings screens change between versions, so check its documentation if the menus here don't match what you see.

Same servers, different agents

Because MCP is a shared standard, the same servers work in other agents with a different setup step. If you also use Claude Code, see how to add MCP servers to Claude Code. To find servers worth adding, browse the tools directory, or compare Claude Code and Cursor side by side.