Add an MCP server to Claude Code, and pick the right scope

One command adds an MCP server to Claude Code. The scope decides who sees it and where it is saved. Tested on Linux and Windows.

Updated 6 min readmcpclaude-codesetupwindows

Tested 28 October 2026 with Claude Code 2.1.312 on Linux, 2.1.311 on Windows 11, Node 22 and 24On this page: 1 live demo, 1 real output

The short answer

  1. Open a terminal in your project folder.
  2. Add the server: claude mcp add <name> -- <command that starts it>, for example claude mcp add everything -- npx -y @modelcontextprotocol/server-everything.
  3. Pick a scope if the default is wrong: add --scope user for every project, or --scope project to share it with your team through .mcp.json. The flag goes before the --.
  4. Check it: claude mcp list should say Connected next to the name.
  5. Start claude in that folder and type /mcp to see the server and its tools.

An MCP server gives your coding agent tools it did not have: search a catalog, read a database, open a ticket. Claude Code starts the server for you each session. You only tell it once how to start it.

The command, in three shapes

A server that runs on your machine (stdio) is a command line after --. Everything after the two dashes is passed through untouched, so the server's own flags never clash with Claude's.

claude mcp add everything -- npx -y @modelcontextprotocol/server-everything

@modelcontextprotocol/server-everything is the MCP project's own test server: free, on npm, no key, and it has an echo tool, so it is a good first server to prove your setup works. Swap in the command your real server's README gives.

A server on the internet (streamable HTTP) is a URL. If it needs a key, send it as a header and keep the key in an environment variable, never typed into the command. The example is Clinamen's hosted server, which needs a Clinamen Signature key (sales open at launch); any server that takes a bearer key works the same way:

claude mcp add --transport http clinamen https://mcp.clinamen.dev/mcp --header "Authorization: Bearer $CLINAMEN_LICENCE_KEY"
claude mcp add --transport http clinamen https://mcp.clinamen.dev/mcp --header "Authorization: Bearer $env:CLINAMEN_LICENCE_KEY"
claude mcp add --transport http clinamen https://mcp.clinamen.dev/mcp --header "Authorization: Bearer %CLINAMEN_LICENCE_KEY%"

The shell fills the variable in before Claude Code sees the line, so the saved config holds the key itself. That is why the three lines differ: in PowerShell, $CLINAMEN_LICENCE_KEY is an empty PowerShell variable, and the line saves Bearer with nothing after it. In PowerShell use $env:NAME, in cmd %NAME%, and in every shell check the variable is set (echo $env:NAME or echo %NAME%) before you add the server.

Live demoBuild your claude mcp add line

The live demo loads here when scripts run. The text below says what it shows.

Type your server's name and the command that starts it (or its URL and the name of the variable that holds its key), pick who should see it and your computer, and copy the result. It applies exactly the rules on this page and runs in your browser: nothing is sent or saved. With scripts off, the examples below are the same shapes.

Scopes: who sees the server, and where it is saved

Scope Flag Who sees it Saved in
Local (the default) none, or --scope local you, in this folder only ~/.claude.json, under this project's path
Project --scope project everyone who opens the repo .mcp.json in the project root, meant to be committed
User --scope user you, in every folder ~/.claude.json

Rules of thumb:

  • A tool you want everywhere (a docs server, a component catalog): --scope user.
  • A tool the whole team needs for this repo: --scope project, and keep any key out of the file (below).
  • Trying something out: the default. It disappears from view the moment you cd elsewhere, which is also the most common "my server vanished" report.

Put --scope before the --. After it, the flag becomes an argument to the server's own command, and Claude Code quietly falls back to the local scope.

A project server asks first

A server in .mcp.json does not start until you approve it, because anyone can commit one. claude mcp list shows it as:

everything: npx -y @modelcontextprotocol/server-everything - ⏸ Pending approval (run `claude` to approve)

Start claude in the folder and accept the prompt. Your teammates do the same once.

A committed .mcp.json must never hold a key. Claude Code expands ${VAR} inside .mcp.json when it starts, so write the variable's name and let each person set their own:

{
  "mcpServers": {
    "clinamen": {
      "type": "http",
      "url": "https://mcp.clinamen.dev/mcp",
      "headers": { "Authorization": "Bearer ${CLINAMEN_LICENCE_KEY}" }
    }
  }
}

Check that it works

claude mcp list
Real outputclaude mcp add everything …, then claude mcp list and claude mcp get everything
$ claude mcp add everything -- npx -y @modelcontextprotocol/server-everything
Added stdio MCP server everything with command: npx -y @modelcontextprotocol/server-everything to local config
File modified: /home/you/cfg/.claude.json [project: /home/you/proj]
$ claude mcp list
Checking MCP server health…

everything: npx -y @modelcontextprotocol/server-everything - ✔ Connected
$ claude mcp get everything
everything:
  Scope: Local config (private to you in this project)
  Status: ✔ Connected
  Type: stdio
  Command: npx
  Args: -y @modelcontextprotocol/server-everything
  Environment:

To remove this server, run: claude mcp remove everything -s local

That is a real session from 28 Oct 2026 (Claude Code 2.1.312, Linux), run with an empty config folder (CLAUDE_CONFIG_DIR), which is why the file it names is not ~/.claude.json; only the folder names were shortened.

Each server gets a health check. ✔ Connected (√ Connected in Windows terminals) means Claude Code started it and the handshake worked. For one server in detail:

claude mcp get everything

That prints the scope, the command and the headers in plain text, key included. Do not paste its output into an issue or a chat.

Connected is not proof that your key arrived. A server that accepts a missing key and explains the problem still connects: Clinamen's hosted server, added with an empty key, shows Connected and then answers every call with the reason the key was refused. So after Connected, ask the agent to call one of the server's tools (for the test server: "call the echo tool of the everything server with hello"); a keyed server's answer tells you whether the key arrived.

Windows notes

  • claude mcp add <name> -- npx -y <package> works as written in PowerShell and cmd. We also checked the cmd /c npx … form some older guides recommend: it connects too, but you do not need it in Claude Code.
  • A local package file path must use forward slashes: npx -y file:C:/Users/you/my-server-1.0.0.tgz. A backslash path makes npx hang with no message.
  • If npx --version itself fails in PowerShell with "running scripts is disabled on this system", PowerShell is blocking npx.ps1. Type npx.cmd instead of npx, or allow signed scripts for your user once: Set-ExecutionPolicy -Scope CurrentUser RemoteSigned.

Remove or change a server

claude mcp remove everything --scope local

There is no edit command. Remove the server and add it again with the new line. To move a server to another scope, remove it from the old one first, or you will have two with the same name and the narrower scope wins in that folder.

Something here did not work?

Every command on this page was run before it was published, on the systems named in "How we tested this". If a step fails for you, write to [email protected] with what you ran and what you saw, and we will fix the page.