A protocol-authority gateway that manages identity, authorization, and execution dispatch for Model Context Protocol clients and backends.
Also known as mcpg-dev/mcpg, model-context-protocol-gateway
- Stars
- 0
- Tools
- 1
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 13, 2026
- License
- Apache-2.0
What is MCPG MCP?
MCPG is a protocol-authority gateway that manages identity, authorization, and execution dispatch for Model Context Protocol clients and backends. It exposes 1 tool, such as built.
Summary generated from the project's README
About MCPG MCP server
Managing identity, authorization, and execution dispatch for Model Context Protocol clients and backends is what mcpg enables. It acts as a protocol-authority gateway that sits between clients and downstream systems, handling the entire session lifecycle and protocol implementation. Developers can deploy it locally using cargo or npm, or in production environments via Docker and Kubernetes with Helm charts.
The gateway routes tool calls, prompt requests, and resource reads to operator-defined backends through a plugin system. It supports various communication methods including HTTP, gRPC, SQL, and messaging systems like NATS or Kafka. It also manages outbound credentials using the credential_issuer plugin family, allowing backends to reference issued values through specific URIs.
Security is a core focus, with the system enforcing pre-dispatch authorization using CEL expressions and resolving identity through OIDC, OAuth, or JWKS. It provides observability through Prometheus metrics and OpenTelemetry traces, ensuring that complex multi-step pipelines and task-augmented tool calls are fully monitored and controlled.
What you can do with it
- 1Secure tool executionAn AI client can trigger tool calls that are gated by specific trust levels and CEL expressions before reaching the backend.
- 2Automated credential managementA developer can delegate the handling of OAuth 2.0 or Vault dynamic database credentials to the gateway's plugin system.
- 3Connecting diverse data sourcesYou can route MCP requests to a wide variety of backends including SQL databases, GraphQL APIs, or LLM providers.
- 4Orchestrating complex workflowsAn agent can execute multi-step pipelines that require interaction with the client for sampling or elicitation.
Written from the project's README. Every use case is checked against a quote from it.
How to install MCPG MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall MCPG MCP in Claude Code
$ claude mcp add mcpg -- npx -y model-context-protocol-gatewayInstall MCPG MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"mcpg": {
"command": "npx",
"args": [
"-y",
"model-context-protocol-gateway"
]
}
}
}Install MCPG MCP in VS Code
.vscode/mcp.json
{
"servers": {
"mcpg": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"model-context-protocol-gateway"
]
}
}
}Install MCPG MCP in VS Code CLI
$ code --add-mcp '{"name":"mcpg","type":"stdio","command":"npx","args":["-y","model-context-protocol-gateway"]}'Install MCPG MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"mcpg": {
"command": "npx",
"args": [
"-y",
"model-context-protocol-gateway"
]
}
}
}Install MCPG MCP in Codex
$ codex mcp add mcpg -- npx -y model-context-protocol-gatewayInstall MCPG MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.mcpg] command = "npx" args = ["-y", "model-context-protocol-gateway"]
Install MCPG MCP in Gemini CLI
$ gemini mcp add -s user mcpg npx -- -y model-context-protocol-gatewayInstall MCPG MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"mcpg": {
"command": "npx",
"args": [
"-y",
"model-context-protocol-gateway"
]
}
}
}MCPG MCP tools 1
Detected from the READMEbuilt
| built | — |
Configuration
MCPG_CONFIG
| Name | Description | |
|---|---|---|
| MCPG_CONFIG | — |
Automated checks
Ran Nov 14, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachablemcpg-dev/mcpg is public and reachablegithub.com/mcpg-dev/mcpg ↗Pass
- Package names this repository as its sourcemodel-context-protocol-gateway names mcpg-dev/mcpg as sourcenpmjs.com/package/model-context-protocol-gateway ↗Pass
- Build provenance (Sigstore attestation)Sigstore attestation for model-context-protocol-gatewaynpmjs.com/package/model-context-protocol-gateway/v/0.1.0-rc. ↗Pass
- Open source license (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-13github.com/mcpg-dev/mcpg ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNo popular package one edit away from model-context-protocol-gatewayPass
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model1 tool description and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNo tool named like delete, drop or execPass
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubMCPG — Model Context Protocol Gateway
MCPG is a protocol-authority gateway for the Model Context Protocol. It sits between MCP clients and downstream backend systems, owning protocol handling, session lifecycle, identity, authorization, execution dispatch, and observability.
Production-grade Rust · extensive unit + integration + MCP-conformance coverage · implements MCP 2026-07-28 and 2025-11-25 (both CI-conformance-gated; legacy 2025-06-18 / 2025-03-26 accepted on request)
Build an MCP server with MCPG: see
docs/agent-authoring-guide.mdfor the AI-agent authoring procedure, anddocs/mcp-server-ideas.mdfor 25 concrete systems worth wrapping (name.com, Cloudflare, GitHub, Stripe, iPhone Simulator, and more) — each with a runnable sample underexamples/.Compliance status: start at
docs/compliance/mcp-compliance.mdfor the canonical reference. The supported-feature matrix is atdocs/compliance/compliance-support.md; operator knobs and metrics are documented indocs/configuration.mdanddocs/observability.md. Doc index:docs/README.md.
What MCPG Does
- Speaks MCP over Streamable HTTP with SSE streaming — the finalized
2026-07-28revision (stateless, header-routed) and the session-based2025-11-25default; the server always emits2026-07-28as its wire string and accepts the legacy2025-06-18/2025-03-26revisions when a client requests them - Routes tool calls, prompt gets, and resource reads to operator-defined backends
- Enforces pre-dispatch authorization with trust levels and CEL expressions
- Resolves identity via JWKS, OIDC/OAuth (multi-provider), or header assertion
- Orchestrates multi-step pipelines with client interaction (elicitation, sampling)
- Supports MCP Tasks — task-augmented tool calls with background execution, polling, cancellation, and result retrieval
- Distributes state across NATS, Redis, or in-process backends per capability (activated via per-capability
<capability>.store/<bus>.busoverrides) - Manages outbound credentials (OAuth 2.0 client_credentials, Vault dynamic DB, static) via the
credential_issuerplugin family — backends reference issued values throughcred://<plugin_id>/<target>URIs, with cached, auto-refreshed tokens - Surfaces MCP App URLs (
_meta.mcpAppUrl) on resource descriptors with CEL interpolation - Delivers subject-scoped resource notifications with 4 filter scopes (all, subject, session, expression)
- Extends via async plugin system — dual-tier (Native + Wasm) tool-gate, transform, and identity chains
- Enforces external guardrails via HTTP webhook callouts with CEL triggers and fail-open/fail-closed policies
- Gates tool calls via Machine Payment Protocol with HMAC-bound challenges
- Emits Prometheus metrics and OpenTelemetry traces
Backends
Backends are cdylib plugins — the gateway binary hard-wires none. The
catalog ships 32 backend and connector plugins; a caller selects one
per capability via a nested backend.kind: discriminator. Common kinds:
| Kind | Transport |
|---|---|
http |
HTTP POST/GET to downstream endpoints |
command |
Local subprocess execution |
nats / kafka / amqp |
Messaging (request/reply, pub/sub) |
grpc |
gRPC via proto-less JSON mapping |
graphql / soap |
GraphQL query/mutation, SOAP |
sql |
SQL + warehouse databases (Postgres, MySQL, Snowflake, BigQuery, ClickHouse, DuckDB, Oracle, …) |
ldap / dynamodb / email / sftp |
Directory, key-value, mail, file transfer |
openapi |
OpenAPI spec → generated tools |
mock |
Static fixture response |
pipeline |
Multi-step orchestration (11 step types) |
| LLM/media family | 17 kinds — OpenAI, Azure OpenAI, Anthropic, Gemini, Stability, and OpenAI-compatible chat/embedding/image/TTS/STT |
Full reference: docs/backends.md.
Install
The model-context-protocol-gateway package installs mcpg together with
mcpg-config, mcpg-cloud and mcpg-plugin:
npx model-context-protocol-gateway --help # npm, one-shot
npm install -g model-context-protocol-gateway # npm
pipx install model-context-protocol-gateway # PyPI (or: uvx model-context-protocol-gateway)
cargo install model-context-protocol-gateway --version <version> # crates.io: a launcher that runs the release binaries
cargo binstall model-context-protocol-gateway --version <version> # the release binaries directly
curl -fsSL https://raw.githubusercontent.com/mcpg-dev/mcpg/main/install.sh | sh
The container image is ghcr.io/mcpg-dev/mcpg:<version>. Every install path:
mcpg.dev/docs/install.
Build from source
# Build
cargo build
# Test
cargo test
# Run
MCPG_CONFIG=config.example.yaml cargo run
Docker & Kubernetes
# Build Docker image (from repo root)
docker build -t mcpg:latest -f apps/gateway/Dockerfile .
# Run single instance
docker run -p 8787:8787 -v $(pwd)/config.yaml:/etc/mcpg/config.yaml:ro mcpg:latest
# Deploy to Kubernetes via Helm (single instance). The charts are
# 0.1.0-beta.N prereleases: always pass --version.
helm install mcpg oci://ghcr.io/mcpg-dev/charts/mcpg --version <chart-version>
# Deploy HA with NATS backend (multi-instance)
helm install mcpg oci://ghcr.io/mcpg-dev/charts/mcpg --version <chart-version> \
--set replicaCount=3 \
--set nats.enabled=true \
--set autoscaling.enabled=true \
--set podDisruptionBudget.enabled=true
Full deployment guide: docs/deployment.md. Helm chart reference: Kubernetes install with Helm.
Configuration
See config.example.yaml for a working configuration. Full reference: docs/configuration.md.
server:
bind_address: "127.0.0.1:8787"
observability:
logs:
level: "info"
sinks:
- kind: stderr
config: { format: json }
mcp:
capabilities:
tools:
- name: "my_tool"
description: "Example HTTP backend"
backend:
kind: http
url: "https://api.example.com/endpoint"
method: post
timeout_ms: 5000
Documentation
| Document | Description |
|---|---|
| docs/architecture.md | System architecture, module structure, request flow |
| docs/request-flow.md | Complete request lifecycle, all routes, plugin extension points |
| docs/configuration.md | Complete configuration reference |
| docs/backends.md | Backend kinds and connector plugins with examples |
| docs/pipelines.md | Pipeline execution, 11 step types, suspension/resumption |
| docs/identity-and-authorization.md | JWKS, OIDC/OAuth, trust levels, CEL policy |
| docs/infrastructure.md | Session stores, delivery buses, pipeline stores |
| docs/observability.md | Logging, Prometheus metrics, OpenTelemetry |
| docs/api-reference.md | HTTP endpoints, MCP operations, SSE protocol |
| docs/deployment.md | Docker, Kubernetes/Helm, deployment topologies |
| docs/plugins.md | Plugin system: traits, registry, Wasm, config |
| Kubernetes install with Helm | Helm chart reference — parameters, examples, architecture |
Architecture at a Glance
MCP Client
│
▼
HTTP Transport ──→ Identity Resolution ──→ Gateway Runtime ──→ Plugin Chain ──→ Backend Execution
│ (OIDC/JWKS/Plugin) │ (gate/transform) (backend plugins)
│ │
├── SSE Streaming Session Management
│ (replay window) (4 store backends)
│
└── Prometheus + OpenTelemetry
Plugin System Crates
libs/
├── plugin-protocol/ — Trait contracts + FFI ABI types (ToolGatePlugin, BackendPlugin, etc.)
├── plugin-host/ — Registry, chain evaluation, Wasm hosting, artifact verification
├── plugin-sdk/ — SDK for building plugins (testing helpers, MockGateway)
├── sdk/ — `mcpg-sdk` umbrella crate plugin authors depend on
└── plugins/ — the production catalog: 92 shipping plugins across 14
categories (backend, security, identity, transform,
observability, payment, credential, …), cdylib + a few Wasm
Design Decisions
Key architectural decisions:
- ADR-0001: Single-deployment, backend-driven runtime (no multi-tenancy)
- ADR-0004: Canonical backend execution contract (gateway as protocol authority)
- ADR-0005: Multi-node lease fencing with CAS semantics
- ADR-0007: OIDC/OAuth multi-provider authentication
License
The gateway core is Apache-2.0 (see LICENSE). Enterprise plugins and the fleet platform (Kubernetes operator, control plane) ship under BUSL-1.1, each release auto-converting to Apache-2.0 three years later. To license production use of the BUSL-1.1 components, email agent@mcpg.dev or use the managed service at mcpg.cloud. The canonical component map is at mcpg.dev/license.
Backend governance integrates with the policy layer. Each backend's minimum_trust and allow_if are injected as per-tool policy rules at startup. CEL expressions are compiled and validated during bootstrap.
Debug Tools
The debug capability model is intentionally narrow:
- the top-level
debug.enabled: truegate must be set before any debug capabilities exist - command probes, network probes, and the debug HTTP JSON call use named execution profiles (under
debug.tools.command_profiles/debug.tools.network_profiles) with bounded timeout and size limits - built-in debug tools, prompt, and resource capabilities can be exposed or hidden independently via
debug.tools.exposure.* - debug tools emit structured logs with
backend_kind: debug_toolto distinguish from operator backends
Execution Contract
All downstream execution paths produce structured result envelopes with:
- tool name, profile, and request kind classification
- request and response details
- structured error objects with category, retry hints, idempotency, and suggested actions
- execution duration, status codes, and truncation indicators
Execution logs include backend_kind (operator_backend or debug_tool) on all call sites.
MCPG MCP questions
How do I add MCPG MCP to Claude Code?
Run claude mcp add mcpg -- npx -y model-context-protocol-gateway in your terminal. Add --scope user to make it available in every project.
How do I add MCPG MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
What tools does MCPG MCP provide?
It exposes 1 tool, including built.
What does MCPG do?
It acts as a gateway between MCP clients and backend systems, handling protocol handling, session lifecycle, identity, authorization, and observability.
How can I deploy MCPG on Kubernetes?
You can deploy it using Helm charts, with options for single instance or high availability using a NATS backend.