Skip to main content

Crate mcp_gateway

Crate mcp_gateway 

Source
Expand description

MCP Gateway Library

Universal Model Context Protocol (MCP) Gateway with a compact Meta-MCP tool surface.

§Features

  • Meta-MCP Mode: 12 tools minimum, 14 in the README benchmark scenario, 15 when webhook status is surfaced
  • Streaming: Real-time notifications via SSE (MCP 2025-03-26 Streamable HTTP)
  • Notification Multiplexer: Routes backend notifications to connected clients
  • Multi-Transport: stdio, Streamable HTTP, SSE support
  • Failsafes: Circuit breakers, retries, timeouts, rate limiting
  • Production Ready: Health checks, metrics, graceful shutdown

§Protocol Version

Implements MCP protocol versions:

  • 2025-11-25 (latest - tasks, elicitation, audio, tool annotations)
  • 2025-06-18
  • 2025-03-26 (Streamable HTTP)
  • 2024-11-05
  • 2024-10-07

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

a2a
A2A (Agent2Agent) transport adapter — Phase 1.
attestation
Symphony+ sandbox attestation — token injection at sandbox creation (MIK-5223, B1-IDENT).
autotag
Automatic keyword extraction for MCP tool descriptions.
backend
Backend management
cache
Response caching with TTL for gateway_invoke results
capability
Capability system for direct REST API integration
chains
Durable Capability Chains — step-level checkpoint + retry for multi-tool pipelines.
cli
Command-line interface definitions for mcp-gateway.
config
Configuration management.
config_persistence
Shared helpers for mutating and persisting gateway config files.
config_reload
Config hot-reload with diff patching.
context_compression
DSA-inspired context compression for proxied conversations — Issue #79.
context_integrity
Context integrity kernel for tool-result boundary protection.
control_plane
Enterprise control-plane domain model.
cost_accounting
Per-client cost accounting for gateway tool calls.
discovery
MCP Server Auto-Discovery
error
Error types for MCP Gateway
failsafe
Failsafe mechanisms: circuit breaker, retry, rate limiting, health tracking
gateway
Gateway server implementation
idempotency
Idempotency key support for gateway_invoke
identity_grants
Identity-scoped capability grants for personal MCP tools.
identity_propagation
End-user identity propagation to backend MCP servers (MIK-6704 / ADR-007).
key_server
LLM Key Server — OIDC identity to temporary scoped API keys.
kill_switch
Production safety — kill switches and error budgets for backend servers.
kubernetes
Kubernetes enterprise reconciliation planning.
metrics
Prometheus metrics recorder installation and text-format rendering.
mtls
Mutual TLS (mTLS) authenticated tool access.
oauth
OAuth 2.0 Client for MCP Gateway
playbook
Playbook engine for multi-step tool chains.
projection
Projection layer for the gateway proxy surface (MIK-3530).
protocol
MCP Protocol types (version 2025-11-25)
protocol_imports
Safe protocol import planning for external API and MCP package sources.
provider
Provider abstraction — pluggable tool sources for FastMCP 3.0.
ranking
Smart search ranking based on usage frequency
registry
Capability registry for community-shared capability definitions
routing_profile
Routing profiles for session-scoped tool access control.
runtime
RUNTIME-D: dual-substrate OCI abstraction layer.
scheduler
Cron scheduler and inbound webhook action dispatcher.
secret_injection
Secret injection proxy — credential brokering at the gateway level.
secrets
Secret resolution with keychain integration
security
Security modules for the MCP gateway.
semantic_search
Semantic search for natural language MCP tool discovery (RFC-0072).
session_sandbox
Gateway-level session sandboxing for per-session resource limits.
simhash
Simhash-based request routing and cache sharing for MCP Gateway — Issue #46.
skills
MCP Capability to Agent Skills bridge.
stats
Usage statistics tracking for the gateway
tool_profiles
Per-user tool usage profiles (RFC-0073).
tool_registry
Engram-inspired deterministic O(1) tool registry with prefetching.
tracing_context
Distributed tracing for tool call chains — Issue #63.
transform
Response transform pipeline for stripping noise from API responses.
transition
Predictive tool prefetch via invocation sequence tracking.
transport
Transport implementations for MCP backends
trust
TrustCard and CBOM metadata for MCP servers and tools.
tunnel
Tunnel integration for secure remote access.
validator
MCP Server Design Validator - Agent-UX Compliance

Constants§

MCP_PROTOCOL_VERSION
MCP Protocol version supported by this gateway (latest)

Functions§

setup_tracing
Setup tracing/logging