Labsco
mapyr logo

MCP Hangar

β˜… 11

from mapyr

Kubernetes-native registry for managing multiple MCP servers with lazy loading, health monitoring, and RBAC

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeNeeds API keys

MCP Hangar

PyPI Python 3.11+ License: MIT

Production-grade infrastructure for Model Context Protocol.

MCP Hangar is a control plane for MCP servers. It manages MCP server lifecycle, parallel tool execution, security governance, and observability -- so you don't have to.

What It Does

Parallel execution. Your AI agent calls 5 tools sequentially -- each takes 200ms, that's 1 second of waiting. hangar_call runs them in parallel. 200ms total.

hangar_call(calls=[
    {"mcp_server": "github", "tool": "search_repos", "arguments": {"query": "mcp"}},
    {"mcp_server": "slack", "tool": "post_message", "arguments": {"channel": "#dev"}},
    {"mcp_server": "internal-api", "tool": "get_status", "arguments": {}}
])

Single MCP tool call. Parallel execution. All results returned together.

Lifecycle management. Lazy loading, health checks, automatic restart, graceful shutdown. MCP servers start on first use, stay warm while active, shut down after idle TTL.

Single-flight cold starts. When 10 parallel calls hit a cold MCP server, it initializes once -- not 10 times.

Circuit breaker. One failing MCP server doesn't kill your batch. Automatic isolation and recovery.

Python API

For programmatic use (scripts, pipelines, custom integrations):

from mcp_hangar import Hangar, HangarConfig

# Async
async with Hangar.from_config("config.yaml") as hangar:
    result = await hangar.invoke("math", "add", {"a": 1, "b": 2})

# Sync wrapper
from mcp_hangar import SyncHangar

with SyncHangar.from_config("config.yaml") as hangar:
    result = hangar.invoke("math", "add", {"a": 1, "b": 2})

# Programmatic config
config = (
    HangarConfig()
    .add_mcp_server("math", command=["python", "-m", "math_server"])
    .add_mcp_server("fetch", mode="docker", image="mcp/fetch:latest")
    .build()
)
hangar = Hangar(config)

Security & Governance (1.0)

  • Capability declaration. Declare what each MCP server can access (network, filesystem, environment). Violations are detected and reported.
  • Behavioral profiling. Baseline MCP server behavior, detect deviations (new destinations, protocol drift, frequency anomalies). Learning and enforcing modes.
  • Tool schema drift detection. Track tool schema changes across MCP server updates.
  • Network connection monitoring. /proc/net/tcp parsing, Docker and Kubernetes monitors with audit events.
  • RBAC. Role-based access control with tool-level policies. API key and JWT/OIDC authentication.
  • Approval gate. Human-in-the-loop approval for sensitive tool calls.

Observability

  • OpenTelemetry. Distributed tracing with W3C trace context propagation across MCP servers.
  • Prometheus metrics. MCP server state, tool calls, health checks, circuit breaker, concurrency, batch execution.
  • Grafana dashboards. Pre-built overview and per-MCP server deep dive dashboards.
  • Structured logging. Correlation IDs across parallel calls. JSON log format for production.
  • Audit trail. Event-sourced audit log with OTLP export for security-relevant events.

Scales With You

  • Home lab: 2 MCP servers, zero config complexity
  • Team setup: Shared MCP servers, Docker containers, hot-reload
  • Enterprise: 50+ MCP servers, behavioral profiling, RBAC, approval gates, Kubernetes operator

Same API. Same reliability. Different scale.

Documentation

License

Licensed under MIT.


Docs | PyPI | GitHub