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.

Published
Read
7 min
Source
Markdown

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 managedMcpServers or managed-mcp.json. Anthropic’s security page warns that “reviewing .mcp.json doesn’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] in config.toml. Cursor took the Grok Build name on November 30, 2026; the .cursor paths 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.toml serves 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.

  1. 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.
  2. Scan source control for the project-level paths in the table. Anything committed there lands on every clone.
  3. 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.”
  4. 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:

  1. Locate every machine that runs it, from your inventory.
  2. Cut its egress at the proxy or firewall while you respond.
  3. Rotate each credential those configs handed to it.
  4. 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.

Sources

  1. Control MCP server access for your organizationAnthropic code.claude.com
  2. Connect Claude Code to tools via MCPAnthropic code.claude.com
  3. SecurityAnthropic code.claude.com
  4. Deploy managed settingsAnthropic code.claude.com
  5. Enterprise configuration for Claude DesktopAnthropic support.claude.com
  6. Enabling and using the desktop extension allowlistAnthropic support.claude.com
  7. Local Server Security (2026-07-28)Model Context Protocol modelcontextprotocol.io
  8. Connect to local MCP serversModel Context Protocol modelcontextprotocol.io
  9. Streamable HTTP (2026-07-28)Model Context Protocol modelcontextprotocol.io
  10. MCP configuration referenceMicrosoft code.visualstudio.com
  11. Centrally manage VS Code settings with policiesMicrosoft code.visualstudio.com
  12. Configuring an MCP server allowlist for your enterpriseGitHub docs.github.com
  13. MCP private registry enforcementGitHub docs.github.com
  14. Model Context ProtocolOpenAI learn.chatgpt.com
  15. Managed configurationOpenAI learn.chatgpt.com
  16. Model context protocol (MCP)Grok Build docs docs.grok.com
  17. Cursor is now Grok BuildGrok, 2026-11-30 grok.com
  18. MCP Security Notification: Tool Poisoning AttacksInvariant Labs, 2025-04-01 invariantlabs.ai

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
Cite one section