MCP Gateway: Centralizing AI Agent Tool Access
An MCP gateway is the control layer between AI agents and the MCP servers they call. This guide covers the enterprise problems it solves, from tool sprawl and credential handling to per-consumer filtering, audit logging, Code Mode token savings, and air-gapped deployment.
TL;DR
- An MCP gateway is a control layer between AI agents and Model Context Protocol (MCP) servers that gives every client one endpoint with central authentication, tool filtering, and logging.
- The MCP specification makes authorization optional, so enterprises need a gateway to apply identity, least-privilege tool access, and audit trails consistently across servers.
- Bifrost filters MCP tools at three levels (client, request, and virtual key) and denies tools by default when a virtual key has no MCP configuration.
- Bifrost Code Mode cut input tokens by 92.8% and estimated cost from $377 to $29 on a 508-tool, 16-server benchmark, with a 100% task pass rate.
- Bifrost runs self-hosted inside the customer's VPC or a fully air-gapped network, so tool traffic, credentials, and logs stay in the customer's infrastructure.
An MCP gateway is the layer enterprises add once AI agents need governed access to more than a handful of tools. Each Model Context Protocol server brings its own credentials and tool list, and both multiply with every new team and coding agent. Bifrost, the open-source AI gateway built in Go by Maxim AI, includes the MCP gateway in the same gateway that governs model calls, so tool calls follow the same identity, access, and logging rules. This guide covers why direct connections break down at enterprise scale and how a gateway centralizes AI agent tool access.
What Is the Model Context Protocol?
The Model Context Protocol is an open standard that lets AI applications discover and call external tools, data sources, and prompts through a common client-server interface. An MCP client such as Claude Desktop or Cursor connects to MCP servers, and the model returns tool calls for the client to run.
Anthropic introduced MCP in November 2024, and in December 2025 the Linux Foundation formed the Agentic AI Foundation with MCP as a founding project. Three properties of the protocol matter for enterprise rollouts:
- Servers are independent. Each server publishes its own tools, and nothing coordinates permissions across servers.
- Authorization is optional. The MCP authorization specification makes authorization optional, and STDIO servers read credentials from the local environment.
- Tool definitions have a token cost. Every tool exposed to the model is described in its context.
Bifrost acts as both an MCP client and an MCP server: it connects to upstream servers over STDIO, HTTP, or SSE and exposes the aggregated tools to downstream clients.
What Is an MCP Gateway?
An MCP gateway is a control layer between MCP clients and MCP servers that exposes one endpoint where authentication, tool access policy, and logging are enforced for every tool call. Clients connect once to the gateway instead of configuring each server, and the gateway holds the upstream connections and credentials.
The MCP gateway topic page covers terminology; this post covers how one gateway centralizes tool access across teams.

Coding agents, desktop clients, and internal agents connect to one Bifrost MCP gateway endpoint, which applies auth, tool filtering, and logging before calling MCP servers
Figure 1: Clients configure one URL, and the gateway holds the server connections, credentials, and policy.
In Bifrost, the MCP gateway is built in rather than sold as a separate product. Bifrost serves connected tools at one /mcp endpoint, and the same virtual keys that scope model access also scope tool access. The open-source MCP gateway resource page walks through setup with npx or Docker, and the MCP Gateway product page covers the enterprise controls.
MCP Security and Governance Gaps Without a Gateway
Direct agent-to-server connections leave five gaps that grow with each new server: scattered credentials, no per-consumer tool scoping, no central record of tool calls, inconsistent approval, and a tool catalog that inflates every prompt. A gateway closes each gap at one enforcement point.
| Gap | With direct connections | What the gateway enforces |
|---|---|---|
| Tool sprawl | Each client keeps its own server list | Servers registered once, reached through one endpoint |
| Credential sprawl | Keys and tokens sit in local config files | Upstream credentials held by the gateway |
| Over-broad access | Every tool is available to every caller | Allow-lists per client, request, and virtual key |
| No audit trail | Each server logs separately, if at all | One tool call log plus signed change records |
| Token cost | Every definition rides on every turn | Narrowed tool lists, or Code Mode |
These gaps are why platform teams treat ungoverned MCP servers as a shadow IT risk.
MCP Gateway Architecture: How a Tool Call Is Governed
The gateway processes each tool call as a short pipeline: authenticate the caller, check the tool against that caller's allow-list, attach the right upstream credential, forward the call, and log the result. A call that fails any check is rejected before it reaches the MCP server.

