API Security4 min read

MCP server security: a practical testing checklist

MCP servers give AI agents access to your tools and data. The main risks, from token passthrough to over-broad scopes, and a checklist for testing them.

Your product team has built an MCP server so customers’ AI assistants can search tickets, create invoices or query reports. It works in the demo. The question nobody has asked yet: whose permissions is the agent using, and what stops it, or whoever is steering it, from going further?

An MCP server is an API with a new kind of client. Most of what makes it safe is familiar API and OAuth security. What changes is that the client is a language model acting on instructions that may not come from your user.

What an MCP server is

The Model Context Protocol (MCP) is an open protocol that lets AI applications connect to external tools and data. An MCP server exposes “tools” (actions such as create_ticket), “resources” (data the model can read) and prompts. An AI client, such as a desktop assistant, an IDE or an agent framework, discovers those tools and calls them on the user’s behalf. Remote MCP servers are protected with OAuth, so access tokens, scopes and consent all matter.

The protocol’s own Security Best Practices page (a draft revision at the time of writing) and the OWASP MCP Top 10, which is in beta, are the two best references. The checklist below draws on both.

Authorization: tokens issued to the server, not passed through

The most important rule in the MCP security guidance is short: MCP servers “MUST NOT accept any tokens that were not explicitly issued for the MCP server”.

The anti-pattern it forbids is token passthrough. A server accepts whatever token the client sends and forwards it unchanged to a downstream API. That breaks the audience check, a core OAuth boundary (see RFC 9068 for how the audience claim works in access tokens). A token meant for one service can be replayed against another, rate limits and audit logs keyed on the token stop meaning anything, and a stolen token turns your server into a proxy.

The fix is the same as for any API: validate issuer, audience and expiry on every request, and get a separate token for any downstream call. Our post on JWT mistakes in APIs covers the validation gaps that show up most often.

Many MCP servers are proxies in front of a third-party API, using one static OAuth client ID. The guidance describes a confused deputy attack: if the proxy lets clients register dynamically and doesn’t ask for its own consent, an attacker can register a client with their own redirect address and ride on a consent cookie the user granted earlier. The user never sees a consent screen, and the authorization code goes to the attacker.

The required protections are per-client consent stored server-side, a consent page that names the client, its scopes and its redirect address, exact redirect matching, and single-use OAuth state values set only after consent.

Scope minimisation and state handles

Broad scopes granted up front make every leaked token worse. The guidance recommends a small starting set of low-risk scopes, with step-up challenges when a privileged tool is first used. Wildcard scopes such as admin:*, or publishing every scope you have, are listed as common mistakes. OWASP’s MCP02, Privilege Escalation via Scope Creep, covers the same ground.

MCP itself has no protocol-level sessions, so servers that need state hand out a handle, such as a cart or workflow ID. The guidance is explicit that servers “MUST NOT treat possession of a state handle as authentication”. Bind handles to the authenticated user on the server, or you have an IDOR with a new name.

SSRF, local servers and tool poisoning

Three more risks are specific to how MCP is deployed:

  • SSRF during metadata discovery. OAuth discovery makes clients fetch URLs supplied by the server. A malicious server can point them at internal addresses or cloud metadata endpoints, so server-side clients need HTTPS-only fetching, private range blocking and redirect checks.
  • Local server compromise. A local MCP server is a program running with the user’s privileges. One-click installs must show the exact command and ask for consent. Local servers should prefer the stdio transport or require a token on HTTP.
  • Tool poisoning and prompt injection. OWASP lists Tool Poisoning (MCP03) and Prompt Injection via Contextual Payloads (MCP06). Tool descriptions and tool output go straight into the model’s context. A poisoned description, or a document containing hidden instructions, can steer the agent into calling other tools. The defence is to assume the model will sometimes be fooled and limit what any single tool can do.

A testing checklist

When we test an MCP server, the work looks like an API penetration test with extra attention on delegation:

  1. Token validation: are tokens for other audiences, expired tokens and tokens from other issuers rejected?
  2. No passthrough: does the server get its own tokens for downstream APIs?
  3. Consent and redirects: in proxy servers, is consent per client, and are redirect addresses matched exactly?
  4. Scopes: is the starting scope minimal, and do privileged tools trigger step-up?
  5. Object-level authorization: can user A’s agent reach user B’s records through any tool or state handle?
  6. Tool design: do destructive tools need confirmation, and is each tool limited to the least it needs?
  7. Injection paths: can content the agent reads (tickets, emails, documents) cause it to call tools the user didn’t ask for?
  8. Outbound fetches: does anything fetch URLs supplied by the client or a third party without restrictions?
  9. Logging: can you tell which client, user and tool made each change?

Shipping an MCP server? Request a scoping call and we’ll test it like the API it is.

One practical security note a week.

No spam. Unsubscribe any time.

Need a pentest for an audit, a customer, or peace of mind?

Tell us what you need tested. You’ll get a fixed-fee proposal with tester-days and timeline stated, usually within a few days of the scoping call.