New Tool Radar

AI Concepts

How to Add an MCP Server to Claude Code With the Command Line

Use claude mcp add to connect a server to Claude Code, list it, and check which scope it was saved in.

Schematic with three steps: Add the server with one command; List and inspect it; Check the scope it was saved in.

Claude Code adds MCP servers with a command instead of a settings page, and the same command covers both remote servers over HTTP and local servers over stdio. The scope you choose decides who gets the server: just you in this project, everyone who clones the repository, or you in every project. Check the scope before you add a server to a shared repository.

What you need

  • Claude Code installed
  • The server URL for a remote server, or the command that starts a local server
  • The scope you want: local, project or user

Step 1: Add the server with one command

For a remote server run claude mcp add –transport http followed by a name and the URL. For a local server use –transport stdio, then — followed by the command that starts it. Put secrets in –env, not in the command itself.

Step 2: List and inspect it

Run claude mcp list to see the servers, and claude mcp get followed by the server name to inspect one. If a server needs OAuth, run /mcp inside Claude Code to sign in.

Step 3: Check the scope it was saved in

The local scope is the default and stores the server in ~/.claude.json under the current project. The project scope writes .mcp.json in the repository root, and the user scope stores it for you in every project.

Worked example: synthetic Claude Code server additions

The table below is a synthetic example. It shows the expected result of adding two servers; no command was run.

Server Command form Scope
notion claude mcp add –transport http notion https://mcp.notion.com/mcp local
my-api claude mcp add –transport stdio my-api — node /path/to/index.js local
Check claude mcp list shows both Pass

Expected result (UNTESTED). both servers appear in claude mcp list, each saved in the local scope. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A project-scope .mcp.json is shared with everyone who clones the repository, after they approve it, so keep secrets in environment variables such as ${API_KEY}.
  • If a server is slow to start, raise the startup timeout with MCP_TIMEOUT; if its output gets cut off, raise MAX_MCP_OUTPUT_TOKENS, whose default limit is 25,000 tokens.
  • On macOS and WSL, claude mcp add-from-claude-desktop copies the servers you set up in Claude Desktop.
  • Remove a server with claude mcp remove followed by its name.

Sources

See all