An MCP tool call passes through caller authentication, the tool allow-list check, and upstream credential injection before reaching the MCP server, and the result is logged
Figure 2: A call that fails authentication or the allow-list never reaches the MCP server.
Bifrost applies this pipeline with a security-first default. When an application calls models through Bifrost, tool calls returned by the model are suggestions only; the application executes approved calls explicitly through a separate API call. Automatic execution is opt-in through Agent Mode, configured per tool.
When clients such as Claude Code connect to /mcp, the client runs the agent loop and owns the approval prompt. The comparison of an MCP gateway, an MCP proxy, and an MCP server explains where each component sits.
MCP Authentication for Clients and Servers
MCP authentication at a gateway runs in two directions: inbound, where clients prove who they are to the gateway, and outbound, where the gateway authenticates to each upstream server. Bifrost handles both, so upstream credentials never need to live on employee machines or in agent code.
Inbound. The mcp_server_auth_mode setting controls what /mcp accepts. In the default headers mode, clients send a virtual key. In oauth or both mode, Bifrost acts as an OAuth 2.1 authorization server, and interactive clients complete a browser consent flow to receive a short-lived JWT. The gateway authentication guide covers both modes.
Outbound. Bifrost supports eight upstream MCP authentication types:
| Auth type | Who authenticates | Typical use |
|---|---|---|
none |
Nobody | Public servers, local STDIO tools |
headers |
Admin, once | Shared API key or bearer token |
oauth |
Admin, once | A company-wide OAuth app |
client_credentials |
Bifrost as a registered client | Machine-to-machine servers |
aws_sigv4 |
Bifrost's AWS identity | Servers that require AWS IAM |
per_user_headers |
Each user, on first call | Personal API keys |
per_user_oauth |
Each user, on first call | Per-user accounts such as GitHub or Notion |
token_exchange |
Each caller, every call | Internal servers trusting the identity provider (Enterprise) |
Per-user credentials are stored against the caller's identity (SSO user, then virtual key, then session ID), and admins can revoke them on the MCP Sessions page. Token exchange stores no per-user credential at all.
Per-Consumer Tool Filtering and Access Control
Per-consumer tool filtering means each agent, team, or customer sees only the MCP tools it is approved to use, even on a shared endpoint. Bifrost applies three stacked filters, and a tool must pass every applicable filter before it reaches the model or can be executed.

The full MCP tool catalog is narrowed by client configuration, then request headers, then the virtual key allow-list, leaving only the tools the model receives
Figure 3: A tool must pass every applicable filter, and a header can narrow a key's allow-list but never widen it.
The three levels of MCP tool filtering work as follows:
- Client configuration.
tools_to_executeon each MCP server sets the baseline; an empty list exposes nothing. - Request headers.
x-bf-mcp-include-clientsandx-bf-mcp-include-toolsnarrow the set for one request. - Virtual keys. A key with no MCP configuration gets no MCP tools, except from servers marked Allow by Default. The allow-list is enforced again at execution, and expired keys receive a
403.
Per-virtual-key tool restrictions let a support agent read tickets without touching billing tools, while an admin key reaches everything. Virtual MCPs bundle tools from several servers behind a stable /mcp/<slug> endpoint reachable only through the keys attached to it.
Bifrost Enterprise adds access profiles that apply MCP policies to users, teams, and business units. The guide to MCP tool filtering and allowlisting for the enterprise covers rollout patterns.
The Token Cost of Large Tool Catalogs and MCP Code Mode
Every tool exposed to a model is described in its context on every turn, so input token cost grows with the size of the tool catalog rather than the work done. A gateway controls that cost two ways: filtering shrinks each consumer's tool list, and Bifrost Code Mode replaces direct tool exposure for large server sets.
With Code Mode, the model sees four meta-tools instead of every definition. It reads Python stubs for only the servers it needs, writes a short orchestration script, and Bifrost runs it in a sandboxed Starlark interpreter. Intermediate results stay in the sandbox; only the final result returns.

