Documentation
¶
Overview ¶
Package mcpserver exposes a Runefile's non-private tasks to AI agents and IDEs as Model Context Protocol tools. Tools are run through the SAME engine the CLI uses (FR-026); secrets never appear in any tool name, description, schema, or result (FR-029, Principle VII). It is a public package so it can be embedded.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine interface {
// Tasks returns the exposable (non-private) tasks with their metadata.
Tasks() []TaskInfo
// Call runs a task by display name with string arguments, capturing output.
Call(ctx context.Context, name string, args map[string]string) (Result, error)
}
Engine is the host the MCP server runs tasks against. The CLI implements it.
type HTTPConfig ¶
HTTPConfig configures the opt-in Streamable HTTP transport.
type Options ¶
type Options struct {
// AllowDestructive permits calling tasks marked destructive ([confirm]).
AllowDestructive bool
// AllowList, when non-empty, narrows callable tasks to these names.
AllowList []string
// Version reported to clients.
Version string
}
Options configures authorization for the server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps an mcp.Server built from a Runefile's tasks.
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(ctx context.Context, cfg HTTPConfig) error
ServeHTTP starts the Streamable HTTP transport. It binds the configured address (localhost by default), requires a bearer token before any list/call (SC-010), and refuses a non-localhost bind unless the address is explicit.
func (*Server) ServeStdio ¶
ServeStdio runs the MCP server over stdio (always available, auth inherited from the local process/session).
func (*Server) StartHTTP ¶
func (s *Server) StartHTTP(cfg HTTPConfig) (addr string, stop func(), err error)
StartHTTP binds and serves the HTTP transport in a background goroutine, returning the bound address and a stop function. Used by the (agent) executor to expose project tasks to the agent it drives.
type TaskInfo ¶
type TaskInfo struct {
Name string // display name (namespaced mod::task becomes mod__task as a tool)
Doc string
Params []ParamInfo
Destructive bool // has [confirm]/destructive => DestructiveHint
Network bool // has [network] => OpenWorldHint
}
TaskInfo is the agent-facing view of a task. Private tasks are never included.