mcp, host (plain HTTP/A2A), and named backend references defined at the top-level backends list.
Backend types
Each entry inroutes[].backends must be exactly one of:
| Field | Description |
|---|---|
mcp | Connect to one or more MCP servers (stdio, HTTP/SSE, or OpenAPI). |
ai | Proxy to an LLM provider (OpenAI, Gemini, Anthropic, Bedrock, Azure OpenAI, Vertex AI). |
host | Plain HTTP hostname or A2A agent address. |
aws | AWS-native backends such as AWS Bedrock AgentCore. |
backend | Reference to a named backend in the top-level backends list. |
service | Reference to a Kubernetes service (control-plane environments). |
MCP backend
Themcp backend type proxies traffic to one or more MCP (Model Context Protocol) servers. Multiple targets are aggregated: the gateway exposes all tools, resources, and prompts as a single unified MCP server to clients.
When multiple targets are configured, each tool name is prefixed with
<target-name>_ to avoid collisions between servers.MCP target fields
A unique name for this MCP target. Used to prefix tool names when multiple targets are aggregated (e.g.,
weather_get_forecast).Per-target policies (header modification, backend TLS, authentication, etc.). These merge with and can override route-level policies for this specific target.
Stdio transport
Agentgateway spawns a local process and communicates over its standard input/output. Use this for MCP servers distributed as CLI tools.The command to execute. The process is started when the first client connects.
Arguments to pass to the command.
Environment variables to set for the spawned process. Key-value string pairs.
HTTP/SSE transport
Agentgateway connects to an already-running MCP server over HTTP. Two sub-types are supported: SSE transport (sse) — connects to an MCP server using the legacy Server-Sent Events transport.
Hostname or IP address of the MCP server.
Port of the MCP server.
URL path prefix, e.g.
/sse.mcp) — connects to an MCP server using the modern streamable HTTP transport.
Hostname or IP address of the MCP server.
Port of the MCP server.
URL path prefix, e.g.
/mcp.OpenAPI transport
Agentgateway converts an OpenAPI specification into MCP tools, enabling any REST API to be used by AI agents over the MCP protocol.Hostname of the REST API.
Port of the REST API.
Base path for the API.
The OpenAPI schema to use. Provide either a
file path or a url.HTTP / A2A backend
Usehost to forward traffic to any HTTP service or A2A (Agent-to-Agent) endpoint. This is the simplest backend type and requires only a hostname and optional port.
The upstream hostname or
host:port address to forward requests to.Examples: 127.0.0.1:8080, backend.internal:9000, localhost:9999.plain HTTP
A2A traffic
For A2A (Agent-to-Agent protocol) traffic, usehost combined with the a2a: {} route policy. The policy enables A2A-specific processing, telemetry, and tracing.
a2a/config.yaml
Top-level named backends
The top-levelbackends list defines named backend resources that can be referenced by routes using backend: <name>.
A unique name for this backend. Referenced from routes as
backend: <name>.The upstream hostname or
host:port.Policies attached to this backend (TLS, auth, health, HTTP settings, etc.). These apply whenever this backend is referenced from any route.
Backend TLS (backendTLS)
Configure TLS for connections agentgateway makes to the upstream backend.
Send TLS to the backend.
Backend auth (backendAuth)
Authenticate agentgateway to upstream services. Exactly one auth variant must be set.
passthrough — forward client credentials
passthrough — forward client credentials
Pass the incoming request’s
Authorization header directly to the backend without modification.key — static API key or bearer token
key — static API key or bearer token
Attach a static key as the
Authorization header on every upstream request. The key value can be an inline string or loaded from a file.inline key
key from file
gcp — Google Cloud identity token
gcp — Google Cloud identity token
Obtain a GCP identity or access token from the instance metadata service (or a service account) and attach it to upstream requests.
type—identityTokenoraccessToken.audience— Audience for the token. Defaults to the backend host when omitted.
aws — AWS SigV4 request signing
aws — AWS SigV4 request signing
Sign upstream requests using AWS Signature Version 4.
azure — Azure managed identity or service principal
azure — Azure managed identity or service principal
Obtain an Azure access token and attach it to upstream requests. Supports explicit service principal credentials, managed identity, workload identity, and developer implicit credentials.
client secret (service principal)
managed identity
workload identity
developer implicit (local dev)
Complete examples
MCP backend with API key auth and TLS
A2A backend with CORS
OpenAPI backend
AI backend
Theai backend proxies traffic to an LLM provider. It enables AI-specific policies like prompt guard and prompt enrichment, and exposes LLM-specific telemetry (token counts, model used, streaming status).
Supported providers
- OpenAI
- Google Gemini
- Anthropic
- Google Vertex AI
- AWS Bedrock
- Azure OpenAI
backendAuth.key set to your OPENAI_API_KEY environment variable:AI backend fields
A unique name for this AI backend instance. Used in telemetry and logging.
The LLM provider configuration. Exactly one provider must be specified:
openAI, gemini, anthropic, vertex, bedrock, or azureOpenAI.AI-specific policies
When using anai backend, the following additional policies are available:
| Policy | Description |
|---|---|
policies.ai.promptGuard | Inspect and filter LLM prompts and responses |
policies.ai.prompts | Append or prepend system prompts |
policies.ai.routes | Map URL paths to LLM operation types |
policies.backendAuth | Provide API keys for the LLM provider |
AWS backend
Theaws backend type handles AWS-native integrations such as AWS Bedrock AgentCore.
AWS backends use IAM/SigV4 authentication by default. Configure
backendAuth.aws with explicit credentials, or rely on the instance’s IAM role for implicit authentication.