Skip to main content
Glama
ahmed2qaid

MCP Policy Gateway

by ahmed2qaid

MCP Policy Gateway

A zero-trust policy enforcement gateway that sits between AI agents/MCP clients and real MCP servers.

MCP Client / AI Agent
        ↓
Identity + Rate Limit + Policy + Approval + Egress Guard
        ↓
MCP Policy Gateway
        ↓
Schema Pin + Circuit Breaker + Audit
        ↓
 one or many MCP upstream servers

Why it exists

MCP makes tool access easy; production systems also need to answer who may call a tool, with which arguments, how often, to which destinations, and when a human must approve the action. MCP Policy Gateway keeps those controls outside the agent prompt and applies them before the upstream tool executes.

Tools are namespaced at the gateway boundary to prevent collisions:

local__filesystem_read
crm__customer_lookup
billing__refund_payment

Related MCP server: nice

v0.3 — zero-trust controls

  • real MCP stdio and Streamable HTTP gateway from v0.2

  • per-agent identity (agent_id, tenant, roles)

  • identity/role-aware policy rules

  • argument-level argument_equals policy conditions

  • short-lived HMAC approval tokens bound to agent + tool + exact arguments

  • approval resume without weakening the original rule

  • per-agent/per-tool sliding-window rate limits

  • outbound URL/domain allowlists

  • prompt-injection signal detection before high-risk tool execution

  • secret/email redaction helpers for logs and operator surfaces

  • upstream circuit breakers and request timeouts

  • schema pinning and drift enforcement

  • structured JSONL audit

  • tests and CI

Policy example

{
  "default": "deny",
  "rules": [
    {
      "id": "finance-refund-usd",
      "tool": "billing__refund*",
      "effect": "approval",
      "risk": "high",
      "roles_any": ["finance"],
      "argument_equals": {"currency": "USD"}
    },
    {
      "id": "block-delete",
      "tool": "billing__delete*",
      "effect": "deny",
      "risk": "critical"
    }
  ]
}

Signed approval flow

identity = AgentIdentity("agent-42", tenant="acme", roles=("finance",))
args = {"invoice_id": "INV-7", "amount": 50, "currency": "USD"}

first = await service.call_tool("billing__refund", args, identity=identity)
# -> approval_required

token = signer.issue(tool="billing__refund", arguments=args, identity=identity)
result = await service.call_tool(
    "billing__refund",
    args,
    identity=identity,
    approval_token=token,
)

Changing the amount, tool, agent or tenant invalidates the token.

Install

pip install -e .

The gateway targets the stable MCP Python SDK v2 line (mcp>=2.1,<3).

Run over stdio

mcp-policy-gateway --config examples/gateway.json --transport stdio

Run over Streamable HTTP

mcp-policy-gateway \
  --config examples/gateway.json \
  --transport streamable-http \
  --host 127.0.0.1 \
  --port 8000

Clients connect to http://127.0.0.1:8000/mcp.

Security boundary

v0.3 provides a practical policy layer, not a claim of complete isolation. Persistent identity extraction from every client transport, external approval APIs, signed schema registries, policy hot reload, OpenTelemetry, deployment hardening and a formal threat model remain roadmap items.

See ROADMAP.md.

License

MIT.

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

0Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    MCP server for AI agent security guardrails. Provides input validation, prompt injection detection, PII redaction, output filtering, policy enforcement, rate limiting, and comprehensive audit logging.
    76
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Provides a secure MCP gateway for AI agents to access APIs without exposing raw credentials, with scoped access, audit logging, and OAuth support.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Governs AI agent HTTP requests with policy enforcement, security scanning, and audit logging via MCP.
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Provides a governance gateway for LLM and agent traffic via MCP, blocking prompt injection, redacting PII, enforcing per-tenant token budgets, and caching repeat questions semantically. Enables AI agents to route model calls through the same guardrails instead of calling providers directly.
    MIT

View all related MCP servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ahmed2qaid/mcp-policy-gateway'

If you have feedback or need assistance with the MCP directory API, please join our Discord server