Copied!
Blog

How to Add an MCP Server to Claude Code (and Claude Desktop)

The one-line command, the three scopes nobody explains, remote vs. local servers, and fixes for the errors you will actually hit.

← Blog
Close-up of a circuit board with electronic components
Photo via Unsplash

October 14, 2026

5 min readIncludes a config generator for 4 clients

If you only need the command, here it is. For a remote server (one with a URL):

claude mcp add --transport http my-server https://example.com/mcp

For a local server (one Claude Code starts on your machine):

claude mcp add my-server -- npx -y some-mcp-package

Then type /mcp inside Claude Code to check it connected. That covers most cases. The rest of this guide covers the parts that trip people up: which scope to choose, how Claude Desktop differs, authentication headers, Windows, and what each error actually means.

Generate your config

Pick your client and server type and the generator writes the exact command or JSON, with the right file location. It is pre-filled with Enrichr’s remote server as an example. Replace the URL and header with your own server’s.

Remote vs. local servers

Every MCP server is one of two kinds, and the kind decides the command.

Remote (HTTP)Local (stdio)
Where it runsOn someone’s server; you connect to a URLOn your machine; Claude Code starts it as a process
Commandclaude mcp add --transport http name URLclaude mcp add name -- command args
AuthA header (--header) or OAuth via /mcpEnvironment variables (--env KEY=value)
Needs installedNothingUsually Node (for npx) or Python (for uvx)
Good forSaaS tools, hosted APIs, browser-based toolsYour files, local databases, private tools

You may see guides that use --transport sse. SSE is the older remote transport. Use http unless a server’s own docs say it only supports SSE.

The -- in the local command matters. Everything after it is passed to your server untouched, so its flags are not mistaken for Claude Code’s own.

Local, project or user scope?

Scope answers one question: who should get this server, and where? It is the part of the docs most people skip, and the reason a server “disappears” when you change folders.

THREE SCOPES · WHO GETS THE SERVER --scope local · DEFAULT Just me, this project Stored in ~/.claude.json under this project's path. Use for: experiments, servers with personal API keys. --scope project Everyone on the repo Written to .mcp.json in the repo root. Commit it. Use for: team tools. Put keys in env vars, not the file. --scope user Just me, every project Stored in ~/.claude.json at the top level. Use for: tools you want everywhere (docs, browser). IF TWO SCOPES DEFINE THE SAME NAME local wins over project wins over user
The default is local. If you add a server in one project and it is missing in another, that is why. Re-add it with --scope user.

Project scope has one extra safety step. The first time a teammate opens the repo, Claude Code asks them to approve the servers in .mcp.json before any of them run. If someone clicked no by mistake, claude mcp reset-project-choices brings the prompt back.

Never commit an API key in .mcp.json. The file supports environment variable expansion, so reference the key instead:

{
  "mcpServers": {
    "enrichr": {
      "type": "http",
      "url": "https://enrichr.dev/mcp",
      "headers": { "X-API-Key": "${ENRICHR_API_KEY}" }
    }
  }
}

Adding a server to Claude Desktop

Claude Desktop and Claude Code are separate apps with separate server lists. Desktop handles the two kinds of server in two different places:

Already set servers up in Desktop? claude mcp add-from-claude-desktop imports them into Claude Code (on macOS and WSL) and lets you choose which ones.

Managing your servers

CommandWhat it does
claude mcp listEvery configured server and whether it connects
claude mcp get nameDetails for one server, including its scope
claude mcp remove nameRemoves it (add --scope if it exists in more than one)
claude mcp add-json name '{...}'Adds a server from a JSON snippet, handy when docs give you JSON
/mcp (inside a session)Live status, tool counts, and OAuth sign-in for servers that need it

Troubleshooting

What to add first

Once the mechanics work, the question becomes which servers are worth it. We keep a running list in 10 MCP servers that turn Claude Code from clever into unfair, and a free-only list in 9 free MCP servers. Before installing anything from a stranger’s repo, read how not to get burned by unaudited MCP servers. A local server runs code on your machine with your permissions.

If you build websites, the one we would add first is a way for Claude Code to see the rendered web. Without it, Claude cannot read half the pages you point it at (here is why). Client-specific setup pages: Claude, Cursor, VS Code, Windsurf, Cline.

FAQ

How do I add an MCP server to Claude Code?

Run claude mcp add in your terminal. For a remote server: claude mcp add --transport http my-server https://example.com/mcp. For a local one: claude mcp add my-server -- npx -y some-package. Then run /mcp inside Claude Code to check it connected.

Where does Claude Code store MCP servers?

Local and user scoped servers are stored in ~/.claude.json. Project scoped servers are written to .mcp.json in the root of your repository, which you can commit so teammates get the same servers.

How do I add an MCP server to Claude Code globally?

Use the user scope: claude mcp add --scope user my-server ... It then loads in every project on your machine.

How do I add an MCP server to Claude Desktop?

For a remote server, go to Settings → Connectors → Add custom connector and paste the URL. For a local server, open Settings → Developer → Edit Config, add it under mcpServers in claude_desktop_config.json, then fully quit and reopen the app.

Can I import my Claude Desktop servers into Claude Code?

Yes. claude mcp add-from-claude-desktop reads your Desktop config and lets you pick which servers to import (on macOS and WSL).

Why does my MCP server not show up?

Check claude mcp list for its status. The usual causes are a URL missing its /mcp path, a missing auth header, a local command that fails on its own, the cmd /c wrapper on native Windows, or Claude Desktop not being fully restarted.