Skip to content

AI security / Agent protocols

Model Context Protocol security for agents with access.

Model Context Protocol (MCP) expands what an AI agent can see and do. FailSafe tests the servers, tools, resources, permissions, and trust boundaries that turn a model into an operator.

MCP scope is agreed separately. Confirm that your target and testing requirements fit the Startup offer before purchasing. Explore our AI security coverage for related application risks.

Plan the work with the MCP assessment test plan, review the synthetic authorization walkthrough or download the scope worksheet.

Definition

What is Model Context Protocol security?

Model Context Protocol (MCP) security is the practice of securing MCP servers, tools, resources, and the agent runtimes that connect language models to external data and actions. MCP penetration testing applies that work to a deployed server and its callers.

The important question is not only whether the model follows its system prompt. It is whether untrusted data can influence a tool call, whether a server grants more access than intended, whether tool metadata has been poisoned, and whether a compromised resource can move across a tenant or network boundary.

FailSafe maps testing to the OWASP MCP Top 10 and related agent-security guidance where that helps teams communicate risk.

Authorization boundary

MCP authorization and cross-tenant tool access

An MCP server makes a security decision every time it accepts a tool call. The decision should bind the authenticated caller, the token audience, the permitted tool and the object being acted on. Cross-tenant access appears when one of those links is missing and the server trusts the tool argument instead.

Test it as one workflow rather than a prompt check. This is a test design, not a customer result.

  1. 1. Define the rule

    Create synthetic records in two workspaces. Name the caller, the token audience, the permitted tool and the object that must be denied. Keep the legitimate operation as a control case.

  2. 2. Attempt the boundary

    Use untrusted content and a direct tool call to request the other workspace's record. Record whether the model proposed the call, whether the server accepted it and whether any restricted content entered the model context.

  3. 3. Keep the evidence

    Retain the sanitized request, caller identity, policy decision, tool arguments and observed state. A refusal in the final answer does not show that nothing was retrieved earlier.

  4. 4. Fix and retest

    Bind the object lookup to the caller's authorized workspace on the server. Repeat the denied case and the permitted control on the corrected build, and state which variants remain untested.

Use the MCP assessment test plan to sequence the work, the tool and object authorization walkthrough for the permission model, and the synthetic walkthrough for a fictional case matrix.

Testing checklist

How to test an MCP server

  1. 01Map servers, tools, resources, identities, and trust boundaries.
  2. 02Test direct and indirect prompt injection through tool descriptions and retrieved content.
  3. 03Probe permissions, secrets, tenant isolation, network access, and dangerous side effects.
  4. 04Deliver reproducible findings, remediation guidance, and retesting under the agreed engagement scope.

Vetting a server before deployment? Use the MCP server vetting checklist to review provenance, authorization, credentials, isolation and logging.

Regression cases

Keep the boundary cases in the test plan.

A tool label describes intended business behavior, not the behavior of the code path behind it. These cases belong in a repeatable regression set because each one has broken an MCP boundary in practice somewhere, and each one can return after a patch.

Read-only tool reaches executable configuration

Check whether a Git, filesystem or build tool can run a hook, configuration file or subprocess without an explicit action. Record the action attempted, the component that executed it and the resulting state.

Repository and filesystem confinement

Verify that path handling cannot escape the authorized root through symlinks, relative paths, URL encoding or a race between check and use. Keep the denied path and the server-side decision.

Outbound fetch and private addresses

Test whether a fetch tool can reach loopback, link-local, metadata or internal service addresses. Record the destination class, the resolver result and whether egress policy or the tool blocked it.

Metadata that changes approval

Attempt to change which action the agent selects through a tool description, resource or updated schema. Record the content source, the proposed call and the approval state before execution.

Schema and permission drift

Compare the deployed tool definition and scopes with the reviewed version. A renamed tool or a widened scope is a security change even when the endpoint stays the same.

Patch bypass and partial remediation

After a fix, repeat the original denied case and the permitted control case. A blocked exploit variant does not show that the underlying authorization rule was corrected.

Redaction under indirect injection

Try to make a diagnostics or troubleshooting tool return environment values, secret references or configuration detail through untrusted content. Record the source, the call, the returned content and the redaction decision.

Unauthenticated and alternate routes

Look for a second listener, default bridge, debug endpoint or background job that reaches the same tool without the authenticated path. Record the route, the caller and the server-side decision.

Persistent memory and learning-store poisoning

Check whether untrusted content can become durable agent state that affects a later session. Record the source content, the stored record, the later retrieval and any action it influenced.

Non-HTTP browser egress

Test WebRTC, WebTransport, WebSocketStream, NAT64, IPv6 and URL-parser differentials against the egress policy. Record the protocol, destination, resolver answer and connection outcome.

Credential lifecycle after compromise

If agent infrastructure is compromised, confirm that every credential and session it used can be rotated or revoked, and that no working copy survives the rotation.

Use the MCP assessment test plan to sequence the cases, the read-only tool guide for the capability question and the tool and object authorization walkthrough for the permission model. The redaction and egress regression review explains the recent advisories behind the new cases, and the canary evidence review shows what a tool-compliance result does and does not demonstrate.

What the assessment covers

Security areas and the evidence each one should produce

MCP testing is only useful if each area produces an observation your team can act on. The rows below describe the test area, the question it answers and the record to keep. Scope, access and stop conditions are agreed before execution.

