Skip to main content
BlogAI

Claude Code MCP Server Setup: Scopes, Auth, Tool Budget

How to add MCP servers to Claude Code without wrecking your context window or your security posture: the three scopes, transports, tool search and trust.

Matthews Wong

Software Engineer

August 202612 min read
Claude Code MCP Server Setup: Scopes, Auth, Tool Budget

Key Takeaway

Claude Code connects to MCP servers at three scopes — local in your home config, project in a committed .mcp.json, and user across all projects. Tool search defers tool definitions by default, so context cost stays low, and workspace trust decides whether a cloned repository's servers connect at all.

The moment an AI coding agent can read your issue tracker, query your database and check your error monitoring, the work changes character: you stop pasting context and start asking questions. The Model Context Protocol is the open standard that makes that possible, and Claude Code speaks it natively.

What is less discussed is the governance side. Every server you add is a surface — for context bloat, for credentials, and for content that arrives from outside your codebase. This is how to set them up properly, and where the sharp edges are.

What MCP actually gives Claude Code

MCP is a client-server protocol. Claude Code is the client; each server exposes some combination of tools it can call, resources it can read, and prompts it can offer as slash commands. The protocol is open and not specific to Anthropic, which is why the same server can serve several different clients.

The practical trigger for adding one is simple: if you find yourself copying data into the session from another system — a ticket, a log, a schema — that system deserves a server. If you are not copying anything, you probably do not need it, and the documentation is explicit that a plain command line tool is often more context-efficient than an MCP server for the same job.

A client-server diagram showing clients connecting to a server across a network
MCP is the plainest possible shape: a client that wants capabilities, and servers that expose them over a transport. Everything else — scopes, approvals, tool search — is about which servers a given session is allowed to reach. Diagram: Michel Bakni / Wikimedia Commons, CC BY-SA 4.0

Three scopes, and how to choose

The scope you pick decides which projects a server loads in and whether your team gets it too. Choosing badly is how a personal experiment ends up in everyone's session, or how a team server has to be re-added by every new joiner.

ScopeLoads inShared with the teamStored in
Local (the default)Only the project you added it fromNoYour home configuration, under that project's path
ProjectOnly that projectYes, through version controlA committed .mcp.json in the project root
UserEvery project you openNoYour home configuration

My rule of thumb: user scope for things that are about me — my notes, my calendar, my cloud account. Project scope for things that are about the codebase and that a colleague would need on day one. Local scope for anything experimental or holding a credential I have no intention of sharing.

Adding a server, and confirming it actually works

Servers come in several transports: a local process over stdio, a remote HTTP endpoint, an SSE endpoint, and WebSocket for servers that push events. The command line covers all of the common ones, and the JSON form accepts streamable-http as an alias for http so configurations copied from a vendor's docs work unmodified.

# Remote HTTP server, shared with the team via .mcp.json
claude mcp add --transport http --scope project sentry https://mcp.sentry.dev/mcp

# Local stdio server: everything after -- is passed to the server untouched
claude mcp add --env DB_URL=postgres://localhost/dev --transport stdio db \
  -- npx -y @company/db-mcp --readonly

# Check what is configured and whether it actually connects
claude mcp list        # ✔ Connected / ! Needs authentication / ✘ Failed
claude mcp get sentry  # one server in detail

The verification step matters more than it looks. Adding a server only writes configuration; the status column tells you whether it connected, needs authentication, or failed. A server sitting at needs-authentication looks configured and does nothing, which is the most common form of I added it and Claude ignores it.

For stdio servers, remember that everything after the double dash is passed to the server untouched. That separator is what lets you pass the server its own flags without Claude Code trying to interpret them, and forgetting it produces confusing errors that look like the server is broken.

Tool search, and why context stays cheap

The obvious objection to connecting many servers is context. Historically every tool definition loaded into the window at session start, so a handful of chatty servers could consume a serious fraction of it before you typed anything. Tool search changes that.

  • Tool definitions are deferred by default. Only tool names and server instructions load up front, and Claude searches for a tool when a task needs one.
  • A threshold mode exists if you prefer it: definitions load eagerly while they stay under about a tenth of the context window, and defer beyond that.
  • Server instructions become important with tool search on, because they are what tells Claude when to go looking for your tools at all.

