Documentation
¶
Overview ¶
Package mcp exposes Console over the Model Context Protocol (MCP), so an AI agent (Claude Desktop, Claude Code, or any MCP client) can operate a Console instance as a set of tools: list and evaluate feature flags, read component health, and — when writes are enabled — create, toggle, and delete flags and components.
MCP is a consumer surface, like the CLI and the dashboard — not one of Console's plugin seams (store/status/notify/llm). The server talks to Console through a Backend, which has two implementations: an in-process one over the flags/status engines (the default), and an HTTP one that targets a running `console serve` (selected with -addr). Handlers are written against Backend so they are identical in either mode.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backend ¶
type Backend interface {
// Flags.
ListFlags(ctx context.Context) ([]core.Flag, error)
GetFlag(ctx context.Context, key string) (core.Flag, error)
CreateFlag(ctx context.Context, f core.Flag) error
UpdateFlag(ctx context.Context, f core.Flag) error
DeleteFlag(ctx context.Context, key string) error
EvaluateFlag(ctx context.Context, key string, subj core.Subject) (core.Evaluation, error)
// Components and health.
ListComponents(ctx context.Context) ([]core.Component, error)
GetComponent(ctx context.Context, key string) (core.Component, error)
CreateComponent(ctx context.Context, c core.Component) error
UpdateComponent(ctx context.Context, c core.Component) error
DeleteComponent(ctx context.Context, key string) error
CheckComponent(ctx context.Context, key string) (core.Check, error)
HealthSnapshot(ctx context.Context) (core.Health, error)
}
Backend is the set of Console operations the MCP tools need. Both the in-process engine backend and the HTTP-client backend satisfy it, so the tool handlers never depend on how Console is reached.
func NewEngineBackend ¶
NewEngineBackend wraps an already-constructed App as a Backend. The caller retains ownership of the App (and its Close).
func NewHTTPBackend ¶
NewHTTPBackend builds a Backend that talks to the Console JSON API at addr. addr may be a bare host:port ("127.0.0.1:8080") or a full URL; a missing scheme defaults to http.
type Options ¶
type Options struct {
// Name and Version identify the server to the MCP client.
Name, Version string
// AllowWrites registers the mutating tools (create/toggle/delete flags and
// components). It is off by default: without it the server exposes only
// read and flag-evaluation tools. Console has no built-in auth, so writes
// are opt-in.
AllowWrites bool
}
Options configures an MCP server.