Skip to main content
MCP server CX Codex

MCP Hangar — Claude Code MCP server: policy verdicts and audit

A self-hosted layer between your client and your MCP servers: every tool call gets a verdict, and changed tool descriptions are caught by digest pin.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add --env MCP_CONFIG=<MCP_CONFIG> --transport stdio mcp-hangar -- uvx mcp-hangar
Open on GitHub

What MCP Hangar does

MCP Hangar is a Python MCP server that sits on the call path and decides what reaches the model. Clients cache the tool list, so the call itself is the only place a provider can mediate in real time — that is where revocation, per-tenant scoping and audit attach.

Run mcp-hangar init and it locates your MCP client, writes a config, starts each server once and records a digest pin over every tool's name, description, inputSchema and outputSchema. If a server rewrites a description between runs, that tool is withheld from the model and calls to it answer as if the tool did not exist. mcp-hangar pin --check prints both digests and exits 1, which makes it a fit for CI or a pre-commit hook; --write adopts the change when you meant it. The upstream in examples/rugpull/ rewrites its own description on request, so you can watch this happen.

HTTP mode needs an auth block. Without one, Hangar refuses to bind a non-loopback interface — --unsafe-no-auth is for a quick demo only. Over stdio the spawning process is the trust boundary, so the caller is declared in auth.stdio.principal.

What it helps with

  • block a tool call whose description was swapped between runs
  • catch in CI that a server's tool set drifted from the pinned digest
  • scope which tools and arguments a given tenant may reach
  • keep an attributable log of who made which call
  • serve MCP over HTTP with a REST API at /api/ instead of stdio

Example prompts for the agent

  • Run mcp-hangar init -y so it finds my MCP client and writes the config
  • Check config.yaml with mcp-hangar pin --check — I want to see if any tool description moved
  • Start mcp-hangar serve --config config.yaml --http --port 8000 and show me what /api/ returns

How to install MCP Hangar

Platform CLI

claude mcp add --env MCP_CONFIG=<MCP_CONFIG> --transport stdio mcp-hangar -- uvx mcp-hangar

Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-hangar <command>

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about MCP Hangar

How do I install MCP Hangar in Claude Code?

Add it with claude mcp add hangar -- uvx mcp-hangar. To point it at your own config, use claude mcp add --env MCP_CONFIG=<MCP_CONFIG> --transport stdio mcp-hangar -- uvx mcp-hangar.

What does MCP Hangar do?

It is a policy enforcement plane for MCP: it mediates tool calls, returns a verdict for each one, and keeps attributable audit records with SIEM export. Self-hosted, MIT licensed.

What does HTTP mode require?

A configured auth block. Hangar will not bind a non-loopback interface without it; keep --unsafe-no-auth for demos.

Similar MCP servers

Everything for Security →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor