Guide security/
Shadow MCP servers: finding the servers developers added themselves
Developers add MCP servers in one command, and nobody is asked first. Here is where each client keeps its MCP config, how to build an inventory, and how each client's managed allowlist blocks the rest.
Short answer
Shadow MCP servers are MCP servers developers connect to their AI clients without security or IT review. Find them in each client's config files, such as ~/.claude.json and .mcp.json for Claude Code or ~/.cursor/mcp.json for Grok Build (formerly Cursor), and with claude mcp list or codex mcp list. Block new ones with each client's managed allowlist, matched on server URL or launch command, because a server name is a label any user can choose.
Checked against: Anthropic’s Claude Code managed MCP, MCP and security docs, the MCP project’s Local Server Security guide, Microsoft’s VS Code MCP configuration reference and policies, GitHub’s enterprise MCP allowlist docs, OpenAI’s Codex MCP and managed configuration docs, and Grok Build’s MCP docs, December 6, 2026.
Run by us: no. Commands and config are copied from Anthropic’s and OpenAI’s docs.
Why do unapproved MCP servers matter?
An unapproved local MCP server is ordinary software running with the developer’s access, and nothing in the protocol asks anyone before it is installed. The MCP project’s Local Server Security guide describes what that process gets:
| What the server process gets | Per the MCP guide |
|---|---|
| Environment | The environment variables of whatever launched it |
| Files | Whatever the user’s account can read: SSH keys, cloud credentials, browser profiles, the home directory |
| Network | Outbound connections “to anywhere” |
| Model context | Shared with every other configured server |
The guide tells administrators to “Assume users install servers the same way they install editor extensions.” Anthropic’s managed MCP docs say that unless an administrator restricts it, any Claude Code user can connect any server, and that Anthropic “doesn’t security-audit or manage any MCP server.”
Two risks are specific to agents. One server’s tool descriptions can steer how the agent uses the others, which is tool poisoning. And config files hold credentials: Invariant Labs’ tool poisoning demo stole ~/.cursor/mcp.json because it “is typically used to store credentials for other MCP servers.”
Where does each client keep its MCP config?
Each client reads a few known files, and most also load servers from places no file shows. As of December 6, 2026, these are the documented paths:
| Path | Client | Scope | Inside the project folder? |
|---|---|---|---|
~/.claude.json |
Claude Code | User and local | No |
.mcp.json at the project root |
Claude Code | Project | Yes |
~/.cursor/mcp.json |
Grok Build (formerly Cursor) | Global | No |
.cursor/mcp.json |
Grok Build | Project | Yes |
~/Library/Application Support/Claude/claude_desktop_config.json (macOS), %APPDATA%\Claude\claude_desktop_config.json (Windows), ~/.config/Claude/claude_desktop_config.json (Linux) |
Claude Desktop | User | No |
~/.copilot/mcp-config.json, or $COPILOT_HOME/mcp-config.json |
VS Code with Copilot | User | No |
.mcp.json at the workspace root |
VS Code with Copilot | Workspace | Yes |
.vscode/mcp.json and the profile mcp.json |
VS Code, deprecated Local harness | Workspace and profile | Workspace file only |
~/.codex/config.toml |
Codex | User | No |
.codex/config.toml |
Codex | Project (trusted projects only) | Yes |
The paths come from Anthropic, Grok Build, the MCP project’s local server tutorial, Microsoft and OpenAI. Servers that reach a session without appearing in those files:
- Claude Code: plugins, claude.ai connectors, and servers an admin provides through
managedMcpServersormanaged-mcp.json. Anthropic’s security page warns that “reviewing.mcp.jsondoesn’t show every server a session can load.” - Grok Build: dashboard team servers, marketplace plugins, servers an extension registers with
vscode.cursor.mcp.registerServer(), and the terminal UI’s[mcp_servers]inconfig.toml. Cursor took the Grok Build name on November 30, 2026; the.cursorpaths stayed. - Claude Desktop: desktop extensions.
- VS Code: with
chat.mcp.discovery.enabled, it reads other apps’ configs (Claude Desktop, GitHub Copilot CLI, Cursor and Windsurf); only the Copilot CLI source is on by default. Microsoft says the Local harness “is deprecated and will be removed in February 2027.” - Codex: nothing extra is documented, but one
config.tomlserves Codex CLI, the IDE extension and the ChatGPT desktop app, per OpenAI.
How do I build an inventory?
Gather config files, ask each client what it loaded, and turn on telemetry, then key every entry by URL or launch command. The client commands, from Anthropic’s and OpenAI’s docs:
# List all configured servers
claude mcp list
codex mcp list
Claude Code marks a project server nobody has approved yet as ⏸ Pending approval. VS Code has MCP: List Servers in the Command Palette, and Grok Build lists servers on its Customize page.
- Pull config files from managed machines. Per the MCP guide, these files sit “in known locations on each platform,” so endpoint management tooling can collect them.
- Scan source control for the project-level paths in the table. Anything committed there lands on every clone.
- Turn on tool telemetry. With
OTEL_LOG_TOOL_DETAILS=1, Claude Code’s OpenTelemetry events carry MCP server and tool names; Anthropic’s docs suggest totaling them in your collector “to see which servers your users actually connect to.” - Key each entry by URL or command, with its pinned version, publisher, the teams that run it and the systems it can touch.
Remote servers also show up on the wire: under the 2026-07-28 Streamable HTTP spec, every request carries MCP-Protocol-Version and Mcp-Method headers. If your egress proxy already decrypts TLS, a rule on those headers can surface remote servers missing from every config file.
How do I block servers nobody approved?
Turn on each client’s managed allowlist and write its rules against URLs and commands. In Claude Code, this example from Anthropic’s managed MCP docs allows two URL patterns and ignores any allowlist a user writes:
{
"allowManagedMcpServersOnly": true,
"allowedMcpServers": [
{ "serverUrl": "https://api.githubcopilot.com/*" },
{ "serverUrl": "https://*.internal.example.com/*" }
]
}
Deploy it as managed-settings.json in the system directory (/Library/Application Support/ClaudeCode/ on macOS, /etc/claude-code/ on Linux and WSL, C:\Program Files\ClaudeCode\ on Windows), per the managed settings docs, or push the same keys through MDM or server-managed settings. Codex takes a requirements.toml table instead, per OpenAI’s managed configuration docs:
[mcp_servers.docs]
identity = { command = "codex-mcp" }
[mcp_servers.remote]
identity = { url = "https://example.com/mcp" }
Codex turns a server on only when “both its name and identity match an approved entry,” and an empty mcp_servers table turns them all off. Where each client’s admin control lives:
| Client | Where an admin sets it | Keys or switches |
|---|---|---|
| Claude Code | managed-settings.json, MDM or server-managed settings; managed-mcp.json for a fixed set |
allowedMcpServers, deniedMcpServers, allowManagedMcpServersOnly |
| Claude Desktop | MDM configuration profiles; Windows registry under HKLM:\SOFTWARE\Policies\Claude |
isLocalDevMcpEnabled, isDesktopExtensionEnabled |
| VS Code | Group Policy, macOS configuration profiles, /etc/vscode/policy.json |
ChatMCP, ChatAllowedMcpServers, ChatDeniedMcpServers, ChatAllowManagedMcpServersOnly |
| GitHub Copilot | An enterprise managed-settings.json, usually in a .github-private repository, or MDM |
allowedMcpServers, deniedMcpServers |
| Grok Build | Grok Dashboard, Team Settings > MCP Configuration | Allowlist entries |
| Codex | Admin Console, Agent security | mcp_servers |
The rules compare different things. Claude Code matches serverUrl wildcard patterns, exact serverCommand arrays or a serverName label; GitHub matches name, URL or command; Grok Build matches command or URL patterns; Codex checks name plus command or URL. Microsoft’s policies page doesn’t document VS Code’s entry format. In GitHub and VS Code, deny beats allow.
Where do allowlists leave gaps?
Allowlists leave gaps for servers matched only by name, servers that load through a path the list doesn’t govern, and edits users make to their own settings.
| Gap | What the vendor says |
|---|---|
| Name matching | Anthropic: a serverName entry “is not a security control,” because “a user can call any server github” |
| Soft allowlists | Without allowManagedMcpServersOnly, Claude Code merges allowlists from every settings scope, “so a user can broaden what your allowlist permits” |
| Environment | A Claude Code serverCommand entry doesn’t compare the server’s env block |
| Name-only registries | GitHub: registry enforcement by name or ID “can be bypassed by editing configuration files” |
| Custom agent profiles | GitHub’s allowlist doesn’t apply to MCP servers in repository custom agent profiles; block the domains they need to start |
| Desktop extensions | Anthropic: in Claude Desktop, “Desktop extensions can still run local servers,” so block extensions as well as local servers |
| Tampering | Claude Desktop’s extension allowlist “does not guard against individuals tampering with local MCP file contents after installation” |
Three settings close most of these: rules written as serverUrl and serverCommand entries rather than names, allowManagedMcpServersOnly turned on, and, in Claude Desktop, extensions blocked along with local servers. GitHub describes its managed-settings.json allowlist as “The more secure, generally available method,” compared with its registry-based restriction. If approved remote servers sit behind an MCP gateway, make the gateway’s URL the one allowed remote entry, because a gateway can’t govern a server that a client reaches directly.
What do I do when a shadow server turns out to be bad?
Block it everywhere first, then rotate whatever it could reach. A Claude Code deniedMcpServers entry applies from any settings scope, and Anthropic says “Nothing overrides a denylist match.” The Local Server Security guide gives the fleet sequence:
- Locate every machine that runs it, from your inventory.
- Cut its egress at the proxy or firewall while you respond.
- Rotate each credential those configs handed to it.
- Roll out a fixed, pinned version through your approved channel.
Per the guide, SBOMs let you work out which machines run something built on an affected SDK version “in minutes instead of days.” Its suggested starting point is the pair this page describes: a fleet-wide inventory of client configs and a short list of approved servers.
What to read next
Sources
- Control MCP server access for your organization
- Connect Claude Code to tools via MCP
- Security
- Deploy managed settings
- Enterprise configuration for Claude Desktop
- Enabling and using the desktop extension allowlist
- Local Server Security (2026-07-28)
- Connect to local MCP servers
- Streamable HTTP (2026-07-28)
- MCP configuration reference
- Centrally manage VS Code settings with policies
- Configuring an MCP server allowlist for your enterprise
- MCP private registry enforcement
- Model Context Protocol
- Managed configuration
- Model context protocol (MCP)
- Cursor is now Grok Build
- MCP Security Notification: Tool Poisoning Attacks
Changelog
- First published.
Cite this page
Agents for Devs. "Shadow MCP servers: finding the servers developers added themselves." Published Dec 6, 2026. https://agentsfordevs.com/guides/shadow-mcp-servers - Page: https://agentsfordevs.com/guides/shadow-mcp-servers
- Markdown version: https://agentsfordevs.com/guides/shadow-mcp-servers.md
- Reuse: quote or summarize with a link to this page. Reuse terms