Skip to content
Dashboard

What is an MCP gateway?

Content Engineer

An MCP gateway is a proxy between MCP clients and MCP servers. Agents connect to a single gateway endpoint, and the gateway routes each tool call to the server behind it that hosts the tool. The Model Context Protocol specification defines hosts, clients, and servers. Vendors use the term "MCP gateway," but the specification doesn't define it.

Suppose your team uses coding agents that connect to GitHub, an issue tracker, and an internal docs server. Without a gateway, each MCP host needs three server URLs and three sets of credentials because it creates a separate MCP client for each server. With a gateway, each host needs just one URL, and the team decides in one place which tools each person can call and where those calls are logged.

Copy link to headingHow does an MCP gateway work?

The MCP architecture has three roles. The host application, such as an IDE or an agent, creates MCP clients, and each client connects to exactly one server. MCP is stateless in the current protocol version 2026-07-28. Every request carries its own protocol version and capabilities.

A gateway acts as an MCP server when it accepts a client connection. To reach the upstream servers, it uses a separate MCP client for each one. This follows from how MCP pairs clients and servers; the specification has no separate rules for gateways.

Cloudflare documents this request flow for its MCP server portals:

  1. The MCP client connects to the portal URL and receives a 401 response with OAuth discovery metadata.

  2. The user signs in through Cloudflare Access, and the portal returns the tools from its enabled upstream servers.

  3. When the user calls a tool, the portal reads the target server from the tool's namespace, attaches that server's credentials, and proxies the request.

Docker describes the same routing and credential injection for its MCP Gateway. If the server for a requested tool isn't running, the gateway starts it in a Docker container. It then forwards the request and returns the result to the client.

MCP defines two standard transports: stdio, for a subprocess that the client launches, and Streamable HTTP, where each message is an HTTP POST to a single endpoint. Streamable HTTP mirrors selected request metadata in HTTP headers, allowing intermediaries to route requests without parsing the body. Earlier revisions opened a session with an initialize handshake. MCP Version 2026-07-28 drops that handshake, so no request depends on an earlier one.

Copy link to headingHow does an MCP gateway differ from an MCP server, an API gateway, and an AI gateway?

Some products combine two of these roles. The table shows what each service typically handles:

Attribute

MCP server

MCP gateway

API gateway

AI gateway

Sits in front of

Its own tools and backend

Several MCP servers

Backend HTTP services

Model providers

Routes by

Runs the tool directly

Tool name or namespace

Path and host

Model and provider

Policy applies to

Calls to its own tools

Each tool, for each caller

Each HTTP request

Each model request

Example

Vercel MCP

Docker MCP Gateway

Azure API Management

Vercel AI Gateway

Microsoft says Azure API Management, an API gateway, can front an existing MCP server or expose a REST API as one. Kong AI Gateway and Amazon Bedrock AgentCore Gateway each handle both model requests and MCP tool calls, but route them separately.

An MCP server owns its tools, and the Tools specification requires it to validate inputs, apply access controls, and rate-limit invocations. An MCP gateway lists the tools provided by the servers behind it and applies access policies across them.

Solo.io says an API gateway routes HTTP requests by path and host, while an MCP gateway can use the tool name and the caller's identity to decide, for example, whether to show that user a particular tool. The agentgateway docs give another example. When a client asks for a list of tools, the proxy may need to query several backend servers, combine their lists, and return only the tools that the client can access.

An AI gateway such as Vercel AI Gateway handles requests to models. It routes requests across providers and fallback models, and records token usage and cost for each request. An MCP gateway works on the tool call the model makes once it decides to act. AI Gateway vs. MCP explains how an application can use both.

Copy link to headingWhat problems does an MCP gateway address?

Tool name collisions. Tool names are unique only within one server. The specification says proxies that aggregate tools from several servers should disambiguate them, for example by prefixing each name with a server identifier. Cloudflare's portal uses {server_id}_{original_name}, so list_issues on the github server becomes github_list_issues.

