DEV Community

Cover image for How to Secure and Route MCP Servers in Enterprise Environments
Kuldeep Paul
Kuldeep Paul

Posted on

How to Secure and Route MCP Servers in Enterprise Environments

How to Secure and Route MCP Servers in Enterprise Environments

TL;DR

  • Securing and routing MCP servers requires shifting from fragmented, direct agent-to-tool connections to an enterprise AI gateway that centralizes authentication, routing, and policy enforcement.
  • Point-to-point Model Context Protocol implementations introduce severe attack vectors, including prompt injection via untrusted tool outputs, token exfiltration, and confused deputy escalation.
  • Bifrost operates as both an MCP client and an MCP server, establishing virtual keys, tool group allowlists, and execution sandboxes that isolate sensitive enterprise infrastructure.
  • Beyond runtime traffic, Bifrost Edge extends gateway governance to workstations, discovering shadow MCP servers across desktop tools, coding assistants, and local CLI agents.

Connecting autonomous AI agents directly to internal databases, cloud APIs, and developer environments introduces an unmanaged attack surface, as baseline Model Context Protocol connections lack native enterprise access controls, centralized authentication, and unified audit logs. To secure and route MCP servers effectively, platform engineering teams must introduce an intermediary control plane between consuming AI clients and upstream infrastructure. Bifrost, an open-source AI gateway developed in Go by Maxim AI, provides a centralized architecture to manage MCP traffic, enforce policy boundaries, and route tool invocations across multi-tenant production systems. This guide explores the architectural blueprints, identity standards, and runtime controls required to deploy and operate secure MCP servers across enterprise networks.

The Enterprise Challenge: Why Direct MCP Connections Fail

Direct, unmediated connections between AI agents and Model Context Protocol (MCP) servers create architectural fragmentation, credential sprawl, and unmonitored execution pathways across internal networks. When developer tools or production agents connect directly to individual tool servers via standard input/output (stdio) or raw HTTP endpoints, security teams lose visibility into which actions are executed, whose credentials are used, and what enterprise data enters model context windows.

Direct Agent Connections (Fragile & Ungoverned):
[Claude Code / Cursor] ---- (stdio / raw tokens) ----> [Internal DB MCP Server]
[Custom Agent]         ---- (unscoped API key)  ----> [GitHub MCP Server]
[Desktop Chat App]     ---- (unmonitored HTTP)   ----> [Cloud Infrastructure MCP]

Governed MCP Gateway Architecture:
[AI Clients & Agents]  ==== (Virtual Keys / SSO) ====> [ Bifrost MCP Gateway ]
                                                             |
                                           +-----------------+-----------------+
                                           | (Scoped RBAC)   | (Sandboxed)     | (Audit Logged)
                                           v                 v                 v
                                      [Database MCP]   [GitHub MCP]     [Cloud API MCP]
Enter fullscreen mode Exit fullscreen mode

The Model Context Protocol has emerged as an open standard for interconnecting Large Language Model (LLM) agents with operational data stores, API connectors, and execution environments. However, the base protocol specification defines standard JSON-RPC 2.0 message formats, leaving identity federation, rate limiting, and access control to the host application.

When organizations scale tool usage without an intermediary MCP gateway, three fundamental failure modes arise:

  1. Credential Proliferation: Local agent setups frequently store long-lived cloud credentials and database connection strings in unencrypted configuration files on employee laptops or ephemeral containers.
  2. The N×M Integration Bottleneck: Ten client interfaces connecting to thirty distinct tool servers generate three hundred point-to-point connections, each requiring manual updates whenever an API schema, transport protocol, or endpoint address changes.
  3. Context Window Contamination: Exposing complete, unfiltered tool catalogs to LLMs exhausts model context windows, introduces high token costs, and degrades agent reasoning accuracy before any user query begins processing.
Architectural Dimension Direct Point-to-Point MCP Governed AI Gateway (Bifrost)
Authentication Model Static API tokens and hardcoded secrets Enterprise IdP (OIDC/SAML) and scoped virtual keys
Tool Surface Exposure All server tools exposed unconditionally Role-based tool filtering and virtual MCP server groups
Execution Boundary Direct host or container process execution Policy-mediated dispatch, sandboxing, and Code Mode
Audit Trails Fragmented client-side logs or none Centralized, immutable JSON request and execution logs
Network Footprint Arbitrary egress from desktop apps and agents Controlled ingress/egress within private VPC subnets

