180 lines
6.1 KiB
YAML
180 lines
6.1 KiB
YAML
# yaml-language-server: $schema=https://agentgateway.dev/schema/config
|
|
binds:
|
|
- listeners:
|
|
- routes:
|
|
# --- Scenario A: Local stdio MCP + Spec-compliant External Authorization Server
|
|
# Exposes:
|
|
# - MCP server (streamable HTTP) at /stdio/mcp
|
|
# - Well-known OAuth Resource Metadata at /.well-known/oauth-protected-resource/stdio/mcp
|
|
# Validates incoming Bearer tokens against the configured Authorization Server (issuer + JWKS).
|
|
- backends:
|
|
- mcp:
|
|
targets:
|
|
- name: everything
|
|
stdio:
|
|
args:
|
|
- '@modelcontextprotocol/server-everything'
|
|
cmd: npx
|
|
matches:
|
|
- path:
|
|
exact: /stdio/mcp
|
|
- path:
|
|
exact: /.well-known/oauth-protected-resource/stdio/mcp
|
|
- path:
|
|
exact: /.well-known/oauth-authorization-server/stdio/mcp
|
|
policies:
|
|
cors:
|
|
allowHeaders:
|
|
- mcp-protocol-version
|
|
- content-type
|
|
allowOrigins:
|
|
- '*'
|
|
exposeHeaders:
|
|
- "Mcp-Session-Id"
|
|
mcpAuthentication:
|
|
mode: strict
|
|
issuer: http://localhost:9000
|
|
audiences:
|
|
- http://localhost:3000/stdio/mcp
|
|
jwks:
|
|
url: http://localhost:9000/.well-known/jwks.json
|
|
resourceMetadata:
|
|
resource: http://localhost:3000/stdio/mcp
|
|
scopesSupported:
|
|
- read:all
|
|
bearerMethodsSupported:
|
|
- header
|
|
- body
|
|
- query
|
|
resourceDocumentation: http://localhost:3000/stdio/docs
|
|
resourcePolicyUri: http://localhost:3000/stdio/policies
|
|
# --- Scenario B: Remote MCP over HTTPS + Spec-compliant Authorization Server
|
|
# Proxies to a remote MCP server and serves the same resource metadata locally.
|
|
- backends:
|
|
- mcp:
|
|
targets:
|
|
- mcp:
|
|
host: https://mcpbin.is.solo.io/remote/mcp
|
|
name: mcpbin
|
|
matches:
|
|
- path:
|
|
exact: /remote/mcp
|
|
- path:
|
|
exact: /.well-known/oauth-protected-resource/remote/mcp
|
|
policies:
|
|
cors:
|
|
allowHeaders:
|
|
- mcp-protocol-version
|
|
- content-type
|
|
allowOrigins:
|
|
- '*'
|
|
exposeHeaders:
|
|
- "Mcp-Session-Id"
|
|
mcpAuthentication:
|
|
issuer: http://localhost:9000
|
|
audiences:
|
|
- http://localhost:3000/remote/mcp
|
|
jwks:
|
|
url: http://localhost:9000/.well-known/jwks.json
|
|
resourceMetadata:
|
|
resource: http://localhost:3000/remote/mcp
|
|
scopesSupported:
|
|
- offline_access
|
|
bearerMethodsSupported:
|
|
- header
|
|
- body
|
|
- query
|
|
resourceDocumentation: http://localhost:3000/remote/docs
|
|
resourcePolicyUri: http://localhost:3000/remote/policies
|
|
# --- Scenario C: Local stdio MCP + Keycloak adaptation (non-spec provider)
|
|
# When the provider isn't spec-compliant, enable an adapter that exposes modified
|
|
# oauth-authorization-server endpoints while still validating JWTs.
|
|
- backends:
|
|
- mcp:
|
|
targets:
|
|
- name: everything
|
|
stdio:
|
|
args:
|
|
- '@modelcontextprotocol/server-everything'
|
|
cmd: npx
|
|
matches:
|
|
- path:
|
|
exact: /keycloak/mcp
|
|
- path:
|
|
exact: /.well-known/oauth-protected-resource/keycloak/mcp
|
|
- path:
|
|
exact: /.well-known/oauth-authorization-server/keycloak/mcp
|
|
- path:
|
|
exact: /.well-known/oauth-authorization-server/keycloak/mcp/client-registration
|
|
policies:
|
|
cors:
|
|
allowHeaders:
|
|
- mcp-protocol-version
|
|
- content-type
|
|
allowOrigins:
|
|
- '*'
|
|
mcpAuthentication:
|
|
issuer: http://localhost:7080/realms/mcp
|
|
audiences:
|
|
- mcp_proxy
|
|
jwks:
|
|
url: http://localhost:7080/realms/mcp/protocol/openid-connect/certs
|
|
provider:
|
|
keycloak: {}
|
|
resourceMetadata:
|
|
resource: http://localhost:3000/keycloak/mcp
|
|
scopesSupported:
|
|
- profile
|
|
- offline_access
|
|
- openid
|
|
bearerMethodsSupported:
|
|
- header
|
|
- body
|
|
- query
|
|
resourceDocumentation: http://localhost:3000/keycloak/docs
|
|
resourcePolicyUri: http://localhost:3000/keycloak/policies
|
|
# Example configuration for Auth0:
|
|
# - backends:
|
|
# - mcp:
|
|
# targets:
|
|
# - name: everything
|
|
# stdio:
|
|
# args:
|
|
# - '@modelcontextprotocol/server-everything'
|
|
# cmd: npx
|
|
# matches:
|
|
# - path:
|
|
# exact: /auth0/mcp
|
|
# - path:
|
|
# exact: /.well-known/oauth-protected-resource/auth0/mcp
|
|
# - path:
|
|
# exact: /.well-known/oauth-authorization-server/auth0/mcp
|
|
# policies:
|
|
# cors:
|
|
# allowHeaders:
|
|
# - mcp-protocol-version
|
|
# - content-type
|
|
# allowOrigins:
|
|
# - '*'
|
|
# mcpAuthentication:
|
|
# issuer: https://dev-y6sikgx3n3shy7ci.eu.auth0.com
|
|
# audiences:
|
|
# - urn:agent-gateway
|
|
# jwksUrl: https://dev-y6sikgx3n3shy7ci.eu.auth0.com/.well-known/jwks.json
|
|
# provider:
|
|
# auth0: {}
|
|
# resourceMetadata:
|
|
# resource: http://localhost:3000/auth0/mcp
|
|
# scopesSupported:
|
|
# - profile
|
|
# - offline_access
|
|
# - openid
|
|
# bearerMethodsSupported:
|
|
# - header
|
|
# - body
|
|
# - query
|
|
# resourceDocumentation: http://localhost:3000/keycloak/docs
|
|
# resourcePolicyUri: http://localhost:3000/keycloak/policies
|
|
# Public port to listen on
|
|
port: 3000
|