Caller authentication and upstream credentials. MCP authorization is optional and based on OAuth 2.1. Servers that use it must accept only tokens issued for them, and must not accept or forward any other token. The project's security guidance calls forwarding a client's token "token passthrough," an anti-pattern the authorization specification forbids. The rules don't mention gateways, but since a gateway is a server to its clients, they imply it needs its own credential for each upstream server. Microsoft and AWS both describe inbound authentication for callers alongside outbound authentication to the servers or tools behind the gateway.

Tool filtering for each caller. The specification lets a server return a different tools/list result depending on the caller's authorization. Gateways can apply that rule across every server behind them. Cloudflare lets admins choose the tools each portal exposes, and Solo.io describes how a gateway can show different tools to different callers.

Rate limiting. Azure API Management, IBM's ContextForge, and agentgateway document rate limits for MCP traffic. Azure API Management also lets you set usage quotas for clients or subscriptions.

Central logging. Docker says its gateway includes logging and call tracing, and Cloudflare Access logs the individual requests made with a portal's tools. The log details vary by product. The OWASP MCP Security Cheat Sheet recommends logging every tool invocation centrally, with full parameters, user context, and timestamps.

Transport bridging. Some gateways run a stdio server themselves and expose it over HTTP. The ContextForge README shows a command that does this, and Solo.io says agentgateway runs stdio servers as child processes and serves them over Streamable HTTP. The MCP security guidance warns that a proxy capable of spawning stdio servers can give a web-based attack a path to full system compromise, and says such proxies should sandbox spawned processes and log stdio activity.

Copy link to headingWhich products work as MCP gateways?

Here's how the vendors and project maintainers describe their gateways.

  • Docker MCP Gateway. Docker calls it an open source proxy that manages credentials and access control and runs servers in isolated containers.

  • Microsoft MCP Gateway. Microsoft's open source project is a reverse proxy and management layer for MCP servers on Kubernetes. Its README says the current version requires MCP 2026-07-28 clients.

  • Azure API Management. Microsoft says it exposes REST APIs or existing MCP servers and supports MCP tools, but not resources or prompts.

  • Cloudflare MCP server portals. Cloudflare says a portal routes several MCP servers behind a single HTTP endpoint.

  • Kong AI Gateway. Kong says that version 2.0 and later can proxy an MCP server, convert REST APIs into MCP tools, or aggregate tools into a single endpoint.

  • IBM ContextForge. IBM describes an open source registry and proxy that federates MCP servers, agents, and APIs into one endpoint.

  • Amazon Bedrock AgentCore Gateway. AWS describes a managed gateway that turns APIs and Lambda functions into MCP tools and also routes model requests.

  • agentgateway. The project says it federates several backend MCP servers behind one endpoint, with tools virtualized for each client.

Copy link to headingWhen does a team need an MCP gateway?

The MCP specification sets no threshold, such as a number of servers, and neither do the vendor docs linked here. If the main problem is the number of tools, start with how the host loads them. The MCP project's client guidance says that loading a handful of tools directly is reasonable, and for hosts with hundreds of tools, it recommends progressive discovery and programmatic tool calling within the host.

A gateway can help if you need to manage access for several clients or servers:

  • Several agents or teams share the same servers, and you want each host configured with one URL.

  • Upstream servers require credentials you don't want stored on every client.

  • Different people should see different tools, and the upstream servers can't filter tools/list by caller.

  • Security requires either logging every tool call or isolation between servers; OWASP recommends using a proxy or gateway to enforce isolation between servers.

You can skip a gateway when one client talks to a few servers you run, and each server already checks tokens issued for it, filters tools by scope, and rate-limits its own tools. In that setup, a gateway would repeat checks your servers already perform.

To decide, list each server your agents call, where its credential lives, who may call each tool, and where those calls are logged. If several servers need the same access or logging rules, you can manage those rules at the gateway.

Copy link to headingWhat doesn't an MCP gateway protect against?

Invariant Labs coined tool poisoning for malicious instructions in MCP tool descriptions, which users don't see and models do. OWASP's definition also covers parameter schemas and return values. According to OWASP, a gateway can scan descriptions and results for known patterns, but it can't tell whether the text that passes those filters is safe. Enforce authorization for each tool call in trusted application code, independently of what the model concludes.

