FISTA Solutions does not load Google Analytics until you accept. Rejecting keeps optional analytics off. Read the Cookie Policy.

All field notes

Playbook · 5 minute read

How to Build an MCP Gateway for Agent Governance

An MCP gateway sits between AI agents and MCP servers and enforces what the protocol does not: authenticating each agent, carrying the delegated user's context, authorizing every tool call against a registry and classification policy, pausing consequential actions for approval, applying rate limits and step budgets, and logging each call with a trace identifier for audit.

By FISTA Solutions· AI-Native Engineering Team·
How to Build an MCP Gateway for Agent Governance article cover

Model Context Protocol standardizes how agents reach tools. It does not decide which agent may call which tool on whose behalf, when a human must approve, or how the call is recorded. Those decisions need an enforcement point, and the MCP gateway is it. This playbook builds one, whether as a custom service or as the configuration of an adopted product. It applies the architecture in the Model Context Protocol for the enterprise whitepaper and the controls in MCP security risks.

Step 1: What must the gateway do?

ResponsibilityRequirement
Agent authenticationVerify each agent's workload identity; reject unregistered agents
Delegated contextAccept and validate the user's identity or token; attach it to every downstream call
Registry lookupResolve the requested server and tool; refuse anything not registered
AuthorizationCheck the agent's permissions for the tool and the tool's classification
Approval gatesPause consequential calls, notify approvers, resume or reject on decision
Rate limits and budgetsPer agent, per server, per tool; step budgets per task
LoggingAgent, user, server, tool, parameters (redacted), outcome, latency, trace identifier
ResilienceTimeouts, retries where safe, circuit breakers per server

Step 2: How should agent identity and delegation be handled?

Agents authenticate with a workload identity issued by the platform, never a static key. The user on whose behalf the agent acts is carried as a token the gateway validates and forwards, using token exchange where the identity platform supports it. The gateway rejects calls with no agent identity and, for user-scoped tools, calls with no delegated context. The model follows non-human identities for AI agents.

Step 3: Build the registry

The registry is a service the gateway reads from and the platform team writes to. For each server: identity and endpoint, owner, tools with schemas and classifications, permitted agents per tool, version, and status. Changes are reviewed and pushed to gateway instances; the gateway never routes to a server absent from the registry. The governance around it is described in how enterprise IT should govern MCP.

Step 4: Implement authorization by classification

ClassificationGateway behavior
ReadPass if the agent is permitted; log
Reversible writePass if permitted; flag a sample for review; log
Consequential writePass only if permitted and approved; otherwise pause

Permission is evaluated as the intersection of the agent's registered permissions and, where the server relies on the gateway for user scoping, the delegated user's entitlements from the identity platform. Policy is cached locally with push-based updates so no synchronous call to a policy service sits on the request path.

Step 5: How do approval gates work?

A consequential call is held with its full context (agent, user, tool, parameters, the agent's stated reason, and the trace of what it read) and routed to an approver queue. The approver sees the evidence, approves or rejects, and the gateway resumes or returns a rejection the agent must handle by escalating. Time limits expire held calls. The approval interface can be a dedicated queue or an existing workflow tool; the design follows human-in-the-loop AI explained.

Step 6: Add limits and resilience

Rate limits per agent, server, and tool protect downstream systems; step budgets per task stop runaway loops; timeouts and circuit breakers isolate a failing server so one outage does not take down every agent; and connection pooling keeps latency low. Never let an agent retry a consequential write automatically.

Step 7: Log for audit without creating a liability

Log every call with agent identity, delegated user, server, tool, redacted parameters, outcome, latency, and a trace identifier that links to the agent's reasoning trace and retrieved content. Redact parameters and results by data category; retain per policy; restrict access. The trail design is in how to build an AI audit trail.

Step 8: Keep the request path fast

Stateless gateway instances behind a load balancer; policy and registry cached and pushed; logging asynchronous; connections pooled; identity tokens validated locally with cached keys. A well-built gateway adds milliseconds, which is negligible against model inference. Measure it anyway: publish gateway overhead per call as a metric, because the first sign of a design mistake is overhead creeping up as policy grows, and the fix is far cheaper before agents depend on the path.

Streaming deserves a note. Some tools return large or incremental results; the gateway should pass streamed responses through without buffering them entirely, while still recording the call's metadata and outcome once the stream completes.

Step 9: Test the gateway itself

  • Unregistered agents and servers are rejected.
  • Permission denials return the correct error and are logged.
  • Consequential calls pause and resume correctly, including timeout expiry.
  • Rate limits and budgets trigger.
  • A server outage trips the breaker without affecting other servers.
  • Logs contain every required field with redaction applied.

Step 10: What is the rollout sequence?

  1. Deploy with logging only, routing one read-only server.
  2. Migrate agents to the gateway one at a time; compare behavior.
  3. Enable authorization in audit mode; review would-be denials.
  4. Enforce authorization; enable approval gates for consequential tools.
  5. Revoke direct agent-to-server access; the rollout is complete when no path bypasses the gateway.

What are the common mistakes?

  1. Synchronous policy or identity calls on the request path.
  2. A gateway that routes to unregistered servers for convenience.
  3. Approval gates in prompts rather than at the gateway.
  4. Unredacted logs.
  5. Direct paths left open after rollout.
  6. Approval queues nobody staffs, so consequential calls expire and agents learn to escalate everything.

How does FISTA Solutions help?

FISTA Solutions is an official Anthropic partner and builds or configures MCP gateways as part of its AI enablement practice, integrated with your identity platform and approval workflows, with forward deployed engineers migrating the first agents and servers. Every AI agent FISTA delivers runs through the gateway. FISTA has delivered 150+ projects for 50+ companies across 12+ countries with 99.9% uptime.

To stand up your gateway, message FISTA on WhatsApp, or read the MCP adoption checklist to see what else must be in place.

Share-ready article cover

Download the generated social format.

Download cover

Clear answers

Questions raised by this field note.

Straightforward guidance for evaluating scope, fit, and the next step.

01Do we need a gateway if we have only a few MCP servers?

Yes, once any server touches a system of record. The gateway is where identity, authorization, approval gates, and audit live; without it those controls are implemented per server, inconsistently, and nobody can list which agents reach which systems. Standing it up before the second server is far cheaper than retrofitting.

02How does the gateway know which tools are consequential?

From the registry, where each server's tools are recorded with a classification set by the system owner and approved by security for consequential actions. The gateway reads that classification on every call to decide whether to pass the call, sample it, or pause it for human approval.

03How much latency does a gateway add?

Milliseconds, if built correctly: policy is cached locally and pushed on change, logging is asynchronous, and connections to servers are pooled. Latency problems come from synchronous calls to identity or policy services on the request path, which the design avoids.

04Should we build or adopt a gateway?

Adopt if a product covers your identity integration, classification- based authorization, approval gates, and logging needs; build if your delegation model, residency, or approval workflow requirements are unusual. Either way, the policy decisions, classification, gates, and logging fields remain yours.

Start with the hard problem

Need the outcome owned, not merely analyzed?

Tell us where delivery is constrained. We’ll map the fastest credible path from intent to verified production.

Start a project