mcpg-control-plane-core MCP server
Commit 10. Nov. 2026Provides shared types, gRPC contracts, and security primitives for the MCPG Control Plane multi-tenant service.
Auch bekannt als mcpg-dev/mcpg-control-plane-core
- Stars
- 0
- Tools
- —
- Downloads, 30 Tage
- —
- Neueste Version
- —
- Letzter Commit
- 10. Nov. 2026
- Lizenz
- Apache-2.0
Was ist mcpg-control-plane-core MCP?
mcpg-control-plane-core ist ein MCP server. Provides shared types, gRPC contracts, and security primitives for the MCPG Control Plane multi-tenant service.
Zusammenfassung generiert aus dem README des Projekts
Über mcpg-control-plane-core MCP server
Developers building components for the MCPG Control Plane use this library to ensure all services share a unified vocabulary and security model. It provides the essential gRPC contracts, such as the AgentControl service, which manages operations like Register, Heartbeat, and PullConfig. By using these shared types and schema migrations, different parts of the multi-tenant system can communicate reliably without drifting apart.
The library includes critical security primitives like the EnvelopeCipher for at-rest encryption, supporting implementations from a NoopCipher for development to AES-256-GCM or VaultTransitCipher for production. It also features a publish guard to validate tenant-authored gateway configurations, preventing unauthorized access to host state or internal networks. This core crate is used by the main control plane server, the gateway-side agent client, and various federation services to maintain strict tenant isolation and billing accuracy.
Was du damit machen kannst
- 1Secure tenant data at restYou can implement envelope encryption using AES-256-GCM or Vault to ensure one tenant cannot decrypt another's data.
- 2Enforce database multi-tenancyApply Postgres row-level security policies to ensure strict isolation between different organizations.
Geschrieben aus dem README des Projekts. Jeder Use Case wurde gegen ein Zitat daraus geprüft.
Konfiguration
MCPG_POSTGRES_TEST_URL
| Name | Beschreibung | Typ |
|---|---|---|
| MCPG_POSTGRES_TEST_URL | — |
README
Auf GitHub ansehenmcpg-control-plane-core
Shared types, traits, schema migrations, and the gRPC agent contract every MCPG Control Plane component is built on.
The MCPG Control Plane is the multi-tenant service that gateways register with,
heartbeat to, and pull configuration from. This crate is the vocabulary all of
its components agree on: the typed tenant identifiers, the domain model, the
mcpg.cp.v1 gRPC contract compiled from proto/mcpg/cp/v1/agent.proto, the
at-rest envelope-encryption primitive, the SQL migrations that define the
schema, and the small pieces of shared policy — the publish guard, the usage
report, the public-route rate limiter — where two services drifting apart would
be a security or billing bug. It is a library of contracts and shared
primitives; the HTTP API, the gRPC server, and the database access layer live in
apps/control-plane/server.
What's here
proto— the gRPC types generated fromproto/mcpg/cp/v1/agent.proto. TheAgentControlservice (Register,Channel,PullConfig,Heartbeat,Deregister) and its messages, includingConfigBundle,MetricsReport,LogBatch,QuotaStatusandCredentialRotation. Themcpg.cp.v1package is a public stability commitment.model—Org(withORG_STATUS_ACTIVE/ORG_STATUS_SUSPENDED/ORG_STATUS_DECOMMISSIONINGandis_suspended()/is_decommissioning()),Workspace,Environment,InstancewithInstanceState,InstancePlacement,ProviderName,PluginSet/PluginEntry, andUser.provider— theInstanceProviderdiscovery trait (name,list,watch, and the optionalregister/deregister, which default toError::Unsupported), plusInstanceEvent,DepartedReason,RegistrationClaim,AddressableEndpointandis_live().idsandlicense, re-exported frommcpg-control-plane-licenseso every control-plane component reads one definition ofOrgId,OrgSlug,LicenseClaims,Quotasand the entitlement gates.cipher— theEnvelopeCiphertrait and its implementations:NoopCipher(pass-through, for development and self-hosting without a key),LocalCipher(AES-256-GCM under a base64 32-byte master key), and, behind the non-defaultkmsfeature,VaultTransitCipherwithVaultKmsConfig. Every call binds a caller-chosencontextstring into the AEAD associated data — a tenant slug for control-plane payloads, a cluster id for provisioner credentials — so one tenant's ciphertext cannot be decrypted as another's even under the same master key.build()selects an implementation from the configured key;build_strict(key, require_encryption)returnsCipherError::EncryptionRequiredinstead of silently falling back to plaintext, which is what a production deployment passes.publish_guard—check_published_config(raw), the pre-deploy guard for tenant-authored gateway configs. A published config runs in the tenant's own pod at config-origin trust, so the guard rejects the constructs that would read host state from there —${env.…}interpolation andenv:///file://secret URIs — and the ones that would reach the pod's internal network:allow_private_backendsand federation upstreams pointed at a literal private address. It inspects leaf string values only, never keys or comments, reports every violation at once, and fails closed on input that parses as neither YAML nor TOML. Credential URIs the tenant owns are allowed and merely checked for well-formedness, and atunnel://upstream stays permitted because it egresses through the authenticated relay.require_cloud_auth(raw)is the companion check on the config's authentication posture.usage_report—UsageReportandOrgUsage, the one definition of the billing figures the control plane serves and the billing federation consumes. Two hand-written copies is exactly how a field rename silently deserializes to zero and bills a tenant nothing.ratelimit::RateLimiter— a dependency-light per-IP token bucket for unauthenticated public routes such as enrollment and login. It is pure: the caller extractsX-Forwarded-Forand the transport peer,client_ip()resolves them (honouring the forwarded header only whentrust_proxyis set, since it is otherwise spoofable), and the caller applies the verdict in its own middleware.error::{Error, Result},env_aliases::mirror_long_to_short()(acceptsMCPG_CONTROL_PLANE_*as a synonym for everyMCPG_CP_*variable, with the short form winning; call it as the first statement inmain), andtls_init::install_default_crypto_provider(), which pins a single rustls crypto provider at boot so a process linking bothaws-lc-rsandringstarts deterministically.migrations/sqlite/andmigrations/postgres/— the schema. The Postgres set carries the row-level-security policies that enforce per-tenant isolation against themcpg.org_idsession variable.apps/control-plane/serverembeds these directories at compile time and runs them.- Cargo features:
sqlite(default) andpostgresselect the sqlx engines, withtier0,tier1andtier2as presets over that pair;kmsadds the Vault Transit cipher and its HTTP client, and is off by default so builds that use no external KMS stay lean.
Used by
apps/control-plane/server— themcpg-cpbinary serving the HTTP API and theAgentControlgRPC service.libs/control-plane/client— the gateway-side agent, which speaks the generatedmcpg.cp.v1types.apps/gatewayunder its embedded-control-plane feature,mcpg-admin, and the Cloud-only federation and provisioner services.
Build / test
cargo build -p mcpg-control-plane-core
cargo test -p mcpg-control-plane-core
# The row-level-security suite needs a real Postgres it is allowed to wipe.
export MCPG_POSTGRES_TEST_URL=postgres://postgres:postgres@127.0.0.1:5432/mcpg_test
cargo test -p mcpg-control-plane-core --features postgres --test postgres_rls
The build script compiles the protobuf contract with a vendored protoc, so no
system protobuf installation is required.
Licence
Apache-2.0.
See also
- Cloud overview — what the Control Plane does for an operator.
mcpg cpreferencelibs/control-plane/client— the gateway side of the agent contract.libs/control-plane/license— the licensing types this crate re-exports.
mcpg-control-plane-core MCP Fragen
What services are included in the gRPC contract?
The AgentControl service includes Register, Channel, PullConfig, Heartbeat, and Deregister.
How does the encryption handle multi-tenancy?
The EnvelopeCipher binds a caller-chosen context string, such as a tenant slug, into the AEAD associated data to prevent cross-tenant decryption.
What databases are supported for schema migrations?
The library supports both SQLite and PostgreSQL for schema migrations.
Does the library support HashiCorp Vault?
Yes, when the 'kms' feature is enabled, it provides the VaultTransitCipher with VaultKmsConfig.