Claude Code MCP Scopes: Local, Project or User in 5 Steps

Code editor showing claude mcp add with --scope project, cover for Claude Code MCP scopes tutorial

Claude Code can save an MCP server in three places: local (this project, private to you), project (this project, shared through a .mcp.json file in git) and user (all your projects, private). The scope you pass with --scope decides which one. Local is the default, so a server you add without a flag is not shared with your team.

Everything below comes from the official Claude Code MCP documentation, read on 2026-12-01. See the test status at the end for what I did and did not run.

The three scopes at a glance

Scope Loads in Shared with team Stored in
Local (default) Current project only No ~/.claude.json
Project Current project only Yes, via version control .mcp.json in the project root
User All your projects No ~/.claude.json

Step 1: Pick the scope

  • Local: personal or experimental servers, and servers with credentials you don’t want in version control.
  • Project: a server the whole team should have, committed as .mcp.json.
  • User: a utility you want in every project on your machine.

Step 2: Add the server with the scope flag

# Local scope (the default)
claude mcp add --transport http stripe https://mcp.stripe.com

# Project scope: writes .mcp.json in the project root
claude mcp add --transport http shared-server --scope project https://example.com/mcp

# User scope: available in all your projects
claude mcp add --transport http hubspot --scope user https://mcp.hubspot.com/anthropic

These are the example servers from the official docs. Replace the names and URLs with your own server.

Step 3: Check what was written

A successful claude mcp add prints an Added ... line, which means the configuration was written. To check that Claude Code actually connected, run:

claude mcp list
claude mcp get shared-server

claude mcp list shows a status next to each server, such as Connected, Needs authentication or Failed to connect. Inside a session, /mcp shows the same panel.

A project-scoped server from .mcp.json shows Pending approval until someone runs claude interactively in that project and approves it. Claude Code asks for this approval for security reasons. In claude -p runs and Agent SDK sessions it can’t show the prompt, so it loads project-scoped servers without asking.

Step 4: Share it with the team (project scope)

The file Claude Code writes for project scope looks like this:

{
  "mcpServers": {
    "shared-server": {
      "type": "http",
      "url": "https://example.com/mcp"
    }
  }
}

Commit it. Teammates get the same server entry. Keep secrets out of the file: .mcp.json supports ${VAR} and ${VAR:-default} expansion in command, args, env, url and headers, so an API key can come from each person’s environment instead.

One config mistake to avoid: an entry with a url but no type is read as a stdio server, and Claude Code skips it with an error. Add "type": "http".

Step 5: Fix duplicate names and precedence

If the same server name exists in more than one place, Claude Code connects once, using the highest-precedence definition. It uses the whole entry and does not merge fields. The order is:

  1. Local scope
  2. Project scope
  3. User scope
  4. Plugin-provided servers
  5. claude.ai connectors

If two scopes define the same name with different endpoints, claude mcp list and /mcp show a conflict warning. Keep the one you want and remove the others:

claude mcp remove shared-server --scope local

Removing a remote server also deletes the OAuth tokens Claude Code stored for it. It does not revoke them at the authorization server; run claude mcp logout <name> first if you want that.

Test status

I did not run these commands: the Claude Code CLI is not installed on the machine used to write this post. The commands, the table, the precedence order and the .mcp.json shape are taken from the official documentation. The only thing I checked myself is that the .mcp.json example above is valid JSON. Claude Code changes often, so check claude mcp add --help on your version.

Related: Claude Code, MCP and AI Coding Tools: Tutorials Index.

Leave a Reply