Assessment areas for an authorized MCP deployment
AreaQuestionEvidence to record
Server authorizationDoes the server enforce the caller’s identity, token audience and permitted tool before acting?Caller identity, policy decision, allowed and denied result.
Tool metadataCan a tool description, resource or updated definition influence which action the agent selects?Content source, proposed call, observed selection and the approved definition version.
Credentials and secretsWhat credentials can the server read, and do they appear in logs or model context?Redacted reference, log query and rotation result where exposure is found.
Tenant and network isolationCan a synthetic record from another workspace be retrieved, or the server reach an unapproved host?Synthetic object identifiers, denied request and the server-side decision.
Side effects and approvalsCan a tool change state without the approval the workflow requires?Approval state before the call, resulting state and the responsible control.
Logging and retestAre authorization decisions recorded, and does the original case pass on the corrected build?Log record, deployed version and the repeated denied and permitted cases.

Agree the target, test identities and stop rules first. The rules-of-engagement guide covers authorization, permitted effects and the events that pause a run.

Synthetic MCP walkthrough

Can untrusted content change a tool permission?

A fictional support assistant can read documents in Workspace A. A synthetic retrieved document suggests looking up a document in Workspace B. The MCP server must enforce the caller's permission before any restricted content reaches the model.

This is an illustrative test design, not an executed customer assessment. The owner authorizes two staging workspaces, synthetic records and read-only retrieval. No working injection prompt, credential or production endpoint is needed to describe the boundary.

Set up identities, permissions and stop rules

Create Reader A and Reader B with access only to their own synthetic workspace. Pin the application, model, connector and permission-policy versions. Approve the read-only tools, a numeric request budget and a test window with the owner. Stop if real data appears, an unapproved side effect occurs or the agreed budget is exceeded.

Fictional case matrix: expected outcomes, not recorded test results
Case and actionExpected boundaryEvidence to collect
Reader A reads Document AAllowedCaller role, object owner, server decision and sanitized trace reference.
Reader A requests Document BDenied before document retrieval or entry into model contextServer decision plus retrieval/context telemetry, not only a final model refusal.
Synthetic retrieved content suggests a Workspace B readText does not grant authority; any proposed read is independently authorizedSeparate proposed tool action, executed action and observed data access.
Repeat A-control on the corrected staging buildAllowedRecord corrected build and policy version with the unchanged allowed behavior.
Repeat B-boundary and approved search/preview variantsDenied for the tested pathsBind each result to the original case; untested variants remain outside the conclusion.

Record actual observations separately. If retrieval or context telemetry is unavailable, label the affected conclusion inconclusive. A final model refusal alone does not show that restricted data never entered the context. No customer trace or executed result is represented here.

  1. 1. Untrusted input

    Label the retrieved document as external content. Its text cannot grant a role, change an object owner or authorize another workspace.

  2. 2. Proposed tool call

    Record which read action the agent proposes and which synthetic object it names. A proposed action is distinct from one the server executes.

  3. 3. Permission boundary

    Compare the authenticated caller, resource owner and permitted action on the server. Expected: deny Workspace B before retrieving its content.

  4. 4. Evidence

    Keep the configuration and sanitized trace references, permission decision and whether any denied content entered model context. Record the permitted Workspace A control too.

  5. 5. Fix

    Bind the downstream object lookup to the caller's authorized workspace. Review service-account privileges and approval gates; a prompt-only instruction does not replace this check.

  6. 6. Retest

    Verify the forbidden read is denied while the permitted read succeeds on the corrected build. Include authorized search and preview paths and state any untested variants.

Validation cadence, monitoring, supported tools and retest coverage are agreed per engagement. A tool or policy change can require a new scope review; this example does not imply continuous coverage.

Scope MCP testing

Sources and scope

What supports this page

The walkthrough is a fictional read-only scenario and the worksheet is a planning aid. No customer assessment or executed test result is represented. Tool permissions, authorization, cadence, safety controls and retest coverage are agreed for each engagement.

By FailSafe Research. Editorial update: .

Cite this page: FailSafe Research, https://getfailsafe.com/mcp-security, updated .

Questions & answers

Frequently asked questions

A practical starting point for securing Model Context Protocol servers and agent tools.

Confirm the target, available portal configuration, required identities and tool actions with FailSafe before purchasing. The Startup offer is one black-box run; a specialized MCP assessment or ongoing validation program is separately scoped when its requirements exceed that configuration.

MCP security is the practice of securing Model Context Protocol servers, tools, resources, and the agent runtimes that connect language models to external data and actions.

Testing can cover tool authorization, server trust boundaries, prompt injection through resources and tool descriptions, tool poisoning and shadowing, SSRF and unsafe fetch behavior, secret exposure, cross-tenant access, command execution, message integrity, logging, and output handling.

Start with an inventory of servers, tools, resources, identities, and data flows; define least-privilege actions; test untrusted content and malicious tool arguments; verify isolation, authentication, replay protection, and logging; then repeat the assessment as tools, dependencies, prompts, and permissions change.

An MCP server or dependency can change the tools, descriptions, resources, or behavior exposed to an agent. Security testing should verify server provenance, pin dependencies and tool definitions where possible, restrict network and filesystem access, and detect changes before production use.

No. A redaction setting describes intent. A test with an injected input and an observed response is what shows whether a tool returns secret values, secret references or enough environment detail to locate them. Recent advisories have shown redaction defaults failing under prompt-influenced tool calls.

Test agent identity separation, delegated-user authority, confirmation context, DLP and classification handling, egress restrictions, revocation during a long-running task and cross-agent authorization. A gateway that is enabled is a configuration claim; a recorded decision on a specific attempted action is the evidence.

An HTTP allowlist may not cover WebRTC, WebTransport, WebSocketStream or alternate address forms such as NAT64 and IPv6. A destination can pass one check and resolve to a blocked target in another, so the test records the protocol, resolver answer and control decision.