npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@authzx/mcp-gateway

v1.0.1

Published

AuthzX MCP Gateway — policy-enforcing proxy between AI agents and MCP servers

Downloads

305

Readme

AuthzX MCP Gateway

License Node npm

Authorization gateway for AI agents and MCP tool calls.

Open-source. Drop-in. Works with any MCP client.

Why

AI agents connected to MCP servers can call any tool they have access to — read your database, delete files, execute arbitrary SQL. AuthzX MCP Gateway puts a policy enforcement point between the agent and those tools, so every call is authorized before it executes.

What it does

  • Sits between MCP clients (Claude Code, Cursor, VS Code, GitHub Copilot) and any MCP server
  • Intercepts every tool call and checks authorization before forwarding
  • Two modes: cloud (AuthzX Cloud API) and local (AuthzX Agent + .rego policy file)
  • Full audit trail of every tool invocation — subject, tool name, arguments, and decision are logged as structured JSON:
{"ts":"2026-05-25T10:03:11.482Z","level":"info","msg":"mcp_tool_call","subject":"agent:ai-assistant","tool":"database__query","allowed":true,"latency_ms":0.8}

Quick Start

  1. Install and start the AuthzX Agent. The agent runs locally and evaluates your authorization policy — no cloud account needed.
go install github.com/authzx/agent/cmd/agent@latest
authzx-agent --policy ./policy.rego

Create a policy.rego to define what your agent can do:

package authzx.mcp

default allow := false

# Allow read-only tools
allow if { input.resource.name == "database__query" }
allow if { input.resource.name == "database__list_tables" }

# Allow writes, but block destructive SQL
allow if {
    input.resource.name == "database__execute"
    not contains(lower(input.resource.attributes.sql), "drop")
    not contains(lower(input.resource.attributes.sql), "delete from")
}

See demo/policies/ for more examples including Kubernetes namespace protection.

  1. Create a gateway.config.json:
{
  "authzx": {
    "agentUrl": "http://localhost:8181"
  },
  "subject": "agent:ai-assistant",
  "servers": {
    "database": {
      "command": "node",
      "args": ["./my-database-mcp-server.js"]
    }
  }
}
  1. Add to your MCP client (e.g. Claude Code):
claude mcp add --transport stdio authzx-gateway -- \
  npx authzx-mcp-gateway --config /path/to/gateway.config.json

Configuration

Config schema

| Field | Type | Required | Description | | ------------------ | ------ | -------- | -------------------------------------------------------------- | | authzx.agentUrl | string | * | URL of local AuthzX Agent (local mode) | | authzx.cloudUrl | string | * | URL of AuthzX Cloud API (cloud mode) | | authzx.apiKey | string | | API key from AuthzX Cloud (or set AUTHZX_API_KEY env var) | | authzx.timeoutMs | number | | Authorization request timeout (default: 5000) | | subject | string | yes | Identity of the agent making tool calls | | subjectType | string | | Subject type (default: "agent") | | resourceType | string | | Resource type for authorization checks (default: "mcp_tool") | | servers | object | yes | Map of downstream MCP servers to proxy |

* Provide either agentUrl (local mode) or cloudUrl (cloud mode).

Each entry in servers has:

| Field | Type | Required | Description | | --------- | -------- | -------- | -------------------------------- | | command | string | yes | Command to spawn the MCP server | | args | string[] | | Command arguments | | env | object | | Additional environment variables |

Modes

Cloud mode

Connect to AuthzX Cloud for managed policies:

{
  "authzx": {
    "cloudUrl": "https://api.authzx.com/v1/authorize",
    "apiKey": "azx_..."
  },
  "subject": "agent:prod-assistant",
  "servers": {
    "database": {
      "command": "node",
      "args": ["./db-server.js"]
    }
  }
}

Local mode

Run the AuthzX Agent locally with a .rego policy file for offline, self-contained authorization:

# Start the agent with your policy
authzx-agent --policy ./policy.rego
{
  "authzx": {
    "agentUrl": "http://localhost:8181"
  },
  "subject": "agent:dev-assistant",
  "servers": {
    "database": {
      "command": "node",
      "args": ["./db-server.js"]
    }
  }
}

CLI Flags

| Flag | Description | | -------------------------- | -------------------------------------------------------------------------------------- | | --config <path> | Path to gateway config file (default: ./gateway.config.json) | | --list-tools | List all tools from configured downstream servers and exit | | --generate-policy [path] | Generate a starter .rego policy file for the configured tools (default: policy.rego) |

Environment variable overrides: AUTHZX_API_KEY, AUTHZX_AGENT_URL, AUTHZX_SUBJECT.

MCP Client Setup

The gateway runs as a stdio MCP server. Point your MCP client at it instead of the downstream server directly.

Claude Code

claude mcp add --transport stdio authzx-gateway -- \
  npx authzx-mcp-gateway --config /path/to/gateway.config.json

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "authzx-gateway": {
      "command": "npx",
      "args": ["authzx-mcp-gateway", "--config", "/path/to/gateway.config.json"]
    }
  }
}

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "authzx-gateway": {
      "command": "npx",
      "args": ["authzx-mcp-gateway", "--config", "/path/to/gateway.config.json"]
    }
  }
}

VS Code / GitHub Copilot

Add to .vscode/mcp.json:

{
  "servers": {
    "authzx-gateway": {
      "type": "stdio",
      "command": "npx",
      "args": ["authzx-mcp-gateway", "--config", "/path/to/gateway.config.json"]
    }
  }
}

See demo/ for full end-to-end examples with sample policies.

Feedback

License

Apache-2.0 — see LICENSE.