MCP security: what your MCP server exposes, and how to check it

An MCP server gives AI agents a list of tools they can call. Over HTTP it is an API like any other, and the specification makes authorization optional, so a server answers anyone unless you add the check. MCP security comes down to three questions: who can connect, which tools an anonymous caller sees, and what each tool can do with whose permissions. You can answer the first two with two requests to your own server.

The team behind Keybrum's attacksUpdated 10 min read

In short

  • The MCP specification states that authorization is optional. A remote MCP server with no token check lists and runs its tools for anyone who finds the address.
  • The specification's security guide names the main attacks: confused deputy, token passthrough, server-side request forgery, state handle hijacking and local server compromise.
  • For tools, the specification says servers must validate inputs, implement access controls, rate limit calls and sanitize outputs, and that a human should be able to deny a tool call.
  • Authenticating the caller is half the work. Each tool must also check what that caller may see, exactly as your REST API does.
  • OWASP runs a Top 10 for MCP project, in beta, that adds tool poisoning, shadow MCP servers and secret exposure to the list.
On this page

What an MCP server is, and what it exposes

The Model Context Protocol (MCP) is an open protocol that lets an AI application call outside tools in a standard way. An MCP server publishes a list of tools, each with a name, a description and the arguments it takes. An MCP client, such as Claude Code, Cursor or a chat app, reads that list and lets the model call the tools. The messages are JSON-RPC: tools/list to discover, tools/call to run.

There are two ways to run one. A local server is a program on your machine that the client starts and talks to over standard input and output. A remote server listens over HTTP at an address, often /mcp on a domain. The second kind is the subject of most of this page, because a remote MCP server is a public API, with one difference: its documentation is built in. Anyone who can connect can ask it what it does.

What is exposedWhat a caller learns or getsWhy it matters
The tool listEvery tool name, description and argumentA map of your internal operations, handed out on request
Read toolsWhatever the tool returns: customers, orders, files, logsA data leak if the tool does not check who asks
Write toolsCreate, update, delete, send, payActions taken in your system by someone who is not a user
Tool descriptions and resultsText that a model will readA path for prompt injection into the agent that connects
Tokens the server holdsAccess to the third-party APIs behind the toolsThe server acts with its own rights, which may exceed the caller's

When an app built with AI tools ships an MCP endpoint, it is usually because an assistant offered to add one or because customers asked for agent access. It can be written in an afternoon, and it may never get the review the REST API had.

The risks named in the MCP specification

The protocol's own documents are frank about the risks. Two facts from the specification frame everything else. First, on authorization, the text reads: "Authorization is OPTIONAL for MCP implementations." A server that implements none is valid MCP. Second, on tools, it sets duties for both sides:

For trust & safety and security, there SHOULD always be a human in the loop with the ability to deny tool invocations.
Tools, Model Context Protocol specification

The same page says servers must validate all tool inputs, implement proper access controls, rate limit tool invocations and sanitize tool outputs. The separate Security Best Practices page then describes specific attacks. Here are the ones that concern a server operator, in plain words. We read the revision dated 2026-07-28.

AttackWhat goes wrongWhat the specification requires
Confused deputyAn MCP server that proxies a third-party API with one static OAuth client id can be tricked into handing an attacker an authorization code, because the user's earlier consent is reusedProxy servers must obtain consent per client before forwarding, and match redirect addresses exactly
Token passthroughThe server accepts a token that was issued for another service and forwards it downstreamServers must not accept any token that was not issued for the MCP server itself
Server-side request forgeryA malicious server feeds a client addresses that point to internal services or cloud metadata during OAuth discoveryClients should require HTTPS and block private address ranges
State handle hijackingA tool takes an id for stored state, such as a cart or a workflow, and does not check that it belongs to the callerServers must not treat possession of a handle as authentication, and should bind handles to the user
Local server compromiseA local server is installed from an untrusted source, or started with a command the user never readClients must show the exact command and ask for consent. Local servers should use stdio or require a token
Scope minimizationOne broad token opens every tool, so a stolen token opens everythingStart with minimal scopes and raise them only when a privileged tool is first used
Summarised from the Security Best Practices page of the MCP specification. The page also covers OAuth URL validation, mix-up attacks and localhost redirect impersonation.

