How to set up MCP servers in Claude Code, Claude Desktop and Cursor

An MCP server is a small program that gives your AI assistant a new ability, such as reading files, looking up documentation, or driving a browser. Each app needs to be told which servers to run. This guide shows where that setting lives in each app and how to check it worked.

Short on time? Use the free config builder. Tick the servers you want and it writes the JSON for you. Not sure which to pick? See the servers worth installing first.

What the config looks like

All three apps use the same shape: a list of named servers, each with a command to run and its arguments.

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    }
  }
}

Many servers need Node.js installed, because npx comes with it. Some use uvx, which comes with uv.

Claude Code

You can add a server with one command:

claude mcp add context7 -- npx -y @upstash/context7-mcp

Everything after the -- is the command that starts the server. To pass a secret such as an API key, use --env KEY=value, and put another option such as --transport stdio between it and the server name.

Where it gets saved

Check it worked

claude mcp list

This shows each server and whether it connected.

Claude Desktop

  1. Open the Claude menu, choose Settings, then the Developer tab, then Edit Config.
  2. Add your servers under mcpServers. The file is %APPDATA%\Claude\claude_desktop_config.json on Windows and ~/Library/Application Support/Claude/claude_desktop_config.json on macOS.
  3. Fully quit and restart Claude Desktop. Closing the window isn't enough.

Use absolute paths for any folders you give a server, not relative ones. If a server doesn't show up, the logs are in %APPDATA%\Claude\logs (Windows) or ~/Library/Logs/Claude (macOS).

Cursor

If a server won't start

  1. Run the command yourself in a terminal (for example npx -y @upstash/context7-mcp). If it prints an error, that's your answer.
  2. Check Node.js is installed: node --version.
  3. "Connection closed" usually means the server process exited right after starting. The terminal test above shows why. Full troubleshooting guide.
  4. Windows: we tested plain npx with Claude Code 2.1.278 on native Windows and it connected fine. Some older setups have reported needing "command": "cmd" with "/c", "npx", ... at the start of the arguments. Try that only if the steps above don't help.

Stay safe

MCP servers run on your computer with your user's permissions. Only install servers from authors you trust, give file servers access to specific folders rather than your whole drive, and be careful with servers that fetch content from the web, since that content can try to steer the AI.

Open the config builder Get early access to Pro