This is worth internalising because it inverts old advice. Adding a well-described server is now cheap; adding a server with vague instructions and forty near-identical tools is what costs you, because Claude cannot tell when to use it.

A terminal split into multiple panes running different processes
The other half of the toolbox. A command line tool costs no per-tool listing at all, so for anything already scriptable — the GitHub CLI, a cloud provider CLI, psql — the terminal is often the cheaper integration. Screenshot: Avelino0 / Wikimedia Commons, CC BY-SA 4.0

Trust, approvals and prompt injection

A project-scoped server is configuration that arrives with a repository, which means cloning a repository must not silently grant it the ability to run processes on your machine. Claude Code handles this with workspace trust: until you have trusted a folder, approvals committed inside that repository are ignored and its servers stay pending rather than connecting.

The deeper risk is content, not configuration. Any server that fetches external material — a web page, an issue comment, a customer email — can carry instructions aimed at the model rather than at you. The official guidance is blunt about verifying that you trust a server before connecting it, and that guidance is about the data it returns as much as the code it runs.

Treat an MCP server's output as untrusted input, exactly like user input in a web application. The dangerous combination is a session that can read external content, access private data and make outbound requests at the same time; if a task needs all three, it deserves a separate, narrower session rather than your everyday one.

A governance checklist for a team

Four decisions cover most of what a team needs to agree about MCP before it spreads.

  1. Decide what belongs in the committed .mcp.json. My test: would a new joiner be blocked without it on day one? If not, it is local or user scope.
  2. Keep credentials out of the file. Pass them through environment variables or a header helper that fetches a token at connect time, never as a literal in a committed configuration.
  3. Set a per-server timeout for anything that touches a slow system, so one unresponsive integration cannot stall a session.
  4. Review the list quarterly. Servers accumulate; run the list command, disable what nobody has used, and delete what nobody can explain.

That last step is the one people skip, and it is the one that keeps the whole thing sustainable. A tidy set of four well-chosen servers is more useful than fifteen that nobody trusts.

When not to add a server

MCP is not free, and three situations are usually better served another way.

  • The system already has a good command line tool. A CLI adds no tool listing to context and Claude can run it directly.
  • You need the data once. Paste it, or have Claude fetch it with a script; a permanent integration for a one-off question is overhead.
  • The server would hold write access to something irreversible. If the blast radius includes production data, a human-run script with a review step is the safer shape.

MCP turns an agent that reasons about your code into one that can also see your systems, and Claude Code's implementation has taken most of the context cost out of that. What it cannot take away is the judgement call: which servers earn a place in a shared configuration, which credentials they hold, and how much you trust the content they return.

FAQ

Frequently Asked Questions

Short answers to what readers ask most about this topic.

What are the three MCP scopes in Claude Code?

Local is the default and loads a server only in the project you added it from, stored in your home configuration. Project scope lives in a committed .mcp.json and is shared with the team through version control. User scope loads in every project you open and stays private to you.

Does adding many MCP servers eat my context window?

Much less than it used to. Tool search is enabled by default, so tool definitions are deferred and only tool names plus server instructions load at session start; Claude searches for a tool when a task needs one. A threshold mode also exists that loads definitions eagerly until they reach about a tenth of the window.

Why is my project's MCP server stuck pending approval?

Because the folder is not trusted yet. Approvals committed inside a repository are ignored until you run Claude in that folder and accept the workspace trust dialog, so a cloned repository cannot approve its own servers. That is deliberate: cloning a repo must not silently let it start processes on your machine.

What is the security risk with MCP servers?

Two distinct ones. A server runs code or holds credentials, so you should only connect servers you trust. More subtly, any server that returns external content — web pages, issue comments, emails — can carry instructions aimed at the model, so treat its output as untrusted input rather than as data you asked for.

When is a CLI tool better than an MCP server?

Whenever a good one already exists. Command line tools such as the GitHub CLI, cloud provider CLIs and psql add no per-tool listing to context and Claude can run them directly, which makes them more context-efficient for anything already scriptable. Reach for MCP when you would otherwise be pasting data into the session repeatedly.