What is MCP security?
How safe are MCP servers?
MCP isn’t inherently unsafe, but its safety depends on the server, the permissions it holds, and how it’s deployed. Two things raise the stakes. Anyone can publish an MCP server, and installing one usually gives it standing access to whatever credentials it’s configured with. And the AI model reads the server’s tool descriptions and follows them, which opens attack paths that traditional software doesn’t have.
- Tool poisoning: An attacker hides malicious instructions inside a tool’s description. The model reads and follows them, but the user rarely sees them in a normal review. The instructions might tell the model to send data somewhere it shouldn’t go.
- Rug pulls: A server behaves correctly when you approve it, then changes its tool definitions in a later update. The approval you gave no longer matches what the server does.
- Prompt injection through tool output: A tool retrieves a web page, document, or email that contains hidden instructions, and the model treats them as commands.
- Confused deputy attacks: The server uses its own broad authority to act for a user who was never allowed to do that. Passing a user’s token straight through to another service, known as token passthrough, is a common way this goes wrong.
- Over-permissioned credentials: Servers are often connected with far broader access than their tools need. One compromised tool can then reach much more than it should.
- Supply chain risk: Malicious or lookalike servers can impersonate popular integrations, and a trusted server’s dependencies can be tampered with. This is the same problem as malicious packages, applied to AI tooling.
- Implementation flaws: Servers written quickly can contain classic bugs, such as command injection, server-side request forgery, and path traversal.
- Exposed and shadow servers: Servers left reachable on a network without authentication, or set up by employees without IT knowing, are easy targets and easy to overlook.
Do MCP servers require authentication?
Not by default. The MCP specification makes authorization optional, so a server can run with no login at all. That’s fine for a tool running on your own laptop, but risky for anything reachable over a network.
- Local servers (stdio): These run on the same machine as the AI application, launched by it. They usually skip a login flow and read credentials from the environment, such as environment variables. The main risk is that whatever runs the server inherits those credentials.
- Remote servers (HTTP): These are reachable over a network, and the specification recommends OAuth 2.1 for them. The MCP server acts as a resource server that validates access tokens issued by a separate authorization server. Tokens should be short-lived, limited to specific scopes, and issued for that particular server rather than reusable elsewhere.
There are actually two authentication questions to answer:
2. What is the server allowed to do downstream? The server holds its own credentials for the services it connects to, and those need the same care.
- Running a network-reachable server with no authentication at all
- Sharing one long-lived API key across many agents or users, so nobody can tell who did what
- Accepting tokens that weren’t issued for the server and passing them along to other services
- Granting broad scopes “just to make it work”
What are the best practices for MCP servers?
Good MCP security comes down to verifying what you run, limiting what it can reach, and watching what it does.
- Prefer official or verified publishers, and check the source before connecting anything.
- Pin server versions and turn off automatic updates so a rug pull can’t slip in.
- Read the tool descriptions, not just the tool names.
- Keep an inventory of every MCP server in use, including ones employees added on their own.
- Apply least privilege. A server that reads tickets shouldn’t hold write access to your repositories.
- Use a separate credential for each server, so one compromise doesn’t spread.
- Keep tokens short-lived and scoped, and store secrets in a secrets manager rather than in configuration files.
- Require human approval for high-impact actions like deleting data, sending external messages, or moving money.
- Run it locally over stdio when only one user needs it, to avoid network exposure altogether.
- For remote servers, require TLS and OAuth, and never leave one open to the whole network without authentication.
- Bind the server only to the interfaces it needs, and run it in a container with minimal permissions.
- Validate every input the server accepts to block command injection and path traversal.
- Add rate limits, and segment the server from systems it doesn’t need to reach.
- Log every tool call, and alert when a tool’s definition changes from what you approved.
- Watch for unusual sequences, such as a tool reading a secret and another sending data out right after. Test regularly for exposed or forgotten servers.