All posts
AI

Runtime Guardrails at the MCP Gateway

Runtime Guardrails at the MCP Gateway

An MCP gateway decides which agents can reach which tools. Runtime guardrails decide what happens on every single call: whether this agent, with these arguments, at this moment, should be allowed to proceed, and whether what comes back is safe to hand to the model. Access control sets the boundaries. Runtime guardrails enforce them while agents are working.

This guide explains what runtime guardrails at the MCP gateway are, where they act in the life of a tool call, the types worth putting in place, and how to run them without slowing agents down or blocking real work.

What are runtime guardrails at the MCP gateway?

Runtime guardrails at the MCP gateway are policies that check each tool call as it happens, before the request reaches an MCP server and before the response reaches the model. They can allow, block, modify, or escalate a call based on who is calling, which tool and arguments are involved, what the content contains, and what the agent has already done.

They differ from setup-time controls like server approval and role assignments. Those decide what’s possible. Runtime guardrails decide what actually happens, one call at a time.

Why the MCP gateway is the right place for guardrails

  • Every tool call passes through it. Guardrails at the gateway cover every agent and every server, without changes to either.
  • It sees both directions. The gateway sees the request going to the tool and the response coming back, so it can check both.
  • It knows the context. It knows the user, the agent, the tool, and the agent’s recent calls, which lets it apply rules a single server can’t.
  • It’s model-agnostic. The same guardrails apply whether the agent runs on a model from Anthropic, OpenAI, Google, or anyone else.
  • It’s one place to change policy. Update a rule once and it applies everywhere.

Where guardrails act in the life of a tool call

Stage What happens Guardrails that apply
Tool discovery The agent asks which tools exist Show only tools allowed for this role and agent. Scan tool names and descriptions for injected instructions
Before the call The agent sends a tool call with arguments Check permissions, validate arguments, check rate and time limits, require approval for risky actions
During the call The gateway calls the MCP server Use the gateway’s own credentials, apply timeouts
After the call The server returns a result Scan for prompt injection, mask or block sensitive data, limit result size
Across the run The agent makes many calls in one task Cap call counts and cost, watch for risky sequences of calls

Types of runtime guardrails for MCP

Access guardrails

Decide whether this caller may use this tool right now.

  • Role-based access at the server, tool, and argument level
  • Separate rules for read-only and destructive tools
  • Per-agent limits, so two agents used by the same person can have different permissions

Argument guardrails

Check what the agent is trying to do with the tool.

  • Allowed values, such as specific projects, channels, or tables
  • Format and range checks, such as a maximum number of records per update
  • Blocking dangerous patterns, such as shell metacharacters in arguments to execution tools

Content guardrails

Check what goes in and what comes back.

  • Prompt injection detection on tool descriptions and tool results
  • Data loss prevention on arguments and results, such as masking personal data or blocking secrets
  • Size limits on results, so one tool can’t flood the model’s context

Behavior guardrails

Look at the pattern, not just the single call.

  • Rate limits per user, agent, and tool
  • Caps on tool calls, retries, and cost per agent run
  • Sequence rules, such as flagging when an agent reads from a private source and then writes to a public one

Time and context guardrails

  • Restrict certain tools to business hours or change windows
  • Apply stricter rules in production than in testing

Approval guardrails

  • Pause high-risk calls and ask a person to approve them
  • Block the call if no one approves it within a set time

Examples of MCP gateway guardrails in practice

Scenario Guardrail Result
A support agent tries to delete a ticket Destructive tools blocked for the support role Call denied and logged
A coding agent reads an issue with hidden instructions Prompt injection scan on tool results Result blocked before it reaches the model
A sales agent’s CRM query returns personal data Data loss prevention on results Sensitive fields masked
An analytics agent requests 50,000 rows Argument and result size limits Call rejected or results trimmed
An agent loops on the same tool Call cap per run and rate limit Agent stopped after the limit
A deployment tool is called on a Friday night Time-based restriction Call held for approval
An agent reads a private repo, then posts to a public channel Sequence rule Second call escalated for review

