← All docs

Connect a server

Most MCP clients use a JSON configuration file to know which servers to load. Here's how to set it up.

Claude Desktop

  1. Open Claude Desktop → Settings → Developer → Edit Config. This opens claude_desktop_config.json.
  2. Add your server:
    {
      "mcpServers": {
        "my-server": {
          "command": "npx",
          "args": ["-y", "@example/mcp-server"],
          "env": { "API_KEY": "your-key-here" }
        }
      }
    }
  3. Save and restart Claude Desktop. Look for the 🔌 icon — your server's tools are now available.

Cursor

  1. Open Cursor → Settings → MCP → Add new MCP server.
  2. Enter the command and arguments (same format as above).
  3. Cursor will start the server automatically.

Tips

  • API keys: never commit them to git. Use environment variables.
  • Local vs remote: some servers run on your machine (command), others connect to a URL (url instead of command).
  • Troubleshooting: check the client's logs. Most connection issues are wrong paths or missing env vars.

Next: Submit a server →