In classic MCP every model turn carries hundreds of tool definitions; in Code Mode the model sees four meta-tools and Bifrost runs the orchestration script in a Starlark sandbox
Figure 4: Code Mode cost tracks what the model reads, not how many tools are connected.
Bifrost benchmarked Code Mode against classic MCP across three rounds with the same query set:
| MCP footprint | Input tokens, classic | Input tokens, Code Mode | Change | Est. cost, classic vs Code Mode |
|---|---|---|---|---|
| 96 tools / 6 servers | 19.9M | 8.3M | -58.2% | $104.04 vs $46.06 |
| 251 tools / 11 servers | 35.7M | 5.5M | -84.5% | $180.07 vs $29.80 |
| 508 tools / 16 servers | 75.1M | 5.4M | -92.8% | $377.00 vs $29.00 |
Code Mode passed 100% of tasks in every round and is enabled per server, so small utilities can stay direct. The benchmark is detailed in the post on MCP access control, cost governance, and 92% lower token costs, and the Bifrost MCP Gateway overview shows how Code Mode fits with tool governance.
MCP Logging and Audit Trails
MCP logging at the gateway records every tool call in one place, so teams can see which caller ran which tool, with what result, and when. Bifrost keeps two separate records: MCP logs for tool traffic and audit logs for administrative changes.
- MCP logs. Built-in observability records MCP log entries alongside LLM logs, and selected request headers can be captured into their metadata to tie a call to a tenant or ticket.
- Audit logs (Enterprise). Signed audit logs record administrative activity with an HMAC signature, including events such as
mcp_client.createdandvirtual_mcp.updated, and can be archived to S3 or GCS.
MCP logs show what an agent did; audit logs show who granted it access. The guide to MCP gateway observability for every AI tool call covers dashboards and alerting.
Deploying an Enterprise MCP Gateway In-VPC or Air-Gapped
An enterprise MCP gateway has to run where the tools and data live, because tool calls carry sensitive payloads such as database rows and source code. Bifrost is self-hosted as a single binary on a virtual machine, Kubernetes, a private cloud, or a disconnected network.
Bifrost runs air-gapped by default: no prompts, responses, files, or telemetry leave the customer's infrastructure.
- In-VPC. Bifrost in-VPC deployments run on AWS, Google Cloud, and Azure, among other platforms, with network isolation.
- Air-gapped. The air-gapped deployment guide loads pricing datasheets and the MCP server catalog from local files.
- Compliance. Bifrost holds SOC 2 Type II, ISO 27001, HIPAA, and GDPR compliance; see the Bifrost Enterprise page.
Teams in regulated sectors can review the MCP gateway control guide for regulated industries.
Frequently Asked Questions
What is the difference between an MCP gateway and an MCP server?
An MCP server exposes tools, resources, and prompts from one system, such as GitHub or a database. An MCP gateway sits in front of many servers and adds one endpoint for clients, caller authentication, per-consumer tool filtering, upstream credential management, and central logging. Bifrost acts as an MCP client to upstream servers and as an MCP server to downstream clients.
Do I need an MCP gateway for a single MCP server?
A single developer with one local server usually does not. A gateway becomes necessary when teams share servers, when credentials should not sit on every client, or when different users must see different tools. The guide to connecting multiple MCP servers through one gateway shows the setup.
Is an MCP gateway the same as an API gateway?
No. An API gateway routes and secures HTTP requests to REST services. An MCP gateway understands MCP methods such as tools/list and tools/call, filters tool lists per caller, manages per-user credentials for upstream servers, and controls how many tool definitions reach the model. Bifrost governs MCP tool calls and LLM calls in one gateway.
How does an MCP gateway reduce token costs?
An MCP gateway reduces token costs by sending each model only the tools its consumer may use, rather than the full catalog. Bifrost adds Code Mode, which replaces direct tool definitions with four meta-tools and a sandbox. In a 508-tool benchmark, Code Mode cut input tokens by 92.8% and estimated cost from $377 to $29.
Does Bifrost execute MCP tool calls automatically?
Bifrost does not execute tool calls automatically by default. Tool calls returned by a model are suggestions, and the application executes approved calls through a separate API request. Agent Mode enables auto-execution only for tools an admin lists. When clients connect to the /mcp endpoint, the client application owns the approval step.
Is Bifrost an open source MCP gateway?
Yes. Bifrost's core is open source under Apache 2.0, including the MCP gateway, tool filtering, Virtual MCPs, and Code Mode. Bifrost Enterprise adds identity-based governance, token exchange, access profiles, signed audit logs, clustering, and in-VPC deployment, with a 14-day free trial.
Getting Started with Bifrost as Your MCP Gateway
An MCP gateway gives platform teams one place to register MCP servers, authenticate every agent, scope tools per consumer, and log every call, without moving data outside their infrastructure. Bifrost delivers this in the same gateway that governs model traffic. Start with the open-source MCP gateway setup guide, or book a demo to see how Bifrost centralizes AI agent tool access.