AgilityOS

Home / Blog

MCP Security for AI Agents: Tool Poisoning, Prompt Injection, and Safe Orchestration

AI AgentsSecurityMCPOrchestrationGovernance

<h2>Why MCP security is suddenly a board-level topic</h2> <p>Model Context Protocol (MCP) is quickly becoming a standard way to connect AI agents to external tools—databases, ticketing systems, browsers, CRMs, internal APIs, and more. The value is obvious: a consistent interface that lets agents act in the world.</p> <p>The risk is equally obvious: once an agent can call tools, security stops being only about model outputs and starts being about <strong>what actions the system can take</strong>.</p> <p>Two attack families show up repeatedly in real deployments:</p> <ul> <li><strong>Prompt injection</strong>: manipulating the agent’s instructions or context so it behaves unsafely.</li> <li><strong>Tool poisoning (including MCP Tool Poisoning)</strong>: compromising the tools, tool metadata, or tool outputs so the agent takes harmful actions.</li> </ul> <p>OWASP has explicitly documented <em>MCP Tool Poisoning</em> as an emerging attack and provides a useful starting vocabulary for mitigations (see OWASP’s community write-up on the attack and defenses: <a href="https://owasp.org/www-community/attacks/MCP_Tool_Poisoning">https://owasp.org/www-community/attacks/MCP_Tool_Poisoning</a> ). The key takeaway: when tools become part of an agent’s “operating environment,” tools are now part of the attack surface.</p> <p>At AgilityOS, we approach MCP security as an orchestration problem: strong boundaries, runtime policy enforcement, and auditability across every tool call and every step in a long-running workflow.</p> <h2>The threat model: where MCP-connected agents break in production</h2> <p>Most agent security incidents don’t start with “the model went rogue.” They start with <strong>inputs the system trusted</strong>.</p> <p>In an MCP-enabled stack, common trust boundaries include:</p> <ul> <li><strong>Tool discovery and descriptions</strong> (what capabilities a tool claims)</li> <li><strong>Tool outputs</strong> (data returned by a connector, web page, or internal API)</li> <li><strong>Memory and state</strong> (what gets persisted between steps)</li> <li><strong>Human handoffs</strong> (approvals, reviews, ticket updates)</li> <li><strong>Secrets and credentials</strong> (how tools authenticate)</li> <li><strong>The orchestration layer</strong> (what is allowed to run, when, and with what permissions)</li> </ul> <p>If any of these are implicitly trusted, attackers can influence behavior without ever “breaking into” the model itself.</p> <h2>MCP Tool Poisoning: what it is and why it’s different</h2> <p>Traditional prompt injection often focuses on untrusted content (a web page, email, document) that contains instructions like “ignore previous directions.” Tool poisoning is broader: it targets the <em>mechanisms</em> that agents use to act.</p> <p>In MCP Tool Poisoning, attackers can exploit:</p> <ul> <li><strong>Malicious or compromised MCP servers/connectors</strong></li> <li><strong>Tampered tool schemas or tool descriptions</strong> that misrepresent behavior</li> <li><strong>Manipulated tool outputs</strong> that include hidden instructions or misleading data</li> <li><strong>Dependency confusion or supply-chain issues</strong> in tool hosting and deployment</li> </ul> <p>Why this matters: agents frequently treat tool responses as authoritative—especially if the workflow is designed to “continue until done.” A poisoned tool response can nudge the agent toward unsafe actions, data exfiltration, or privilege escalation.</p> <h2>Prompt injection for AI agents: still the #1 entry point</h2> <p>Prompt injection remains the most common way to steer an agent into unsafe behavior—especially when agents browse the web, read inbound messages, or process documents.</p> <p>In production, prompt injection typically shows up as:</p> <ul> <li><strong>Instruction hijacking</strong>: untrusted content overrides system policies.</li> <li><strong>Data exfiltration</strong>: the agent is coerced into revealing secrets (API keys, internal docs) via tool calls.</li> <li><strong>Policy evasion</strong>: the agent is tricked into taking disallowed actions (“just do it once”).</li> </ul> <p>The twist in agent systems: prompt injection becomes more dangerous when paired with tools. A successful injection doesn’t just produce bad text—it can produce <strong>unauthorized API calls</strong>.</p> <h2>Safe orchestration: the control plane that makes MCP usable</h2> <p>Security teams often ask, “How do we secure MCP?” The practical answer is: <strong>secure the runtime that orchestrates MCP tool use</strong>.</p> <p>A safe orchestration layer provides controls that are difficult to bolt on later:</p> <ul> <li><strong>Least-privilege tool access</strong> per agent, per workflow, per step</li> <li><strong>Runtime policy enforcement</strong> that can block, require approval, or redact</li> <li><strong>Deterministic audit logs</strong> of decisions, tool calls, and data flows</li> <li><strong>Separation of duties</strong> between builders, operators, and approvers</li> <li><strong>Incident response hooks</strong> (kill-switches, quarantine, replay)</li> </ul> <p>This is the difference between “agents as scripts” and an <strong>agent control plane</strong>.</p> <h2>Practical defenses: what to implement first</h2> <p>Below are the highest-leverage controls we recommend for MCP-connected agents.</p> <h3>1) Treat every tool output as untrusted input</h3> <p>Tool responses should be handled like web content: potentially malicious.</p> <p>Implement:</p> <ul> <li><strong>Output sanitization</strong> (strip or quarantine executable instructions)</li> <li><strong>Content-type validation</strong> (don’t parse HTML as JSON, etc.)</li> <li><strong>Schema validation</strong> against strict, versioned contracts</li> <li><strong>Instruction isolation</strong> (keep tool outputs out of the instruction channel)</li> </ul> <p>A simple rule: tool outputs inform decisions, but they should not become new “system instructions.”</p> <h3>2) Enforce allowlists and capability scoping</h3> <p>Broad tool access is the fastest path to costly incidents.</p> <p>Implement:</p> <ul> <li><strong>Tool allowlists</strong> (only approved MCP servers/tools)</li> <li><strong>Capability scoping</strong> (read-only vs write; specific endpoints only)</li> <li><strong>Environment scoping</strong> (dev vs prod; tenant boundaries)</li> <li><strong>Time-bound access</strong> (short-lived grants for sensitive actions)</li> </ul> <p>For example: a support-ticket agent may need to <em>read</em> customer context and <em>draft</em> an update, but not <em>issue refunds</em> or <em>change account owners</em>.</p> <h3>3) Runtime policy enforcement (not just “guidelines”)</h3> <p>Policies that live only in prompts are not controls.</p> <p>Implement enforceable policies such as:</p> <ul> <li><strong>Data loss prevention (DLP) checks</strong> before any outbound tool call</li> <li><strong>PII/PHI redaction rules</strong> depending on workflow context</li> <li><strong>Approval gates</strong> for high-impact actions (money movement, deletions, permissions)</li> <li><strong>Rate limits and spend caps</strong> to prevent runaway execution</li> </ul> <p>This is where orchestration pays off: policies can be evaluated at runtime with full context—who initiated the workflow, what data is present, what tools are being invoked, and what the agent is attempting to do.</p> <h3>4) Strong identity, auth, and secret handling for tools</h3> <p>MCP makes it easy to connect tools; security requires disciplined identity.</p> <p>Implement:</p> <ul> <li><strong>Per-agent identities</strong> (no shared “god tokens”)</li> <li><strong>Short-lived credentials</strong> (OIDC where possible)</li> <li><strong>Secret vault integration</strong> with audited access</li> <li><strong>Scoped service accounts</strong> aligned to least privilege</li> </ul> <p>If a tool token grants broad access, a prompt injection can become a full account compromise.</p> <h3>5) Human-in-the-loop for irreversible actions</h3> <p>Autonomy should be graduated. A safe default is:</p> <ul> <li>Autonomous for <strong>low-risk, reversible</strong> actions</li> <li>Approval required for <strong>high-risk, irreversible</strong> actions</li> </ul> <p>Examples that typically warrant review:</p> <ul> <li>Changing payment terms</li> <li>Deleting records</li> <li>Granting permissions</li> <li>Sending external emails to large distributions</li> <li>Publishing code or infrastructure changes</li> </ul> <p>The goal isn’t to slow teams down—it’s to put friction only where the blast radius is real.</p> <h3>6) Audit logs that support forensics (and learning)</h3> <p>Agent systems need logs that answer:</p> <ul> <li>What was the <strong>input</strong>?</li> <li>What did the agent <strong>decide</strong> and <strong>why</strong>?</li> <li>Which <strong>tools</strong> were called, with what <strong>parameters</strong>?</li> <li>What <strong>data</strong> left the boundary?</li> <li>Which <strong>policy</strong> allowed or blocked the step?</li> </ul> <p>Without this, teams can’t investigate incidents, prove compliance, or improve reliability.</p> <h2>A reference “secure MCP” architecture (what good looks like)</h2> <p>A production-grade setup typically looks like this:</p> <ul> <li><strong>Agent runtime</strong> (LLM + planner/executor)</li> <li><strong>Orchestration layer</strong> (workflow state, retries, approvals, scheduling)</li> <li><strong>Policy engine</strong> (runtime checks: DLP, RBAC/ABAC, approvals, spend caps)</li> <li><strong>Tool gateway</strong> (MCP client that enforces allowlists, schema checks, and identity)</li> <li><strong>Observability stack</strong> (structured logs, traces, evaluations, alerts)</li> <li><strong>Secrets + identity</strong> (vault, OIDC, short-lived tokens)</li> </ul> <p>The design principle: agents should never call tools “directly.” They should call tools through a controlled gateway with policies, identity, and logging.</p> <h2>Security checklists for teams piloting MCP</h2> <p>For US enterprise teams moving from proof-of-concept to production, these are the checkpoints that prevent most avoidable failures:</p> <ul> <li><strong>Inventory</strong> every MCP server/tool and classify data sensitivity</li> <li><strong>Define</strong> allowed actions per agent (capabilities, not just prompts)</li> <li><strong>Implement</strong> runtime approval for high-risk actions</li> <li><strong>Validate</strong> tool schemas and sanitize tool outputs</li> <li><strong>Use</strong> per-agent identities and least-privilege service accounts</li> <li><strong>Log</strong> every tool call with enough detail for forensics</li> <li><strong>Add</strong> a kill-switch and quarantine mode for suspicious workflows</li> </ul> <h2>Conclusion</h2> <p>MCP accelerates agent adoption because it standardizes how agents reach tools—but that same convenience expands the attack surface. The safest path is to treat MCP tool use as a governed runtime: least privilege, policy enforcement, and auditable orchestration around every action.</p> <p>AgilityOS is built for teams deploying autonomous workflows in production, with the control-plane capabilities needed to operate MCP-connected agents safely. For organizations standardizing agent deployments across the United States, reaching out to the AgilityOS team is a practical next step when it’s time to move from experiments to secure, governed orchestration.</p>

Run your business on AgilityOS

Give it tasks in plain language — it executes, delivers, and organizes the work.

Get started free