Insight
November 6, 2026
How to Penetration Test an MCP Server
An MCP server pentest tests behavior: what the tools can reach, what changed since approval, and what agents do with the answers.
How to Penetration Test an MCP Server
Most MCP security reviews I have seen read the config file, check the server against a hardening list, and write up the result. That is an audit of what the server declares. Nobody attacks a declaration.
An MCP server is two surfaces wearing one name. It is an instruction source: every tool description it publishes lands in your agent's context window and gets read as orders. And it is an action surface: tools that read files, query databases, call APIs, and run commands under whatever credentials the host handed it. A penetration test interrogates both surfaces. A config review inspects neither.
Start with the inventory nobody has
OX Security counted 15,465 MCP servers in its 2026 benchmark report. Ask a security team to list the servers their agents connect to and you will get a shorter number, and it will be wrong. Servers arrive through developer workstations, vendor bundles, and one-off installs nobody ticketed. The first deliverable of the test is the inventory itself: every server, every tool, every description, every credential each connection carries, hashed and versioned.
The count is the wrong unit of measure anyway. What matters is trust granted per server. A read-only documentation server and a server holding a database write tool are both "one MCP server" in the inventory spreadsheet. They are not the same risk, and a test plan that treats them as the same line item has already missed the point. Rank the inventory by what each server can make your agents do, then test in that order.
Fingerprint it like an attacker
Recon on an MCP server is protocol-native. Enumerate what it advertises: the tool list, the resource list, the prompt templates, the schemas, the error behavior when you hand it arguments it does not expect. Error messages are a fingerprint. So are the defaults: which tools are enabled out of the box, which parameters are optional, what the server assumes about the host calling it.
I built a deliberately vulnerable MCP server once, as a false-negative oracle for my own scanner: a server guaranteed to be findable, so I could prove the scanner missed nothing. Then I pointed the same service at the internet and watched what arrived. Real attackers fingerprint these servers methodically. They enumerate first and exploit second, and they keep notes. Your test should produce the same map theirs does, before theirs matters.
Test the descriptions
Every description on the server is a test case. Read each one the way the agent will: as instructions from a trusted source. If this description told the agent to do something the operator never intended, would the agent comply? Would it comply if the instruction arrived inside a parameter description instead of the tool description, where reviewers rarely look?
This is the tool poisoning class, and it gets its own treatment in MCP Tool Poisoning. The server-level point is narrower: the pentest tests instruction-following against this server's actual descriptions, with this client's actual agent on the other end. Generic payloads against a generic model tell you about the model. Planted instructions in the real descriptions tell you about your deployment.
Test what the tools can reach
Then the action surface. For each tool, three questions. What can it reach: which files, which records, which internal systems sit behind this one call? Under whose credentials: does the server act as itself, as the host application, or as the user, and can a downstream system tell the difference? And what happens on hostile input: arguments shaped to escape the tool's intended job, reach a shell, a query, or a path the developer never meant to expose.
That middle question is the confused deputy problem wearing new clothes. The server asks, the host complies, the audit log blames the user. Agents reinvent this weekly because the protocol makes the easy path the trusting path.
Tool output gets the same suspicion in the other direction. Output is untrusted input to the agent, and a server that can be made to return attacker-shaped output has a channel straight into the agent's reasoning. That data-path problem is the subject of Indirect Prompt Injection Testing. On a server pentest it is one test track among several, and it is the one config reviews never run at all.
Test the drift
Here is the part of the engagement almost nobody sells, and it is the part that decides whether the rest of the report still means anything in a month.
A rug pull is a server-side change after trust was granted. The description changes. The schema changes. The behavior changes. The agent keeps trusting all of it, because nothing in the connection re-validates what was approved. You pentested the server as it existed on a Tuesday. By the following Tuesday it can be a different server wearing the same name.
So the test includes the drift controls, and it tests them like controls, not like paperwork. Are descriptions hashed and pinned at approval time? Does anything diff the live server against the approved baseline, and does a human see the diff? Does an unreviewed change get treated as a new server, with new trust to earn, or does it inherit the old approval by default?
Credit where it is due: pinning, hashing, and registry hygiene have a real job. They catch the dumb changes before the dumb changes cost you. Run them. But a control that nobody tests is a hope, and the pentest is where the hope gets verified. The registry scanner tells you the description matches a pattern. The drift test tells you it matches what you approved.
Chain across servers
Agents rarely connect to one server. They connect to five, ten, twenty, and the composition is the attack surface. One server's output becomes the context in which the agent calls the next server's tools. A poisoned result from a low-trust server can steer a call into a high-trust one, and the high-trust server executes faithfully, because from its side the request looks legitimate.
Test the servers in isolation and you will miss this entire shape. Test them composed, through the agent your people actually run, and the chains surface. This is the same lesson as the agent-level methodology in How to Penetration Test an AI Agent: a finding in one component is a vulnerability, a path across components is the pentest.
Rules of engagement are engineering controls
MCP servers take real actions, so the test needs real guardrails, enforced in code. Depth gating: the plan declares how far a chain may run before it stops for a human. Pacing: rate limits so a test loop cannot hammer a production API or burn a budget. A single audited chokepoint for privileged actions, so nothing irreversible happens during the test without a person in a defined seat. A guardrail written as a prompt instruction to the agent is a request. Write it in code or do not claim it.
How I would know I am wrong
Here is the falsification turn, because a methodology without one is a sales pitch. This approach is wrong if the ecosystem converges on signed, pinned, permission-scoped tool manifests that hosts actually enforce: descriptions that cannot change without re-approval, tools that cannot exceed declared scopes, identity that survives the trip from user to agent to server. If that world arrives, MCP server testing collapses into manifest review, and I will say so.
That world has not arrived. What has arrived is a gold rush of servers with README-grade security, agents that trust all of them, and review processes that read the config and stop. Until the manifests are real and enforced, test the server.
The checklist version
For the buyer reading this before an engagement, demand five things:
- A trust inventory before testing starts: every server, tool, description, and credential, hashed and versioned. No inventory, no engagement.
- Description testing against your actual agent, not generic payloads against a generic model.
- Reach testing per tool: what it can touch, under whose credentials, and what hostile arguments do to it.
- A drift baseline and a diff process, so the report still means something after the server changes.
- Findings reported as chains through the agent, and written rules of engagement with pacing and a privileged-action gate.
If the deliverable is a config checklist with a logo on it, you bought an audit. Price it like one.
This test method, run as an engagement, is our MCP Security Assessment.
Your agents already trust these servers. The only question a pentest answers is whether they should.
FAQ
What does penetration testing an MCP server involve?
Interrogating the server the way an attacker would. Enumerate everything it advertises: tools, resources, prompts, schemas. Audit the descriptions as instructions, because that is how the agent reads them. Test what the tools can reach and what their output does to the agent. Then test drift: whether the server running today still matches the server you approved.
How is an MCP server pentest different from a config review?
A config review reads the server's declared settings. A pentest tests behavior: what the tools actually do with hostile arguments, what the descriptions make an agent do, and how the server composes with the other servers the same agent trusts. The findings live in behavior. Config is where the review starts.
What is an MCP rug pull and how do you test for it?
A rug pull is a server-side change after trust was granted: a tool description, schema, or behavior changes, and the agent keeps trusting it because nothing re-validates what it approved. Test for it by hashing and versioning every description at approval time, diffing on a schedule, and treating any unreviewed change as a new, untrusted server.
Can an MCP scanner replace a pentest?
No. Scanners and registry checks have a real job: config hygiene, known-bad patterns, and regression after a human has mapped the trust surface. They assess servers one at a time, against known classes. A pentest tests composition, drift, and the chains that run through your agent from one server into another.
What should an MCP server pentest deliver?
A trust inventory (every server, tool, description, and credential in scope, hashed and versioned), findings reported as chains that run through the agent, a drift baseline you can diff against later, and written rules of engagement covering pacing and the privileged-action gate.