To overcome these structural risks, enterprise architectures isolate backend systems behind a reverse proxy that normalizes transports, validates incoming requests, and filters tool definitions before they reach the model.

A cross-section visual metaphor of an intricate layered glass and steel filter chamber, sorting glowing raw crystalline

Threat Modeling: Vulnerabilities in Unmanaged MCP Infrastructure

Treating an MCP server as a passive API endpoint overlooks the reality that autonomous AI agents invoke tools probabilistically rather than deterministically. Threat actors target the boundary between external model generation and internal tool execution through distinct attack vectors documented across the OWASP Top 10 for Large Language Model Applications.

Adversarial Threat Vectors in MCP Tool Calling:

 [ Attacker ] --(Indirect Prompt Injection via Web/DB)--> [ Agent Context Window ]
                                                                   |
                                                      (Subverted Tool Call)
                                                                   v
                                                     [ Bifrost Policy Firewall ]
                                                      |                       |
                                     (Blocks: Destructive Tool)    (Sanitizes: Leaked Secrets)
                                                      |                       |
                                                      x                       v
                                            [ Production Server ]    [ Approved Read-Only Tool ]
Enter fullscreen mode Exit fullscreen mode

Indirect Prompt Injection via Tool Outputs

When an agent calls an MCP tool to fetch third-party content (such as customer emails, ticket threads, or scraped web pages), an attacker can embed hidden instructions within that data payload. If the agent processes this unvalidated payload, the injected instructions can override system prompts, instructing the agent to invoke secondary, privileged tools (such as deleting database records or transmitting private keys to an external server).

Confused Deputy Escalation and Token Passthrough

In unhardened architectures, an MCP server may accept a client request and blindly pass the caller's broad identity token to downstream enterprise APIs. This creates a classic confused deputy vulnerability: an agent manipulated by prompt injection executes actions that the human user theoretically has permissions for, but never intended to trigger. Securing this boundary requires that downstream credentials remain strictly isolated within the gateway infrastructure, binding agents to narrow, task-specific privileges.

Tool Poisoning and Rug-Pull Attacks

Tool definitions contain natural language descriptions that guide LLM reasoning regarding when and how to invoke functions. In unmonitored environments, a modified or rogue MCP server can alter its tool schema descriptions post-installation, subtly directing the model to route sensitive user queries through malicious parameters. Without gateway-level schema pinning and description validation, automated agents cannot detect this semantic drift.

Context-Exhaustion Denial of Service

Every tool registered with an MCP client adds JSON Schema definitions directly into the prompt context. According to industry analyses of tool-augmented workflows, registering multiple complex servers can consume tens of thousands of tokens before user input is evaluated. This state-bloat increases execution latency, degrades model attention, and drives excessive API spend.

Core Architecture: How to Secure and Route MCP Servers

Centralizing tool operations requires an infrastructure component capable of mediating between diverse client interfaces and heterogeneous tool environments. Bifrost addresses this by functioning simultaneously as an MCP client to upstream tool infrastructure and an MCP server to consuming downstream clients.

+-----------------------------------------------------------------------------------+
|                            Downstream AI Consumers                                |
|          (Claude Desktop, Cursor, Custom Agent Frameworks, Terminal CLIs)         |
+-----------------------------------------------------------------------------------+
                                          |
                        HTTP / SSE with Virtual Key Auth
                                          v
+-----------------------------------------------------------------------------------+
|                         Bifrost AI & MCP Gateway                                  |
|                                                                                   |
|   +-----------------------+   +-----------------------+   +-------------------+   |
|   | Authentication Engine |   | Tool Group Filter     |   | Policy Firewall   |   |
|   | (OIDC, Virtual Keys)  |   | (Role-Based Scoping)  |   | (Guardrails/PII)  |   |
|   +-----------------------+   +-----------------------+   +-------------------+   |
|                                                                                   |
|   +---------------------------------------------------------------------------+   |
|   | Execution Orchestration: Classic Agent Mode vs. Sandboxed Code Mode       |   |
|   +---------------------------------------------------------------------------+   |
|                                          |                                        |
|                          Internal Upstream Client Pool                            |
+-----------------------------------------------------------------------------------+
             |                                 |                             |
      Streamable HTTP                        SSE                         stdio / IPC
             v                                 v                             v
