mcpbundle

package
v0.2.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2026 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DocumentLocatorForPackage

func DocumentLocatorForPackage(
	address source.ManagedPackageAddress,
) (basespec.Locator, error)

func EncodeAttachmentData

func EncodeAttachmentData(
	value AttachmentData,
) (json.RawMessage, error)

func EncodeCollectionData

func EncodeCollectionData(
	value CollectionData,
) (json.RawMessage, error)

func IsBundleDocumentLocator

func IsBundleDocumentLocator(value basespec.Locator) bool

func NewBundleCodec

func NewBundleCodec() shareable.Codec

func PackageAddressForBundle

func PackageAddressForBundle(
	logicalName basespec.LogicalName,
	logicalVersion basespec.LogicalVersion,
) (source.ManagedPackageAddress, error)

func ServerFromCanonicalBundle

func ServerFromCanonicalBundle(
	bundle BundleDocument,
	name string,
) (server.ServerDocument, error)

ServerFromCanonicalBundle projects one server from a Bundle that has already been accepted and canonicalized by the Artifact Store shareable schema registry.

It deliberately does not call CanonicalizeServer. MCP lifecycle code must not create a second portable-document validation path after registry canonicalization.

func ValidateBundle

func ValidateBundle(value BundleDocument) error

func ValidateDocumentLocator

func ValidateDocumentLocator(value basespec.Locator) error

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func New

func New(dependencies Dependencies) (*API, error)

func (*API) Create

func (a *API) Create(
	ctx context.Context,
	request CreateRequest,
) (Bundle, error)

func (*API) EnsureBuiltIn

func (a *API) EnsureBuiltIn(
	ctx context.Context,
	request EnsureBuiltInRequest,
) (Bundle, error)

EnsureBuiltIn creates or verifies one protected MCP Bundle topology and installs its complete canonical document through the protected managed source path. It is only callable from trusted hydration composition.

func (*API) EnsureBuiltInCurrent

func (a *API) EnsureBuiltInCurrent(
	ctx context.Context,
	ref collection.CollectionRef,
) error

EnsureBuiltInCurrent avoids managed package republishing for a current protected Bundle, but repairs a missing or stale Catalog after startup, decoder changes, or interrupted prior work.

func (*API) Get

func (a *API) Get(
	ctx context.Context,
	ref collection.CollectionRef,
) (Bundle, error)

func (*API) GetBundleInstallation

func (a *API) GetBundleInstallation(
	ctx context.Context,
	ref collection.CollectionRef,
) (BundleInstallationView, error)

func (*API) GetDocument

func (a *API) GetDocument(
	ctx context.Context,
	ref collection.CollectionRef,
) (BundleDocument, error)

GetDocument returns the current canonical source-owned MCP Bundle document.

Source access remains inside Artifact Store. This method verifies current Catalog inputs, Source revision, Source generation, stable source bytes, canonical schema identity, Collection metadata, and all current valid subresource Definitions.

func (*API) GetServerInstallation

func (a *API) GetServerInstallation(
	ctx context.Context,
	ref artifact.ArtifactRef,
) (ServerInstallationView, error)

func (*API) InspectMCPPolicy

func (a *API) InspectMCPPolicy(
	ctx context.Context,
	ref artifact.ArtifactRef,
) (PolicyView, error)

func (*API) InspectMCPServer

func (a *API) InspectMCPServer(
	ctx context.Context,
	ref artifact.ArtifactRef,
) (server.Resolved, error)

InspectMCPServer establishes Artifact, Collection, Catalog, Definition, installation, and policy validity without opening a Source snapshot or resolving a secret. It is deliberately for read-only status and setup projections. Connection and explicit runtime refresh must use ResolveMCPServer, which verifies exact current source bytes.

func (*API) List

func (a *API) List(
	ctx context.Context,
	rootID basespec.RootID,
) ([]Bundle, error)

func (*API) ListPolicies

func (a *API) ListPolicies(
	ctx context.Context,
	ref collection.CollectionRef,
) ([]artifact.Artifact, error)

func (*API) ListServers

func (a *API) ListServers(
	ctx context.Context,
	ref collection.CollectionRef,
) ([]artifact.Artifact, error)

func (*API) Purge

func (a *API) Purge(
	ctx context.Context,
	ref collection.CollectionRef,
	expectedRevision uint64,
) error

func (*API) Refresh

func (a *API) Refresh(
	ctx context.Context,
	ref collection.CollectionRef,
	allowProtected bool,
) (Bundle, error)

