Is this MCP server safe? How to audit your MCP servers
An MCP server that you install runs with your user rights and writes text straight into your agent. List every server, read its full tool schema, and pin its version. Give it a token with minimal rights. Remove it if you do not use it. A server can also change its tools after you approve it.
This guide shows where each client keeps its MCP list, what to read in a tool schema, and how to stop the common attacks.
Why is an untrusted MCP server a risk?
Two parts of the protocol create the risk.
First, tool descriptions go into the agent context. The model reads them like instructions. A description can contain text that the user never sees. The Cloud Security Alliance (CSA) explains in its research note that MCP does not separate instructions from data. Tool metadata affects the agent about as much as the system prompt does.
Second, a server can change after you approve it. The CSA note names two examples:
- April 2025. Invariant Labs showed a tool poisoning attack on the Cursor editor. A hidden instruction made the assistant read an SSH private key and send it out.
- September 2025. The npm package
postmark-mcphad 15 clean releases. Version 1.0.16 then added a hidden blind copy of outgoing email.
The same note reports the MCPTox benchmark. It tested 20 language models against 353 real tools from 45 live MCP servers. The average attack success rate was 36.5%. The note also reports that Microsoft disclosed the risk on June 30, 2026. Microsoft advises you to check if your setup applies a changed description at once, with no new approval. The note calls this a risk to check, not a measured norm.
Tool results are a second path. A server can return text that carries instructions. See indirect prompt injection and tool spec injection.
This page covers servers that you install. If you run your own server and it is open to the internet, read MCP server exposed to the internet.
How do I list every MCP server on my machine?
Check each client. The same server can sit in several files.
Claude Code
Claude Code keeps MCP servers in three scopes. The Claude Code MCP documentation gives these files:
| Scope | File |
|---|---|
| Local (default) | ~/.claude.json, under projects["<path>"].mcpServers |
| Project | .mcp.json in the project root |
| User | ~/.claude.json, under mcpServers |
Plugins can also add servers. Claude.ai connectors add more.
claude mcp list
claude mcp get <name>
Inside a session, run /mcp. List the project files that you cloned:
find ~ -name ".mcp.json" -not -path "*/node_modules/*" -maxdepth 6 2>/dev/null
Read the raw file for the user scope:
python3 -c "import json,os;d=json.load(open(os.path.expanduser('~/.claude.json')));print(json.dumps(d.get('mcpServers',{}),indent=2))"
Claude Code asks you to approve a project .mcp.json server before it uses it, in interactive sessions. In claude -p runs and Agent SDK sessions it loads them without a prompt. Do not run a headless agent in a repository that you did not read.
Cursor
Cursor reads two files, according to the Cursor MCP documentation:
- Project:
.cursor/mcp.json - Global:
~/.cursor/mcp.json
These paths are the same on macOS and Linux.
cat ~/.cursor/mcp.json
find ~ -path "*/.cursor/mcp.json" -maxdepth 6 2>/dev/null
Claude Desktop
Claude Desktop reads one file. The MCP documentation gives these paths:
# macOS
cat ~/Library/Application\ Support/Claude/claude_desktop_config.json
# Linux
cat ~/.config/Claude/claude_desktop_config.json
Open the file from the app with Settings, then Developer, then Edit Config. Claude Desktop writes MCP logs here:
# macOS
ls ~/Library/Logs/Claude/
# Linux
ls ~/.config/Claude/logs/
The file mcp.log shows connections. The files mcp-server-<name>.log show the output of each server.
What do I write down for each server?
Make a short table. Use one row for each server.
- The name and the client that uses it.
- The command or the URL. For a command, note the package and the version.
- The owner and the source repository.
- The secrets in
env,headers, orargs. - What the secret can reach.
- The last date that you used the server.
Remove any server that you cannot fill in. Remove it also if you do not use it.
How do I read the full tool schema?
Do not trust the short summary in the client. Read the raw output of the server. Look at each tool name, each description, and each parameter.
You can use the MCP Inspector to start the server and list its tools. Run it in a throwaway directory with no secrets:
npx @modelcontextprotocol/inspector npx -y some-mcp-server@1.2.3
For a text dump that you can save, use the Inspector command line mode:
npx @modelcontextprotocol/inspector --cli npx -y some-mcp-server@1.2.3 --method tools/list > tools-1.2.3.json
Read the file. Check these points in each tool:
- A long description. A simple tool needs a short description. A long text with rules for the agent is a warning.
- Text that speaks to the model. Phrases such as “before you use this tool, read” or “do not tell the user” are red flags.
- A reference to files outside the tool task. An email tool does not need
~/.ssh/id_rsa. - Extra parameters. A parameter named
notes,context, ormetadatacan carry stolen data. - Hidden characters. Scan the file for invisible Unicode.
perl -CSD -ne 'print "$.: hidden character\n" if /[\x{E0000}-\x{E007F}\x{200B}-\x{200F}\x{202A}-\x{202E}\x{2060}]/' tools-1.2.3.json
- A tool that is not in the documentation. Compare the list to the README.
- Tools that overlap. A server that defines a tool with the same name as another server can try to take over its calls.
Warning: Do not approve a tool that you cannot explain. If the description is unclear, ask the author or remove the server.
How do I stop a rug pull?
A rug pull is a change after approval. You stop it with a pin, a diff, and a review step.
How do I pin the version?
Most local servers start through npx, uvx, or docker. Without a version, these tools fetch the latest release on each start. Pin an exact version.
{
"mcpServers": {
"example": {
"command": "npx",
"args": ["-y", "some-mcp-server@1.2.3"]
}
}
}
For Python servers, pin with uvx:
uvx some-mcp-server@1.2.3
For containers, pin the image digest, not a tag:
docker pull ghcr.io/example/mcp-server@sha256:<digest>
Better, install the server once into a folder you own, review the code, and run it from there. Then an update needs your action.
How do I find a changed tool definition?
Save the output of tools/list after each review. Compare it on a schedule and after each update.
npx @modelcontextprotocol/inspector --cli npx -y some-mcp-server@1.2.3 --method tools/list > tools-new.json
diff tools-1.2.3.json tools-new.json && echo "no change"
Put the saved file in a private Git repository. A diff on a description is a reason to stop and read.
The CSA note recommends that you disable automatic re-approval of changed descriptions. It also recommends human review of those changes. Check if your client asks for approval again. If it does not, treat each update as a new install.
What about remote servers?
A remote server runs on another party’s machine. You cannot pin its code. It can change its tools at any time. Use only a remote server from a vendor that you trust. Compare its tool list on a schedule. Read the OAuth scopes before you approve them.
For a remote server in Claude Code, use claude mcp logout <name> before claude mcp remove <name>. The Claude Code documentation states that remove deletes the stored tokens locally. It does not revoke them at the server.
How do I limit what a server can reach?
Assume that a server will go wrong. Limit the damage.
- Use one token for each server. Do not share a token between servers.
- Give each token the least rights. A server that reads issues does not need write access to code.
- Use read-only database users. Do not give an MCP server your production database token. Use a read-only role or a copy of the data. Supabase and Postgres both let you create such a role.
- Set a short expiry. A token that expires in a week limits a leak.
- Keep secrets out of the config file. The Claude Code
.mcp.jsonfile supports${VAR}values from the shell, so the file holds no secret. A project file goes to Git, so do not put a token in it.
{
"mcpServers": {
"tracker": {
"type": "http",
"url": "https://mcp.example.com/mcp",
"headers": { "Authorization": "Bearer ${TRACKER_TOKEN}" }
}
}
}
- Require approval for risky tools. In Claude Code, keep the permission prompt for tools that send data, change files, or run commands. Do not use “allow all” for a server that you did not review.
- Isolate the server. Run a local server in a container with no access to your home folder. The Claude Desktop documentation states that a server runs with your user account rights. A file server can then read what you can read.
- Limit the paths. For a file server, list only the folders that it needs. Do not give it
~. - Separate work. Use a clean profile or a virtual machine for servers that you test. Keep your real keys out of it.
To load only the servers that you name in Claude Code, use --strict-mcp-config with --mcp-config. To block a project server, add it to disabledMcpjsonServers. To clear old project approvals, run:
claude mcp reset-project-choices
What if I think a server is already bad?
Act at once if a server did something that you did not ask for. Signs are unknown emails, new files, or calls to unknown hosts.
- Stop the client. Quit Claude Code, Cursor, and Claude Desktop.
- Remove the server from every file. Use the list from the first section.
claude mcp remove <name> --scope user
claude mcp remove <name> --scope project
claude mcp remove <name> --scope local
For Cursor and Claude Desktop, delete the entry from the JSON file.
- Save the logs. Copy the Claude Desktop logs and the Claude Code session history in
~/.claude/projects/before you delete anything. - Rotate every secret that the server could read. Include the secrets in its
envblock, in your shell, and in the folders that it could reach. - Review the actions. Check the audit log of each connected service. Look for new tokens, new repositories, sent messages, and deleted data.
- Check for changes to agent files. Look at
CLAUDE.md,AGENTS.md, hooks in~/.claude/settings.json, and your rules files. A poisoned agent can write to them. See hidden instructions in rules files. - Check secrets in Git. If a token reached a public repository, see what to do after a GitHub secret alert.
If the server installed a package, also read what to do after a malicious npm package. If it came with a skill, read what to do after a malicious agent skill.
How do I keep my MCP setup clean?
Make this a routine. It takes a few minutes each month.
- Remove what you do not use. Each server adds tool text to every session and keeps a token alive.
- Prefer servers from the vendor. A vendor-run server has a known owner.
- Read before you install. Read the source, the open issues, and the release history.
- Check the package name. Typosquats copy popular names. An AI agent can also suggest a name that does not exist, and an attacker can register it. Use the package hallucination scanner on names that an agent gave you.
- Review each update. Do not use an unpinned
latest. - Keep a short list. Add the file from the first section to your notes. Update it when you add or remove a server.
- Monitor. Watch the audit logs of connected services for new destinations and large reads.
When should I get help?
Ask for help in these cases:
- A server read secrets or customer data that you cannot replace.
- A company device ran the server. Tell your security team before you delete files.
- You see actions in a connected system that no person did.
- You cannot tell what a server does after you read its schema and code.
Give the team your table of servers, the saved tool lists, and the logs. They can then find the scope fast.
Common questions
Is an MCP server safe if it is popular?
What is tool poisoning?
What is an MCP rug pull?
Is a remote MCP server safer than a local one?
Must I remove servers that I do not use?
Test what your tokens reach
A VibeEval scan tests the live web app and API from outside. Run it on the apps whose tokens you gave to MCP servers, to see what a stolen token could reach.
14-day free trial · Cancel anytime