---
title: "Shadow MCP: how to find the servers your team runs"
description: Find unapproved MCP servers by reading each AI client’s config files and searching repos, then enforce an allowlist with each client’s managed settings.
canonical: https://mcp1.com/blog/shadow-mcp-servers
last-updated: 2026-11-20
---

# Shadow MCP: how to find the servers your team runs

Find unapproved MCP servers by reading each AI client’s config files and searching repos, then enforce an allowlist with each client’s managed settings.

![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite

 MCP servers on this machine

- \~/.claude.json`linear`Approved
- \~/.cursor/mcp.json`npx -y pg-mcp`Unknown
- .vscode/mcp.json`github`Approved
- \~/.codex/config.toml`http://10.0.4.12/mcp`Unknown

 MCP servers on this machine

- \~/.claude.json`linear`Approved
- \~/.cursor/mcp.json`npx -y pg-mcp`Unknown
- .vscode/mcp.json`github`Approved
- \~/.codex/config.toml`http://10.0.4.12/mcp`Unknown

Shadow MCP is the set of MCP servers people have added to Claude Code, Cursor, VS Code and other AI clients without anyone approving them. You find it by reading each client’s config files on company machines and searching your repositories for committed configs. You control it by deciding which servers are allowed and enforcing that list in each client’s managed settings.

## Why does shadow MCP matter?

Each server someone adds is a new path from an AI agent into a company system, and none of them show up in your usual inventory:

- A local server runs as the person, with their files, their shell and their network. One started with `npx -y some-package` runs whatever version that package publishes next.
- A remote server signed in with OAuth holds a grant to GitHub, Notion or your CRM that lives outside your SSO and survives someone leaving.
- Tokens for servers that don’t support OAuth often sit in plain text in a JSON file in the home folder.
- Nothing records which tool an agent called, as whom, with what arguments.

Banning MCP outright tends to push it further out of sight. The useful goal is a known list, enforced where the client can enforce it. The wider set of risks is in [MCP security best practices](https://mcp1.com/blog/mcp-security-best-practices).

## Where do MCP clients store their server config?

Every client keeps its own file, and most have both a per-user file and a per-project one that can be committed to a repository:

ClientFiles

Claude Code

`~/.claude.json` for user and local scope (local servers sit under each project’s path), `.mcp.json` in a project.

Cursor

`~/.cursor/mcp.json`, and `.cursor/mcp.json` in a project.

VS Code

`~/.copilot/mcp-config.json` and a workspace `.mcp.json`, plus the older `.vscode/mcp.json` and the user profile’s `mcp.json`.

Codex

`~/.codex/config.toml`, and `.codex/config.toml` in trusted projects, one `[mcp_servers.<name>]` table per server.

Gemini CLI

`~/.gemini/settings.json`, and `.gemini/settings.json` in a project.

Claude Desktop

`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS.

Windsurf

`~/.codeium/windsurf/mcp_config.json`.

Most use a top-level `mcpServers` object; VS Code’s `.vscode/mcp.json` uses `servers`, and Codex uses TOML. In Claude Code, `claude mcp list` shows a person’s servers with their status, including ones waiting for approval.

## How do I list every MCP server on a machine?

Read those files and print each server’s name and where it points. This script does that for macOS and Linux with Python 3.11 or later. It prints only names, URLs and commands, never `env` or `headers`, where tokens usually sit:

mcp-inventory.py

```
#!/usr/bin/env python3
# Lists the MCP servers configured for this user, one line each: client, file, server name, URL or command.
# Never prints env or headers, where tokens usually sit. Optional arguments: folders to scan for project configs.
import json, os, sys, tomllib
from pathlib import Path

home = Path.home()
USER_FILES = [
    ('Claude Code', home / '.claude.json'),
    ('Claude Desktop', home / 'Library/Application Support/Claude/claude_desktop_config.json'),
    ('Cursor', home / '.cursor/mcp.json'),
    ('VS Code', home / '.copilot/mcp-config.json'),
    ('Gemini CLI', home / '.gemini/settings.json'),
    ('Windsurf', home / '.codeium/windsurf/mcp_config.json'),
    ('Codex', home / '.codex/config.toml'),
]
PROJECT_FILES = ['.mcp.json', '.cursor/mcp.json', '.vscode/mcp.json', '.gemini/settings.json', '.codex/config.toml']

def servers(data):
    yield from (data.get('mcpServers') or data.get('servers') or data.get('mcp_servers') or {}).items()
    for project in (data.get('projects') or {}).values():  # Claude Code keeps local-scope servers per project
        yield from (project.get('mcpServers') or {}).items()

def target(cfg):
    url = cfg.get('url') or cfg.get('serverUrl') or cfg.get('httpUrl')
    return url or ' '.join([cfg.get('command', '')] + [str(a) for a in cfg.get('args', [])])

def report(client, path):
    try:
        text = path.read_text()
        data = tomllib.loads(text) if path.suffix == '.toml' else json.loads(text)
    except (OSError, ValueError):
        return
    for name, cfg in servers(data):
        print(f'{client}\t{path}\t{name}\t{target(cfg)}')

for client, path in USER_FILES:
    report(client, path)
for root in sys.argv[1:]:
    for folder, dirs, _ in os.walk(root):
        dirs[:] = [d for d in dirs if d not in ('node_modules', '.git')]
        for name in PROJECT_FILES:
            if (Path(folder) / name).is_file():
                report('Project', Path(folder) / name)
```

Pass the folders where people keep code to include project configs, and collect the output through your device management tool:

Terminal

```
python3 mcp-inventory.py ~/code ~/src > mcp-servers.tsv
```

Arguments can hold secrets too

A server started with a token as a command-line argument prints that token. Treat the output as sensitive, and flag any server whose command line carries one: that token should move to an environment variable or, better, to OAuth.

Committed configs are visible from the other side as well. Search your GitHub organization for them:

Terminal

```
gh search code mcpServers --owner <org> --limit 100
gh search code servers --owner <org> --filename mcp.json
gh search code mcp_servers --owner <org> --filename config.toml
```

## Which MCP servers should be allowed?

Sort what you found into three groups:

1. 1Keep: remote servers run by the vendor of a system you already use (GitHub, Linear, Sentry, Notion), where each person signs in with their own account.
2. 2Keep, pinned: local servers that need the machine, such as browser automation or a filesystem server, at an exact version you have reviewed.
3. 3Replace: unknown packages, servers on plain http, personal forks of vendor servers, and anything holding a shared or admin token in a config file.

For each server you keep, decide who needs write tools. Read-only access covers most people most of the time; [how to make an MCP server read-only](https://mcp1.com/blog/read-only-mcp-server) shows how to enforce it at the credential rather than in the client.

## How do I enforce an MCP allowlist?

In Claude Code, with `allowedMcpServers` and `deniedMcpServers` in managed settings, deployed through MDM. Each entry matches one of `serverUrl` (with `*` wildcards), `serverCommand` (the exact command and arguments) or `serverName`:

Managed settings

```
{
  "allowedMcpServers": [
    { "serverUrl": "https://mcp.linear.app/*" },
    { "serverUrl": "https://mcp.sentry.dev/*" },
    { "serverCommand": ["npx", "-y", "@playwright/mcp@0.0.86"] }
  ],
  "deniedMcpServers": [
    { "serverUrl": "http://*" }
  ]
}
```

- The denylist always wins over the allowlist.
- An unset `allowedMcpServers` allows everything; an empty list allows nothing.
- `allowManagedMcpServersOnly: true` ignores allowlists in user and project settings.
- Don’t rely on `serverName`: anyone can name a server `github`. Match on URL or command.
- To push a fixed set of servers instead, deploy `managed-mcp.json` to `/Library/Application Support/ClaudeCode/` on macOS or `/etc/claude-code/` on Linux. With it in place, Claude Code loads only the servers it defines.

Other clients have their own controls. Cursor’s Enterprise plan has an MCP allowlist under Team Settings, MCP Configuration, matching by command or URL with optional tool lists. VS Code takes the `ChatAllowedMcpServers`, `ChatDeniedMcpServers` and `ChatMCP` policies through Group Policy, a macOS configuration profile or `/etc/vscode/policy.json`. Gemini CLI’s `mcp.allowed` and `mcp.excluded` settings live in files people can edit, so treat them as defaults, not enforcement. Where a client has no enforced control, the inventory is your control: run it on a schedule and follow up on what changes.

## Does an allowlist revoke access people already granted?

No. Blocking a server in the client stops the agent from calling it, but the OAuth grant the person approved still exists at the vendor, and a token in a config file still works anywhere. For every server you replace, revoke the grant in that service’s admin console and rotate any token you found on disk. The steps per service are in [how to revoke MCP access when someone leaves](https://mcp1.com/blog/mcp-offboarding).

## One approved URL instead of a list per client

An allowlist per client works, but you maintain it in every client and it still doesn’t tell you what agents did. MCP1 is a gateway that moves the list to one place. An admin installs the approved servers in the workspace once, with tokens MCP1 keeps encrypted, and grants gateways to groups with full or read-only access. Each client then needs a single entry, so the managed setting shrinks to:

Managed settings

```
{
  "allowedMcpServers": [{ "serverUrl": "https://mcp1.com/mcp/*" }],
  "allowManagedMcpServersOnly": true
}
```

Adding a server for a team becomes a change in the dashboard instead of a new MDM rollout, removing a person cuts off every client they approved, and the audit log records every tool call with the person, client and arguments. The [docs](https://mcp1.com/docs) cover gateways and groups, and the Individual plan is free to [start with](https://mcp1.com/signup).

## Common questions

### What is shadow MCP?

MCP servers that people add to AI clients like Claude Code, Cursor or VS Code without IT or security knowing. Each one is a path from an agent into a company system, often with its own token or OAuth grant.

### Can I block all MCP servers in Claude Code?

Yes. Set allowedMcpServers to an empty list in managed settings and Claude Code allows none. Leaving it unset allows everything.

### Are local MCP servers riskier than remote ones?

Usually. A local server runs as the person with their files and network, and an unpinned npx package can change under you. A vendor-hosted remote server with OAuth limits the agent to what that person can already do in the service.

### How often should I rerun an MCP inventory?

Often enough to catch new servers before they hold anything important. A monthly run through device management, plus a search of your repositories for committed configs, is a reasonable start.

Give your team one URL

Create a workspace, install your servers and share a gateway with a group. Free for individuals.

[Start with MCP1](https://mcp1.com/signup)[Read the docs](https://mcp1.com/docs)

## More from the blog

[ Terminal$ claude mcp add --transport http github api.githubcopilot.com/mcp/githubConnectedHow to connect GitHub MCP to Claude CodeRun claude mcp add with https://api.githubcopilot.com/mcp/ and a fine-grained token. Read-only mode, toolsets, permission rules and team setup.![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite](https://mcp1.com/blog/github-mcp-claude-code)[ SupportIntercomRead-onlyLinearRead-onlyNotionRead-onlyStripeRead-onlyMCP servers for support teams: what to connect firstStart with your helpdesk, Linear, Notion and Stripe, read-only first. What they answer together, which writes to hold back and a shared setup.![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite](https://mcp1.com/blog/mcp-servers-for-support-teams)

---

This is the markdown copy of https://mcp1.com/blog/shadow-mcp-servers. Site index for agents: https://mcp1.com/llms.txt