OWASP recommends a proxy or gateway to enforce isolation between servers, treating each server as an untrusted, independent security domain. That isolation covers only traffic that passes through the gateway. Cloudflare warns that users its policy blocks can still reach an MCP server at its direct URL, unless Access is configured as that server's OAuth provider. Make each upstream server require its own authorization as well.

The gateway itself can become the weak point. The MCP security guidance describes a confused deputy attack on proxy servers that act as a single OAuth client to a third-party API. With a static client ID, dynamic client registration, and a consent cookie on the third-party server, a malicious client can obtain an authorization code without the user's consent. The guidance requires such proxies to get user consent for each client before forwarding to third-party authorization.

The specification also says a human should always be able to deny a tool invocation. Require approval before running a tool that changes data.

Copy link to headingWhere does Vercel fit around an MCP gateway?

Vercel AI Gateway routes model requests. You can host MCP servers on Vercel with or without a gateway, and code you deploy on Vercel can get tokens to call third-party MCP servers.

mcp-handler turns an MCP server definition into a Web-standard request handler for Next.js, Nuxt, SvelteKit, Hono, and similar frameworks. Version 2 serves Streamable HTTP to clients on the 2026-07-28 specification and to older 2025 clients, doesn't need Redis, and no longer supports the legacy HTTP+SSE transport. When you deploy the server to Vercel Functions, Fluid compute shares instances across concurrent requests and scales dynamically, which suits an MCP server's long idle periods and bursts of messages.

Wrap the handler in withMcpAuth and set required: true. The server returns 401 if the request has no valid token or 403 if the token lacks a required scope. mcp-handler verifies tokens but doesn't issue them or run an authorization server, so you choose an authorization server to pair with it. Because the server checks tokens itself, a caller who skips the gateway still needs a token your verifier accepts.

Add a WAF rate limiting rule for the MCP path, or call checkRateLimit from @vercel/firewall in the route with the rate limiting SDK. Keep Deployment Protection on preview deployments while you test server changes.

For outbound calls, Vercel Connect gives your code short-lived tokens for third-party OAuth and API-key services, including OAuth-protected MCP servers such as Linear's. Connect asks each user for consent, so you don't need to store a provider secret in your environment variables. Connect supplies the token, and your MCP client, such as the AI SDK's, discovers and calls the server's tools.

Vercel MCP at https://mcp.vercel.com is Vercel's own remote MCP server, and it authorizes clients with OAuth. It's a single server for Vercel's own platform, with tools for projects, deployments, logs, and documentation.

Copy link to headingFrequently asked questions

Copy link to headingDoes the MCP specification define an MCP gateway?

No. The specification names three roles, host, client, and server, and pairs each client with exactly one server. "MCP gateway" is a vendor term. The gateway accepts connections as an MCP server and uses an MCP client to connect to each upstream server.

Copy link to headingIs Vercel AI Gateway an MCP gateway?

No. Vercel AI Gateway handles requests to AI models, with routing across providers and fallback models. MCP gateways handle the tool calls a model makes to MCP servers. Vercel doesn't sell a separate product called an MCP gateway.

Copy link to headingCan an MCP gateway pass the client's access token through to upstream servers?

No. MCP requires a server to accept only tokens issued for it, and the project's security guidance forbids token passthrough. Any gateway that presents itself as an MCP server therefore needs a separate credential for each upstream server it calls.

Copy link to headingDoes an MCP gateway stop tool poisoning?

No. Gateways can hide tools and filter text, but OWASP says filtering can't prove that tool descriptions or results are safe. Check permissions for each tool call in trusted code, and keep human approval on tools that change data.

Copy link to headingDo you need an MCP gateway for a few MCP servers?

Usually not. The MCP project says a host can load a handful of tools directly. The case for a gateway grows when many agents share servers, upstream credentials shouldn't sit in each client, different users need different tools, or security wants one log of every call.

Reference Architecture

Choose a stack and work through the decisions behind it, with curated documentation, guides, templates, and courses to help you build.

  • Agent stack: Build and operate agents with models, tools, and durable workflows.
  • Web applications: Choose rendering, data, authentication, and caching approaches.
  • Backends: Choose a runtime, connect services, and run background work.

Browse all stacks

Build with prompts

Build an app, extend an agent, or improve your project with ready-to-use prompts for your coding agent.

Ready to deploy?