mcp

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 14 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 mcp exposes the devsys application service over the Model Context Protocol using the official Go SDK (github.com/modelcontextprotocol/go-sdk).

The SDK owns the protocol: framing, lifecycle, version negotiation, tools/list and tools/call shapes, and input validation against the schema inferred from each handler's typed input. This package owns what is ours: which tools a profile exposes, and the error taxonomy shared with the CLI (internal/app) so both surfaces refuse the same way.

Index

Constants

View Source
const (
	ProfileSession  = "session"
	ProfileExecutor = "executor"
	ProfileReviewer = "reviewer"
	ProfileAdmin    = "admin"
)

Tool profiles (方案 §8.6). The server exposes the union of the selected profiles' tools; the default is session + executor, and reviewer/admin stay opt-in so dangerous entries are explicit.

View Source
const (
	TierCore     = "core"
	TierStandard = "standard"
)

Tool tiers (#301): core is the daily subset, standard is everything the selected profiles expose. Tiers compose with profiles by conjunction.

View Source
const ServerName = "devsys"

ServerName is the fixed identity every devsys MCP surface reports.

Variables

This section is empty.

Functions

func DefaultProfiles

func DefaultProfiles() []string

DefaultProfiles is the profile set an unconfigured server exposes.

func DefaultTier

func DefaultTier() string

DefaultTier is the tier an unconfigured server exposes.

func NewServer

func NewServer(cfg Config) *mcpsdk.Server

NewServer builds the SDK server with exactly the tools the selected profiles expose. Registration is the profile filter: a tool that is not exposed is never registered, so it cannot be called by name either.

func ParseProfiles

func ParseProfiles(list string) ([]string, error)

ParseProfiles parses a comma-separated profile list. Empty input selects the defaults; unknown names are rejected so a typo cannot silently widen or narrow the tool surface.

func ParseTier

func ParseTier(tier string) (string, error)

ParseTier parses the --tier flag. Unknown names are rejected so a typo cannot silently widen or narrow the tool surface.

func Run

func Run(ctx context.Context, cfg Config, in io.ReadCloser, out io.WriteCloser) error

Run serves the protocol over the given streams until the client closes them. Nil streams mean the process standard streams (stdio transport).

func VisibleTools

func VisibleTools(cfg Config) []string

VisibleTools lists the tool names NewServer would register for cfg — the same profile∧tier conjunction — so the CLI can refuse to start a server whose filter leaves nothing to serve instead of spinning a silent no-op.

Types

type Config

type Config struct {
	// Root is the absolute project root; tools read and write only beneath it.
	Root string
	// Profiles is the active profile set.
	Profiles []string
	// Tier caps the exposed tools: core shows the daily subset, standard
	// shows everything the profiles expose. Empty means the default tier.
	Tier string
	// ServerVersion is the build identity reported to clients.
	ServerVersion string
	// Instructions is the discipline note clients receive at initialize.
	Instructions string
	// Log receives server diagnostics (stderr in the CLI).
	Log io.Writer
}

Config is the project binding a tool set serves.

Jump to

Keyboard shortcuts

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