mcpserver

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
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

func New

func New(o Options) *mcp.Server

New builds the MCP server.

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.

Jump to

Keyboard shortcuts

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