Claude Code MCP: How to Add and Check Servers
By Maximo Correa · 2026-11-16
To add an MCP server to Claude Code, run claude mcp add --transport http NAME URL for a hosted server, or claude mcp add NAME -- COMMAND for a local one. Add --scope user or --scope project to change where it loads. Then run claude mcp list to confirm it shows Connected.
Add a server in one command
Adding an MCP server to Claude Code is one command, run from your shell, not inside a session. The command depends on where the server lives. Not sure what a server is first? Read what an MCP server is and come back.
For a hosted server with a URL, which the documentation calls "the recommended option for connecting to remote MCP servers":
claude mcp add --transport http <name> <url>
A real example from the documentation, which connects Notion:
claude mcp add --transport http notion https://mcp.notion.com/mcp
For a server that runs on your machine, put the launch command after --:
claude mcp add [options] <name> -- <command> [args...]
For example, the Airtable server with an API key:
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \
-- npx -y airtable-mcp-server
The name is yours to choose. The quickstart says Claude Code "uses whatever name you pick to label the server's tools in Claude's output and to refer to the server in commands like claude mcp remove."
Which form do you have?
Setup instructions are often written for another client and may not show a claude mcp add command. Find what they give you and use the matching form.
| What the instructions give you | What it means | What to run |
|---|---|---|
An https:// URL | A remote server | claude mcp add --transport http <name> <url> |
A launch command such as npx -y @example/mcp-server | A local stdio server | claude mcp add <name> -- npx -y @example/mcp-server |
An mcpServers JSON block | Config written for another client | claude mcp add-json <name> '<json>' |
A wss:// URL | A WebSocket server | claude mcp add-json with "type":"ws" |
Three details trip people up.
The double dash. For stdio servers, "the -- (double dash) separates Claude's own options, such as --transport, --env, and --scope, from the command and arguments that run the server." Without it, Claude Code tries to read the server's own flags as its own.
The --env position. --env takes several KEY=value pairs, and "if the server name comes directly after --env, the CLI reads the name as another pair and rejects it". Put another option, such as --transport stdio, between --env and the name.
SSE. The SSE transport "is deprecated. Use HTTP servers instead, where available." You can still add an SSE-only service with the same --transport http command, because Claude Code tries HTTP first and switches to SSE when the server does not accept it. That automatic switch needs Claude Code v2.1.265 or later. On an earlier version, pass --transport sse instead:
claude mcp add --transport sse asana https://mcp.asana.com/sse
Pass a token with a header
Some hosted servers take a static token instead of a browser sign-in. Pass it with --header when you add the server. The documentation's GitHub example:
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
--header "Authorization: Bearer YOUR_GITHUB_PAT"
One warning applies to every token: "The claude mcp add command saves the configuration without validating credentials, so a placeholder value is accepted here but the server fails to connect later." Check the connection after you add it, as described below.
Choose a scope
A scope decides which projects load the server and whether teammates get it. There are three.
| Scope | Loads in | Shared with team | Stored in |
|---|---|---|---|
| Local | Current project only | No | ~/.claude.json |
| Project | Current project only | Yes, via version control | .mcp.json in project root |
| User | All your projects | No | ~/.claude.json |
Local is the default. Add --scope to choose another:
claude mcp add --transport http stripe --scope local https://mcp.stripe.com # local scope, the default, spelled out
claude mcp add --transport http shared-server --scope project https://example.com/mcp # writes .mcp.json so your team gets the same server
claude mcp add --transport http hubspot --scope user https://mcp.hubspot.com/anthropic # available in every project on your machine
If you define the same server in more than one place, Claude Code connects to it once, from the highest-precedence source: local, then project, then user, then plugin-provided servers, then claude.ai connectors. The documentation is specific that "the entire server entry from that source is used; fields are not merged across scopes."
Where the configuration lives
You do not have to edit these files, but you will want to know where they are when something breaks.
- Local scope writes under your project's path inside
~/.claude.json. - User scope writes to the
mcpServerskey in~/.claude.json. - Project scope creates or updates
.mcp.jsonat the project root.
On Windows, ~/.claude.json resolves to %USERPROFILE%\.claude.json. A project-scope server looks like this in .mcp.json:
{
"mcpServers": {
"shared-server": {
"type": "http",
"url": "https://example.com/mcp"
}
}
}
Commit that file and everyone who clones the project gets the same server. For security, "Claude Code prompts for approval in interactive sessions before using project-scoped servers from .mcp.json files." To reset your approval choices, run claude mcp reset-project-choices.
To keep secrets out of a committed file, .mcp.json supports two forms of environment variable expansion in command, args, env, url and headers: ${VAR}, and ${VAR:-default} which falls back when the variable is unset.
{
"mcpServers": {
"api-server": {
"type": "http",
"url": "${API_BASE_URL:-https://api.example.com}/mcp",
"headers": {
"Authorization": "Bearer ${API_KEY}"
}
}
}
}
Claude Code reads .mcp.json at session start, so restart the session after you edit the file by hand. A JSON entry with a url but no type is an error, because Claude Code reads an entry with no type as a stdio server.
Add from JSON or from Claude Desktop
If you already have a JSON configuration, pass it straight in:
claude mcp add-json weather-api '{"type":"http","url":"https://api.weather.com/mcp","headers":{"Authorization":"Bearer token"}}'
Give add-json the object inside mcpServers, not the wrapper, and escape the JSON for your shell.
If you set servers up in Claude Desktop, import them:
claude mcp add-from-claude-desktop
An interactive dialog lets you pick which to import. The documentation says this "only works on macOS and Windows Subsystem for Linux (WSL)". Add --scope user to import into your user configuration.
Check that it is connected
A successful claude mcp add prints an Added ... line. That line means the configuration was written, not that the server works. To check the connection, run:
claude mcp list
Each server gets a status:
| Status | Meaning |
|---|---|
✔ Connected | Ready to use |
| Connected · tools fetch failed (warning glyph) | Connected, but could not list its tools. Run claude mcp get <name> for the error |
| Needs authentication (warning glyph) | Reachable, but needs a browser sign-in or a token |
✘ Failed to connect | The server did not respond |
✘ Connection error | The connection attempt threw an error |
⏸ Pending approval (run claude to approve) | A project-scoped server you have not approved |
⊘ Disabled for this project (re-enable via /mcp) | Turned off in this project |
For one server, run claude mcp get <name>. It also shows which scope holds the definition. Inside a session, /mcp shows the same status with a tool count next to each connected server, and you can reconnect or authenticate from there. Then ask Claude to use the server by name. If Claude Code asks permission the first time, approve it. The tool call in Claude's output carries the server name, which tells you the answer came from the server.
Sign in to servers that need it
Hosted services such as Sentry, Linear and Notion put their servers behind OAuth. Add the server as usual, then sign in:
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
Open a session, run /mcp, pick the server and choose Authenticate. Your browser opens to the service's sign-in page. You can also run the flow from your shell:
claude mcp login sentry
To clear stored credentials, run claude mcp logout <name>.
Remove or disable a server
claude mcp remove notion
The command confirms with a line such as Removed MCP server "notion" from local config. If the same name exists at more than one scope, remove reports exists in multiple scopes, and you choose which copy to delete:
claude mcp remove notion --scope local
When you remove a remote server, Claude Code also deletes the OAuth tokens it stored for it, but it does not revoke them at the service. To revoke where the service supports it, run claude mcp logout <name> first.
To stop a server connecting without losing its configuration, toggle it off in the /mcp panel. Claude Code records your choice per project in ~/.claude.json.
Removal is worth doing. The quickstart notes that each connected server "takes some space in Claude's context window because its tool names and server instructions load into every session."
Troubleshooting
Check claude mcp list first, then match the symptom.
| Symptom | What to check |
|---|---|
/mcp says No MCP servers configured | You added a local-scope server from a different project. Re-add it from the project you are in, or use --scope user. Also confirm you edited ~/.claude.json or <project>/.mcp.json; Claude Code does not read paths such as ~/.claude/mcp.json |
✘ Failed to connect | Run claude mcp get <name>. It shows the HTTP status or error text the server returned |
| 404 on an HTTP server | The URL path is wrong. Compare it to the server's documented endpoint, then claude mcp remove <name> and add it again |
| Connection error on a stdio server | Run the configured command directly in your terminal to see the underlying error |
The command shown by claude mcp get differs from what you typed | You probably left out the -- separator. Remove the server and add it again |
| Connection timed out at startup | Raise the limit, for example MCP_TIMEOUT=60000 claude. The default is a 30-second startup timeout, and a first npx run can be slow while it downloads the package |
MCP server <name> already exists in local config | The name is taken at that scope. Remove the old entry or pick a new name |
| Connects, but no tools appear | Open /mcp and select the server. An empty list usually means a missing environment variable such as an API key. Pass it with --env KEY=value |
Edits to .mcp.json have no effect | Restart the session. If you rejected the server earlier, run claude mcp reset-project-choices |
For an HTTP server, curl -I <url> tells you whether it is reachable. A 404 or 405 still means the server is up, because many MCP endpoints answer only POST requests. A 401 or 403 means the server is up and you need to authenticate. In PowerShell, use curl.exe so the request goes to the real curl binary.
After it connects
A connected server is available, and Claude chooses relevant tools on its own. With tool search on, which is the default, only tool names and server instructions load at the start of a session, so a few extra servers cost little context. Plugins can also ship MCP servers: the documentation says they "define MCP servers in .mcp.json at the plugin root or inline in plugin.json". See what a Claude Code plugin is for how that bundling works.
To find servers worth adding, browse Flowy's best MCP servers or the full MCP directory. Verify you trust a server before you connect it. The Claude Code documentation warns that servers that fetch external content can expose you to prompt injection risk.
Sources
