How to review MCP servers a repository adds to Claude Code

To review MCP servers a repository adds to Claude Code, read its project .mcp.json before you approve anything. For each entry, check the command or URL, the environment values, every ${VAR} reference and the headers it sends. Claude Code asks before it uses project servers in interactive sessions, but that prompt is not a review.
What a project .mcp.json can start
A project-scoped server is defined in a .mcp.json file at the project root. The docs suggest checking that file into version control so everyone on the team gets the same servers. A cloned repository therefore brings its server definitions with it, and each definition can start a process on your machine or open a connection to a remote host.
The docs say that “a launch command means the server runs as a local stdio process.” An entry with a url connects to a remote server instead. Both kinds can carry environment variables and headers, which is where secrets tend to end up.
For security reasons, Claude Code prompts for approval in interactive sessions before using project-scoped servers from .mcp.json files. Treat that prompt as the point where you decide, not as the place where you find out what the file does. Read the file first.
Read the example file
This post follows the Claude Code MCP docs as fetched on 2026-11-24. The docs tie some behavior to version numbers, so check the output on your own build before you rely on it.
Take this example, adapted from the docs’ variable expansion pattern. The server names and paths are invented for this post.
{
"mcpServers": {
"docs": {
"type": "http",
"url": "${DOCS_MCP_URL:-https://mcp.example.com}/mcp",
"headers": {
"Authorization": "Bearer ${API_KEY}"
}
},
"local-tools": {
"command": "node",
"args": ["${CLAUDE_PROJECT_DIR:-.}/tools/server.js"],
"env": {
"LOG_LEVEL": "debug"
}
}
}
}
-
Read each
commandand itsargs. A launch command runs on your machine, so the program and its arguments are the code you approve. Note whether it runs a script inside the repository, a binary, or a package fetched by name. A package name inargsdoes not pin a version, so the file alone cannot tell you what you will run. In a project entry, a${CLAUDE_PROJECT_DIR}reference incommandorargsneeds a default, such as${CLAUDE_PROJECT_DIR:-.}. -
Check the
typeof each entry. A JSON entry with aurland notypeis read as a stdio server, and Claude Code skips it and reports a configuration error. Note any entry with"type": "sdk": Claude Code skips it too, unless an SDK host application registers it. A skipped entry is still in the file, so count it in your review.
Trace variables, credentials and helpers
-
Trace every
${VAR}to your environment. Claude Code expands${VAR}and${VAR:-default}incommand,args,env,urlandheaders. The default after:-is written in the repository. In the example, ifDOCS_MCP_URLis unset, the request goes tohttps://mcp.example.com/mcpand carries yourAPI_KEY.API_KEYis not on the credential list below, so it expands as written. The question for the reviewer is which host receives that key, and whether you trust that host. -
Check the credential names and the helper. For a remote server’s
urlandheaders, Claude Code reads some credential variables as empty rather than expanding them. The docs name Claude Code’s own credentials, such asANTHROPIC_API_KEYandANTHROPIC_AUTH_TOKEN, cloud provider credentials such asAWS_BEARER_TOKEN_BEDROCK, and others such asHTTPS_PROXYandNPM_TOKEN. AheadersHelperis an arbitrary shell command. For a project entry, it runs only after you accept the trust dialog for that folder. Until then, the server connects with its static headers alone.
Check the approval state before you decide
Run claude mcp list and claude mcp get <name> in the clone. The docs list four states that matter here: pending approval, rejected through disabledMcpjsonServers, disabled for this project, and blocked by enterprise managed policy. These commands show a ${VAR} reference by name, not its resolved value, so you can review an entry without printing a secret.
Trust changes what a clone can approve. A cloned repository cannot approve its own servers. The docs say that enableAllProjectMcpServers or enabledMcpjsonServers, committed to the project’s .claude/settings.json, is ignored in an untrusted folder, and the server stays at pending approval. Approvals in your user settings, managed settings and --settings still apply in an untrusted folder. Check those lists before you open a clone you have not reviewed.
Then decide, one server at a time:
- Approve the servers whose entries you have read and understood.
- Add a server you do not want to
disabledMcpjsonServers. The docs say an entry in any settings file rejects the server in every permission mode. - If an earlier choice is wrong, run
claude mcp reset-project-choicesand review the file again.
Non-interactive runs skip the prompt
The docs say that in claude -p runs, Agent SDK sessions and cloud sessions outside a project’s threads, Claude Code cannot show the approval prompt, so it loads project-scoped servers without asking. It also skips the prompt in a session started in bypassPermissions mode, when skipDangerousModePermissionPrompt is set in your user or managed settings.
So review a fresh clone before any script, pipeline or SDK job runs in it. To keep a server out of those runs, use disabledMcpjsonServers, exclude project settings with --setting-sources or the SDK’s settingSources option, or start with --strict-mcp-config. The docs say skipping the prompt for servers Claude Code does not load needs v2.1.246 or later.
What to check in each field
Field in .mcp.json |
What to check | What the docs say |
|---|---|---|
command and args |
The program, the script path or the package name | A launch command runs the server as a local stdio process |
url with type |
The host and path, and that type is present |
An entry with a url and no type is skipped with an error |
env |
The values, and which of them are ${VAR} references |
Values are passed to the server, and ${VAR} expands from your environment |
url and headers |
Where each variable’s default points, and which names are credentials | Covered credential names read as empty in remote url and headers |
headersHelper |
The shell command it runs | It runs only after you accept the trust dialog for the folder |
| Entry name | Whether the same name appears in another scope | A conflicting endpoint produces a warning, and the entry from the highest-precedence source is used |
Reviewing one file is not an inventory
A file review covers one project. User settings, local settings, plugins and claude.ai connectors can each add servers, and when a server is defined in more than one place, Claude Code uses the definition from the highest-precedence source as a whole. Fields are not merged across scopes. To find .mcp.json files across many repositories, use the search in how to find MCP servers in your codebase and clusters. Keep the approved list itself in an allowlist, as how to restrict which MCP servers Claude Code can use explains. For the wider set of controls, see the MCP security checklist for enterprises.
Enforcing this with AIControls
AIControls supports Claude Code through its gateway for both the CLI and VS Code. It provides per-user tokens, and per-user and per-session cost and budget limits. Those controls cover model traffic. They do not replace the file review above, so run it for every repository before its servers reach a developer’s session. To see how Nirmata approaches MCP policy, read MCP security.
Frequently asked questions
Does Claude Code run a server from a repository before I approve it?
In an interactive session, Claude Code asks for approval before it uses project-scoped servers from a .mcp.json file. A cloned repository cannot approve its own servers. The enableAllProjectMcpServers and enabledMcpjsonServers keys in the committed .claude/settings.json are ignored in a folder you have not trusted, and the server stays pending. In claude -p runs and Agent SDK sessions, Claude Code cannot show the prompt, so it loads project servers without asking.
What does a ${VAR} reference in a project .mcp.json do?
Claude Code expands ${VAR} and ${VAR:-default} in the command, args, env, url and headers fields, using your environment. If the variable is unset and has no default, the server still loads with the text unexpanded, and Claude Code warns about it. The default is written in the repository, so the file decides where a value goes when your variable is unset. Some credential names, such as ANTHROPIC_API_KEY, read as empty in a remote url or headers.
How do I stop one project MCP server from loading?
Add its name to disabledMcpjsonServers in any settings file. The docs say that entry rejects the server in every permission mode. To keep project settings out of a run entirely, exclude them with the --setting-sources flag or the SDK's settingSources option. To load only the servers you pass with --mcp-config, start the session with --strict-mcp-config.
Is reviewing the .mcp.json file enough to approve MCP servers?
No. User settings, local settings, plugins and claude.ai connectors can each add servers too. When one name is defined in more than one scope with different endpoints, Claude Code warns about the conflict. Review the file, then check the full set of servers with claude mcp list, and keep an allowlist so the approved set holds for the whole team.