Documentation
¶
Overview ¶
Package mcp implements comanda's Model Context Protocol (MCP) server mode, exposing workflows as MCP tools and skills as MCP prompts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultWorkflowDirs ¶
func DefaultWorkflowDirs() []string
DefaultWorkflowDirs returns the default workflow directories that exist: ~/.comanda/workflows/ (user level) and .comanda/workflows/ (project level).
func NewServer ¶
NewServer builds an MCP server exposing each workflow as a tool and each skill as a prompt.
Types ¶
type Options ¶
type Options struct {
Name string // Server name reported to MCP clients
Version string // Server version reported to MCP clients
Verbose bool // Enable debug logging (to stderr)
EnvConfig *config.EnvConfig
Workflows []WorkflowDef // Workflows to expose as tools
Skills []*skills.Skill // Skills to expose as prompts (nil/empty disables)
}
Options configures the MCP server.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner executes workflows on behalf of MCP tool calls.
func NewRunner ¶
NewRunner creates a Runner that executes workflows with the given environment configuration.
func (*Runner) Run ¶
Run executes the workflow defined by def with the given tool arguments and returns the workflow's final output. All arguments except the reserved "input" argument are passed as CLI variables ({{ var }} substitution); "input" is fed to the workflow as STDIN-style input via SetLastOutput.
type WorkflowDef ¶
type WorkflowDef struct {
Name string // MCP tool name (sanitized workflow file base)
Path string // Path to the workflow YAML file
Description string // Tool description (first comment line or fallback)
Vars []string // {{ var }} placeholders discovered in the file
}
WorkflowDef describes a discovered workflow file exposed as an MCP tool.
func DiscoverWorkflows ¶
func DiscoverWorkflows(dirs, files []string) ([]WorkflowDef, error)
DiscoverWorkflows scans dirs for *.yaml/*.yml workflow files and combines them with the explicit files, building one WorkflowDef per file. It returns an error if two files map to the same tool name, if a file cannot be read, or if a file base cannot be sanitized into a valid tool name.