consumerapi

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func (*API) Create

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

func (*API) CreateMCPBundle

func (a *API) CreateMCPBundle(
	ctx context.Context,
	request *CreateMCPBundleRequest,
) (*CreateMCPBundleResponse, 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

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) GetMCPBundle

func (a *API) GetMCPBundle(
	ctx context.Context,
	request *GetMCPBundleRequest,
) (*GetMCPBundleResponse, error)

func (*API) GetMCPBundleDocument

func (a *API) GetMCPBundleDocument(
	ctx context.Context,
	request *GetMCPBundleDocumentRequest,
) (*GetMCPBundleDocumentResponse, error)

func (*API) GetMCPBundleInstallation

func (a *API) GetMCPBundleInstallation(
	ctx context.Context,
	request *GetMCPBundleInstallationRequest,
) (*GetMCPBundleInstallationResponse, error)

func (*API) GetMCPServerInstallation

func (a *API) GetMCPServerInstallation(
	ctx context.Context,
	request *GetMCPServerInstallationRequest,
) (*GetMCPServerInstallationResponse, error)

func (*API) GetMCPServerSchemaIdentity

func (a *API) GetMCPServerSchemaIdentity(
	ctx context.Context,
) (MCPServerSchemaIdentity, error)

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,
	request *InspectMCPPolicyRequest,
) (*InspectMCPPolicyResponse, error)

func (*API) InspectMCPPolicyForRuntime

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

func (*API) InspectMCPServer

func (a *API) InspectMCPServer(
	ctx context.Context,
	request *InspectMCPServerRequest,
) (*InspectMCPServerResponse, error)

func (*API) InspectMCPServerForRuntime

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

InspectMCPServerForRuntime 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 root.RootID,
) ([]Bundle, error)

func (*API) ListMCPBundlePolicies

func (a *API) ListMCPBundlePolicies(
	ctx context.Context,
	request *ListMCPBundlePoliciesRequest,
) (*ListMCPBundlePoliciesResponse, error)

func (*API) ListMCPBundleServers

func (a *API) ListMCPBundleServers(
	ctx context.Context,
	request *ListMCPBundleServersRequest,
) (*ListMCPBundleServersResponse, error)

func (*API) ListMCPBundles

func (a *API) ListMCPBundles(
	ctx context.Context,
	request *ListMCPBundlesRequest,
) (*ListMCPBundlesResponse, 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) PreparePurge

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

func (*API) PrepareRefresh

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

func (*API) PrepareReplaceDocument

func (a *API) PrepareReplaceDocument(
	ctx context.Context,
	request ReplaceDocumentRequest,
) (BundleMutationCommit, error)

PrepareReplaceDocument validates and materializes all request-derived document state before runtime invalidation. The returned commit function still relies on Artifact Store compare-and-swap checks for concurrency.

func (*API) PrepareRetire

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

func (*API) PrepareUpdateBundleEnabled

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

func (*API) PrepareUpdateProtectedBundleInstallation

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

func (*API) PrepareUpdateProtectedServerInstallation

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

func (*API) PrepareUpdateServerInstallation

func (a *API) PrepareUpdateServerInstallation(
	ctx context.Context,
	ref artifact.ArtifactRef,
	expectedArtifactRevision uint64,
	data mcpDomainServer.ServerData,
) (ArtifactMutationCommit, 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,
) (mcpDomainServer.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 mcpDomainServer.ServerData,
) error

func (*API) UpdateServerInstallation

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

type ArtifactMutationCommit

type ArtifactMutationCommit func(context.Context) (artifact.Artifact, error)

type BuiltinStore

type BuiltinStore interface {
	EnsureBuiltIn(
		ctx context.Context,
		request EnsureBuiltInRequest,
	) (Bundle, error)

	EnsureBuiltInCurrent(
		ctx context.Context,
		collectionRef collection.CollectionRef,
	) error

	Get(
		ctx context.Context,
		collectionRef collection.CollectionRef,
	) (Bundle, error)

	ListServers(
		ctx context.Context,
		collectionRef collection.CollectionRef,
	) ([]artifact.Artifact, error)

	ListPolicies(
		ctx context.Context,
		collectionRef collection.CollectionRef,
	) ([]artifact.Artifact, error)
}

type Bundle

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

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 BundleMutationCommit

type BundleMutationCommit func(context.Context) (Bundle, error)

type BundleMutator

type BundleMutator interface {
	PrepareReplaceDocument(
		ctx context.Context,
		request ReplaceDocumentRequest,
	) (BundleMutationCommit, error)

	PrepareRefresh(
		ctx context.Context,
		collectionRef collection.CollectionRef,
		allowProtected bool,
	) (BundleMutationCommit, error)

	PrepareUpdateBundleEnabled(
		ctx context.Context,
		collectionRef collection.CollectionRef,
		bundleID uint64,
		enabled bool,
	) (BundleMutationCommit, error)

	PrepareRetire(
		ctx context.Context,
		collectionRef collection.CollectionRef,
		bundleID uint64,
	) (CollectionMutationCommit, error)

	PreparePurge(
		ctx context.Context,
		collectionRef collection.CollectionRef,
		bundleID uint64,
	) (MutationCommit, error)

	PrepareUpdateProtectedBundleInstallation(
		ctx context.Context,
		collectionRef collection.CollectionRef,
		bundleID uint64,
		protected bool,
	) (MutationCommit, error)

	PrepareUpdateServerInstallation(
		ctx context.Context,
		artifactRef artifact.ArtifactRef,
		installationID uint64,
		serverData mcpDomainServer.ServerData,
	) (ArtifactMutationCommit, error)

	PrepareUpdateProtectedServerInstallation(
		ctx context.Context,
		artifactRef artifact.ArtifactRef,
		installationID uint64,
		protected bool,
		serverData mcpDomainServer.ServerData,
	) (MutationCommit, error)
}

