CLI reference
Every MCPG command-line tool — the gateway (mcpg), plugin artifacts (mcpg-plugins), the config tooling, the control-plane CLI (mcpg-ctl), the control-plane server, and the Kubernetes operator — and how they fit together.
MCPG ships a small family of command-line tools. One is the hub — mcpg,
the gateway — and the rest are focused binaries that produce, validate, or
manage what the gateway runs, or operate the control plane around it.
The crates are publish = false, so there is no cargo install mcpg from
crates.io: build the binaries from the workspace, or pull the release
container images. Two planes stay deliberately separate — the data plane
(the gateway, its config, its plugins) and the control plane (the CP
server, mcpg-ctl, and the operator).
Reference pages
mcpg— the gateway — run it,MCPG_CONFIG,--stdio, and thedev/pluginfront-door subcommands.mcpg-plugins— plugin artifacts — scaffold, hash, sign, pack, push, pull, and test plugin artifact files (also viamcpg plugin …).mcpg-config-*— config tooling — the seven binaries that scaffold, validate, document, and inspect the gatewayAppConfig.mcpg-ctl— the control plane — run the CP locally, enrol gateways, sign in via OIDC, and drive Cloud provisioning + cluster admin.mcpg-control-plane-server— the REST + gRPC control-plane server thatmcpg-ctland gateway agents talk to.mcpg-operator&crdgen— the Kubernetes operator that reconciles themcpg.devCRDs, plus the CRD-YAML generator.
The ecosystem at a glance
| Binary | What it is | Plane |
|---|---|---|
mcpg | The gateway server and the front-door CLI (mcpg plugin …, mcpg dev …) | Data |
mcpg-plugins | Plugin artifact tool — scaffold / hash / sign / pack / push / pull / test plugin files | Data (build/release) |
mcpg-config-* (7 binaries) | Author, validate, and inspect the gateway config (AppConfig) | Data (config) |
mcpg-ctl | Control-plane CLI — run the CP, enrol gateways, provision Cloud, admin clusters | Control |
mcpg-control-plane-server | The control-plane REST + gRPC server mcpg-ctl and gateways talk to | Control |
mcpg-operator + crdgen | Kubernetes operator that reconciles the eight mcpg.dev CRDs; CRD-YAML generator | Control (K8s) |
How they connect
The config tooling authors and validates an AppConfig (YAML). The gateway
loads it from MCPG_CONFIG (standalone) or from MCPGGateway.spec.config (on
Kubernetes, set by the operator). mcpg plugin <cmd> execs the mcpg-plugins
binary to package and publish plugins to an OCI registry; the gateway then
loads them by path or OCI reference. On the control plane, mcpg-ctl and
gateway agents talk to mcpg-control-plane-server over REST /v1 and gRPC.
Common workflows
Author and run a plugin locally
mcpg plugin new --kind tool_gate --name rate-limit # scaffold a crate
cd mcpg-plugin-tool-gate-rate-limit && cargo build --release
mcpg dev --plugin target/release/libmcpg_plugin_tool_gate_rate_limit.so # load into a live gateway
# Package + publish when ready:
mcpg plugin pack -d plugin.yaml -a target/release/lib*.so -v 0.1.0 -o rl.zip
mcpg plugin push rl.zip ghcr.io/acme/plugins/rate-limit:0.1.0 -u me -p env:GHCR_TOKEN
Self-host the gateway
mcpg-config-init --template production-single-redis --output config.yaml
# edit config.yaml (add capabilities/bindings, plugins referencing ghcr.io/…)
mcpg-config-check config.yaml # validate before boot
mcpg-config-secrets config.yaml # review which secrets it will resolve
mcpg-config-wiring config.yaml # confirm each slot resolves to the right kind
MCPG_CONFIG=config.yaml mcpg # run it
Control plane + gateway enrolment
mcpg-ctl quickstart # run the CP locally (or mcpg-control-plane-server in prod)
# In the UI/API, create an enrolment URL, then:
mcpg-ctl gateway --enrollment-url "http://127.0.0.1:7843/enroll/<token>"
mcpg-ctl status && mcpg-ctl gateway-status
Environment-variable quick reference
| Variable | Used by | Meaning |
|---|---|---|
MCPG_CONFIG | mcpg | Config file path, or a path-separator-joined overlay list |
MCPG_* (__-nested) | mcpg | Per-field config overrides (e.g. MCPG_GATEWAY__SERVER__BIND_ADDRESS) |
MCPG_PLUGIN_DIR | mcpg-plugins list | Default plugin directory |
MCPG_STATE_DIR | mcpg-ctl | State / DB / credentials directory (default ~/.mcpg) |
MCPG_CP_URL | mcpg-ctl | CP HTTP base URL (default http://127.0.0.1:7843) |
MCPG_SESSION_COOKIE | mcpg-ctl provision / cluster | mcpg_sid session cookie value |
MCPG_ENROLLMENT_URL | mcpg-ctl gateway | First-run gateway enrolment URL |
MCPG_FED_ISSUER | mcpg-ctl login | OIDC issuer |
MCPG_CP_* (or MCPG_CONTROL_PLANE_*) | CP server | All CP server options (short form wins) |
MCPG_OPERATOR_* | operator | All operator options |
RUST_LOG | all | Log filter |
Port quick reference
| Service | Default | Protocol |
|---|---|---|
Gateway (mcpg, HTTP) | 127.0.0.1:8787 | HTTP / SSE (MCP) |
| Control plane HTTP | 127.0.0.1:7843 | REST /v1 + UI |
| Control plane gRPC | 127.0.0.1:7844 | Agent contract |
| Operator admission webhook | 0.0.0.0:9443 | HTTPS |
Operator metrics + health (/metrics, /healthz, /readyz) | 0.0.0.0:8443 | HTTPS |
For the full configuration surface the gateway accepts, see the configuration reference.