Skip to main content

Production-grade infrastructure for Model Context Protocol

Project description

MCP Hangar

The policy enforcement plane for MCP -- deterministic admission and egress policy, attributable audit, and SIEM export for your MCP server fleet. MIT, self-hosted, no SaaS.

PyPI CI License: MIT

Why

In MCP, the tool list is a hint the client caches; the call path is the only surface a provider mediates in real time. Every governance primitive worth having -- revocation, per-tenant scoping, audit -- attaches there, or attaches to nothing. Hangar puts a policy enforcement plane on that seam: one mediated path for lifecycle, policy, and telemetry across your whole MCP server fleet.

Background: The Advisory List -- Why MCP Governance Lives at the Call Path

Install

pip install mcp-hangar
# or: uv pip install mcp-hangar

This resolves to 2.0.0. Coming from 1.6.x, read the upgrade guide first — two of the changes need a decision before you upgrade, not after: Slack approval delivery now needs an adapter you run yourself, and approval resolution is authorized. Your upstream MCP servers do not have to move; a connection that negotiates the 2025-11-25 protocol keeps working. To stay on the old line while you plan, pin "mcp-hangar>=1.6,<2" — note that it is closed and receives no fixes.

Quickstart

Point Hangar at an MCP server in config.yaml:

mcp_servers:
  github:
    mode: subprocess
    command: [uvx, mcp-server-github]
    env:
      GITHUB_TOKEN: ${GITHUB_TOKEN}

Then serve it:

mcp-hangar serve --config config.yaml                     # stdio (Claude Desktop)
mcp-hangar serve --config config.yaml --http --port 8000  # HTTP + REST API at /api/

Hangar refuses to bind a non-loopback interface without auth. For a quick/insecure demo, pass --unsafe-no-auth; for anything real, configure the auth block.

Or skip the config entirely -- get filesystem, fetch, and memory servers wired into Claude Desktop in one line:

curl -sSL https://mcp-hangar.io/install.sh | bash && mcp-hangar init -y && mcp-hangar serve

What you get

The enforcement plane — what the call path actually decides:

  • L7 egress policy -- allow/deny in MCP semantics: which upstream, which tool, which arguments. Deterministic, with no anomaly scores and no learned baselines, so every verdict is reproducible from the policy that produced it.
  • Tool-schema digest pinning -- an upstream that changes a pinned tool's schema fails closed instead of quietly serving a different tool.
  • Auth & RBAC -- API-key and OIDC/JWT identity with role-based access and RFC 8707 audience binding; bootstrap the first administrator with mcp-hangar auth bootstrap-admin, and every call carries a verified principal into the audit trail.
  • Per-tenant tool projection -- front-door mode presents a different executable surface per caller, fail-closed on unknown identity.
  • Human-in-the-loop approvals -- gate a call on an explicit decision, authorized and attributed to a real principal. Delivery channels are pluggable; core ships no vendor integration.
  • Governed task relay -- Hangar interposes on the SEP-2663 task lifecycle and never becomes an executor: no scheduler, no job runner, no result store.
  • Attributable audit -- an event-sourced trail exported to SIEM as CEF, LEEF 2.0, RFC 5424 syslog or JSON-lines, and to OTLP.

Everything else it takes to run a fleet:

  • Parallel tool calls -- one hangar_call fans out to many MCP servers concurrently; all results returned together.
  • Lifecycle management -- lazy start, health checks, single-flight cold starts, idle shutdown, and per-server circuit breaking.
  • Hot config reload -- add or withdraw servers and tools via file watch, no restart.
  • OAuth ingress -- advertise as an RFC 9728 protected resource and challenge external agents for verified tokens.
  • Observability built in -- OpenTelemetry traces, Prometheus metrics, and structured logs.

One config gotcha: tools: is overloaded

The per-server tools: key accepts two forms that look similar and mean opposite things:

tools:                        # LIST -- pre-start visibility projection
  - name: add
    inputSchema: { type: object, properties: { a: { type: number } } }

tools:                        # DICT -- access policy
  allow: [create_issue, list_issues]
  deny: [delete_repository]

The list form only lets a tool be listed before its provider has started. It is not an access policy, and it does not survive startup: the provider's dynamic tools/list is authoritative and replaces it entirely, so a statically-listed tool the provider does not return becomes uncallable and fails with Tool not found: <name> at invocation.

The dict form is the access policy — glob patterns, three-level merge. Reach for it when you mean to restrict something. Full semantics in the configuration reference.

Documentation

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_hangar-2.3.0.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_hangar-2.3.0-py3-none-any.whl (934.9 kB view details)

Uploaded Python 3

File details

Details for the file mcp_hangar-2.3.0.tar.gz.

File metadata

  • Download URL: mcp_hangar-2.3.0.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mcp_hangar-2.3.0.tar.gz
Algorithm Hash digest
SHA256 0ed490f3da8c259756d3e2a2cf18ba0dd3bf1cb63bb4ecfbc9cd88594a49135b
MD5 fbc64e10e8bbace307a4b10cb674eaad
BLAKE2b-256 b7a61530ab492470a67e6116ef89e384d93baae11df1d935f5ef030b0d4cdd2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_hangar-2.3.0.tar.gz:

Publisher: release.yml on mcp-hangar/mcp-hangar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_hangar-2.3.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_hangar-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 934.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mcp_hangar-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4940fc2142e8d3bf38077c1ffc640ad039ba1220c9b686dcf0604bdeb34a5fba
MD5 0c32c2694ed800f8a6c178f400698469
BLAKE2b-256 86c0561dc71a0d6c4981e6119a3ea1eb06b89249944cfafb12820ad6fcba77fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_hangar-2.3.0-py3-none-any.whl:

Publisher: release.yml on mcp-hangar/mcp-hangar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page