Learn / Securing AI coding assistants in an organisation
Lesson 4 of 610 minReviewed
MCP allowlists for developer tools
Choose between a fixed MCP deployment, an approved catalogue and a denylist, write entries that match what actually runs, and close the repository and automation paths that skip approval.
Every MCP server a developer adds is either code running with their privileges or a remote endpoint whose tool descriptions the model reads as instructions. The MCP project's own guidance is to treat a third-party local server as untrusted code with exactly the privileges you hand it [1]. An allowlist turns that into policy: which servers may load at all.
Claude Code: choose a pattern
| Pattern | Configure | Effect |
|---|---|---|
| Fixed deployment | managed-mcp.json in the system directory | Only the listed servers load; claude mcp add fails |
| Provided servers | managedMcpServers in managed settings | Remote https servers for everyone; entries cannot name a command to run |
| Approved catalogue | allowedMcpServers with allowManagedMcpServersOnly: true | Users add what they need from your list; anything else is blocked |
| Denylist only | deniedMcpServers | Known-bad servers blocked; everything else allowed |
Entries match by serverUrl (wildcards allowed), serverCommand (the exact command and arguments, every argument in order) or serverName. The documentation warns that a serverName entry is not a security control, because the name is a label the user assigns and anyone can call a server github [2]. Two further details catch teams out: an unset allowedMcpServers allows everything while an empty array allows nothing, and without allowManagedMcpServersOnly users' own allowlists merge with yours and can broaden it. The denylist always wins over an allowlist match [2].
{
"allowManagedMcpServersOnly": true,
"allowedMcpServers": [
{ "serverUrl": "https://mcp.internal.example.com/*" },
{ "serverCommand": ["npx", "-y", "@example/approved-server@1.4.2"] }
],
"deniedMcpServers": [
{ "serverUrl": "https://*.untrusted.example.com/*" }
]
}Pinning the version in a serverCommand entry helps, but know its reach: launchers such as npx and uvx fix only the top-level package, and transitive dependencies resolve fresh at install time. A container image pinned by digest freezes the whole tree [1].
Paths that skip the prompt
A repository can ship a .mcp.json. In interactive sessions Claude Code asks before using those project servers, and a cloned repository in an untrusted folder cannot approve its own servers. In claude -p runs, Agent SDK sessions and some cloud sessions there is no one to ask, so Claude Code loads project-scoped servers without asking [3]. A CI job that runs the agent on a pull request branch therefore runs whatever servers that branch declares, unless you pass --strict-mcp-config or list them in disabledMcpjsonServers [3].
Approvals also need to bind to content. In MCPoison (CVE-2025-54136), Cursor tied trust to the entry's name, so once a user approved an MCP entry in a shared repository, a later change to its command ran without a new prompt. Cursor 1.3, released 29 July 2025, requires approval for any change [4].
GitHub Copilot
Copilot's enterprise allowlist uses the same key names in its own managed-settings.json, matching by serverUrl or serverCommand. Built-in default servers are always allowed, a deny match blocks, a server outside a configured allowlist is blocked, and an entry with an unresolved ${VARIABLE} is blocked because the client cannot verify it [5]. GitHub describes restricting access to a private registry as a public preview and not the recommended method [6].
Try it on ThreatDeck
- MCP allowlist generator Turn the servers your teams use into allowlist entries for Claude Code and Copilot.
- MCP Server Watch Check a server's repository facts and advisories before you approve it.
- Detection: MCP server added via agent CLI Alert when `claude mcp add` or similar commands register a new server on a managed machine.
Self-check
4 questionsPick an answer to see whether it is right and why. Only your score is saved, in this browser.
-
The label comes from
claude mcp addor a config file the user edits. Enforce withserverUrlandserverCommandentries, which describe what actually runs. -
Unset means no restriction; an empty array means nothing passes. The organisation's own managed servers and built-in servers are the documented exceptions.
-
Non-interactive runs cannot show the approval prompt, so project-scoped servers load. Use
--strict-mcp-config,disabledMcpjsonServersor a managed allowlist in automation. -
Trust has to follow the content that runs. Re-prompting whenever a command, argument or tool definition changes closes the gap.
References
- MCP Local Server Security. Model Context Protocol, 2026-07-28.
- Control MCP server access for your organization. Anthropic (Claude Code docs).
- Connect Claude Code to tools via MCP. Anthropic (Claude Code docs).
- Cursor IDE's MCP Vulnerability (MCPoison, CVE-2025-54136). Check Point Research, 2025-08-05.
- Configuring an MCP server allowlist for your enterprise. GitHub Docs.
- Restrict MCP server access to a custom registry. GitHub Docs.