catalog

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package catalog compiles immutable composite feature snapshots and routes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fingerprint

func Fingerprint(cfg *config.Config) (string, error)

Fingerprint returns a stable, non-reversible digest of a complete configuration.

Types

type Catalog

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

Catalog is an immutable, sorted composite feature snapshot.

func Compile

func Compile(ctx context.Context, cfg *config.Config, discoverer component.Discoverer) (*Catalog, error)

Compile discovers every configured component and builds a complete snapshot.

func (*Catalog) CompositeURI

func (c *Catalog) CompositeURI(prefix, original string) string

CompositeURI maps a component resource URI into its exposed identity.

func (*Catalog) PagePrompts

func (c *Catalog) PagePrompts(cursor string, pageSize int) ([]*mcp.Prompt, string, error)

PagePrompts returns one stable page of prompts.

func (*Catalog) PageResourceTemplates

func (c *Catalog) PageResourceTemplates(cursor string, pageSize int) ([]*mcp.ResourceTemplate, string, error)

PageResourceTemplates returns one stable page of resource templates.

func (*Catalog) PageResources

func (c *Catalog) PageResources(cursor string, pageSize int) ([]*mcp.Resource, string, error)

PageResources returns one stable page of resources.

func (*Catalog) PageTools

func (c *Catalog) PageTools(cursor string, pageSize int) ([]*mcp.Tool, string, error)

PageTools returns one stable page of tools.

func (*Catalog) Prompts

func (c *Catalog) Prompts() []*mcp.Prompt

Prompts returns a copy of the sorted prompt slice.

func (*Catalog) ResourceTemplates

func (c *Catalog) ResourceTemplates() []*mcp.ResourceTemplate

ResourceTemplates returns a copy of the sorted resource-template slice.

func (*Catalog) Resources

func (c *Catalog) Resources() []*mcp.Resource

Resources returns a copy of the sorted resource slice.

func (*Catalog) RewriteCallToolResult

func (c *Catalog) RewriteCallToolResult(prefix string, result *mcp.CallToolResult) *mcp.CallToolResult

RewriteCallToolResult clones a tool result and rewrites supported resource identities.

func (*Catalog) RewriteGetPromptResult

func (c *Catalog) RewriteGetPromptResult(prefix string, result *mcp.GetPromptResult) *mcp.GetPromptResult

RewriteGetPromptResult clones a prompt result and rewrites supported resource identities.

func (*Catalog) RewriteReadResourceResult

func (c *Catalog) RewriteReadResourceResult(prefix string, result *mcp.ReadResourceResult) *mcp.ReadResourceResult

RewriteReadResourceResult clones a read result and rewrites content URIs.

func (*Catalog) RoutePrompt

func (c *Catalog) RoutePrompt(name string) (PromptRoute, bool)

RoutePrompt resolves an exposed prompt name.

func (*Catalog) RouteResource

func (c *Catalog) RouteResource(uri string) (ResourceRoute, bool)

RouteResource resolves an exposed resource URI, including template expansions.

func (*Catalog) RouteTool

func (c *Catalog) RouteTool(name string) (ToolRoute, bool)

RouteTool resolves an exposed tool name.

func (*Catalog) ServerInfo added in v0.1.2

func (c *Catalog) ServerInfo() *mcp.Implementation

ServerInfo returns the single component's MCP implementation metadata.

func (*Catalog) Tools

func (c *Catalog) Tools() []*mcp.Tool

Tools returns a copy of the sorted tool slice.

type Family

type Family string

Family identifies one independently paginated feature collection.

const (
	FamilyTools             Family = "tools"
	FamilyPrompts           Family = "prompts"
	FamilyResources         Family = "resources"
	FamilyResourceTemplates Family = "resourceTemplates"
)

type PromptRoute

type PromptRoute struct {
	Component    config.Server
	Prefix       string
	OriginalName string
}

PromptRoute maps an exposed prompt identity back to its component identity.

type Registry

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

Registry caches immutable catalogs by complete configuration fingerprint.

func NewRegistry

func NewRegistry(discoverer component.Discoverer) *Registry

NewRegistry creates a catalog registry.

func (*Registry) Close

func (r *Registry) Close()

Close cancels pending catalog refreshes.

func (*Registry) Get

func (r *Registry) Get(ctx context.Context, cfg *config.Config) (*Catalog, string, error)

Get returns the cached catalog for cfg, compiling it once on first use.

func (*Registry) Refresh

func (r *Registry) Refresh(ctx context.Context, cfg *config.Config) (*Catalog, string, error)

Refresh recompiles cfg and replaces its cached catalog only after success.

func (*Registry) RequestRefresh

func (r *Registry) RequestRefresh(fingerprint string, callback func(bool))

RequestRefresh debounces a full rediscovery for fingerprint. A failed refresh leaves the previous immutable snapshot installed.

type ResourceRoute

type ResourceRoute struct {
	Component    config.Server
	Prefix       string
	OriginalURI  string
	CompositeURI string
}

ResourceRoute maps an exposed resource URI back to its component URI.

type ResourceTemplateRoute

type ResourceTemplateRoute struct {
	Component         config.Server
	Prefix            string
	OriginalTemplate  string
	CompositeTemplate string
	// contains filtered or unexported fields
}

ResourceTemplateRoute retains both template directions without guessing from strings.

type ToolRoute

type ToolRoute struct {
	Component    config.Server
	Prefix       string
	OriginalName string
}

ToolRoute maps an exposed tool identity back to its component identity.

Jump to

Keyboard shortcuts

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