Getting Started2026-07-193 min read

Connecting Claude to an MCP Server: Every Real Method

Claude Desktop, Claude Code, and the Claude API each connect to MCP servers differently. Here's the real configuration for each, plus local-stdio versus remote-HTTP considerations.

Success storiesConnection troubleshooting

"Connect Claude to MCP" means something slightly different depending on which Claude product you're using — Claude Desktop, Claude Code, or the Claude API directly. Each has its own real connection mechanism.

Claude Desktop: Local Config File

Claude Desktop reads its server list from claude_desktop_config.json. On macOS this lives under ~/Library/Application Support/Claude/; on Windows, under %APPDATA%\Claude\.

{
  "mcpServers": {
    "my-server": {
      "command": "node",
      "args": ["/absolute/path/to/server.js"]
    }
  }
}

This launches the server as a local child process communicating over stdio. Restart Claude Desktop after editing the file — it only reads this config at startup.

Claude Desktop: Remote Servers

For a remotely-hosted server (like Zerodha's Kite MCP or Razorpay's hosted MCP endpoint), the config points at a URL instead of a local command, typically via a connector or a url field depending on the client version — check the specific remote server's own setup docs, since the exact config shape for remote/HTTP servers has evolved across Claude Desktop releases faster than for the stable local-stdio path.

Claude Code: Project or Global Config

Claude Code (the CLI) supports MCP servers configured either per-project or globally, and can also register a server directly from the command line without hand-editing JSON:

claude mcp add my-server -- node /absolute/path/to/server.js

This is generally the fastest path if you're already working inside a terminal-based Claude Code session and just need a server available for that project.

Claude API: No Native MCP Config — You Wire It Yourself

If you're calling the Claude API directly (not through Desktop or Code), there's no config file — MCP connectivity is something your own application code manages: your server process talks to the MCP server, retrieves tool results, and passes them into the Messages API's tool-use flow yourself. This is the integration pattern covered in this site's Claude API + MCP guides, distinct from the point-and-click config file approach the consumer clients use.

Verifying the Connection Actually Worked

Don't just trust the config — verify it:

  • In Claude Desktop, check the developer/MCP settings panel for a green "connected" indicator next to your server name, not just its presence in the config.
  • Ask Claude directly to list available tools, or attempt an action that would only work if your tool is registered.
  • If it's not connecting, run the server binary directly from a terminal first — a server that crashes on launch will fail silently from inside the Claude UI, and you'll only see the real error by running it standalone.

The Most Common Real Failure

By far the most common reported issue is a relative path in the args field of the config — Claude Desktop's working directory when it launches your server isn't necessarily your project folder, so a path like "./server.js" often fails to resolve while the exact same file referenced by its full absolute path works correctly.

Join the Discussion

Discussion (0)

Y

No comments yet. Be the first to share your thoughts!