Skip to main content

Streamable HTTP Transport

Connect agentgateway to MCP servers via HTTP with streaming

Streamable HTTP transport connects agentgateway to remote MCP servers over HTTP with streaming support for real-time responses.

Overview

Streamable HTTP transport is ideal when:

  • MCP servers run as standalone HTTP services
  • You need real-time streaming of responses
  • The server is accessible over the network
  • You want stateful sessions with the MCP server

Quick start

# Start an MCP server with streamable HTTP
PORT=3005 npx -y @modelcontextprotocol/server-everything streamableHttp

# Create config.yaml
cat <<EOF > config.yaml
# yaml-language-server: $schema=https://agentgateway.dev/schema/config
mcp:
port: 3000
policies:
cors:
allowOrigins:
- "*"
allowHeaders:
- "*"
exposeHeaders:
- "Mcp-Session-Id"
targets:
- name: mcp
mcp:
host: http://localhost:3005/mcp/
EOF

# Run agentgateway
agentgateway -f config.yaml

Configuration

Configure a streamable HTTP MCP backend:

# yaml-language-server: $schema=https://agentgateway.dev/schema/config
mcp:
port: 3000
policies:
cors:
allowOrigins:
- "*"
allowHeaders:
- "*"
exposeHeaders:
- "Mcp-Session-Id"
targets:
- name: remote-mcp
mcp:
host: http://mcp-server:8080/mcp/

Key configuration

SettingDescription
mcp.hostThe HTTP URL of the MCP server endpoint
cors.exposeHeadersMust include Mcp-Session-Id for session management

Example: Multiple MCP servers

Aggregate multiple remote MCP servers:

mcp:
port: 3000
targets:
- name: server-a
mcp:
host: http://mcp-server-a:8080/mcp/
- name: server-b
mcp:
host: http://mcp-server-b:8080/mcp/

Why use agentgateway?

Direct HTTP ConnectionWith agentgateway
Client manages connectionsGateway handles reconnection and buffering
No authenticationOAuth2, API keys, or custom auth
No access controlTool-level authorization
Single server per clientMultiple servers aggregated
No metricsFull observability with OpenTelemetry
Manual session handlingAutomatic session management

Verify access

  1. Open the agentgateway UI to view your configuration
  2. Go to Playground to test tools
  3. Click Connect to retrieve available tools from all configured servers
  4. Select a tool and click Run Tool to test

Learn more