---
title: "Securing MCP Servers: Authorization, Tool Trust, and the Confused Deputy Problem"
url: "https://raoofaltaher.com/blog/securing-mcp-servers"
description: "A practical security guide for MCP servers covering resource-bound tokens, least privilege, tool validation, untrusted metadata, confused deputy risks, and audit controls."
---

# Securing MCP Servers: Authorization, Tool Trust, and the Confused Deputy Problem

27 November 2026 9 min read

-   [security](/blog/tags/security)
-   [agent-security](/blog/tags/agent-security)
-   [tool-calling](/blog/tags/tool-calling)
-   [ai-agents](/blog/tags/ai-agents)

The Model Context Protocol (MCP) gives AI applications a standard way to discover and invoke tools. That makes integration easier, but it also creates a security boundary: a model-selected tool call can reach APIs, files, databases, and business operations.

![A dark textured title card reading Securing MCP Servers: Authorization, Tool Trust, and the Confused Deputy Problem inside a thin white frame, over a blue and amber glow](/_astro/securing-mcp-servers.C36pn-uy_Z1WfTdu.avif)

MCP does not make a tool trustworthy simply because it follows a protocol. The client, server, authorization layer, downstream API, and user interface still need explicit controls. This article focuses on the server-side decisions that prevent a legitimate integration from becoming an unintended path to data or actions.