What OWASP adds: the MCP Top 10

OWASP runs a separate project, the OWASP MCP Top 10. It is in beta, so the list may still change. Where the specification focuses on the authorization flow, OWASP's list covers the whole life of an MCP deployment, including what the model reads.

  • MCP01 Token Mismanagement and Secret Exposure. Long-lived tokens and keys in configuration files, logs or the model's context.
  • MCP02 Privilege Escalation via Scope Creep. Permissions that grow over time until the server can do far more than its tools need.
  • MCP03 Tool Poisoning. A tool's description or output carries instructions for the model that reads it.
  • MCP04 Software Supply Chain Attacks and Dependency Tampering. A server or one of its packages is malicious or compromised.
  • MCP05 Command Injection and Execution. Tool arguments reach a shell, a query or an interpreter.
  • MCP06 Prompt Injection via Contextual Payloads. Data returned by a tool steers the agent.
  • MCP07 Insufficient Authentication and Authorization. The subject of the self-check below.
  • MCP08 Lack of Audit and Telemetry. Nobody can say which agent called which tool, and when.
  • MCP09 Shadow MCP Servers. Servers set up without anyone in charge knowing they exist.
  • MCP10 Context Injection and Over-Sharing. One user's or one task's context leaks into another.

Entries 3 and 6 are prompt injection arriving through a tool. They concern you twice: as the operator of a server, since your tool results are text a model will trust, and as a user of other people's servers in your coding agent.

How to check your own MCP server

Three checks cover the questions that matter most. The first two take a minute and need only curl. Run them against a server you own, from a machine that has no credentials for it.

  1. 1

    Does it answer with no credentials?

    Send the first request below with no Authorization header. A protected server answers 401 Unauthorized. A JSON result means the server talks to anyone. Servers built for the 2026-07-28 revision may skip the initialize step: go straight to the second request.

  2. 2

    Which tools does an anonymous caller see?

    Send tools/list, again with no credentials. Read every name that comes back. A public documentation search tool is fine. list_users, export_orders or delete_project in an anonymous list is a finding, even before you call anything.

  3. 3

    What can each tool do, and for whom?

    Sign in as a fresh test account that owns nothing. Call each read tool. Any record that comes back belongs to someone else. Then open the code of each tool and find the line that filters by the caller's account. If there is none, the tool trusts whoever connects.

bash
# Against YOUR OWN server, with no Authorization header.
# 1. Will it talk to a stranger?
curl -s -i -X POST https://your-app.example/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"self-check","version":"1"}}}'

# 2. Which tools does it list to a stranger?
curl -s -X POST https://your-app.example/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
If the first answer carries an mcp-session-id header, repeat it as a header on the second request. Also try /api/mcp if that is where your framework put the route.

The fix: treat MCP like your REST API

The typical mistake is easy to make: the REST routes go through an authentication middleware, and the MCP route was added beside it. The fix is to give the MCP route the same two layers.

ts
// Bad: the tool trusts whoever connected
server.tool("list_invoices", async () => db.invoices.findMany());

// Better: identity from the verified token, data scoped to it
server.tool("list_invoices", async (_args, ctx) => {
  const user = await verifyAccessToken(ctx.authorizationHeader); // 401 when missing or invalid
  return db.invoices.findMany({ where: { accountId: user.accountId } });
});
A sketch, not a specific SDK's API. The point is the two lines: verify the token on every call, then filter by the account it belongs to.
  • Every HTTP request to the server carries a token, and a missing or invalid one gets a 401
  • Tokens are issued for this server and checked for it. A token for another service is refused
  • Each tool filters by the caller's account in its own code, including tools that take an id
  • Write and delete tools need a higher scope than read tools
  • Tool arguments are validated, and never reach a shell or a raw query
  • Calls are rate limited per caller and logged with the tool name and the caller
  • Tool results carry only the fields the task needs: no tokens, no other users' data
  • A local server uses stdio, or requires a token if it listens on a port

