The Model Context Protocol (MCP) makes it easier for AI applications to discover and invoke tools, but convenience also concentrates authority. A secure MCP deployment must treat every tool call as a privileged API action, every returned resource as potentially untrusted input, and every credential as a scoped capability rather than a reusable secret.
Why MCP server security is different from ordinary API security
An MCP server sits between an AI client and real capabilities: files, databases, SaaS APIs, internal services, developer tooling, ticketing systems, or infrastructure. The client may decide which tool to call from natural-language context, so the security boundary cannot rely on the model making a correct judgment every time.
The July 2026 MCP specification continued the protocol’s move toward clearer authorization and extensibility. Enterprise-managed authorization also became a defined path for centrally controlled access. Those improvements help, but they do not remove application-level risks such as excessive permissions, unsafe tool semantics, prompt injection, SSRF, confused-deputy behavior, or untrusted tool output.
Prompt-to-action risk
An attacker may influence model context so that a legitimate tool is invoked for an illegitimate purpose.
Delegated credential risk
A server or client can become a high-value holder of tokens that reach multiple downstream services.
Tool-chain risk
One MCP tool can feed data into another, turning a low-trust read operation into a higher-impact workflow.
Trust-boundary ambiguity
The user, model, MCP client, server, tool implementation, and downstream API may each have different identities and permissions.
Protect tokens and sessions from passthrough and cross-user leakage
Token handling is one of the most consequential MCP design choices. Scope tokens narrowly, validate issuer and audience, avoid forwarding tokens to services they were not minted for, and keep user sessions isolated. Token passthrough can create confused-deputy problems when one component accepts a credential intended for another.
- Use short-lived, audience-restricted credentials where practical.
- Do not log bearer tokens, authorization headers, refresh tokens, or tool secrets.
- Bind cached state and session data to the correct authenticated principal.
- Rotate server-side secrets and remove credentials from tool descriptions, prompts, and error messages.
- Prefer delegated user identity for user-specific actions instead of a universal backend super-token.
Make tools narrow, typed, and difficult to misuse
A safe tool should expose the smallest operation the agent actually needs. A generic run_shell, execute_sql, or unrestricted http_request tool creates a much larger attack surface than a purpose-built operation such as get_invoice_status or create_read_only_report. Narrow tools also produce clearer audit records and make policy enforcement easier.
| Risky pattern | Prefer instead | Reason |
|---|---|---|
| Arbitrary URL fetch | Allowlisted service operation | Reduces SSRF and data exfiltration paths |
| Raw SQL execution | Parameterized domain query | Limits injection and excessive data access |
| Generic filesystem write | Scoped document-save tool | Constrains path and file-type abuse |
| One admin tool for many actions | Separate read/write/admin tools | Allows distinct authorization and approval policies |
Treat prompt injection as an authorization and containment problem
Prompt injection becomes dangerous when untrusted text can influence a model that possesses powerful tools. The defensive goal is not merely to detect malicious wording. The system should remain safe even when the model reads adversarial instructions.
- Separate untrusted content from trusted policy and system instructions.
- Do not allow retrieved documents or tool output to redefine authorization policy.
- Require policy checks outside the model before high-impact actions execute.
- Constrain egress and filesystem access so a compromised decision cannot reach arbitrary destinations.
- Require confirmation for destructive, financial, identity, or externally visible actions.
Constrain network egress and defend against SSRF
MCP tools frequently call remote APIs, fetch URLs, access webhooks, or resolve resources. Any user-influenced destination should be treated as an SSRF boundary. Block link-local, loopback, metadata, management, and private destinations unless explicitly required; validate redirects; and prefer service allowlists over arbitrary outbound connectivity.
At the infrastructure layer, network policy should limit what the MCP runtime can reach even if application validation fails. This turns egress control into a second enforcement layer rather than relying on a single URL parser.
Log the security decision, not sensitive content
Useful MCP telemetry connects identity, session, tool, arguments at an appropriate redaction level, downstream target, authorization decision, latency, result class, and policy outcome. This supports incident response without turning logs into a repository of secrets or private prompts.
- Test cross-user and cross-tenant access, not only happy-path authentication.
- Test malformed arguments, redirects, encoded URLs, oversized inputs, and tool chaining.
- Verify that denied actions remain denied when invoked indirectly through another tool.
- Alert on unusual tool sequences, new high-risk destinations, permission changes, and sharp changes in call volume.
- Re-test after adding tools, changing scopes, or upgrading MCP libraries and clients.
MCP server security checklist
- Inventory every MCP server, tool, resource, prompt template, downstream API, and credential.
- Define a trust level and required identity for each tool.
- Enforce object- and function-level authorization outside the model.
- Use narrow scopes, correct token audiences, and short credential lifetimes.
- Replace generic execution tools with typed domain operations wherever possible.
- Isolate sessions and caches by user and tenant.
- Constrain outbound network access and validate all remote destinations.
- Sanitize and label untrusted tool output before it re-enters model context.
- Gate destructive or high-impact actions with policy or human approval.
- Monitor tool sequences and downstream API behavior at runtime.
Where runtime API security fits
MCP security controls are strongest when the server and the downstream APIs agree on identity and policy. Runtime API security adds visibility into what the agent actually does after authentication: which endpoints are called, which objects are accessed, which parameters change, and whether behavior deviates from established patterns.
For organizations deploying many agents and MCP servers, this behavioral layer can expose shadow endpoints, excessive access, unusual sequences, and business-logic abuse that a protocol-compliant MCP implementation alone will not detect.
Frequently asked questions
What is an MCP server?
An MCP server exposes tools, resources, or prompts to an MCP-compatible client so an AI application can discover and use external capabilities through a standardized protocol.
Does OAuth make an MCP server secure?
OAuth is an important authorization foundation, but it does not replace tool-level, object-level, and business-action authorization. A valid token can still be used to perform an unsafe action if permissions are too broad.
What is the biggest MCP server security risk?
There is no single universal risk. High-impact failures usually combine excessive tool authority, weak downstream authorization, untrusted model context, or poorly constrained credentials and network access.
Should MCP tools be able to make arbitrary HTTP requests?
Usually not. Purpose-built operations and destination allowlists are safer because they reduce SSRF, data exfiltration, and confused-deputy paths.
How should teams test MCP security?
Test identity boundaries, tool permissions, downstream object authorization, prompt-injection resilience, session isolation, SSRF controls, tool chaining, sensitive logging, and behavior under malformed or excessive input.
Sources and further reading
- Model Context Protocol — July 2026 specification release — official MCP project update on the current specification
- OWASP MCP Security Cheat Sheet — defensive guidance for MCP implementations
- OWASP MCP Top 10 — risk taxonomy for MCP deployments
- OWASP Practical Guide for Secure MCP Server Development — implementation-oriented guidance
Protect APIs with runtime context, not just static rules
Ammune helps security teams discover APIs, understand normal behavior, detect abuse and authorization anomalies, and apply runtime protection across modern API environments.
