How to Add MCP Servers to Claude Code with claude mcp add

JS
Jai Singh
24 Nov, 2026 3 min read 25 views

Claude Code, Anthropic's command-line coding agent, manages MCP servers through the claude mcp subcommands. You add a server with claude mcp add, check it with claude mcp list, and remove it with claude mcp remove. No manual JSON editing is needed, although you can edit files if you prefer.

Add a local stdio server

For a server that Claude Code should launch as a process, give it a name and then the command, separated from the options by two dashes.

claude mcp add slug-server -- node /Users/me/projects/slug-server/build/index.js

Everything after -- is the command and its arguments. The dashes keep Claude Code from reading your server's flags as its own. For a Python server, use the interpreter that has the SDK installed:

claude mcp add temperature -- /Users/me/projects/temp-server/.venv/bin/python /Users/me/projects/temp-server/server.py

Pass environment variables

Use the --env option (short form -e) before the name-and-command part. Repeat it for each variable.

claude mcp add --env API_KEY=abc123 --env REGION=eu weather -- node build/index.js

Add a remote HTTP server

For a server that is already running somewhere, choose the transport and give the URL:

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

Remote servers that need a token can take extra headers with the --header option. Servers that use OAuth are authorized from inside Claude Code using the /mcp command, which walks you through the sign-in.

Manage your servers

claude mcp list
claude mcp get slug-server
claude mcp remove slug-server

list shows each server and whether it connected. get shows the details of one. Inside a running Claude Code session, the slash command /mcp shows the connection status of every server and lets you authenticate remote servers.

Scopes: who gets the server

The --scope option decides where the configuration is stored and who sees it.

ScopeStored forUse it for
local (default)You, in this project onlyPersonal or experimental servers
projectEveryone, in a file in the repositoryServers the team shares
userYou, in every projectServers you want everywhere

Use local scope for experiments and anything with personal credentials. Use project scope for servers the whole team should have; the next post covers that file in detail.

claude mcp add --scope project slug-server -- node build/index.js

Choosing between the options

If you are the only user and the server holds personal credentials, stay with local scope. If the team needs the same server, use project scope. If you use the same helper everywhere, such as a note-taking server, use user scope. You can list everything with claude mcp list to see what is configured and where it came from. When the same name appears in more than one scope, the more specific one wins, so a local entry can override a project entry on your own machine without changing the shared file.

Using the tools

After adding a server, start or restart Claude Code in your project. MCP tools show up with names that include the server name, so a tool called slugify from slug-server appears with both names combined. Claude Code asks for permission the first time a tool runs. You can approve once or allow it for the session, and permission rules in settings can allow or deny specific tools ahead of time.

A simple test prompt is "Use the slugify tool to convert: My First MCP Post". You should see the permission prompt, then the result my-first-mcp-post.

Troubleshooting

  • If claude mcp list shows a failed connection, run the command by hand to see the error.
  • If the server connects but tools are missing, test it with the Inspector and read the tool list.
  • If a slow-starting server times out, reduce work done at startup. Heavy initialization should be lazy.
  • Remember that anything your server prints to stdout other than protocol messages breaks the connection.
  • Run claude mcp --help to see the options your installed version supports. The command line evolves, and the help output is the final authority.

Security

A project-scoped server in a repository you just cloned will run code when approved. Claude Code asks before using project servers for that reason. Read the configuration before you say yes, especially in repositories you do not trust.

Was this article helpful?

Comments

No comments yet. Have a question or a tip? Be the first to share it.

Leave a comment

Comments are reviewed before they appear.