Deterministic rules vs model-based checks

Runtime guardrails come in two kinds, and good programs use both.

  • Deterministic rules always give the same answer for the same input: role permissions, argument allowlists, rate limits, and time windows. They’re fast, predictable, and easy to audit.
  • Model-based checks use classifiers to judge content: prompt injection detection, sensitive data detection, and harmful content checks. They catch things rules can’t describe, but they work on probability.

Put hard limits in deterministic rules. Use model-based checks for content, and back them with deterministic limits so that a missed detection still can’t lead to a destructive action.

How to run guardrails without slowing agents down

  • Keep checks fast. Agents make many calls per task. Guardrails that add seconds per call make agents unusable.
  • Run cheap checks first. Permission and argument checks are nearly instant. Run content scanning only when needed.
  • Decide fail open or fail closed per tool. If a check can’t complete, low-risk read tools might proceed while write tools stop.
  • Start in monitor mode. Log what a new guardrail would block before turning it on, then tune it.
  • Return clear denials. Tell the agent why a call was blocked, so it can choose a different approach instead of retrying.
  • Log every decision. Allowed, denied, modified, and escalated calls are all evidence.

MCP gateway runtime guardrails checklist

  • Tool lists filtered by role and agent
  • Tool descriptions scanned when added and when changed
  • Argument rules for every write and execution tool
  • Prompt injection scanning on tool results
  • Data loss prevention on arguments and results
  • Rate limits and per-run caps on calls and cost
  • Approval steps for high-risk actions
  • Time-based rules for sensitive tools
  • Fail open or fail closed set per tool
  • Every decision logged and forwarded to the SIEM

How Airia enforces runtime guardrails at the MCP gateway

Airia applies runtime protection at the point where agents call tools:

  • Access by role, down to the argument. Airia’s MCP Gateway requires admin approval for MCP servers and sets access by role at the app, tool, and parameter level. The Dynamic MCP Gateway gives each team one address with a tool set matched to its role.
  • Scanning before tools reach agents. The gateway scans tool names and descriptions for prompt injection and respects read-only and destructive tool annotations.
  • Rules on every call. Rate limits, data handling rules, and time-based restrictions apply as calls happen, and every call is logged as succeeded, denied, or errored.
  • Inline security runbooks. Multi-step checks run at the moment an agent attempts a tool call and return resume, block, or escalate for human review, with every decision logged.
  • Fast content protection. Airia Secure blocks prompt injection in under 300 milliseconds and applies data loss prevention to AI traffic, including MCP server responses.
  • Deterministic limits. Agent Constraints enforce rules on what agents can do, separate from the model’s judgment.
  • Cost limits per run. Airia AI FinOps budgets every agent run, checked on every model call, tool call, and retry.

For more on how gateways fit together, see MCP gateway vs API gateway.

FAQ

What are MCP guardrails? MCP guardrails are policies that control how AI agents use MCP tools. Runtime guardrails check each tool call as it happens and can allow, block, modify, or escalate it.

What’s the difference between access control and runtime guardrails? Access control decides which tools an agent can reach. Runtime guardrails check each individual call, including its arguments, content, and context, while the agent is working.

Do runtime guardrails slow down AI agents? They don’t have to. Deterministic checks are nearly instant, and content scanning can be fast enough to run inline. Running cheap checks first keeps added latency low.

Can guardrails stop prompt injection through MCP tools? They reduce it significantly. Scanning tool descriptions and results catches many injection attempts, and deterministic limits on what agents can do keep a missed detection from turning into a harmful action.

Stop risky tool calls in the moment, not in the postmortem. Request a demo to see Airia’s MCP Gateway check, block, and escalate agent tool calls in real time.

Put these ideas to work.

Schedule a 30-minute walkthrough with our team.

Talk through your use case