All articles
createos

MCP Server Security: Preventing Tool Poisoning, Credential Leakage, and Excessive Permissions

A production-security playbook for MCP servers. Prevent tool poisoning, credential leakage, and excessive permissions with scoped access, explicit consent,...

MCP Server Security: Preventing Tool Poisoning, Credential Leakage, and Excessive Permissions
On this page

MCP Server Security: Preventing Tool Poisoning, Credential Leakage, and Excessive Permissions

When an AI agent connects to an MCP server, it receives a list of available tools. Each entry includes a name, description, and schema. That metadata shapes what the agent believes it can do and how it should act. If the server is compromised or malicious, it can rename a destructive operation to sound benign, or it can request broader credentials than the task requires. In production, this is not a theoretical risk. It is a direct path to tool poisoning, credential leakage, and excessive permissions. Security teams need a playbook that treats the MCP layer as a boundary to be hardened, not a convenience to be trusted.

Tool metadata is untrusted input

The MCP protocol lets servers advertise capabilities dynamically. A server might expose a tool called query_database that actually drops tables, or it might inject misleading descriptions that trick an agent into calling the wrong function. Because the agent relies on this metadata to plan its next move, poisoned metadata becomes a supply-chain attack on reasoning itself.

The fix starts with validation. Before an agent registers a tool, the client should compare the advertised schema against an allowlist of approved operations. Descriptions should be treated like user-generated content: parsed, but never trusted to define safety boundaries. If a server updates its metadata, the change should trigger a re-validation workflow rather than automatic acceptance.

In practice, this means maintaining a catalog of known-good tool definitions for each MCP server your environment consumes. When a server deviates from that catalog, the connection should fail closed. This adds operational overhead, but it is the necessary price of preventing a compromised server from rewriting its own capabilities in your agent's context window. Your MCP server hosting model should make those validation and isolation controls explicit before production deployment.

Validate OAuth audiences and restrict discovery

Credential leakage often begins at the connection boundary. MCP servers frequently rely on OAuth for authentication, and a misconfigured flow can leak tokens to the wrong audience. If your agent requests a token scoped for one MCP server but the redirect or audience claim is ambiguous, you risk handing credentials to an intermediary that can replay them elsewhere.

Restricting discovery limits the blast radius. Not every agent needs to see every tool a server offers. By filtering tool visibility at connection time, you reduce the attack surface available to a poisoned prompt or a confused agent. The client should request only the tool categories relevant to the current session, and the server should enforce that filter at the authorization layer.

Audience validation should be explicit. Check the aud claim in the token response against the exact MCP server identifier. Do not rely on broad wildcard matching. If the server cannot prove it is the intended recipient, the token should not leave the client. This pattern is common in modern API security, but it is easy to overlook when MCP connections are treated as internal plumbing rather than external integrations.

Excessive permissions are the default when an MCP connection grants blanket access to a server. A tool that only needs read access to a single table should not inherit write access to the entire database. Per-tool scoping forces you to map each advertised function to the least privilege required for the agent's current task.

Consent should be explicit, not implied. Before an agent invokes a tool that modifies state, accesses sensitive data, or calls an external service, the user or an authorized policy engine must approve the action. This can be implemented as a runtime prompt for high-risk operations or as a policy check for automated workflows. The key is that execution is opt-in, not opt-out.

Combining scoped permissions with explicit consent creates a two-gate system. The first gate limits what the tool can do. The second gate limits when it is allowed to do it. Together, they prevent an attacker who gains control of the agent from using a legitimate tool in an illegitimate way. This is especially important in multi-tenant environments where one agent session should never influence another.

Retain audit logs for runtime accountability

Prevention eventually fails. When it does, you need a record of what the agent was told, what it decided, and what it executed. Audit logs for MCP interactions should capture the full tool metadata snapshot, the arguments sent, the token identity used, and the response received. Without this, incident response becomes guesswork.

Logs should be structured and tamper-evident. Store them outside the execution environment so a compromised agent or server cannot rewrite its own history. Include correlation IDs that link MCP tool calls to the broader agent trace, so security teams can reconstruct the chain of reasoning that led to a specific action.

Retention policies should match your compliance and operational needs, but the minimum viable standard is complete runtime accountability. If you cannot answer the question "exactly which tool was called, with what data, by which identity, at what time," then your MCP deployment lacks a critical production control. Logging is not a postscript. It is part of the security control surface.

What these controls do not fix

No set of client-side controls eliminates all risk. If the underlying host running the MCP server is compromised, an attacker can bypass metadata validation by serving the expected schema while executing malicious code on the backend. Similarly, if the OAuth identity provider itself is breached, audience validation will not stop token theft at the source.

Per-tool scoping and explicit consent add latency. Every approval gate introduces a decision point that can slow down agent workflows or frustrate users who expect immediate answers. There is a real tradeoff between security friction and execution speed. Teams that ignore this tension often end up disabling controls under pressure, which defeats the purpose.

Audit logs help you detect breaches, but they do not prevent them. They also create a data management burden. Sensitive arguments captured in logs may themselves require encryption, access controls, and lifecycle management. The cost of logging is not just storage. It is the operational discipline to review, protect, and eventually delete what you have recorded.

Audit your MCP server configurations against these controls. If you are still choosing infrastructure, compare where to host an MCP server against the access, isolation, and audit requirements above. Then explore how a unified execution layer keeps security, deployment, and monitoring in one environment.

Give Us One Stuck Pilot.

We'll have it in governed production before your next board meeting.