Documentation
¶
Overview ¶
Package mcp implements the MCP (Model Context Protocol) stdio transport. It serves spec context and tools to MCP-compatible coding agents over JSON-RPC 2.0 on stdin/stdout.
Index ¶
- func Serve(ctx context.Context, handler Handler, in io.Reader, out io.Writer, ...) error
- type GenericHandler
- func (h *GenericHandler) CallTool(name string, args json.RawMessage) (*ToolResult, error)
- func (h *GenericHandler) Close()
- func (h *GenericHandler) GetResource(uri string) (*Resource, error)
- func (h *GenericHandler) ListResources() []Resource
- func (h *GenericHandler) ListTools() []Tool
- func (h *GenericHandler) WithDB(db *store.DB) *GenericHandler
- func (h *GenericHandler) WithRegistry(reg *adapter.Registry) *GenericHandler
- type Handler
- type Resource
- type Tool
- type ToolResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GenericHandler ¶
type GenericHandler struct {
// contains filtered or unexported fields
}
GenericHandler provides spec resources and tools without requiring a build session. It serves as the default MCP handler, providing access to specs, pipeline info, and common operations.
func NewGenericHandler ¶
func NewGenericHandler(cfg *config.ResolvedConfig, specsDir string) *GenericHandler
NewGenericHandler creates a handler that serves generic spec resources.
func (*GenericHandler) CallTool ¶
func (h *GenericHandler) CallTool(name string, args json.RawMessage) (*ToolResult, error)
CallTool executes a tool.
func (*GenericHandler) Close ¶ added in v0.26.0
func (h *GenericHandler) Close()
Close flushes any pending background pushes. Call it when the MCP server stops so agent-authored edits are not left unpublished.
func (*GenericHandler) GetResource ¶
func (h *GenericHandler) GetResource(uri string) (*Resource, error)
GetResource returns a specific resource by URI.
func (*GenericHandler) ListResources ¶
func (h *GenericHandler) ListResources() []Resource
ListResources returns available resources.
func (*GenericHandler) ListTools ¶
func (h *GenericHandler) ListTools() []Tool
ListTools returns available tools.
The authoring tier is always present; the transition tier is appended only when enabled, so a disabled capability is missing from the list rather than failing at call time. That makes the authority boundary discoverable by looking instead of by trying.
func (*GenericHandler) WithDB ¶ added in v0.44.0
func (h *GenericHandler) WithDB(db *store.DB) *GenericHandler
WithDB attaches a database for activity attribution. Optional by design — a handler without one serves every read and write, silently skipping only the log entry.
func (*GenericHandler) WithRegistry ¶ added in v0.44.0
func (h *GenericHandler) WithRegistry(reg *adapter.Registry) *GenericHandler
WithRegistry attaches the adapter registry that transition effects use.
type Handler ¶
type Handler interface {
ListResources() []Resource
GetResource(uri string) (*Resource, error)
ListTools() []Tool
CallTool(name string, args json.RawMessage) (*ToolResult, error)
}
Handler defines the domain operations the MCP server delegates to. Implemented by a thin adapter over build.MCPServer in cmd/.
type ToolResult ¶
ToolResult represents the outcome of a tool call.