mcpAuthorization— evaluates access to MCP tool calls, resources, and prompts using CEL expressions with MCP-aware context variables.authorization— evaluates access to HTTP routes using CEL expressions with HTTP-aware context variables.
true. If no rule matches, the request is denied.
Configuration location
Both policies are set underbinds[].listeners[].routes[].policies:
mcpAuthorization
Authorization policy for MCP access. Controls which MCP tool calls, resource reads, and prompt invocations are allowed.
CEL context variables for mcpAuthorization
The following variables are available inside CEL expressions formcpAuthorization:
| Variable | Type | Description |
|---|---|---|
mcp.tool.name | string | Name of the MCP tool being called |
mcp.tool.target | string | Target server name for the tool |
mcp.resource.name | string | Name of the MCP resource being accessed |
mcp.resource.target | string | Target server name for the resource |
mcp.prompt.name | string | Name of the MCP prompt being invoked |
mcp.prompt.target | string | Target server name for the prompt |
jwt | map | Decoded JWT claims from the authenticated token. Access any claim with dot notation, e.g. jwt.sub, jwt.email |
jwt.sub | string | JWT subject claim |
Nested JWT claims are accessible using dot notation. For example, a claim
{"nested": {"key": "value"}} can be referenced as jwt.nested.key.authorization
Authorization policy for HTTP access. Controls which HTTP requests are allowed based on request attributes.
Rule evaluation
Evaluate each rule in order
Agentgateway evaluates each CEL expression in the
rules list sequentially.Allow on first match
If any rule returns
true, the request is allowed immediately and evaluation stops.Examples
Allow specific tools
Allow specific tools
Allow anyone to call
echo, but restrict add to a specific user:Require a specific JWT claim
Require a specific JWT claim
Allow access to
printEnv only for users who have a specific nested claim value:Combined authentication and authorization
Combined authentication and authorization