Refresh performs an explicit MCP configuration refresh. The runtime session is invalidated before publication so a live client cannot continue using configuration that the caller explicitly asked to re-evaluate.

func (*API) ReplaceDocument

func (a *API) ReplaceDocument(
	ctx context.Context,
	request ReplaceDocumentRequest,
) (Bundle, error)

ReplaceDocument publishes the canonical document-only package used by user-managed MCP Bundles.

func (*API) ResolveMCPServer

func (a *API) ResolveMCPServer(
	ctx context.Context,
	ref artifact.ArtifactRef,
) (server.Resolved, error)

func (*API) Retire

func (a *API) Retire(
	ctx context.Context,
	ref collection.CollectionRef,
	expectedRevision uint64,
) (collection.Collection, error)

func (*API) UpdateBundleEnabled

func (a *API) UpdateBundleEnabled(
	ctx context.Context,
	ref collection.CollectionRef,
	expectedRevision uint64,
	enabled bool,
) (Bundle, error)

func (*API) UpdateProtectedBundleInstallation

func (a *API) UpdateProtectedBundleInstallation(
	ctx context.Context,
	ref collection.CollectionRef,
	expectedOverlayRevision uint64,
	runtimeEnabled bool,
) error

func (*API) UpdateProtectedServerInstallation

func (a *API) UpdateProtectedServerInstallation(
	ctx context.Context,
	ref artifact.ArtifactRef,
	expectedOverlayRevision uint64,
	runtimeEnabled bool,
	data server.ServerData,
) error

func (*API) UpdateServerInstallation

func (a *API) UpdateServerInstallation(
	ctx context.Context,
	ref artifact.ArtifactRef,
	expectedArtifactRevision uint64,
	data server.ServerData,
) (artifact.Artifact, error)

type AttachmentData

type AttachmentData struct {
	SchemaVersion  string                       `json:"schemaVersion"`
	PackageAddress source.ManagedPackageAddress `json:"packageAddress"`
}

func DecodeAttachmentData

func DecodeAttachmentData(
	raw json.RawMessage,
) (AttachmentData, error)

func (AttachmentData) DocumentLocator

func (d AttachmentData) DocumentLocator() (basespec.Locator, error)

type Bundle

type Bundle struct {
	Collection      collection.Collection        `json:"collection"`
	Data            CollectionData               `json:"data"`
	Attachment      collection.Attachment        `json:"attachment"`
	Source          source.Summary               `json:"source"`
	PackageAddress  source.ManagedPackageAddress `json:"packageAddress"`
	DocumentLocator basespec.Locator             `json:"documentLocator"`
}

type BundleCodec

type BundleCodec struct{}

func (BundleCodec) Canonicalize

func (BundleCodec) Canonicalize(
	ctx context.Context,
	raw []byte,
) (shareable.ParsedDocument, error)

func (BundleCodec) JSONSchema

func (BundleCodec) JSONSchema() []byte

func (BundleCodec) Key

type BundleDocument

type BundleDocument struct {
	Kind          basespec.CollectionKind `json:"kind"`
	SchemaID      basespec.SchemaID       `json:"schemaID"`
	SchemaVersion string                  `json:"schemaVersion"`
	Digest        cryptoutil.Digest       `json:"digest,omitempty"`

	LogicalName    basespec.LogicalName    `json:"logicalName"`
	LogicalVersion basespec.LogicalVersion `json:"logicalVersion,omitempty"`
	DisplayName    string                  `json:"displayName,omitempty"`
	Description    string                  `json:"description,omitempty"`
	Labels         map[string]string       `json:"labels,omitempty"`

	MCPServers      map[string]server.CoreServer `json:"mcpServers"`
	BundleExtension BundleExtension              `json:"bundleExtension"`
}

func BundleFromParsedDocument

func BundleFromParsedDocument(
	input shareable.ParsedDocument,
) (BundleDocument, error)

BundleFromParsedDocument projects an Artifact Store-validated canonical MCP Bundle document into the MCP domain model.

It is intentionally not a second schema-validation entry point. Untrusted bytes must first pass through shareable.ExpectedCanonicalizer with BundleCodec{}.Key(). This helper verifies the registry output identity, canonical-byte invariant, and document digest before MCP lifecycle code consumes the typed projection.

func CanonicalizeBundle

func CanonicalizeBundle(
	input BundleDocument,
) (BundleDocument, json.RawMessage, error)

type BundleExtension

