β¨ Features OverviewΒΆ
MCP Gateway is a gateway + registry + proxy purpose-built for the Model Context Protocol (MCP). It unifies REST, MCP, and stdio worlds while adding auth, caching, federation, and an HTMX-powered Admin UI.
π Multi-Transport CoreΒΆ
Supported Transports
| Transport | Description | Typical Use-case |
|---|---|---|
| HTTP / JSON-RPC | Low-latency request-response, default for most REST clients | Simple tool invocations |
| WebSocket | Bi-directional, full-duplex | Streaming chat or incremental tool results |
| Server-Sent Events (SSE) | Uni-directional server β client stream | LLM completions or real-time updates |
| STDIO | Local process pipes via mcpgateway-wrapper | Editor plugins, headless CLI clients |
Try it: SSE from curl
π Federation & DiscoveryΒΆ
Features
- Auto-discovery - DNS-SD (
_mcp._tcp.local.) or static peer list - Health checks - fail-over + removal of unhealthy gateways
- Capability sync - merges remote tool catalogs into the local DB
- Request forwarding - automatic routing to the correct gateway
Architecture
graph TD
subgraph Local_Gateway
A[MCP Gateway Core]
end
subgraph Remote_Gateway_1
B[Peer 1]
end
subgraph Remote_Gateway_2
C[Peer 2]
end
A <-- ping / register --> B
A <-- ping / register --> C Configuration
Enable or tweak discovery via .env:
π SecurityΒΆ
Auth mechanisms
- JWT bearer (default, signed with
JWT_SECRET_KEY) - HTTP Basic for the Admin UI
- Custom headers (e.g., API keys) per tool or gateway
Rate limiting
Set MAX_TOOL_CALLS_PER_MINUTE to throttle abusive clients. Exceeding the limit returns HTTP 429 with a Retry-After header.
Generate a 24 h token
π Tool & Server RegistryΒΆ
What you can register
| Registry | Entities | Notes |
|---|---|---|
| Tools | Native MCP tools or wrapped REST / CLI functions | JSON Schema input validation |
| Resources | URIs for blobs, text, images | Optional SSE change notifications |
| Prompts | Jinja2 templates + multimodal content | Versioning & rollback |
| Servers | Virtual collections of tools/prompts/resources | Exposed as full MCP servers |
| gRPC Services | gRPC microservices via automatic reflection | Protocol translation to MCP/JSON |
REST tool example
π gRPC-to-MCP TranslationΒΆ
Automatic gRPC Integration
- Server Reflection - Automatically discovers gRPC services and methods
- Protocol Translation - Converts between gRPC/Protobuf β MCP/JSON
- Zero Configuration - No manual schema definition required
- TLS Support - Secure connections to gRPC servers
- Metadata Headers - Custom gRPC metadata for authentication
- Admin UI - Manage gRPC services via web interface
Register a gRPC service
# CLI: Expose gRPC service via HTTP/SSE
python3 -m mcpgateway.translate --grpc localhost:50051 --port 9000
# REST API: Register for persistence
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "payment-service",
"target": "payments.example.com:50051",
"reflection_enabled": true,
"tls_enabled": true
}' \
http://localhost:4444/grpc
How it works
- Gateway connects to gRPC server using Server Reflection Protocol
- Discovers all available services and methods automatically
- Translates Protobuf messages to/from JSON
- Exposes each gRPC method as an MCP tool
- Handles streaming (unary and server-streaming)
Supported gRPC features
| Feature | Status | Notes |
|---|---|---|
| Unary RPCs | β Supported | Request-response methods |
| Server Streaming | β οΈ Partial | Basic support implemented |
| Client Streaming | π§ Planned | Future enhancement |
| Bidirectional Streaming | π§ Planned | Future enhancement |
| TLS/mTLS | β Supported | Certificate-based auth |
| Metadata Headers | β Supported | Custom headers for auth |
| Reflection | β Required | Auto-discovery mechanism |
π₯ Admin UIΒΆ
Built with
- FastAPI + Jinja2 + HTMX + Alpine.js
- Tailwind CSS for styling
π Audit & Metadata Tracking
- Comprehensive metadata for all entities (Tools, Resources, Prompts, Servers, Gateways)
- Creation tracking - who, when, from where, how
- Modification history - change attribution and versioning
- Federation source tracking for MCP server entities
- Bulk import batch identification
- Auth-agnostic - works with/without authentication
- Backwards compatible - legacy entities show graceful fallbacks
π Persistence, Caching & ObservabilityΒΆ
Storage options
- SQLite (default dev)
- PostgreSQL, MySQL/MariaDB, MongoDB - via
DATABASE_URL
Observability
- Structured JSON logs (tap with
jq) /metrics- Prometheus-friendly counters (tool_calls_total,gateway_up)/health- readiness + dependency checks
π§© Dev & ExtensibilityΒΆ
Highlights
- Makefile targets -
make dev,make test,make lint - 400+ unit tests - Pytest + HTTPX TestClient
- VS Code Dev Container - Python 3.11 + Docker/Podman CLI
- Plug-in friendly - drop-in FastAPI routers or Pydantic models
Next StepsΒΆ
- Hands-on Walk-through β Quick Start
- Deployment Guides β Compose, K8s & Cloud
- Admin UI deep dive β UI Guide
Ready to explore
With transports, federation, and security handled for you, focus on building great MCP tools, prompts, and agents-the gateway has your back.