Why MCP Gateway Least-Privilege Is a Security Architecture Decision Not a Configuration Task
Enterprise agents need an enforcement point outside the model, designed before deployment.

Securing enterprise agents requires an MCP gateway that enforces tool-level permissions outside the model, binds each agent to a distinct identity, and issues short-lived credentials for approved actions. An MCP gateway with OAuth and tool-level role-based access control must separate authentication from authorization on every call. Least-privilege is therefore a security architecture decision that must precede deployment.
Why the model cannot be the enforcer
A poisoned tool description persuades an agent to request an action it should not perform. If the agent holds a long-lived credential and the tool server leaves caller identity unchecked, that request can become an operation against a production system. The failure begins before the tool executes. Authority has been handed to the component that processes untrusted instructions, with no independent decision between its request and the system it can change.
User prompts, tool descriptions, and tool responses all enter the model’s context window. The model has no reliable mechanism for distinguishing a legitimate instruction from a crafted one simply because both arrive as text. Better instructions can guide what the model does, but they cannot take the place of an authorization boundary. Prompt injection becomes a denied request rather than a compromise only when something outside the model intercepts the call and has the authority to refuse it.
What a gateway actually does that a model cannot

A gateway supplies that independent refusal point. It evaluates each tool call against an explicit allow-or-deny rule before execution. The agent submits intent, after which the gateway validates the call’s shape, the policy engine decides, a scoped credential is minted, an ephemeral runner executes, and an audit record is written. The agent proposes the action rather than controlling these downstream decisions. That separation is the architecture’s central safeguard.
Credential handling makes the boundary concrete. Instead of forwarding an agent’s standing credential, the gateway exchanges authentication for a short-lived token scoped to the approved tool and argument set. API keys, cloud credentials, and service tokens stay in a server-side vault, outside the model’s context. The authority to read deployment status differs from the authority to delete a deployment. Verb-class scoping prevents permission for the first from silently becoming permission for the second.
The same boundary determines what happens when a new tool appears. Under default-deny policy, a tool without an explicit rule is unreachable, rather than available until someone remembers to restrict it. This reverses the default-open posture described in the MCP pattern. Discovery does not itself confer permission to execute. The gateway can therefore reject an unauthorized request even when the model has been persuaded that making it is a splendid idea.
Why identity must be designed in, not assigned later
An authorization rule needs a subject it can distinguish. When every agent uses a shared service account, the gateway cannot use that account to give each agent separate permissions or tell which workload took an action. Fine-grained rules then rest on coarse-grained identity. Each agent instead needs a persistent, unique, cryptographic identity tied to the company’s existing identity provider before it reaches production.
MCP’s June 2026 Enterprise-Managed Authorization stabilization formalizes enterprise identity providers, such as Okta, as the authoritative provisioner for human access to MCP servers. Work on standardized workload identity and agent delegation in the specification is still underway. Existing identity-provider integration therefore leaves open how agents get authority and pass it on. The gateway architecture must account for that gap.
When Agent A asks Agent B to act, the delegated token must grant less authority than Agent A possesses and specify the tool, resource, operation, and expiry. Reading a ticket must not become unrestricted ticket access. OAuth authentication establishes who is calling, while tool-level role-based access control determines what that caller may do.
The three threat classes that make least-privilege non-optional
Prompt injection and tool poisoning attack the model’s choice of action. A malicious tool description may still persuade it to request an operation, even when a gateway is present. The gateway must reject the request unless policy permits it. This containment also exposes the cost of excessive permissions, because a harmful request already allowed by policy will not become forbidden merely by passing through an enforcement point.
Data exfiltration through MCP channels attacks what the agent can expose. Credential isolation addresses this threat at a different layer by keeping raw secrets out of the context window. A secret that is kept out of that context cannot leak through it, and tool and resource permissions still determine which data the agent can access.
Runaway sessions use authority that stays available after a bounded task ends. Short-lived, task-scoped credentials limit how long that authority can sustain activity. Credential expiry provides a lifecycle control that ends the credential’s authority to sustain the loop. Together, the threat classes require policy enforcement, credential isolation, and bounded sessions. No single “secure MCP” setting can replace the design.
Shadow MCP as the architecture problem that precedes all others
A gateway governs only requests routed through it. The Coalition for Secure AI’s MCP security analysis describes unauthorized, unmonitored server instances as blind spots that raise the risk of undetected compromise and covert data exfiltration. Shadow MCP develops much like shadow IT, as teams stand up useful services without entering a governed registry. The shortcut bypasses more than an administrative process. It removes the enforcement point and leaves the model making access decisions again.
Delegating scope configuration to engineering teams has a legitimate strength. Those teams know the tools and operations their workloads need, so they can contribute precise rules. Local configuration cannot, however, set a common boundary for servers it does not reach. Nor does it create shared identity, credential lifecycle, or audit controls by itself.
A centrally maintained registry connects that local knowledge to a governed access path. Inventory identifies the servers and agents already running, including shadow deployments, so access can move through the gateway with per-agent tool allowlists and audit logging. Unknown routes cannot remain convenient exceptions to the boundary. Pre-approved paths also reduce the pressure to bypass governance. They can make onboarding take hours rather than weeks, giving teams a usable official route.
What the policy layer must express before agents touch production
“This agent may use MCP” grants access without defining its limits. A defensible rule names the agent, tool, operation, resource scope, data classification, and expiry. Role membership alone is not the complete decision. Open Policy Agent, or OPA, provides an external policy decision point so those rules can change without redeploying agent workloads. The gateway enforces the decision, while application code remains separate from the policy that constrains it.
The Rego example makes that discipline visible through default allow := false. Every tool starts closed until a rule opens it. Its read verbs, including get, list, describe, and logs, are allowed for authenticated sessions, while mutating verbs such as create, update, restart, and deploy require fresh approval and a scope match, with dry-run-first for destructive operations. If OPA is unreachable, nothing executes.
The policy still needs to account for resource scope and data classification, even for read access. Irreversible writes, financial transactions, and production infrastructure changes need fresh approval within a bounded window each time, with no standing permission. That window is an explicit policy parameter. The practical response to policy-development cost is to begin with a small, low-risk, read-only tool set and expand from observed use, rather than grant broad access and promise restraint later.
Observability as the enforcement layer's proof of function
A team that cannot see what its gateway accepted and denied cannot know whether least-privilege is functioning. An audit trail provides evidence of enforcement through attributable records of both permits and denials. Without them, a mistaken rule can look like a working control, and the team cannot connect its written policy to the decisions made at runtime. Governance without that evidence is an assertion.
The MCP specification update of 2026-07-28 deprecated protocol-level logging. OpenTelemetry’s GenAI semantic conventions include a dedicated MCP section with defined span names, attributes, and metrics. Full-stack traces connect the agent’s selected tool and exact arguments through the MCP server to what actually ran. Policy denials also need records that support examination of the rejected request.
The records must reach the customer’s own observability stack. That places audit evidence under the controls governing the enterprise’s other systems of record. The trace must cross the enforcement boundary. A record of what the model intended is insufficient without evidence of what the gateway allowed and what executed. Telemetry completes the architecture by making those distinctions inspectable.
How do teams implement this architecture in practice?
Speakeasy’s enterprise MCP gateway implements this request path by evaluating policy on every tool call, binding persistent agent identities to the existing identity provider, and issuing short-lived, task-scoped credentials without exposing raw secrets to agents. It combines a governed server registry and shadow MCP discovery with decision logs sent to the customer’s observability stack, addressing the routing, identity, credential, and evidence gaps that local scope configuration alone cannot close.
Red Hat Connectivity Link offers another route into the pattern. Connectivity Link 1.4 includes an MCP gateway as a Technology Preview. Red Hat’s January 2026 guidance describes MCP-as-a-Service as a longer-term vision for centrally hosting, observing, and auditing MCP servers. The release status is an important qualification. This is platform-level productization of the gateway approach.
systemprompt.io describes an integrated governance platform with per-server OAuth2 scoping, tool-call audit trails, secret isolation, rate limiting, and a central registry. Those capabilities address several of the same structural requirements. They do not establish every buyer criterion by themselves. Per-server OAuth2 scoping and OAuth support with role-based access control for individual tools make distinct claims, so an evaluation must distinguish the authentication version, permission granularity, and delegation behavior.
An OPA-based self-build gives teams direct control over policy through an open-source pattern with Rego rules in source control and a thin gateway enforcement layer. That control comes with engineering work. Teams need to set aside time to develop policy, integrate the gateway, wire up the vault, and set up observability. Teams operating fewer than roughly ten MCP servers may find that burden disproportionate. Across these options, a complete OAuth and tool-level access control comparison requires verification of those specific claims.
What to design in before the first agent reaches production
For a team moving into production, the next step is to settle the enforcement model before provisioning access. Place the gateway ahead of every production system the agents can reach, without temporary bypass routes. Issue each agent a unique, persistent, cryptographic identity tied to the existing identity provider, and retire shared service accounts from the agent fleet. Make credential issuance conditional on an approved call. Keep credentials short-lived and task-scoped, and use network policy to keep agents from reaching the vault rather than relying on a convention that they leave it alone.
Set the registry and tool policy to deny by default. Unknown servers must be unreachable, and undeclared tools must remain denied until verified need justifies access. Establish observability before writing production policy, then expand incrementally from a read-only baseline. These decisions define the target architecture, but discovery determines where rollout starts. Before routing traffic or granting access, list every MCP server and agent already running, including the ones nobody asked permission to deploy.