type BundleExtension struct {
	Servers  map[string]server.ServerExtension `json:"servers,omitempty"`
	Policies map[string]policy.PolicyDocument  `json:"policies,omitempty"`
}

type BundleInstallationView

type BundleInstallationView struct {
	Bundle             collection.CollectionRef `json:"bundle"`
	BuiltIn            bool                     `json:"builtIn"`
	CollectionRevision uint64                   `json:"collectionRevision"`
	OverlayRevision    uint64                   `json:"overlayRevision"`
	RuntimeEnabled     bool                     `json:"runtimeEnabled"`
}

type CollectionData

type CollectionData struct {
	SchemaVersion           string                  `json:"schemaVersion"`
	DiscoveryPolicyRevision string                  `json:"discoveryPolicyRevision"`
	LogicalName             basespec.LogicalName    `json:"logicalName"`
	LogicalVersion          basespec.LogicalVersion `json:"logicalVersion,omitempty"`
	Labels                  map[string]string       `json:"labels,omitempty"`
	ManagedSourceID         basespec.SourceID       `json:"managedSourceID,omitempty"`
}

func DecodeCollectionData

func DecodeCollectionData(
	raw json.RawMessage,
) (CollectionData, error)

type CreateRequest

type CreateRequest struct {
	RootID           basespec.RootID
	CollectionID     basespec.CollectionID
	SourceID         basespec.SourceID
	SourceStorageKey basespec.StorageKey

	// Document is raw portable JSON. It remains raw until the Artifact Store
	// expected-schema registry validates and canonicalizes it.
	Document      json.RawMessage
	Registrations []Registration
}

type Dependencies

type Dependencies struct {
	Sources          *source.Service
	Collections      *collection.Service
	Artifacts        *artifact.Service
	ManagedArtifacts *managedartifact.Service
	Refresh          refresh.Runner

	Catalogs           catalog.Reader
	SourceRuntime      source.Runtime
	ShareableDocuments shareable.ExpectedCanonicalizer

	HasDecoder         func(basespec.DecoderID) bool
	DecoderFingerprint func() (cryptoutil.Digest, error)

	RootPolicy    protection.RootPolicy
	UserRootID    basespec.RootID
	Runtime       RuntimeInvalidator
	Overlays      overlay.OverlayRepository
	SecretCleaner server.SecretCleaner

	BaselinePolicy policy.MCPPolicy
}

type EnsureBuiltInRequest

type EnsureBuiltInRequest struct {
	RootID         basespec.RootID
	CollectionID   basespec.CollectionID
	SourceID       basespec.SourceID
	PackageAddress source.ManagedPackageAddress

	PackageFiles  []source.ManagedPackageFile
	Document      shareable.ParsedDocument
	Registrations []Registration
}

type PolicyView

type PolicyView struct {
	Artifact         artifact.Artifact        `json:"artifact"`
	Collection       collection.CollectionRef `json:"collection"`
	CatalogRevision  uint64                   `json:"catalogRevision"`
	Definition       definition.Definition    `json:"definition"`
	Body             policy.MCPPolicy         `json:"body"`
	EffectiveEnabled bool                     `json:"effectiveEnabled"`
	BuiltIn          bool                     `json:"builtIn"`
}

type Registration

type Registration struct {
	ArtifactID  basespec.ArtifactID
	Subresource basespec.SubresourceLocator
	Kind        basespec.ArtifactKind
	Enabled     bool
	Data        json.RawMessage
}

type ReplaceDocumentRequest

type ReplaceDocumentRequest struct {
	Bundle                     collection.CollectionRef
	ExpectedCollectionRevision uint64
	Document                   json.RawMessage
	Registrations              []Registration
	AllowProtected             bool
}

type RuntimeInvalidator

type RuntimeInvalidator interface {
	Invalidate(
		ctx context.Context,
		ref artifact.ArtifactRef,
	) error

	InvalidateCollection(
		ctx context.Context,
		ref collection.CollectionRef,
	) error
}

type ServerInstallationView

type ServerInstallationView struct {
	Artifact             artifact.Artifact        `json:"artifact"`
	Collection           collection.CollectionRef `json:"collection"`
	CatalogRevision      uint64                   `json:"catalogRevision"`
	Document             server.ServerDocument    `json:"document"`
	Installation         server.ServerData        `json:"installation"`
	InstallationRevision uint64                   `json:"installationRevision"`
	InstallationEnabled  bool                     `json:"installationEnabled"`
	RuntimeEnabled       bool                     `json:"runtimeEnabled"`
	BuiltIn              bool                     `json:"builtIn"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL