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:
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
string
required
A unique name for this MCP target. Used to prefix tool names when multiple targets are aggregated (e.g.,
weather_get_forecast).object
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.string
required
The command to execute. The process is started when the first client connects.
string[]
Arguments to pass to the command.
object
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.
string
required
Hostname or IP address of the MCP server.
number
Port of the MCP server.
string
URL path prefix, e.g.
/sse.mcp) — connects to an MCP server using the modern streamable HTTP transport.
string
required
Hostname or IP address of the MCP server.
number
Port of the MCP server.
string
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.string
required
Hostname of the REST API.
number
Port of the REST API.
string
Base path for the API.
object
required
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.
string
required
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>.
string
required
A unique name for this backend. Referenced from routes as
backend: <name>.string
The upstream hostname or
host:port.object
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.
object
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
string
required
A unique name for this AI backend instance. Used in telemetry and logging.
object
required
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:
See the Prompt Guard guide for configuration details.
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.