What Keybrum tests on MCP, and what it does not

Keybrum is the automated pentest we build for apps made with AI tools. Its MCP attack looks for a server next to the app you verified: /mcp on the app's address and on its API hosts under the same site, /api/mcp, and any address named in /.well-known/mcp.json. It sends the initialize request with no credentials. If the server answers, Keybrum lists the tools and calls each one once with placeholder arguments that match no real record.

  • As a stranger. A finding is reported when a tool returns application data with no credentials, or when a tool whose name suggests a change (create, update, delete, send, pay) accepts the call. If the list only shows privileged-looking names, the report notes it without claiming a leak.
  • As a fresh account. When the run has signed-in test accounts, it calls the tools as an ordinary new user. That account owns nothing, so records with other people's emails or owner fields are someone else's data. This is the check that separates "authenticated" from "authorized".
  • With proof. Each finding carries the exact requests, ready to replay, with personal data redacted.

What it does not test: the OAuth attacks of the specification (confused deputy, token passthrough, audience validation), tool poisoning and injection through tool results, local stdio servers on your machine, and MCP servers hosted on another domain or an unusual path. A server that does not answer the initialize handshake is not examined either. For those, use the specification's security guide as a review list. Keybrum also offers its own MCP server, through which a coding agent reads findings and fixes.

A one-time report costs €49 for one app, with retests for 7 days. Plans start at €29 a month excluding VAT and attack again on every deploy, which is when a new tool tends to appear without its check. Keybrum only attacks apps whose owner proved ownership. The same run covers AI routes that answer anyone.

Questions

Is MCP safe to use?

MCP is a protocol, and it can be deployed safely or not. The specification makes authorization optional and leaves access control to each server. A remote server with no token check, or with tools that do not filter by caller, leaks like any unprotected API.

Does an MCP server need authentication?

A local server started by your client over stdio does not use the HTTP authorization flow. Any server reachable over HTTP should require a token unless everything it offers is public by design. The specification defines an OAuth 2.1 based flow for this and says servers must validate that tokens were issued for them.

What are the main MCP vulnerabilities?

On the server side: missing authentication, tools that return other users' data, tool arguments that reach a shell or query, and broad tokens. On the client side: malicious or compromised servers, and tool descriptions or results that carry instructions for the model. The MCP specification and the OWASP MCP Top 10 list them in detail.

What is tool poisoning in MCP?

It is prompt injection placed in a tool's description or output. The model reads that text as part of its context and may follow it. The specification tells clients to treat tool annotations as untrusted unless they come from a trusted server.

How do I check if my MCP server is exposed?

From a machine with no credentials, send it an initialize request and a tools/list request. A 401 means the door is closed. A list of tools means anyone can read it, and you should then check each tool with a fresh test account.

Is it safe to install MCP servers in Cursor or Claude Code?

Treat each one as a program that runs with your permissions and talks to your agent. Read the install command, prefer servers with public source and a known author, and give them narrow tokens. The specification requires clients to show the exact command before a one-click install.

Sources

  1. 1.Security Best Practices, Model Context Protocol
  2. 2.Authorization, Model Context Protocol
  3. 3.Tools, Model Context Protocol
  4. 4.OWASP MCP Top 10, OWASP Foundation
  5. 5.OWASP Top 10 for Agentic Applications for 2026, OWASP GenAI Security Project

Your app is public. So are its mistakes.

Check what any attacker can already see in it, free, in ten seconds. The full attack, with proof and fixes: €49 once, or €29 a month on a plan.

or continue with Google or GitHub