Blog · October 21, 2026 · 9 min read · by Vilva Athiban P B
The claude mcp Command Reference: add Syntax by Transport, What --scope local, project and user Actually Mean, add-json and add-from-claude-desktop, list, get, remove, login and serve
claude mcp add is the command most people meet on day one with MCP and get wrong on day one as well: the server name goes in a different place depending on the transport, the -- separator is easy to omit and quietly changes what gets parsed, and --scope defaults to the one value that makes a server vanish the moment you open a different folder. This is a reference for the whole claude mcp command family, written from the current Claude Code documentation, with the syntax for each subcommand, what each scope means and where it is stored, and the half-dozen mistakes that produce most of the questions.
It complements our general MCP servers guide and the post on .mcp.json in subfolders and monorepos; this one is purely about the CLI.
The three shapes of claude mcp add
There is one command with three shapes, chosen by the transport. In every shape the server name is a positional argument that comes before the URL or the command.
# Remote server over HTTP (recommended for remote servers)
claude mcp add --transport http <name> <url>
# Remote server over SSE (deprecated transport, still accepted)
claude mcp add --transport sse <name> <url>
# Local server started as a process (stdio)
claude mcp add [options] <name> -- <command> [args...]Three real examples, one per shape:
claude mcp add --transport http notion https://mcp.notion.com/mcp
claude mcp add --transport sse asana https://mcp.asana.com/sse
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \
-- npx -y airtable-mcp-serverSince Claude Code v2.1.265, --transport http tries HTTP first and falls back to SSE if the server does not accept it, so for a remote server you can usually just say http. On earlier versions, pick sse explicitly for an SSE-only server.
The -- separator
For stdio servers, everything before -- is read as Claude's own options (--transport, --env, --scope) and everything after it is passed to the server unchanged. Leave it out and a flag meant for the server, such as --port 8080, is parsed as a Claude option and rejected or silently misread.
# runs: npx server
claude mcp add --transport stdio myserver -- npx server
# runs: python server.py --port 8080, with KEY=value in its environment
claude mcp add --env KEY=value --transport stdio myserver -- python server.py --port 8080One parsing quirk is worth knowing: if the server name directly follows an --env KEY=value pair, the CLI reads the name as another pair and rejects it. Put another option between them, as in the Airtable example above, where --transport stdio sits between --env and the name.
Options reference
--transport/-t:http,sseorstdio.wsis not accepted here; useadd-jsonfor a WebSocket server.--scope/-s:local,projectoruser. Default islocal. See the scopes section below, because this is the option that causes the most confusion.--env/-e:KEY=value, an environment variable for a stdio server. Repeat it for several.--header/-H: an HTTP or SSE header such as"Authorization: Bearer your-token". Repeatable.--client-id,--client-secret,--callback-port: for a remote server with a pre-configured OAuth client.--client-secrettakes no value on the command line; it prompts with masked input, and in CI readsMCP_CLIENT_SECRETinstead.
A successful add prints an Added ... line. If you see was not saved instead, the write to the config file failed; check that the file is writable and, for --scope project, that you are in the directory you think you are in.
Scopes: local, project and user
A scope is where the server definition is stored, which decides where it loads and who else gets it.
local(the default): stored in~/.claude.jsonunderprojects["<project path>"].mcpServers. Loads only when you start Claude Code in that project path. Not shared with anyone. This is why a server you added yesterday is missing today: you opened a different folder.project: stored in.mcp.jsonat the project root. Loads in that project for everyone who checks the file out, which is the point; commit it. Project servers need a one-time approval in interactive sessions, and approvals from a repository's own settings are ignored until you trust the workspace.user: stored in~/.claude.jsonas the top-levelmcpServers. Loads in all your projects. Not shared. The right scope for a personal tool you want everywhere.
The same server written to each scope:
# local (default): only this project, only you
claude mcp add --transport http stripe https://mcp.stripe.com
# project: this project, everyone, via .mcp.json
claude mcp add --transport http shared-server --scope project https://example.com/mcp
# user: all your projects, only you
claude mcp add --transport http stripe --scope user https://mcp.stripe.comWhen the same server name is defined in several places, the highest scope wins and its whole entry is used, with no field merging. The order is local, then project, then user, then plugin-provided servers, then claude.ai connectors. Managed configuration can also provide servers, and from v2.1.259 managedMcpServers ranks above everything. Duplicates are matched by name for the three scopes and by endpoint for plugins and connectors, where two URLs count as the same endpoint if they differ only in scheme, host case, the scheme's default port or a trailing slash.
claude mcp add-json
When you have a JSON block from another client's documentation, or need a transport the plain add does not accept, pass the server definition directly:
claude mcp add-json weather-api '{"type":"http","url":"https://api.weather.com/mcp","headers":{"Authorization":"Bearer token"}}'
claude mcp add-json local-weather '{"type":"stdio","command":"/path/to/weather-cli","args":["--api-key","abc123"],"env":{"CACHE_DIR":"/tmp"}}'It accepts type values http, stdio, sse and ws, with streamable-http as an alias for http. Two traps: a url entry without a type is a configuration error that Claude Code reads as stdio and skips, and if you copy a block from another client's mcpServers config you must pass only the object inside it, not the wrapper. So {"mcpServers":{"example":{"command":"npx","args":["-y","@example/mcp-server"]}}} becomes claude mcp add-json example '{"command":"npx","args":["-y","@example/mcp-server"]}'. Add --scope user to store it for all projects.
claude mcp add-from-claude-desktop
On macOS and WSL, this opens an interactive picker that imports servers from the Claude Desktop configuration. Names may contain only letters, numbers, hyphens and underscores; servers with other characters are reported and skipped, and a name that already exists gets a numeric suffix such as server_1. Pass --scope user to import into your user configuration.
Listing, inspecting and removing: list, get, remove
claude mcp list # every configured server, with health status
claude mcp get notion # details for one server
claude mcp remove notion # remove a server
claude mcp remove notion --scope user # remove from one specific scope
claude mcp login sentry # run the OAuth flow from the shell
claude mcp login sentry --no-browser # print the auth URL instead
claude mcp logout sentry # clear stored credentials
claude mcp reset-project-choices # reset approvals for .mcp.json serverslistshows a status per server: Connected, Needs authentication, Failed to connect, Pending approval (runclaudeto approve), Rejected (seedisabledMcpjsonServersin settings), or Disabled for this project (re-enable via/mcp). Since v2.1.219 the failure detail is appended to the line; earlier versions showed only the bare status.getprints anIssue:line for a failing server with the HTTP status or error text. Credential-looking text is redacted and the expanded URL is never shown, so agetis safe to paste into a bug report.removealso deletes stored OAuth tokens and client registration for a remote server. If the same name exists in more than one scope, pass--scope, or you may remove a different definition than the one that is actually loading.loginnotices when there is no browser (SSH, headless Linux) and prints the URL; paste the full redirect URL back at the prompt, and usessh -tso the prompt works.
claude mcp serve and /mcp
claude mcp serve runs Claude Code itself as a stdio MCP server for another client such as Claude Desktop. It prints nothing at startup and waits for the client; if the client reports spawn claude ENOENT, use the full path from which claude in its config.
Inside an interactive session, /mcp is the companion to the CLI: it shows each server's status and tool count, authenticates OAuth servers (with Re-authenticate and Clear authentication), turns servers on or off for the current project (stored as disabledMcpServers or enabledMcpServers in ~/.claude.json), and reconnects a server. /mcp reconnect all retries every failed or unauthenticated server, from v2.1.284.
Environment variables in definitions
Definitions in .mcp.json and in local and user entries can reference environment variables with ${VAR} and ${VAR:-default} in command, args, env, url and headers. An unset variable with no default loads as the literal text and triggers a warning in list and /mcp. In a remote server's url and headers, credential variables such as ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, AWS_BEARER_TOKEN_BEDROCK, HTTPS_PROXY and NPM_TOKEN read as empty so that a checked-in project file cannot exfiltrate them; to pass a credential on purpose, copy it into a variable with your own name first.
The six mistakes behind most “claude mcp add” questions
- Forgetting
--scopeand losing the server. The default islocal, which is tied to the folder you ran the command in. If you want it in every project, add--scope user; if the team should have it, use--scope project. - Putting the name after the URL. The name is positional and comes first:
claude mcp add --transport http notion https://..., not the other way round. - Omitting
--for a stdio server. The server's own flags get parsed as Claude options. - Name immediately after
--env. The CLI reads it as another pair. Put--transport stdiobetween them. - Pasting an
mcpServerswrapper intoadd-json. Pass only the inner object, and make sure a remote entry has atype. - Removing the wrong copy. With the same name in two scopes,
removewithout--scopemay delete the one that was not loading. Runclaude mcp get namefirst; it tells you which scope is in effect.
When a server is added in the right scope and still does not appear, the next place to look is approval: project servers wait for a one-time approval, and in headless or non-interactive runs nobody is there to grant it. The subfolders post covers that case, including --strict-mcp-config and the settings keys that pre-approve servers.
Keep reading
Desk Exercises for Programmers: 15 Moves to Do While Your AI Agent Codes
7 min read
Exercise While Coding: Turn Claude Code Wait Time Into Micro-Workouts
7 min read
Claude Code Notch Notifications on Mac: See When Claude Is Done Without Watching the Terminal
7 min read
Claude Code Tips and Tricks: 12 Ways to Use Claude Code Effectively
8 min read
Claude Code Multiple Sessions: How to Run Agents in Parallel Without Losing Track
6 min read
A Claude Code Workflow That Doesn't Involve Watching the Terminal
5 min read
Claude Code Hooks: A Practical Guide to Automating Your Agent Workflow
7 min read
Claude Code Auto Mode: Fewer Permission Prompts Without Living Dangerously
7 min read
Claude Code Subagents: How to Delegate Work to Specialized Agents
7 min read
Claude Code Context Management: Treat the Context Window Like a Budget
6 min read
Per-Subagent Model Selection: Route the Grunt Work Down, Keep the Judgment Up Top
7 min read
Skills and Plugins: How to Teach Claude Code Your Way of Working
7 min read
Claude Code Background Tasks: Run Long Commands Without Blocking Your Session
6 min read
Codex CLI Notifications: How to Get a Ding When Codex Is Done or Needs Input
7 min read
Cursor Notification When Done: Every Way to Get Notified When Cursor Finishes
6 min read
Claude Code Notifications: How to Get Notified When Claude Code Finishes or Needs Your Input
6 min read
Want to Be Notified When Claude Responds? How Claude Notifications Work on Web, Desktop, and Mobile
5 min read
Claude Code Notification Scripts: Copy-Paste Recipes for Every Platform
6 min read
Get a Ding the Moment Codex Needs Your Response
6 min read
Get Notified the Moment Claude Code Is Waiting for Your Input
6 min read
“Notifications Are Turned Off for Claude” — Here Is the Fix
6 min read
Codex Sound When Done: Make Codex CLI Play a Sound When It Finishes
6 min read
terminal-notifier + Claude Code: Native macOS Alerts When Your Agent Finishes
6 min read
Gemini CLI Notifications: How to Get a Sound or Alert When Gemini Finishes
6 min read
Get Claude Code Notifications on Your Phone
6 min read
Claude Code Remote Control, Explained
7 min read
preferredNotifChannel: Claude Code's Built-In Notification Setting
6 min read
Claude Code Notifications in tmux and Over SSH
7 min read
Claude Code Effort Levels: Why Your Setting Keeps Getting Ignored
8 min read
Codex vs Claude Code Notifications: How Each One Tells You It Is Done
8 min read
Claude Code Notifications Not Working: A Diagnostic Checklist
10 min read
Claude Code Notifications Inside Your Editor's Terminal
7 min read
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS Explained
7 min read
CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP Explained
8 min read
Cursor Alerts Explained: Every Alert Cursor Raises, and How to Control Them
7 min read
Claude Code Environment Variables: The Groups That Actually Matter
10 min read
Claude Code Notifications on WSL and Windows
9 min read
Claude Code Checkpoints and /rewind
8 min read
Claude Remote Control: How It Works, Turning It Off, and Auto Mode
7 min read
Claude Code /loop: Poll a Deploy, Babysit a PR, and Get Told When It's Done
8 min read
Setting Up NotchFit With OpenAI Codex CLI: Hooks, $notchfit-plan, and the Daily Flow
7 min read
Claude Mods Explained: What the New Plugin Layer Can Do, and How to Turn On 'You Should Know'
9 min read
NotchFit vs Mac Break Reminder Apps: A Clock or a Signal From Your Coding Agent?
8 min read
Claude Code Headless Mode: Running claude -p in Scripts and CI, and the Three Signals That It Finished
10 min read
Building a Movement Habit at a Desk: Use the Agent Run as the Cue, One Set as the Unit, and Streaks Carefully
8 min read
Claude Code MCP Servers Explained: Adding Servers, Choosing a Scope, Handling Secrets, and Why Long Tool Calls Go to the Background
10 min read
/notchfit:plan Explained: How Claude Code or Codex Writes a Weekly Workout Plan the Notch Can Actually Run
8 min read
Claude Code Spinner Verbs Explained: What “Pondering” and “Brewing” Mean, How to Change Them, and Why You Should Stop Watching the Spinner
7 min read
Why NotchFit's Done and Permission Alerts Wait Until Your Set Ends, When That Costs You, and How to Turn the Workout Off
7 min read
How to Resume a Claude Code Session: --continue vs --resume, Naming Sessions, the Session Picker, Branching, and What Comes Back
9 min read
NotchFit on a Mac Without a Notch: How Pill Mode Works on Mac mini, iMac, Mac Studio and a MacBook With the Lid Closed
6 min read
How to Run a Claude Code Session in the Background: /background, claude --bg, Agent View, and Getting Back to It
9 min read
What a Notch App Can See: NotchFit's Local-First Design, What the Claude Code and Codex Hooks Send, and What Stays on Your Mac
7 min read
Why Codex CLI Asks for Permission Every Time, and How to Tune the Sandbox and Approval Policy Without Going Full Access
8 min read
What to Do While Claude Code or Codex Works: A Simple Protocol for the Two-to-Twenty-Minute Gap in Every Agent Run
7 min read
Is It Possible to Get a Notification When Claude Code or Codex Hits a Reset? Yes for Claude Code: the quota_auto_resume Hooks, Explained
8 min read
What a MacBook Notch App Can Actually Do: The Five Kinds of Notch Utility, Their Trade-offs, and Where NotchFit Fits
7 min read
How to Make MCP Servers Not Take Up as Much Context in Claude Code: Tool Search, alwaysLoad, Scopes and Output Caps
8 min read
The notchfit Command Line: Drive Your Workout, Read Status as JSON, Validate Plans and Test the Notch Without Leaving the Terminal
7 min read
How to Audit MCP Tool Calls Made by Claude Code: A Five-Minute Hook Audit Log, OpenTelemetry Tool Events, and the Transcript for Investigations
9 min read
Exercise Snacks: What the Research Actually Says About One-Minute Vigorous Breaks, What It Does Not, and How NotchFit's Agent-Run Sets Compare
8 min read
How Long Until a Claude Code MCP Tool Call Times Out? The Four Timers (Startup, Two-Minute Backgrounding, Idle, Wall-Clock), Their Defaults, and Which One to Change
8 min read
Sitting Too Long as a Developer: The Posture Problems Coding Agents Made Worse, What the Research Says About Breaking Up Sitting, and How NotchFit Turns an Agent Run Into the Break
8 min read
Claude Code .mcp.json Explained: Where Project-Scoped MCP Servers Are Read From, What Happens in Subfolders and Monorepos, and Why a Committed Server Shows Pending Approval
8 min read
Standing Desk Exercises for Developers: Why Standing Still Is Not the Goal, Eight Movements That Fit a Thirty-Second Agent Run, and How NotchFit Cues Them From the Notch
8 min read
Your First Week With NotchFit: Install and Simulate, Run Real Tasks, Write a Smaller Plan Than You Want, Tune the Alerts, Survive the First Skipped Day, and Decide What Stays
8 min read