Documentation
¶
Overview ¶
Package mcpserver is `icon-sets-sync mcp`: a Model Context Protocol server on stdio, built on the official Go SDK, so an agent's host spawns it and no network port is opened.
It offers the read tools once it is enabled. The write tools (sync_pack, cancel_job, set_setting) are registered only with mcp.allow_writes, and never under --read-only: a tool that is not registered cannot be called by a confused or hostile prompt. A real sync also needs confirm set to the pack's slug.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ReadTools = []string{"list_packs", "get_pack", "check_upstream", "list_jobs", "get_job", "get_job_log", "validate_configs", "dry_run_sync"} WriteTools = []string{"sync_pack", "cancel_job", "set_setting"} )
ReadTools and WriteTools name the tools, for docs and tests.
var ErrNeedsConfirm = errors.New("a real sync needs confirm set to the pack's slug")
ErrNeedsConfirm refuses a real sync whose confirm is not the slug.
Functions ¶
Types ¶
type Engine ¶
type Engine interface {
web.Syncer
web.ConfigStore
Packs() ([]*config.PackConfig, error)
Pack(slug string) (*config.PackConfig, error)
PackNotes(pack *config.PackConfig) map[string]string
Check(ctx context.Context, packs []*config.PackConfig) []checker.Result
ConfigFiles() ([]web.ConfigFile, error)
ValidateConfig(name string, data []byte) []app.Finding
}
Engine is what the tools ask of the sync engine; web.AppEngine is one.
type Options ¶
type Options struct {
Engine Engine
// Jobs runs and remembers this process's syncs; its store is the same
// history serve keeps, so runs started here show on the Runs page.
Jobs *jobs.Registry
// ReadOnly (--read-only) and AllowWrites (mcp.allow_writes) decide
// whether the write tools exist at all.
ReadOnly, AllowWrites bool
// ServerRunning reports a serve on this machine; a real sync is then
// refused here, so two processes never race on one pack repository.
ServerRunning func() bool
// Audit receives one record per write tool call. Nil keeps none.
Audit *jsonlog.Log
// Version is the binary's.
Version string
// Now is the clock; nil means time.Now.
Now func() time.Time
}
Options configures the server.