cors policy handles CORS preflight requests and appends configured CORS headers to applicable responses. This is required when MCP clients running in browsers (such as web-based AI agents) need to call Agentgateway from a different origin.
cors is configured under binds[].listeners[].routes[].policies:
Fields
object
CORS policy configuration.
Examples
MCP endpoint with permissive CORS
MCP endpoint with permissive CORS
Suitable for development or public MCP endpoints:
MCP endpoint with strict CORS and credentials
MCP endpoint with strict CORS and credentials
Suitable for production when specific origins are known:
From the mcp-authentication example
From the mcp-authentication example
This is the exact CORS configuration from the MCP authentication example:
Agentgateway automatically handles CORS preflight (
OPTIONS) requests and appends the configured headers to all applicable responses. You do not need to configure a separate route for OPTIONS requests.