To vet an MCP server before you connect it, confirm who publishes it, read the full text of every tool it exposes, pin an exact version, and run it with the least access its job needs: a sandbox for local servers and narrow OAuth scopes for remote ones. Then put it on an approved list and enforce that list in your AI clients. MCP server security comes down to treating each server as third-party code that runs on your systems and also writes text your model will trust.
The Model Context Protocol (MCP) lets assistants and coding agents such as Claude Code or Cursor call external tools through a standard interface. Adding one takes a single line of configuration, so review has to happen before that line is written.
What an MCP server can do once it's connected
An MCP server has two channels into your environment.
The first is code execution. A local server is a program your AI client starts, usually over the stdio transport, with the same operating system privileges as the client. The MCP project's security best practices name arbitrary code execution, data exfiltration and data loss as risks of local servers from untrusted sources, and recommend sandboxing them. On a developer laptop, that reach includes SSH keys and cloud credentials.
The second is text. Every tool name, description and result a server returns goes into the model's context. If that text contains instructions, the model may follow them: prompt injection delivered through your tool list. A remote server can't read your disk, but it can still steer an agent that also has email, database or shell tools.
The main MCP server risks
The OWASP GenAI Security Project's guide to securely using third-party MCP servers groups the attack patterns seen so far. These matter most when you choose a server:
| Risk | What happens | Main control |
|---|---|---|
| Tool poisoning | Hidden instructions in tool descriptions steer the model | Read the full tool manifest before approval |
| Rug pull | A trusted server is later replaced with a malicious version | Pin versions and hash tool descriptions |
| Malicious local code | The package or startup command runs harmful code on the host | Verify the source; run it in a container |
| Tool interference | Output from one server triggers a tool on another | Human approval for actions; separate contexts |
| Over-broad access | The server holds tokens or scopes far beyond its task | Least-privilege scopes, per-user credentials |
Each one exploits the trust a client places in what a server says about itself. The MCP specification says tool annotations such as readOnlyHint must be treated as untrusted unless they come from a trusted server. A tool that claims to be read-only proves nothing.
How to vet an MCP server before you connect it
Run this checklist for every new server, and again when its version or tool list changes.
- Confirm the publisher. Prefer servers from the vendor whose API they wrap, linked from its official documentation. Match the package name character by character, and apply the same tests you use to check AI-suggested packages before you install.
- Read every tool definition in full. Read the complete descriptions and parameter schemas the server returns, not the README. Flag text aimed at the model, such as instructions to read other files or hide something from the user, and descriptions that don't match the tool's name.
- Map what it can reach. Write down the files, networks, APIs and accounts it touches, and which tools can change data or send it outside.
- Read the code of local servers. Check the startup command and install scripts, then look for network calls, file access outside expected directories and dynamic code loading. No source available is a reason to decline.
- Check how remote servers authenticate. Look for OAuth with scopes you can narrow, or short-lived tokens tied to one user. A shared long-lived API key in a config file is a red flag.
- Decide where approval is needed. Choose which tools may run automatically and which need a person to confirm each call.
A server that fails step 1, 2 or 4 doesn't get connected. Steps 3, 5 and 6 decide how you configure the ones that pass.
Pin the version and watch for changes
The server you reviewed last month may not be the one running today. Many setups launch local servers with npx -y <package>, which fetches the current version at every launch. A compromised maintainer account then reaches every machine on the next restart.
Pin an exact version in the launch command or image tag, and update deliberately. The OWASP guide recommends hashing tool descriptions at approval and alerting administrators when they change. Remote servers can change tools at any time, so compare the approved tool list with what the server returns on a schedule. A new tool or edited description sends the server back through review.
Run local MCP servers in a sandbox
Run third-party local servers in a container or similar sandbox with no access to the home directory, SSH keys or cloud credential files. Mount only the directory the server needs, read-only where possible. Block outbound network access unless the job requires it, then allow only the hosts it should call.
Give each server its own minimal credential, so you can revoke it without breaking anything else.
Limit what remote MCP servers can access
For remote servers, access control lives in the tokens. Request the smallest set of OAuth scopes the task needs. The MCP security best practices list wildcard or omnibus scopes such as *, all or full-access among common mistakes, because a stolen broad-scope token opens unrelated tools and data.
Prefer servers that act with each user's own identity over servers holding one shared admin credential. Your existing permissions then still apply, and audit logs show who did what. The same rule runs through securing AI agents that use tools: an agent should never do more than the person it works for.
Keep an approved MCP server list and enforce it
A review only helps if people can't skip it. Keep a registry of approved servers with the pinned version, approved tools, granted scopes, owner and review date. The OWASP guide describes a workflow of submission, automated scanning, sign-off by a security reviewer and the domain owner, a probation period in staging, and periodic re-validation.
Then enforce the list in the clients your staff use. Claude Code, for example, supports managed allowlists and denylists for MCP servers deployed by an administrator:
{
"allowManagedMcpServersOnly": true,
"allowedMcpServers": [
{ "serverUrl": "https://mcp.example.com/*" },
{ "serverCommand": ["npx", "-y", "@example/mcp-server@1.4.2"] }
]
}The documentation flags two details. Without allowManagedMcpServersOnly, allowlists from every settings scope merge, so users can broaden the managed list from their own settings. And an entry that matches only by server name is not a security control, because anyone can assign any name. Match remote servers by URL and local servers by exact command. Check what your other AI clients offer, and track the ones with no such control in your shadow AI inventory.
Common MCP server security mistakes
- Approving a server from its README without listing its actual tools.
- Launching servers with an unpinned
npx -ycommand or alatestimage tag. - Running local servers on developer laptops with full home directory access.
- Granting every scope offered because the consent screen made it one click.
- Giving one agent a server that reads untrusted content, such as inbound email, alongside write tools.
- Auto-approving every tool call to stop the prompts.
If your agents already use several MCP servers, our LLM and AI agent security testing covers tool and function-call abuse and includes an agent and tool permission map.
Frequently asked questions
Are MCP servers from official registries safe to use?
A registry listing tells you where a server is published, not that it was reviewed for your use. Use the registry to find the vendor's official server, then run the same checks.
Is a remote MCP server safer than a local one?
A remote server removes the risk of code running on your machine. It doesn't remove tool poisoning, rug pulls or over-broad tokens, and your data now passes through a third party. Review the provider's data handling terms as you would for any SaaS vendor.
Can we let developers add MCP servers to their own coding tools?
Yes, with guardrails. Publish an approved list, enforce it through managed settings where the client supports them, and offer a fast route to request new servers. A slow approval process pushes people toward unmanaged tools.
Do automated MCP scanners replace a manual review?
No. Scanners, several of which the OWASP guide lists, can flag suspicious descriptions and known vulnerable packages. They can't judge whether a server's access fits your use case. Use them as one step in the review, and rerun them whenever a server changes.