Published on , Aurélien Vandaële

How to configure MCP servers in Claude Code: where to declare them, and what broke for me

You add an MCP server with claude mcp add, and the only real decision is its scope, set with --scope: `local` (the default, this project only, just for you), `project` (a versioned .mcp.json file, shared with the team) or `user` (all your projects). On my machine, six servers are at user scope and only one at project scope. My three failures: a server tied to an old repo path, a server opening on the wrong app, a sign-in refused by a plugin.

The problem: a server that works here but not there

An MCP server gives Claude Code tools for an outside service: your Sentry errors, your subscriptions, a simulator. You add it once, it works, you forget about it. Then one day, in another folder, the agent says it has no Sentry tools and falls back on something else.

The cause is almost always the same: where the server was declared. By default, claude mcp add attaches it to the current project, stored in ~/.claude.json under that project's path. Nothing points this out afterwards. The server exists, but only there.

The method: choose the scope before adding

The Claude Code documentation describes three scopes:

  • `local`, the default scope: the server only loads in the project where you added it, and stays private. It is stored in ~/.claude.json, under the project's path.
  • `project`: the server is written to a .mcp.json at the root of the repo, versioned with the code. Claude Code asks for your approval before using a server from that file.
  • `user`: also stored in ~/.claude.json, but loaded in all your projects.
claude mcp add --transport http sentry --scope user https://mcp.sentry.dev/mcp
claude mcp list         # every server and its status
claude mcp get sentry   # details for one server
/mcp                    # inside a session: status and sign-in

My rule fits in two lines. A service I use across several repos goes to user. A server a repo cannot work without goes to project, so it arrives with the code. The local scope is for experiments and for anything carrying a secret that belongs to a single project.

If the same name exists in several scopes, Claude Code connects only once, using the highest-priority definition: local, then project, then user. And never put a token in plain text in a shared .mcp.json: the file accepts environment variables, written as ${VAR}.

My actual setup

Six servers at user scope, because I use them from one repo to the next:

  • argent, started locally by a command, to drive the iOS simulator.
  • GitLab, started through npx, for client repos.
  • Sentry, to triage errors one by one.
  • RevenueCat, for my apps' subscriptions.
  • Mobbin, a library of screenshots from published apps, to see how others handled a screen.
  • Astro, an App Store keyword tool that runs on my Mac and exposes its server on 127.0.0.1.

Only one server at project scope: one of my app repos declares argent in its .mcp.json, because that repo cannot be worked on without a simulator. The same server also exists at user scope, and the priority rule prevents a duplicate.

Adding servers barely weighs on the context anymore. By default, Claude Code turns on tool search: only tool names and server instructions load at the start, and a tool's full definition arrives when the agent needs it.

What broke

  • The server left on the old path. I had added Sentry at local scope in the ResellStats repo. Then I moved that repo. The configuration stayed attached to the old path, and sessions in the new folder no longer had any Sentry tools. On October 22, 2026, I added it again with --scope user. Since then, my everyday services are never at local scope.
  • The server opening on the wrong app. The PostHog server opens on the project of another of my apps. Its events look plausible, so nothing stands out. I wrote the rule into the project's memory: the first call of any analysis is switching project, and a warning saying that an event specific to ResellStats does not exist means you are reading the wrong app.
  • The refused sign-in. The server shipped by a Supabase plugin failed to sign in: the service rejected the client ID built into the plugin, and updating the plugin changed nothing. I switched to the local server, started through npx, with a personal token passed as an environment variable, at local scope since the token only applies to that project.
claude mcp add --scope local --transport stdio --env SUPABASE_ACCESS_TOKEN=<token> supabase \
  -- npx -y @supabase/mcp-server-supabase@latest --project-ref=<project>

What the three have in common: the agent does not reason wrongly, it is plugged in wrongly. It is up to you to check where each server points, once, and to write it down somewhere.

With nobody at the screen

My scheduled tasks and headless jobs need two more precautions.

  • Sign in beforehand. A claude -p run has no /mcp panel, so it cannot start the OAuth sign-in. I sign in once in an interactive session, with /mcp or claude mcp login <name>, and the jobs reuse that sign-in.
  • The job loads only what it needs. --strict-mcp-config skips the servers declared elsewhere and loads only the ones passed with --mcp-config. I also restrict tools with --tools, and I had to add ToolSearch to the list: without it, the Mobbin tools, loaded on demand, could not be found.

The first Mobbin job found 12 real flows for $0.33. But an MCP tool can cost money without warning: Mobbin's deep search uses credits and it is the default mode. So my automated jobs force the standard mode, and deep search only runs when I ask for it.

Last case: a missing server. Astro only exists when the app is open on the Mac. When the connection fails, Claude Code tells the agent, with the error. The skills that depend on it state it in their instructions (Astro open, required), and my rule for argent is the same: check once per session, do not retry in a loop, tell me only once.

How to start

  • Run claude mcp list in two different folders. A server present in one and missing from the other is at local scope.
  • Move the services you use everywhere to --scope user. Put the ones a repo cannot work without at --scope project, with secrets as ${VAR}.
  • For each server tied to an account, check which project it opens on, and write it down in the repo's CLAUDE.md or memory.
  • Before handing a server to an unattended task, sign in interactively and look at which tools cost money.

Article written with the help of AI, from my daily practice and my projects.

The whole notebook