Skip to main content

Authorization

The gateway operates on a default-deny model. Without explicit policies, no user can access any target, tool, resource, or prompt.

Policy Structure

{
"name": "Allow admins everything",
"description": "Full access for admin role",
"target_id": null,
"resource_type": "all",
"resource_pattern": null,
"effect": "allow",
"priority": 100,
"enabled": true,
"subjects": [
{"subject_type": "role", "subject_value": "admin"}
]
}

Fields

FieldValuesDescription
target_idUUID or nullSpecific target, or all targets if null
resource_typeall, tool, resource, promptType of MCP resource
resource_patternregex or nullPattern match on resource name
effectallow, denyGrant or deny access
priorityintegerHigher = evaluated first
enabledbooleanToggle without deleting

Subject Types

TypeDescription
everyoneAll authenticated users
roleUsers with a specific role
groupUsers in a specific group
userA specific user by ID

Evaluation Order

  1. Policies are sorted by priority (descending)
  2. First matching policy wins
  3. If no policy matches, access is denied

This means deny rules with higher priority override allow rules with lower priority.

Common Patterns

Allow all users to access all targets

POST /api/policies
{
"name": "Global allow",
"resource_type": "all",
"effect": "allow",
"priority": 1,
"subjects": [{"subject_type": "everyone"}]
}

Allow a role to use specific tools

POST /api/policies
{
"name": "Developers can use GitHub tools",
"target_id": "<github-target-id>",
"resource_type": "tool",
"resource_pattern": ".*",
"effect": "allow",
"priority": 10,
"subjects": [{"subject_type": "role", "subject_value": "developer"}]
}

Block dangerous tools (with admin override)

# 1. Block delete tools for everyone (high priority)
POST /api/policies
{
"name": "Block destructive tools",
"resource_type": "tool",
"resource_pattern": "delete_.*|remove_.*",
"effect": "deny",
"priority": 100,
"subjects": [{"subject_type": "everyone"}]
}

# 2. Allow admins to use delete tools (highest priority)
POST /api/policies
{
"name": "Admins can delete",
"resource_type": "tool",
"resource_pattern": "delete_.*|remove_.*",
"effect": "allow",
"priority": 200,
"subjects": [{"subject_type": "role", "subject_value": "admin"}]
}

Policy Management API

MethodPathDescription
GET/api/policiesList all policies
POST/api/policiesCreate policy
GET/api/policies/{id}Get policy details
PUT/api/policies/{id}Update policy
DELETE/api/policies/{id}Delete policy
POST/api/policies/{id}/subjectsAdd subject
DELETE/api/policies/{id}/subjects/{subjectId}Remove subject

Audit

All authorization decisions are logged in the request audit log (GET /api/logs), including the matched policy name and whether access was allowed or denied.