Skip to main content
Agentgateway provides first-class support for three protocols: MCP (Model Context Protocol) for agent-to-tool communication, A2A (Agent2Agent) for agent-to-agent communication, and HTTP for generic web traffic. Each protocol has dedicated handling optimized for its semantics.

Model Context Protocol (MCP)

Model Context Protocol is the standard for connecting AI agents to tools, resources, and prompts. Agentgateway acts as an MCP proxy: it receives MCP requests from clients (AI agents), applies policies, and forwards them to one or more upstream MCP servers.

What Agentgateway provides for MCP

Protocol translation

Transparently proxy MCP requests between any combination of transports — SSE, Streamable HTTP, or Stdio.

Authentication

Enforce JWT, API key, or mTLS authentication before MCP requests reach backend servers.

Tool-level authorization

Use CEL expressions to allow or deny access to specific MCP tools, resources, or prompts by name.

Aggregation

Expose multiple upstream MCP servers as a single MCP endpoint with merged tool lists.

MCP transports

MCP supports three transport mechanisms. Agentgateway handles all three.

Streamable HTTP (/mcp)

The modern MCP transport, introduced in the MCP specification. Clients POST requests to /mcp and receive streaming responses. This is the recommended transport for new deployments.
backends:
- mcp:
    targets:
    - name: my-server
      # Streamable HTTP upstream
      host: mcp-server:8080
Clients connect by sending POST /mcp with a Content-Type: application/json body.
The original MCP transport using Server-Sent Events. The client connects to /sse to establish a persistent event stream, then sends requests via POST /message.SSE is supported for backwards compatibility with existing MCP clients. The Mcp-Session-Id header tracks sessions across the SSE connection.
routes:
- policies:
    cors:
      allowOrigins: ["*"]
      allowHeaders:
      - mcp-protocol-version
      - content-type
      - cache-control
      exposeHeaders:
      - "Mcp-Session-Id"
  backends:
  - mcp:
      targets:
      - name: my-server
        host: mcp-server:8080
Agentgateway can spawn MCP servers as child processes and communicate with them over stdin/stdout. This is useful for running local MCP servers (e.g., Node.js MCP packages) without requiring them to bind to a network port.
backends:
- mcp:
    targets:
    - name: everything
      stdio:
        cmd: npx
        args: ["@modelcontextprotocol/server-everything"]
The cmd is the executable to run. args are passed as command-line arguments. The process inherits the gateway’s environment.
Stdio backends are started when the configuration is loaded and restarted automatically if the process exits.

MCP backend configuration

The mcp backend accepts a list of targets. Each target represents one upstream MCP server.
backends:
- mcp:
    targets:
    - name: my-server          # Name used in logs and CEL context
      stdio:                   # or: host: mcp-server:8080
        cmd: npx
        args: ["@modelcontextprotocol/server-everything"]
Multiple targets are aggregated: the gateway merges their tool lists and routes MCP calls to the correct upstream based on the tool name.

OpenAPI-to-MCP transformation

Agentgateway can transform legacy REST APIs into MCP-compatible tool servers using an OpenAPI specification. This allows AI agents to call existing HTTP APIs through MCP without any changes to the underlying service.When configured, the gateway reads the OpenAPI spec and exposes each operation as an MCP tool. The tool name, description, and input schema are derived from the OpenAPI operation definition.
OpenAPI-to-MCP transformation lets you give AI agents access to your existing REST APIs through the MCP protocol — without modifying the APIs themselves.

Protocol summary

ProtocolTransportGateway endpointBackend type
MCPStreamable HTTPPOST /mcpmcp.targets[].host or stdio
MCPSSEGET /sse + POST /messagemcp.targets[].host or stdio
A2AHTTPAll pathshost with a2a: {} policy
HTTPHTTP/1.1, HTTP/2Configurable pathshost

MCP proxy guide

Step-by-step guide to proxying MCP servers with authentication and authorization

A2A proxy guide

Set up agent-to-agent communication with the A2A protocol

OpenAPI guide

Transform REST APIs into MCP tools using OpenAPI specifications

CEL expressions

Write tool-level authorization rules using CEL expressions