The recommendations below follow the [MCP specification](https://modelcontextprotocol.io/specification/latest), its [authorization guidance](https://modelcontextprotocol.io/specification/latest/basic/authorization), and the [security best practices](https://modelcontextprotocol.io/docs/latest/tutorials/security/security_best_practices). The OAuth authorization flow in the MCP specification applies to HTTP-based transports; authorization is optional for MCP implementations, and the specification tells STDIO implementations to retrieve credentials from the environment instead. Both deployment types still need appropriate authentication and access controls. This article was checked against the 2026-07-28 revision of the specification. Check the current version when you implement a server, because protocol requirements evolve.

## 1\. Treat the tool catalog as untrusted input

An MCP tool definition typically includes a name, description, and input schema. These fields help a client or model choose a tool, but they are not a security policy.

The [MCP tools specification](https://modelcontextprotocol.io/specification/latest/server/tools) says clients must treat tool annotations as untrusted unless they come from trusted servers. Apply the same caution to descriptions, metadata, and results. A tool can describe itself as read-only while its implementation performs a mutation; a compromised server can return content that tries to redirect the model.

Practical controls:

-   Maintain an explicit allowlist of servers and tools that an application is permitted to use.
-   Review tool names, descriptions, and schemas before granting access to sensitive workflows.
-   Treat tool output as data, not as instructions that can override system policy.
-   Validate arguments at the server boundary even when the client advertises a schema.
-   Version and review changes to tool definitions, just as you would review API changes.

Discovery is not authorization. The fact that a tool appears in `tools/list` must not grant it permission to act on every resource the caller can name.

## 2\. Authenticate the caller and authorize each operation

Authentication answers who is making the request. Authorization answers what that identity may do, on which resource, under which conditions. A valid access token is not a blanket permission to invoke every tool.

For HTTP-based deployments that use MCP’s OAuth authorization profile, the client names the MCP server it wants a token for with the `resource` parameter of [RFC 8707](https://www.rfc-editor.org/rfc/rfc8707.html), and the server advertises its authorization servers through [OAuth 2.0 Protected Resource Metadata (RFC 9728)](https://www.rfc-editor.org/rfc/rfc9728.html). Validate each token as [OAuth 2.1 Section 5.2](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-13#section-5.2) describes, including its validity and that it was issued for this server as the intended audience. Follow the token format and validation method required by the authorization server; for example, a [JWT access token (RFC 9068)](https://www.rfc-editor.org/rfc/rfc9068.html) may be verified locally while an opaque token may require [token introspection (RFC 7662)](https://www.rfc-editor.org/rfc/rfc7662.html). Then apply application-level authorization to the requested tool and target resource. For broader OAuth implementation hardening, also consult the IETF’s [OAuth 2.0 Security Best Current Practice (RFC 9700)](https://www.rfc-editor.org/rfc/rfc9700.html), while following the MCP profile’s specific requirements for the transport and deployment.

A policy decision should consider at least:

-   The authenticated user or workload identity.
-   The requested tool and operation.
-   The target resource and tenant.
-   The user’s current permissions.
-   The context and risk of the operation.
-   Whether approval is required.

Enforce access in the tool implementation and downstream service. Do not rely on a prompt telling the model which records it may read.

## 3\. Prevent token passthrough and confused deputy failures

A confused deputy occurs when a component with its own authority is tricked into using that authority for a caller who is not entitled to the operation. MCP deployments can encounter related risks when a proxy or server connects to downstream APIs on behalf of multiple clients.

The [MCP authorization security considerations](https://modelcontextprotocol.io/specification/latest/basic/authorization/security-considerations) require a server to accept only tokens issued for that server and forbid it to pass the incoming client token through to an upstream service; the upstream call uses a separate token from the upstream authorization server. A token issued for one resource must not become a general credential for another.

A safer pattern is:

1.  The client presents a token intended for the MCP server.
2.  The server validates the token and identifies the caller.
3.  The server checks the caller’s permission for the requested operation.
4.  If a downstream API call is needed, the server obtains or uses a separate credential intended for that downstream resource.
5.  The server scopes the downstream operation to the caller’s approved access and records the decision.

Do not simply forward the incoming bearer token and hope the downstream API interprets it correctly. Use resource-specific tokens or a documented delegation flow. Where the server uses a shared service credential, enforce caller-specific authorization before each operation and limit the credential’s scope.

Also review OAuth proxy flows for per-client consent and state handling. The official [MCP security best practices](https://modelcontextprotocol.io/docs/latest/tutorials/security/security_best_practices#confused-deputy-problem) document a confused deputy scenario involving proxy servers, static client IDs, dynamic client registration, and consent cookies. The 2026-07-28 revision deprecates dynamic client registration, but the attack still applies to proxy servers that support it. The lesson is broader than one OAuth configuration: a server must not confuse its own authorization with the user’s consent.

## 4\. Validate every tool input and result

A JSON schema is useful, but it does not replace runtime validation. Validate types, ranges, formats, enum values, resource ownership, and business constraints before performing side effects.

For example, a tool that updates a ticket should not accept an arbitrary tenant ID merely because the input schema permits a string. Resolve the target record, verify that the caller can modify it, and reject unknown or out-of-scope fields. Use parameterized database operations and established API clients rather than constructing commands from model-generated strings.

Validate outputs too. Remove secrets and fields the caller cannot access before returning data to the model. Bound response size, normalize errors, and avoid exposing stack traces, internal paths, credentials, or raw upstream responses.

The [MCP tools specification](https://modelcontextprotocol.io/specification/latest/server/tools) states that servers must validate all tool inputs, implement proper access controls, rate-limit tool invocations, and sanitize tool outputs. Treat these as server responsibilities, not optional model prompt instructions.

## 5\. Keep permissions narrow and actions bounded

Give each server and downstream credential only the permissions it needs. Prefer read-only tools when writes are not required, separate sensitive operations into distinct tools, and avoid generic tools that can execute arbitrary commands or unrestricted queries.

For high-impact operations, add a policy and approval boundary:

-   Validate the requested action and its target.
-   Show the user the specific operation and material parameters.
-   Require confirmation when the risk warrants it.
-   Recheck authorization immediately before execution.
-   Bind approval to that action and target; do not reuse it for unrelated requests.
-   Record the approval reference and execution outcome.

A human approval prompt is not a substitute for authorization. A user may approve a request that they are not allowed to execute, or a model may alter parameters after approval. The server must enforce permissions independently.

Apply rate limits, timeouts, maximum payload sizes, and quotas. These controls reduce the impact of loops, accidental repeated calls, denial-of-service attempts, and unexpectedly expensive operations.

## 6\. Protect against prompt injection through tool content

MCP tool descriptions and results may contain untrusted text. An attacker could place instructions in a repository issue, document, webpage, or API record that the agent later reads through a tool. The agent may then attempt to call another tool, disclose data, or perform an unrelated action.

No delimiter or prompt template reliably turns malicious content into harmless content in every model; OWASP states that it is unclear whether fool-proof methods of prevention exist ([OWASP LLM01:2025 Prompt Injection](https://genai.owasp.org/llmrisk/llm01-prompt-injection/)). Instead:

-   Keep tool output separate from trusted application instructions.
-   Do not let text returned by one tool grant new permissions.
-   Validate each subsequent tool call against an external policy.
-   Limit which tools are available to tasks processing untrusted content.
-   Keep credentials out of model-visible context whenever possible.
-   Test direct and indirect prompt-injection paths with realistic tool results.

The [OWASP Top 10 for Agentic Applications 2026](https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/) is a useful threat-modeling reference for agent goal hijack, tool misuse and exploitation, identity and privilege abuse, and related risks. Map those risks to the actual tools and data in your deployment rather than treating a generic checklist as a complete assessment.

## 7\. Audit decisions without logging secrets

Security logs should answer who requested an operation, which tool was invoked, what policy decision was made, which resource was targeted, and whether the action succeeded. Include timestamps, correlation IDs, server and tool versions, approval references, and relevant error categories.

Avoid logging bearer tokens, API keys, full sensitive payloads, or entire conversations by default. Redact or hash identifiers where appropriate, control access to logs, and define retention periods. Logs should be useful for incident response without creating a second store of sensitive data.

Monitor repeated authorization denials, unexpected tool sequences, high call rates, changes to tool definitions, and attempts to access resources across tenant boundaries. Alerts need an operational response: revoke credentials, disable a tool, pause a workflow, or investigate the affected identity.

## Server-side security checklist

-    Allowlist approved MCP servers and review tool catalog changes.
-    Validate the incoming token and its intended resource.
-    Enforce caller-, tenant-, tool-, and resource-level authorization.
-    Never forward a client token to a downstream API as token passthrough.
-    Use scoped downstream credentials or a documented delegation flow.
-    Validate tool arguments and resource ownership at runtime.
-    Sanitize outputs and normalize errors.
-    Apply rate limits, quotas, timeouts, and payload limits.
-    Require action-specific approval for high-impact operations.
-    Log policy decisions without exposing secrets.
-    Test prompt injection, cross-tenant access, replay, and unauthorized mutations.

## Conclusion

MCP standardizes how applications expose tools. It does not make tool metadata trustworthy, replace application authorization, or solve delegated identity on its own.

Secure implementations validate the caller and resource, authorize every operation, keep credentials audience-bound, and treat tool definitions and outputs as potentially untrusted. The most important control is to ensure that a model-selected action cannot gain more authority than the authenticated caller and the server policy permit.

## Work with me

Do you need a security review of an MCP server, or help designing its authorization and tool policy? [Contact me](/#contact).

## References

-   [MCP Specification](https://modelcontextprotocol.io/specification/latest)
-   [MCP Authorization](https://modelcontextprotocol.io/specification/latest/basic/authorization)
-   [MCP Authorization Security Considerations](https://modelcontextprotocol.io/specification/latest/basic/authorization/security-considerations)
-   [MCP Security Best Practices](https://modelcontextprotocol.io/docs/latest/tutorials/security/security_best_practices)
-   [MCP Tools](https://modelcontextprotocol.io/specification/latest/server/tools)
-   [OAuth 2.1 (draft-ietf-oauth-v2-1-13)](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-13)
-   [Resource Indicators for OAuth 2.0 (RFC 8707)](https://www.rfc-editor.org/rfc/rfc8707.html)
-   [OAuth 2.0 Protected Resource Metadata (RFC 9728)](https://www.rfc-editor.org/rfc/rfc9728.html)
-   [JWT Profile for OAuth 2.0 Access Tokens (RFC 9068)](https://www.rfc-editor.org/rfc/rfc9068.html)
-   [OAuth 2.0 Token Introspection (RFC 7662)](https://www.rfc-editor.org/rfc/rfc7662.html)
-   [OAuth 2.0 Security Best Current Practice (RFC 9700)](https://www.rfc-editor.org/rfc/rfc9700.html)
-   [OWASP Top 10 for Agentic Applications 2026](https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/)
-   [OWASP LLM01:2025 Prompt Injection](https://genai.owasp.org/llmrisk/llm01-prompt-injection/)