How to Add an MCP Server to Claude Desktop

Claude Desktop is Anthropic's desktop application, and it discovers MCP servers from a single JSON file called claude_desktop_config.json. Each entry in its mcpServers object tells the app which local command to launch (stdio) or which remote URL to reach. Claude Desktop is the original MCP client and remains the reference implementation most config examples target.

Config file location

Generate a Claude Desktop config

The tool below is pre-set to Claude Desktop. Fill in the server and copy the JSON — it never leaves your browser.

Transport
Advanced: environment variables

Config JSON

Where this file lives

    Working example

    A complete Claude Desktop config for the GitHub MCP server. Note the -y flag: without it, npx waits for an install confirmation the app can never answer.

    {
      "mcpServers": {
        "github": {
          "command": "npx",
          "args": ["-y", "@modelcontextprotocol/server-github"],
          "env": {
            "GITHUB_TOKEN": "<your-token-here>"
          }
        }
      }
    }
    ~/Library/Application Support/Claude/claude_desktop_config.json
    {
      "mcpServers": {
        "fetch": {
          "command": "npx",
          "args": ["-y", "@modelcontextprotocol/server-fetch"],
          "env": {
            "DEBUG": "mcp:fetch"
          }
        }
      }
    }
    Screenshot-style view of claude_desktop_config.json on macOS with a fetch server and a placeholder env value.

    How to add the server, step by step

    1. Quit Claude Desktop completely (see the restart pitfall below - closing the window is not enough).
    2. Open claude_desktop_config.json in a text editor, creating it if it does not exist.
    3. Paste your generated mcpServers JSON, merging with any servers already present.
    4. Validate the file first if you edited it by hand - one trailing comma disables every server.
    5. Launch Claude Desktop and check the hammer/tools icon in a new chat to confirm the server started.

    Claude Desktop-specific pitfalls

    Closing the window is not a restart

    Claude Desktop reads claude_desktop_config.json once, at launch. On macOS you must use Cmd+Q; on Windows, quit from the system-tray icon. Simply closing the window leaves the old config in memory, which is why "I edited the file and nothing changed" is the most common Claude Desktop complaint.

    GUI apps do not inherit your shell PATH

    If Node was installed via nvm, fnm or volta, the npx shim lives in a directory only your shell profile adds to PATH. Claude Desktop is a GUI app and never reads .zshrc, so it fails with spawn npx ENOENT. The fix is an absolute path, e.g. /Users/you/.nvm/versions/node/v22/bin/npx, or a Node version manager that installs into a system location.

    Broken JSON fails silently

    Claude Desktop shows no error dialog for an invalid config - every server just disappears. If your servers vanished after an edit, run the file through the validator on our homepage before anything else. The app's own logs (Settings > Developer > Open Logs) confirm parse failures.

    Tokens sit in plaintext

    Values in env (like a GitHub token) are stored unencrypted in the config file. Keep the file out of dotfiles repos and screenshots, and prefer read-only, narrowly scoped tokens.

    FAQ

    Where is claude_desktop_config.json?

    On macOS it lives at ~/Library/Application Support/Claude/claude_desktop_config.json; on Windows at %APPDATA%\Claude\claude_desktop_config.json. You can also open it from within the app via Settings > Developer > Edit Config.

    Why does Claude Desktop say "spawn npx ENOENT"?

    The app cannot find npx because GUI applications do not inherit the PATH customizations from your shell profile. Replace "command": "npx" with the absolute path to your npx binary (run `which npx` in a terminal to find it).

    Do I need to restart Claude Desktop after editing the config?

    Yes, a full quit and relaunch. The config file is only read at startup, and closing the window does not quit the app on either macOS or Windows.

    Configuring other clients too? See the guides forClaude Desktop,Cursor,VS Code,Windsurf,Zed andCline, or readhow MCP transports differ.