type BundleServerStore

type BundleServerStore interface {
	ListServers(
		ctx context.Context,
		collectionRef collection.CollectionRef,
	) ([]artifact.Artifact, error)

	GetServerInstallation(
		ctx context.Context,
		artifactRef artifact.ArtifactRef,
	) (ServerInstallationView, error)
}

type CollectionMutationCommit

type CollectionMutationCommit func(
	context.Context,
) (collection.Collection, error)

type CreateMCPBundleBody

type CreateMCPBundleBody struct {
	RootID           root.RootID
	CollectionID     collection.CollectionID
	SourceID         source.SourceID
	SourceStorageKey basespec.StorageKey
	Document         json.RawMessage
	Registrations    []Registration
}

type CreateMCPBundleRequest

type CreateMCPBundleRequest struct {
	Body *CreateMCPBundleBody `json:"body"`
}

type CreateMCPBundleResponse

type CreateMCPBundleResponse struct {
	Body *Bundle `json:"body"`
}

type EnsureBuiltInRequest

type EnsureBuiltInRequest struct {
	RootID         root.RootID
	CollectionID   collection.CollectionID
	SourceID       source.SourceID
	PackageAddress source.ManagedPackageAddress

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

type GetMCPBundleDocumentRequest

type GetMCPBundleDocumentRequest struct {
	Bundle collection.CollectionRef `json:"bundle"`
}

type GetMCPBundleDocumentResponse

type GetMCPBundleDocumentResponse struct {
	Body *mcpDomainBundle.BundleDocument `json:"body"`
}

type GetMCPBundleInstallationRequest

type GetMCPBundleInstallationRequest struct {
	Bundle collection.CollectionRef `json:"bundle"`
}

type GetMCPBundleInstallationResponse

type GetMCPBundleInstallationResponse struct {
	Body *BundleInstallationView `json:"body"`
}

type GetMCPBundleRequest

type GetMCPBundleRequest struct {
	Bundle collection.CollectionRef `json:"bundle"`
}

type GetMCPBundleResponse

type GetMCPBundleResponse struct {
	Body *Bundle `json:"body"`
}

type GetMCPServerInstallationRequest

type GetMCPServerInstallationRequest struct {
	Server artifact.ArtifactRef `json:"server"`
}

type GetMCPServerInstallationResponse

type GetMCPServerInstallationResponse struct {
	Body *ServerInstallationView `json:"body"`
}

type InspectMCPPolicyRequest

type InspectMCPPolicyRequest struct {
	Policy artifact.ArtifactRef `json:"policy"`
}

type InspectMCPPolicyResponse

type InspectMCPPolicyResponse struct {
	Body *PolicyView `json:"body"`
}

type InspectMCPServerRequest

type InspectMCPServerRequest struct {
	Server artifact.ArtifactRef `json:"server"`
}

type InspectMCPServerResponse

type InspectMCPServerResponse struct {
	Body *mcpDomainServer.Resolved `json:"body"`
}

type ListMCPBundlePoliciesRequest

type ListMCPBundlePoliciesRequest struct {
	Bundle collection.CollectionRef `json:"bundle"`
}

type ListMCPBundlePoliciesResponse

type ListMCPBundlePoliciesResponse struct {
	Body *ListMCPBundlePoliciesResponseBody `json:"body"`
}

type ListMCPBundlePoliciesResponseBody

type ListMCPBundlePoliciesResponseBody struct {
	Policies []artifact.Artifact `json:"policies"`
}

type ListMCPBundleServersRequest

type ListMCPBundleServersRequest struct {
	Bundle collection.CollectionRef `json:"bundle"`
}

type ListMCPBundleServersResponse

type ListMCPBundleServersResponse struct {
	Body *ListMCPBundleServersResponseBody `json:"body"`
}

type ListMCPBundleServersResponseBody

type ListMCPBundleServersResponseBody struct {
	Servers []artifact.Artifact `json:"servers"`
}

type ListMCPBundlesRequest

type ListMCPBundlesRequest struct {
	RootID root.RootID `json:"rootID"`
}

type ListMCPBundlesResponse

type ListMCPBundlesResponse struct {
	Body *ListMCPBundlesResponseBody `json:"body"`
}

type ListMCPBundlesResponseBody

type ListMCPBundlesResponseBody struct {
	Bundles []Bundle `json:"bundles"`
}

type MCPDocumentSchemaIdentity

type MCPDocumentSchemaIdentity struct {
	Kind          artifact.ArtifactKind `json:"kind"`
	SchemaID      schema.SchemaID       `json:"schemaID"`
	SchemaVersion string                `json:"schemaVersion"`
}

type MCPServerSchemaIdentity

type MCPServerSchemaIdentity struct {
	Server MCPDocumentSchemaIdentity `json:"server"`
	Policy MCPDocumentSchemaIdentity `json:"policy"`
}

type MutationCommit

type MutationCommit func(context.Context) error

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             mcpPolicy.MCPPolicy      `json:"body"`
	EffectiveEnabled bool                     `json:"effectiveEnabled"`
	BuiltIn          bool                     `json:"builtIn"`
}

type Registration

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

type ReplaceDocumentRequest

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

type ServerInstallationView

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

type ServerStore

type ServerStore interface {
	ResolveMCPServer(
		ctx context.Context,
		ref artifact.ArtifactRef,
	) (mcpDomainServer.Resolved, error)
	InspectMCPServerForRuntime(
		ctx context.Context,
		ref artifact.ArtifactRef,
	) (mcpDomainServer.Resolved, error)
}

Jump to

Keyboard shortcuts

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