DEV Community

Cover image for MCP Security Testing Before Production: What Practitioners Should Validate
Pentest Testing Corp
Pentest Testing Corp

Posted on • Originally published at pentesttesting.com

MCP Security Testing Before Production: What Practitioners Should Validate

Model Context Protocol is quickly becoming a practical way to connect AI agents to tools, data sources, cloud resources, ticketing systems, and internal workflows. That convenience changes the security model. The question is no longer only whether an API endpoint is protected. The question is whether the complete path from user to agent to MCP server to tool to downstream system enforces the right identity, authority, data boundary, and audit trail.

This version is intentionally sanitized. It does not provide exploit chains, bypass prompts, or weaponizable test sequences. It focuses on what a safe pre-production assessment should validate.


Why this deserves a practitioner version

MCP security testing sits between AI security, API security, identity, and application authorization. Practitioners are usually the people who have to turn a buyer concern into testable controls, safe rules of engagement, remediation tickets, and retest criteria.

The business risk is clear: if an MCP-enabled agent can select the right tool with the wrong authority, customer data, financial actions, cloud resources, or regulated workflows may be exposed through a legitimate-looking integration.


Core boundaries to validate

Start with the trust path, not with prompt tricks.

  1. Human user to agent: verify session identity, role, tenant, consent, and step-up requirements.
  2. Agent or client to MCP server: validate OAuth audience, scopes, token expiry, refresh, revocation, redirect behavior, and storage.
  3. MCP server to tool catalog: confirm allowed servers, tool owners, tool versions, tool descriptions, and change approval.
  4. Tool selection to authorization: test whether each role can invoke only the tools and action tiers it should.
  5. Tool parameters to business rules: verify ownership, tenant, amount, destination, environment, and destructive flags server-side.
  6. External content to model context: assess whether untrusted files, tickets, emails, web content, or retrieved documents can influence sensitive actions.
  7. Runtime to audit and response: confirm logs can reconstruct the originating user, agent, server, tool, parameters, authorization decision, approval, target, and response.

What not to rely on alone

OAuth helps establish delegated access, but it does not automatically prove least privilege, correct audience, scoped tool authority, or downstream user context. Cloud IAM can enforce configured permissions, but those permissions may still be too broad for the agent's task. API gateways can centralize policy, but they may not validate model-selected parameters against tenant or business rules.

Functional QA proves the happy path. Security testing must prove prohibited paths fail.


Practical remediation themes

Most fixes are not model tweaks. They usually sit in identity propagation, server-side authorization, API validation, tool governance, approval design, and logging.

Useful remediation tickets often look like this:

  • Derive tenant and owner context from trusted identity, not request body or model-selected parameters.
  • Enforce deny-by-default tool authorization for every role and action tier.
  • Separate tool discovery from tool invocation.
  • Restrict high-impact tools through explicit policy and meaningful approval.
  • Label untrusted content before it enters model context.
  • Validate record identifiers, file paths, amounts, environments, and destructive flags outside the model.
  • Revoke delegated access after logout, role change, account deactivation, or incident response.
  • Correlate logs across user, agent, MCP server, tool, downstream API, authorization decision, and approval.

devto-inline-mcp-test-matrix


Business impact and scope

A strong MCP security test should give engineering teams evidence they can fix and give leadership evidence they can use in launch, audit, vendor review, and customer security discussions.

That means the report should map findings to business impact, remediation ownership, retest criteria, and relevant frameworks such as OWASP LLM01, LLM06, LLM07, and applicable agentic categories. Where an API behind the MCP tool has broken authorization, the remediation should be coordinated with API penetration testing rather than treated as a chatbot-only issue.


Final thought

MCP is not automatically insecure. The risk comes from implementation choices: shared identities, broad tool access, weak data boundaries, untrusted content influencing tool use, missing approval gates, and incomplete audit evidence.

A good assessment gives a simple answer before launch: approved with evidence, approved with conditions, or delayed until a material trust-boundary gap is fixed.

Full canonical guide: https://www.pentesttesting.com/mcp-security-testing/

Top comments (0)