MCP security testing for tools, tokens, and trust boundaries
MCP security testing evaluates the Model Context Protocol connection between an AI host, MCP clients, and external servers that expose tools, resources, and prompts. The highest-risk failures occur when tool metadata, trust delegation, token scope, server behavior, or tool output crosses a boundary the user did not authorize.
Inventory every MCP server and tool, identify the identity and token used for each call, test tool discovery and metadata as untrusted input, verify per-action authorization, constrain server egress and data access, and preserve the request trace and side effect for retesting.

What is MCP security testing?
MCP security testing is an authorized assessment of how a Model Context Protocol deployment discovers and invokes tools, retrieves resources, handles prompts, authenticates servers, and propagates identity. It covers the host application, MCP client, each connected server, and the external systems those servers can reach.
MCP standardizes access, but it does not make every tool or server trustworthy. A server can expose a dangerous tool, describe an action misleadingly, accept a token with excessive scope, return hostile output, or use its own credential to access data on behalf of a less privileged user.
The useful test connects protocol messages to application policy and real side effects. A model responding strangely is not enough. The reviewer needs evidence that a specified identity caused a tool invocation, resource read, external request, or state change outside the approved boundary.
This page is specifically about testing MCP implementations. AI agent security testing covers the broader agent runtime, while API security testing covers the APIs and data services that MCP servers may call.
Where are MCP trust boundaries?
The primary boundaries are between the user and host, host and model, model and client policy, client and MCP server, server and external resource, and tool output and model context. Each connection carries different identities and assumptions.
A local server may run with access to files, shell tools, environment variables, and the local network. A remote server may require OAuth, a service token, or no authentication at all. The host may expose every tool from every server to the model, or it may apply per-server and per-tool policy.
Record which component makes the authorization decision. If the model decides whether a tool is safe, the boundary is weak. If the host checks the user, server, tool, resource, and arguments before dispatch, the control can be inspected and tested.
Map data flow in both directions. Input can poison tool arguments or server state, while output can inject instructions into the agent context. Evidence should preserve both directions and the identity attached to each request.
| Boundary | Test question | Evidence required |
|---|---|---|
| Tool discovery | Can a server manipulate names, descriptions, schemas, or annotations? | Tool manifest, model context, selection, and arguments |
| Authorization | Does the host enforce user, tenant, server, tool, and action policy? | Identity, scope, policy decision, and request trace |
| Token handling | Are tokens scoped to the correct audience, resource, and user? | Issuer, audience, claims, exchange path, and target response |
| Server reach | Can the server access unintended files, networks, or cloud metadata? | Process context, outbound request, target response, and side effect |
| Tool output | Can returned content alter the agent’s policy or leak data? | Raw output, assembled context, model decision, and impact |
| Approvals | Can sensitive actions execute without deterministic review? | Proposed action, approval record, dispatch, and state change |
What MCP security risks should tests cover?
Test tool poisoning through names, descriptions, schemas, defaults, examples, annotations, and hidden instructions. A model may trust tool metadata as system-provided context even when the server is third party. Misleading metadata can steer tool selection or inject instructions before the tool is invoked.
Test confused-deputy behavior. A server may use its own broad credential for a user who should have narrower access, or the host may forward a token without checking the intended audience. Authorization must bind the active user, tenant, server, resource, and action.
Test token passthrough and exchange. OAuth tokens should be audience-bound, narrowly scoped, short-lived, and validated by the receiving service. A token issued for one MCP server should not be accepted by an unrelated API or reused after the user context changes.
Test server-side request forgery and local reach. A tool that accepts a URL, hostname, path, repository, query, or command may reach internal services, cloud metadata, local files, package registries, or the host network. Validate the destination and enforce network policy outside the model.
Test tool output as untrusted input. A server can return HTML, markdown, logs, documents, or structured fields containing instructions. The host should preserve provenance, bound content, and prevent returned text from overriding policy or silently expanding the next action.
- Malicious or compromised third-party MCP servers.
- Tool descriptions that contain hidden instructions or misleading effects.
- Tokens with excessive scope, audience, lifetime, or user privilege.
- Servers with local filesystem, shell, network, or credential access.
- SSRF paths into private networks or cloud metadata endpoints.
- Tool output that changes the agent goal or exposes protected data.
How do you test MCP tools and authorization safely?
Inventory every connected server, transport, tool, resource, prompt, credential, and external dependency. Record who owns the server and which user identities can reach it. Use a controlled environment with synthetic tools and test resources rather than granting a new server broad production access.
For each high-impact tool, capture the normal request and the intended policy. Change one variable at a time: caller role, tenant, tool name, argument, resource identifier, server, or token audience. Stop before destructive effects and use mocks for email, payment, code execution, and file deletion.
Test direct and indirect tool invocation. The host should enforce the same policy whether the model selects a tool, a prompt requests it, a resource contains instructions, or another agent delegates the action. Test the path that bypasses the normal user interface.
Validate approval behavior with an actual prohibited action. The reviewer should see the target server, tool, arguments, active identity, expected effect, and reason for approval. If the underlying server or tool changes after approval, invalidate or bind the approval to the reviewed request.
Check server shutdown and failure behavior. A malicious or unavailable server must not cause credential disclosure, automatic fallback to an untrusted server, prompt leakage, or an uncontrolled retry loop.
- 01Inventory
List hosts, clients, servers, transports, tools, resources, owners, and identities.
- 02Classify
Mark read-only, state-changing, privileged, sensitive, and network-reaching tools.
- 03Constrain
Apply per-server policy, token scope, allow lists, network rules, and sandboxing.
- 04Probe
Test metadata injection, role boundaries, token audience, SSRF, and output trust.
- 05Prove
Capture the protocol request, authorization result, target response, and side effect.
- 06Retest
Repeat the same server, tool, identity, and argument path after remediation.
What evidence should an MCP security finding preserve?
Preserve the user and agent identities, host version, server identity and version, transport, tool manifest, selected tool, arguments, token issuer and claims after redaction, authorization decision, raw server response, outbound request, and resulting side effect.
Evidence must show which trust boundary failed. If tool metadata caused the issue, retain the exact description or schema the model received. If token scope failed, retain the audience and resource decision. If SSRF was possible, retain the resolved destination and the response that proved reachability.
Separate a malicious server from a vulnerable host. A server may intentionally expose a dangerous tool; the security defect belongs to the host when it grants that tool more authority than the user approved. Document both ownership and expected policy.
Redact bearer tokens, credentials, sensitive tool output, and protected resource contents. The reviewer needs the claim structure, request path, and impact, not a reusable secret. Keep the protected artifact available for remediation and retest under controlled access.
How should teams monitor MCP deployments in production?
Monitor server and tool inventory drift, authorization denials, unusual argument patterns, token audience failures, outbound connection changes, approval bypass attempts, and unexpected tool-output volume. Alert on a new server or tool becoming available as well as on a known tool being invoked against a new resource.
Keep an owner and trust tier for every MCP server. Re-review third-party servers when their manifest, package, endpoint, certificate, OAuth metadata, or maintainer changes. Pin or verify the server version where the deployment supports it, and remove unused servers rather than leaving dormant authority connected to the agent.
Review logs without capturing reusable secrets. The audit record should show who requested the action, which agent and server handled it, which tool and resource were selected, whether policy allowed it, and what external request or state change followed. These fields support incident response as well as retesting.
- New or changed server and tool manifests.
- Denied calls, unusual resources, and repeated approval attempts.
- Unexpected egress or access to local and cloud metadata endpoints.
- Expired, over-scoped, or wrong-audience tokens.
- Tool output that crosses normal size, type, or data boundaries.
What makes MCP security testing credible?
Credible MCP testing inventories every server and tool, binds each action to a concrete identity and token scope, proves the authorization decision, and preserves the request trace and side effect. It does not treat a suspicious tool description or unusual model response as a confirmed vulnerability.
Retest after adding a server, changing a manifest, rotating credentials, expanding token scopes, updating the host, modifying network policy, or changing approval rules. MCP ecosystems change through configuration as often as application code.
Prefer deny-by-default tool exposure. Give each server the minimum network and data reach it needs, label third-party metadata, and keep sensitive actions behind deterministic policy and review.
ARTEX can retain authorized tool activity, traffic, findings, and approvals in one task record. Use that evidence to test MCP connections before granting an agent access to production resources or privileged tools.
Frequently asked questions
What is MCP security testing?
It is the authorized testing of Model Context Protocol hosts, clients, servers, tools, resources, tokens, and data boundaries for unauthorized access, unsafe actions, and trust failures.
What is MCP tool poisoning?
Tool poisoning changes tool names, descriptions, schemas, defaults, examples, or annotations so the model selects the tool or follows instructions that do not match the user’s intent.
What is a confused deputy in MCP?
It occurs when an MCP server or host uses its own broader credential on behalf of a less privileged user, allowing the user to reach resources outside their authority.
Should every MCP tool require human approval?
No. Apply risk-based policy. Read-only discovery may proceed automatically, while destructive, privileged, financial, privacy-sensitive, or network-reaching actions should require approval.
How should an MCP finding be retested?
Repeat the same host, server, tool, identity, token scope, arguments, and resource after remediation, then compare the authorization result, request trace, and side effect.
References and review notes
Start with source. Test with authorization.
Review the public ARTEX repository, run it in an owned lab, and keep human approval on actions that can change a target.
ARTEX