+------------------------+        +------------------------+      +--------------------+
| Enterprise Git Server  |        | Production SQL Gateway |      | Local Shell Runner |
+------------------------+        +------------------------+      +--------------------+
Enter fullscreen mode Exit fullscreen mode

The Dual Client-Server Topology

By implementing both sides of the Model Context Protocol specification, Bifrost terminates inbound client connections, inspects and normalizes payloads, and maintains persistent outbound connection pools to backend tool servers. Downstream tools connect to a single unified endpoint (such as https://gateway.enterprise.internal/mcp). The gateway discovers backend tools automatically via tools/list, exposes only sanctioned functions to authorized callers, and proxies execution calls via tools/call.

This design decouples developer clients from infrastructure details:

  • Transport Translation: Bifrost translates local stdio subprocess calls into managed HTTP or Server-Sent Events (SSE) connections, allowing teams to containerize tool servers in isolated subnets while presenting standard interfaces to local workstations.
  • Connection Multiplexing: Rather than having fifty agent sessions open independent database connections, Bifrost manages a shared, authenticated connection pool, eliminating upstream resource exhaustion.
  • Unified Policy Plane: Every request, regardless of originating client or target tool, passes through a single control point where rate limits, content guardrails, and audit logs are consistently evaluated.

Platform teams can configure upstream MCP server connections directly via configuration or dynamic admin APIs:

{
  "mcp_servers": {
    "enterprise_github": {
      "transport": "http",
      "url": "https://mcp-git.internal.net/mcp",
      "auth": {
        "type": "bearer",
        "token_env": "GITHUB_MCP_SECRET"
      },
      "timeout_seconds": 30
    },
    "customer_postgres": {
      "transport": "http",
      "url": "https://mcp-db.internal.net/sse",
      "auth": {
        "type": "headers",
        "headers": {
          "X-Internal-Service": "bifrost-production"
        }
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Identity and Authentication: Bridging Enterprise IdPs to Tool Execution

Securing MCP servers requires eliminating static API keys from configuration files and binding every tool interaction to an authenticated enterprise identity. Gateways achieve this by integrating directly with enterprise Identity Providers (IdPs) like Okta and Microsoft Entra ID through OpenID Connect (OIDC) and OAuth 2.0 with PKCE.

OAuth 2.0 PKCE / OIDC User Authentication Flow:

[ Developer / Workstation ]
         |
         | 1. Connects to Bifrost Gateway Endpoint (/mcp)
         v
[ Bifrost MCP Gateway ]
         |
         | 2. Initiates Browser SSO Challenge (PKCE)
         v
[ Enterprise IdP (Okta / Entra ID) ]
         |
         | 3. Authenticates User & Issues Scoped Identity Token
         v
[ Bifrost MCP Gateway ]
         |
         | 4. Maps Identity to Virtual Key & RBAC Policy
         v
[ Upstream MCP Tool Execution Pool ]
Enter fullscreen mode Exit fullscreen mode

When an engineer accesses internal tools through an editor or desktop application, Bifrost handles authentication out-of-band via browser-based SSO, as documented in the Bifrost MCP authentication guide. The gateway exchanges the verified IdP assertion for an internally tracked virtual credential, ensuring no long-lived backend tokens reside on the client device.

At the core of this access model are virtual keys. A virtual key acts as an abstracted access token assigned to a specific user, team, or automated service account. Rather than granting unrestricted infrastructure access, a virtual key defines:

  • Maximum Spend and Token Budgets: Hard or soft financial quotas configured on daily, weekly, or monthly intervals.
  • Provider and Model Restrictions: Explicit limits dictating which foundation models can be queried.
  • Tool Allowlist Boundaries: Exact assignments of which MCP tools and resources the keyholder is permitted to discover and invoke.

If a project's scope changes or a developer machine is decommissioned, administrators revoke or modify the virtual key centrally, terminating access across all underlying tool servers instantly.

Policy Enforcement: Tool Filtering, Virtual Keys, and Virtual MCPs

Enterprise environments rarely operate on a one-size-fits-all permission structure. An AI coding assistant utilized by a junior software engineer should not have access to production deployment tools, and an internal customer support bot must never invoke destructive database operations. Securing MCP servers requires granular, action-level policy enforcement.

Hierarchical Tool Authorization Flow:

[ Incoming tools/call Request ]
               |
               v
  [ Virtual Key Active? ] -------- No --------> ( 401 Unauthorized )
               |
              Yes
               v
  [ Tool in Allowed Group? ] ----- No --------> ( 403 Forbidden: Tool Blocked )
               |
              Yes
               v
  [ Rate & Budget Checked? ] ----- No --------> ( 429 Quota Exceeded )
               |
              Yes
               v
  [ Input Guardrails Cleared? ] -- No --------> ( 400 Bad Request: Policy Violation )
               |
              Yes
               v
  [ Dispatch to Upstream MCP Server ]
Enter fullscreen mode Exit fullscreen mode

Bifrost implements policy enforcement through a tiered filtering hierarchy:

  1. Client Configuration Filtering: The consuming client specifies a requested subset of tools.
  2. Dynamic Request Headers: Intermediate routing scripts specify tool scopes per task.
  3. Virtual Key Ceilings: The gateway enforces an authoritative, deny-by-default allowlist mapped to the client's virtual key. Even if a client requests access to a destructive command, the gateway strips the definition from discovery and rejects direct invocation attempts.

For enterprise teams managing hundreds of microservices, managing individual tool permissions across thousands of virtual keys becomes unmaintainable. Bifrost resolves this through MCP tool groups (also known as Virtual MCP servers). Administrators assemble discrete tools into functional sets, exposing distinct virtual endpoints to specific teams.

User / Role Category Target Virtual MCP Endpoint Permitted Tools Forbidden Capabilities
Frontend Engineering /mcp/teams/frontend github_read_repo, jira_create_ticket, figma_inspect Shell execution, SQL write operations
Data Platform Leads /mcp/teams/data-core bigquery_query, s3_read_metadata, dbt_run IAM policy modification, cluster deletion
Automated SRE Agent /mcp/agents/triage datadog_get_metrics, pagerduty_ack, k8s_get_logs Secret decryption, namespace deletion
Customer Support Agent /mcp/agents/support zendesk_read_ticket, knowledge_base_search Raw database queries, customer data export

Administrators manage these boundaries declaratively using access profiles that automatically synchronize group memberships from enterprise directory services like Okta or Azure AD.

Runtime Security: Guardrails, Secrets Detection, and Prompt Sanitization

Static authorization controls protect the perimeter, but runtime security controls are necessary to inspect what passes through those boundaries. Because an MCP tool call converts unstructured natural language into structured API arguments, gateways must validate both inbound tool parameters and outbound execution outputs.

Runtime Policy Inspection Engine:

                 [ LLM Invocations & Arguments ]
                               |
                               v
               +-------------------------------+
               |   Bifrost Security Firewall   |
               +-------------------------------+
                 /             |             \
                /              |              \
               v               v               v
     [ Gitleaks Engine ] [ Regex / PII ] [ Content Safety ]
     (Detect API Keys)   (Redact SSN/Data)(Prevent Injection)
                \              |              /
                 \             |             /
                  v            v            v
               +-------------------------------+
               | Decision: Approve or Redact   |
               +-------------------------------+
                               |
                               v
                 [ Execution to Target MCP ]
Enter fullscreen mode Exit fullscreen mode

Inbound Parameter Validation

Before forwarding a tools/call payload to an internal service, Bifrost guardrails execute real-time content checks. Using integrated secrets detection powered by Gitleaks algorithms, the gateway scans tool arguments for exposed private keys, OAuth tokens, and environment variables. If a developer accidentally prompts an agent to commit code containing an AWS secret key, the gateway intercepts and blocks the call before payload transmission.

Custom regular expression engines allow compliance officers to enforce custom regex guardrails that detect and redact Personally Identifiable Information (PII) such as Social Security numbers, credit card tokens, and internal server IP addresses. Organizations operating in regulated industries can route tool payloads through third-party safety providers like AWS Bedrock Guardrails, Azure Content Safety, or Patronus AI directly from the gateway pipeline.

Outbound Output Sanitization

Tool responses returning from enterprise backends are equally susceptible to risk. An unrestricted database query executed by an MCP server might retrieve columns containing hashed passwords, customer telephone numbers, or confidential salary data.

Through centralized governance and data access control, Bifrost applies output masks, redacting sensitive fields before the payload is injected back into the LLM context window.

Enterprise Compliance and Immutable Audit Logs

Demonstrating compliance with frameworks such as SOC 2 Type II, HIPAA, and GDPR requires verifiable records of agent activities. Traditional API proxies record network-level metadata (such as HTTP method and response status), which fails to capture agent context.

Bifrost records structured audit logs that correlate every tool execution with:

  • The human principal authenticated via SSO
  • The active virtual key and client application
  • The exact prompt context that triggered the tool call
  • The JSON parameters supplied to the tool
  • The payload returned by the MCP server
  • Execution duration, token consumption, and financial cost

These logs can be streamed directly to external SIEM systems, BigQuery, or Amazon S3 using automated log exports, providing continuous visibility for enterprise security teams.

Optimizing Tool Routing and Latency: Agent Mode vs. Code Mode

When deploying an MCP gateway, performance overhead is an engineering priority. In agentic workflows, an LLM may chain dozens of tool calls sequentially to resolve a single operational issue. If gateway processing introduces high latency, the compound delay becomes unusable.

Bifrost is implemented in Go to minimize transit overhead. In sustained, published benchmarks, Bifrost adds only 11 microseconds of internal overhead per request at 5,000 requests per second. This sub-millisecond execution profile ensures that adding policy evaluation, rate limiting, and audit logging into the execution path does not degrade application performance.

Beyond raw throughput, enterprise teams must address the token overhead of tool catalogs. Bifrost supports two distinct operational modes for handling tool calls, as documented in the Bifrost tool execution architecture:

Classic Agent Mode (Iterative & Chatty):
Agent ---> Gateway ---> Tool 1 ---> Agent ---> Gateway ---> Tool 2 ---> Output
(Every single call consumes multiple network hops and context re-injections)

Code Mode (Sandboxed Orchestration):
Agent ---> Writes Python Script ---> Gateway Sandbox ---> Executes Tools 1 & 2 Locally ---> Returns Output
(Single network hop, state isolated in sandbox, up to 50% fewer tokens)
Enter fullscreen mode Exit fullscreen mode

Agent Mode (Classic Tool Calling)

In standard Agent Mode, the gateway acts as an intelligent proxy. The LLM evaluates available tool schemas, issues a structured tool call request, waits for the gateway to execute the command on the target server, receives the raw output in context, and determines the next step.

While straightforward, this chatty, back-and-forth orchestration consumes thousands of input tokens on each loop as intermediate state accumulates in the prompt history.

Code Mode (Programmatic Sandboxed Orchestration)

To overcome context bloat, Bifrost introduces Code Mode. Rather than forcing the model to call five tools through five distinct round trips, the model receives simplified tool interfaces and writes a small Python script to orchestrate execution logic directly.

The gateway executes this script within an isolated execution sandbox:

  • Token Reductions: Intermediate data (such as a 10MB JSON database dump) is processed and filtered inside the execution environment rather than returned into the LLM context window. This architecture delivers 50% or greater token savings across complex workflows.
  • Latency Improvements: By executing control logic, loops, and conditional formatting locally, Code Mode reduces end-to-end execution latency by approximately 40%.
  • Deterministic Guarding: Scripts execute under strict CPU, memory, and network constraints, preventing runaway loops from consuming unmetered cloud resources.

Extending Governance to Employee Endpoints with Bifrost Edge

Enterprise governance often breaks down at the endpoint. While platform teams can route server-side agent workloads through a central gateway, employees frequently install desktop applications (like Claude Desktop or Cursor) or run terminal CLI utilities (such as Claude Code) directly on local laptops.

A vast modern architectural workspace seen from an elevated perspective, where subtle translucent light conduits connect

These local tools establish unaudited stdio subprocesses or outbound network connections to unreviewed tools, introducing shadow AI and ungoverned MCP servers across the fleet. Beyond routing, Bifrost applies governance and security controls (virtual keys, budgets, guardrails, audit logs) centrally, and Bifrost Edge extends that same governance and security to AI traffic on employee machines, with endpoint enforcement on each device.

AI Gateway + Bifrost Edge Combined Governance Model:

+-----------------------------------------------------------------------------------+
|                        Central Control Plane (Bifrost Gateway)                    |
|       - Policy Engine: Define Virtual Keys, Spend Quotas, Content Guardrails      |
|       - Approvals Dashboard: Approve or Block Newly Discovered MCP Servers        |
+-----------------------------------------------------------------------------------+
                                          ^
                                          | Policy Sync & Audit Logs
                                          v
+-----------------------------------------------------------------------------------+
|                        Employee Workstations (Bifrost Edge)                       |
|                                                                                   |
|  [ Claude Desktop / Cursor ]    [ Local CLI Agents ]     [ Browser AI Surfaces ]  |
|              \                          |                           /             |
|               v                         v                          v              |
|        +-------------------------------------------------------------+            |
|        |           Bifrost Edge Local Policy Interceptor             |            |
|        |     (Enforces Gateway Policies Directly on Machine)         |            |
|        +-------------------------------------------------------------+            |
|                                         |                                         |
|                   Disallows Unauthorized Tools / Routes Approved                  |
|                                         v                                         |
|                           Corporate Network Boundary                              |
+-----------------------------------------------------------------------------------+
Enter fullscreen mode Exit fullscreen mode

The Combined Architecture: AI Gateway + Bifrost Edge

Bifrost Edge (currently in early access alpha) is the endpoint extension of the Bifrost gateway platform. The central gateway remains the policy definition engine and control plane, while the Edge lightweight client operates locally on macOS, Windows, and Linux devices.

Instead of requiring individual developers to configure proxy base URLs or copy tokens into settings menus, Edge captures local AI traffic transparently at the operating system layer:

  • Shadow MCP Discovery: As detailed in the Bifrost Edge MCP governance documentation, the agent inspects configuration registries used by tools like Claude Desktop, Claude Code, Cursor, and Gemini CLI, constructing an accurate catalog of all configured MCP servers across the enterprise.
  • Enforced Allow/Deny Lists: Administrators review discovered tools in a centralized console. If an unapproved MCP server is denied, Edge blocks the execution process on the endpoint, preventing unvetted code from running locally.
  • SSO Without Secret Leakage: When an employee boots their machine, they authenticate once through the browser using corporate SSO. Edge retrieves the user's active virtual key and applies matching budget limits and guardrails across both desktop chat and terminal coding sessions.
  • Fleet-Wide MDM Rollout: IT and security administrators distribute Edge silently using standard Mobile Device Management (MDM) platforms, including Jamf, Microsoft Intune, Kandji, Omnissa Workspace ONE, and JumpCloud, as detailed in the Edge MDM deployment guide.

This combined model ensures that developers retain access to the coding assistants they prefer while platform teams maintain full visibility, policy boundaries, and audit controls.

Implementation Guide: Deploying a Governed MCP Gateway

Deploying an enterprise-ready MCP routing topology involves connecting upstream tool resources, defining governance boundaries, and exposing a hardened gateway endpoint to client tools. The following steps illustrate a production rollout using Bifrost.

Step 1: Deploy Bifrost in Your Infrastructure

Bifrost is distributed as a lightweight, compiled Go binary that can be deployed standalone, within Docker containers, or across Kubernetes clusters in private enterprise subnets. For strict regulatory compliance, teams can run Bifrost using in-VPC deployments with zero external egress.

To initialize Bifrost using Docker with basic configuration:

# Pull and start the Bifrost gateway container
docker run -d \
  --name bifrost-gateway \
  -p 8080:8080 \
  -v $(pwd)/config.json:/etc/bifrost/config.json \
  -e BIFROST_ENCRYPTION_KEY="your-secure-encryption-key" \
  ghcr.io/maximhq/bifrost:latest
Enter fullscreen mode Exit fullscreen mode

Step 2: Register Upstream MCP Servers

Configure the upstream tools that the gateway should manage. In production, these typically run as containerized microservices within private VPCs, reachable via HTTP or SSE:

{
  "gateways": {
    "mcp": {
      "listen_addr": "0.0.0.0:8080",
      "servers": [
        {
          "name": "internal-jira",
          "transport": "http",
          "url": "http://jira-mcp.internal:3000/mcp",
          "auth": {
            "type": "bearer",
            "token": "jira-internal-service-token"
          }
        },
        {
          "name": "prod-sql-reader",
          "transport": "http",
          "url": "http://sql-mcp.internal:4000/sse",
          "auth": {
            "type": "bearer",
            "token": "sql-read-only-token"
          }
        }
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Establish Virtual Keys and Tool Policies

Create virtual keys to partition tool access per user, team, or automated client application. This configuration uses the governance engine to enforce tool allowlists and financial limits:

{
  "virtual_keys": [
    {
      "name": "vk-engineering-team",
      "key": "sk-bifrost-eng-prod-091a",
      "budget": {
        "amount_usd": 500.0,
        "period": "monthly"
      },
      "rate_limits": {
        "requests_per_minute": 120
      },
      "mcp_governance": {
        "allowed_tools": [
          "internal-jira:create_ticket",
          "internal-jira:read_ticket",
          "prod-sql-reader:run_select_query"
        ],
        "blocked_tools": [
          "prod-sql-reader:drop_table",
          "prod-sql-reader:update_records"
        ]
      }
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Step 4: Configure Downstream Developer Clients

Developers point their local tools to the centralized Bifrost gateway endpoint instead of connecting to local scripts or raw third-party endpoints.

For example, to configure Claude Desktop to route through the secure gateway, developers use the following configuration in their claude_desktop_config.json:

{
  "mcpServers": {
    "enterprise-gateway": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "https://ai-gateway.enterprise.com/mcp",
        "--header",
        "Authorization: Bearer sk-bifrost-eng-prod-091a"
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

When Claude Desktop connects, Bifrost intercepts the initialization handshake, evaluates the virtual key, and returns only the tools approved for the engineering profile. All subsequent tool invocations are logged, sanitized, and audited centrally.

Frequently Asked Questions

What is an MCP gateway?

An MCP gateway is a centralized reverse proxy and policy control layer that sits between AI agents and Model Context Protocol servers. It unifies multiple backend tool connections behind a single governed endpoint, enforcing authentication, access control, traffic routing, and immutable audit logging for all tool calls.

How does an MCP gateway differ from a traditional API gateway?

Traditional API gateways manage predictable, deterministic HTTP requests routed along static endpoints. An MCP gateway manages dynamic JSON-RPC 2.0 tool execution protocols, inspects semantic tool definitions, filters functions based on agent context, protects against prompt injection, and optimizes LLM context window consumption.

What are the primary security risks of deploying MCP servers?

The primary risks include indirect prompt injection through unvalidated tool outputs, credential leakage from local configuration files, unauthorized data exfiltration, confused deputy escalation, and tool poisoning where malicious servers alter their descriptions to subvert agent reasoning.

How does Bifrost handle MCP server authentication?

Bifrost supports multiple authentication patterns, including OAuth 2.0 with PKCE for user sign-in, integration with enterprise identity providers like Okta and Microsoft Entra ID, and virtual keys for programmatic agent access. It abstracts backend infrastructure credentials away from developer devices and client configurations.

Can an MCP gateway reduce LLM token usage and latency?

Yes. By using features like Code Mode, an MCP gateway lets the model write execution scripts that orchestrate multiple tools in a sandboxed environment rather than looping through individual calls. This approach eliminates intermediate state accumulation, saving up to 50% in input tokens and reducing end-to-end execution latency by 40%.

How does Bifrost Edge help prevent shadow AI on employee machines?

Bifrost Edge runs as a native agent on employee workstations (macOS, Windows, and Linux) managed via MDM. It monitors the configuration files of desktop applications and CLI assistants, inventories configured MCP servers, and enforces centralized allow/deny policies directly on the machine before unauthorized data leaves the endpoint.

Next Steps

Securing and routing MCP servers is critical for transitioning generative AI agents from unmonitored prototypes to defensible enterprise deployments. Platform engineering and security teams evaluating infrastructure solutions can request a Bifrost demo to explore enterprise governance controls or evaluate the open-source repository on GitHub to deploy a local gateway.

Sources

Top comments (0)