🛠️Free

Claude Code MCP Configuration: Scopes, Commands, and Verification

Published: 2026-07-23Updated: 2026-08-12~9 min

MCP Radar Editorial · Facts verified: 2026-08-12 · Refresh due: 2026-11-12

Direct answer

Use `claude mcp add` for a one-off local or user configuration; use a project-scoped `.mcp.json` when the team should share the server definition. Keep secret values outside version control, then verify with `claude mcp list`, `claude mcp get <name>`, and the in-session `/mcp` panel.

CLI checked

2.1.117

Installed Claude Code version on 2026-08-12

Scopes

Local · Project · User

Local and user live in ~/.claude.json; project uses .mcp.json

Transports

stdio · HTTP

Choose by process boundary, not by package language

Evidence

Config verified

A harmless project config was created; health did not finish in the observation window

The 60-second configuration chooser

1

Choose scope

Private current repo, shared current repo, or private all repos.

2

Choose transport

stdio launches a child process; HTTP connects to an existing endpoint.

3

Add credentials

Reference environment values; do not commit live tokens.

4

Verify

List, inspect, open /mcp, and run one non-destructive tool.

The scope controls who receives the definition. The transport controls how Claude Code reaches the server.
ScopeLoads inSharedStored inUse it for
LocalCurrent projectNo~/.claude.json under that projectPersonal experiments or private credentials
ProjectCurrent projectYes.mcp.json in the project rootA team-owned server definition reviewed in version control
UserEvery projectNo~/.claude.jsonPersonal utilities used across repositories
Scope behavior verified against the current Claude Code MCP documentation on 2026-08-12.

Choose `claude mcp add` or `.mcp.json`

Use the CLI when you want Claude Code to write the correct structure for you. It reduces syntax mistakes and makes the chosen scope explicit. Use a hand-reviewed `.mcp.json` when a project needs a shared, versioned definition or when you are editing a pull request that introduces an integration.

A project-scoped file is code. Review the command, arguments, endpoint, headers, and requested privileges before approval. Claude Code prompts before using project-scoped servers, but that prompt is not a source or package audit.

Add a local stdio server or a remote HTTP server

For stdio, everything after `--` is passed to the server process. Put Claude options before the server name. For HTTP, provide the endpoint instead of a launch command. Use a harmless server while validating mechanics; a successful launch does not prove that a production package is trustworthy.

Local stdio server

claude mcp add --transport stdio --scope local demo -- npx -y example-mcp-server

Remote Streamable HTTP server

claude mcp add --transport http --scope local hosted https://example.com/mcp

Share configuration without sharing secrets

Claude Code supports environment expansion in `command`, `args`, `env`, `url`, and `headers` inside `.mcp.json`. Commit the variable reference, not the token. A missing required variable without a default causes config parsing to fail, which is preferable to silently sending an empty credential.

Do not assume environment variables are automatically safe: they can still leak through logs, child processes, screenshots, or shell history. Use the least-privileged credential, keep it out of source control, and redact it from diagnostic bundles.

Shared HTTP definition with a private token

{
  "mcpServers": {
    "hosted": {
      "type": "http",
      "url": "${MCP_BASE_URL:-https://example.com}/mcp",
      "headers": {
        "Authorization": "Bearer ${MCP_TOKEN}"
      }
    }
  }
}

Verify the declaration, connection, and first tool separately

Run `claude mcp list` to check configured servers and health, then `claude mcp get <name>` to inspect one definition. Inside Claude Code, open `/mcp` and confirm the server and its tools are visible. Finally invoke one read-only or otherwise reversible tool and check the returned result.

Treat these as separate gates: the JSON can parse while the executable is missing; the process can start while discovery fails; tools can list while the upstream API rejects authorization. Record which gate failed before changing configuration.

Operational commands

claude mcp list
claude mcp get demo
claude mcp remove --scope local demo
claude mcp reset-project-choices

Use the failure tree instead of changing everything at once

If the executable is not found, test the exact command from the environment that launches Claude Code and prefer a stable absolute path only when necessary. If the endpoint returns 401 or 403, repair authentication rather than retrying. If the process stays alive but exposes zero tools, inspect the server's discovery output and stderr. Restart the client only after a config or environment change that requires it.

  • Executable failure: command/PATH/permissions before package arguments.
  • Connection failure: transport, URL, TLS, proxy, then authentication.
  • Discovery failure: protocol compatibility, stderr, and tool/resource list responses.
  • Tool failure: input schema, downstream credentials, rate limits, and handler logs.

Methodology and limitations

  • Commands and scope paths were checked against the official Claude Code docs and the locally installed CLI on 2026-08-12.
  • A temporary project-scoped stdio definition was created successfully. Health checking did not finish within the observation window, so this page does not claim a successful client invocation.
  • Examples use placeholder package names and credentials to avoid recommending an unreviewed third-party server as a universal default.

Frequently asked questions

Where does Claude Code store local MCP servers?

Local-scoped servers are stored in `~/.claude.json` under the current project's path. This is different from `.claude/settings.local.json`, which is used for other local settings.

Should `.mcp.json` contain API keys?

No live key should be committed. Reference environment variables or the secret mechanism used by your organization, and grant the smallest scope the server needs.

Does `claude mcp list` prove a server is safe?

No. It can help verify configuration and health. Safety still requires source, package, permission, credential, network, and behavior review.

Sources

  1. Claude Code — connect to tools via MCP · retrieved 2026-08-12
  2. Model Context Protocol — security best practices · retrieved 2026-08-12

Continue reading