Skip to main content

Crate pmcp_package

Crate pmcp_package 

Source
Expand description

§pmcp-package

The AI-Package format for portable MCP packages: typed manifest schemas, config-slot aggregation, local OCI pack/unpack, and canonical-digest computation.

§Dual-consumer contract

This crate is consumed by two independent call sites:

  • cargo-pmcp (the CLI) — packs local server/agent/team/workflow artifacts for publish.
  • The pmcp.run platform — unpacks and validates packages at import/pre-flight time.

Both call sites MUST resolve identical validation/digest behavior from the same crate code — that is the entire point of this crate existing as a shared, standalone, publishable library rather than being duplicated in each consumer.

§Scope fence

This crate is format only:

  • Typed manifest schemas for the four package kinds (mcp-server, agent, team, workflow).
  • Config-slot type system: classification, aggregation, deviation detection.
  • Local OCI artifact pack/unpack (construct manifests + content-addressed blobs on disk — no registry calls).
  • Canonical-digest computation for approval-record keying.
  • A DELIBERATELY NARROW read of a server’s own config document (oci::config_validation): it reads the [[config_slots]] declaration table and resolves the dotted TOML path each declared slot names, so pack_server can refuse a package whose slot list disagrees with the config it ships, or whose slot-declared value key holds a resolved literal. That is the whole extent of it — the crate models no config schema, holds no opinion about the toolkit’s config shape beyond those two things, and never re-serializes the document (config layer bytes stay verbatim).

It explicitly does NOT contain:

  • Agent runtime semantics (no execution, no LLM calls, no tool dispatch).
  • Network or AWS SDK dependencies (no reqwest, no tokio, no oci-client, no aws-sdk-* crate). Registry push/pull is a caller-side concern at the caller’s call site, not this crate’s.
  • Secret values — config slots may declare that a secret is required by name, but the crate’s types are structurally incapable of holding a resolved secret value (see slot module docs).

Re-exports§

pub use digest::canonicalize;
pub use digest::manifest_digest;
pub use digest::verify;
pub use digest::verify;
pub use digest::ManifestDigest;
pub use error::PackageError;
pub use error::Result;
pub use oci::pack_agent;
pub use oci::pack_server;
pub use oci::pack_team;
pub use oci::pack_workflow;
pub use oci::parse_declared_config_slots;
pub use oci::unpack_agent;
pub use oci::unpack_server;
pub use oci::unpack_team;
pub use oci::unpack_workflow;
pub use oci::validate_config_slot_agreement;
pub use oci::validate_config_slot_placeholders;
pub use oci::validate_no_undeclared_env_refs;
pub use oci::AttestationFile;
pub use oci::BinaryMode;
pub use oci::ConfigFile;
pub use oci::DeclaredConfigSlot;
pub use oci::OciLayout;
pub use oci::OpenApiSpecFile;
pub use oci::RestoredFile;
pub use oci::SubjectVerdict;
pub use oci::UnpackedAttestation;
pub use oci::UnpackedBinary;
pub use oci::UnpackedServer;
pub use oci::UnpackedTeam;
pub use package::AgentPackage;
pub use package::CedarPolicySet;
pub use package::DeployDescriptor;
pub use package::ServerPackage;
pub use package::TeamPackage;
pub use package::WorkflowManifest;
pub use reference::ComponentRef;
pub use reference::PinnedRef;
pub use slot::aggregate;
pub use slot::aggregate;
pub use slot::classify;
pub use slot::classify_slots;
pub use slot::detect_deviation;
pub use slot::required_slots;
pub use slot::ClassifiedSlot;
pub use slot::ConfigSlot;
pub use slot::Deviation;
pub use slot::RequiredSlot;
pub use slot::SlotClass;
pub use slot::SlotType;
pub use slot::SuppliedBy;
pub use validation::validate as validate_deploy_descriptor;

Modules§

digest
Canonical digest computation for AI-Package manifests.
error
Crate-wide error surface for pmcp-package.
oci
Local OCI Image Layout pack/unpack (the titular scope): serialize each of the four package types into an OCI Image Layout on disk with custom application/vnd.pmcp.* media types per layer, content-address each blob by sha256, and verify every blob’s digest before deserializing . Pure local disk I/O — no network, no oci-client — so the registry push/pull can consume these exact oci_spec::image types with zero translation.
package
The four AI-Package schema types: ServerPackage (Task 1), AgentPackage/TeamPackage (Task 2), and WorkflowManifest (Task 3).
reference
Typed component references.
slot
Config-slot type system (,): typed slot declarations that structurally cannot carry a secret/identity value, classification into identity-bearing vs behavior-relevant, aggregation across a component graph, and deviation detection for behavior-relevant slots.
validation
CFN-resource-allowlist validation on DeployDescriptor.