Open Source

AuthZEN Gateway for Apache APISIX

An open-source plugin that turns Apache APISIX into an OpenID AuthZEN policy enforcement point for APIs, MCP servers and MCP Apps. Our contribution to the AuthZEN ecosystem.

What it protects

APIs

Every API request authorized at the gateway, before it reaches your backend.

MCP servers

Every tool call checked against your AuthZEN PDP.

MCP Apps

Interactive MCP App UIs protected the same way.

Works with any AuthZEN-compliant PDP, whether it uses policies (PBAC) or relationships (ReBAC).

How it works

An MCP server protected by the plugin, from configuration to decision.

  1. 1

    Configure the mapping

    Point the plugin to your AuthZEN PDP and map token claims and request fields to subject, resource, action and context. Mappings use CEL expressions.

    Plugin configuration

    authzen:
      pdp:
        host: https://pdp.example.com
      mapping_format: cel
      subject:
        type: identity
        id: "$token.sub"
        properties:
          roles: "$token.?realm_access.roles"
      resource:
        type: customer
        id: "$params.arguments.id"
      action:
        name: "$params.name"
      context:
        agent: "$token.?azp"
      mcp:
        enforce_on:
          methods: ["tools/call"]
  2. 2

    An agent calls a tool

    An AI agent calls an MCP tool through APISIX with its OAuth access token. Only the methods listed in enforce_on are checked.

    MCP request

    POST /mcp
    Authorization: Bearer <access token>
    
    {
      "jsonrpc": "2.0",
      "method": "tools/call",
      "params": {
        "name": "get_customer",
        "arguments": { "id": "cust-123" }
      }
    }
  3. 3

    The plugin asks the PDP

    The plugin evaluates the mapping against the token and the request, and sends a standard AuthZEN evaluation request.

    AuthZEN request

    POST /access/v1/evaluation
    {
      "subject": {
        "type": "identity",
        "id": "alice",
        "properties": { "roles": ["support"] }
      },
      "resource": { "type": "customer", "id": "cust-123" },
      "action":   { "name": "get_customer" },
      "context":  { "agent": "support-agent" }
    }
  4. 4

    The gateway enforces

    On allow, the call is forwarded to the MCP server. On deny, it is rejected at the gateway and never reaches the tool.

    PDP decision

    { "decision": true }

Demo

Securing an MCP App

The gateway authorizes every tool call and UI interaction of an expense management MCP App.

Open source · Beta

Run it with our Apache APISIX image, or add the plugin to your own gateway.

Provided AS IS, without warranties. See the repository README for details.

apisix-authzen