Documentation
¶
Overview ¶
Package mcpserver offers mutti's use cases as tools of a Model Context Protocol server, for AI coding agents: start and inspect environments, run commands and tests in them.
Index ¶
- func New(a *app.App, dir, version string) *mcp.Server
- type AttachInput
- type Attached
- type CommandInput
- type Commands
- type ComposeInput
- type CustomCommand
- type Diagnoses
- type Done
- type Empty
- type Env
- type ExecInput
- type Exited
- type InitInput
- type Initialized
- type Instances
- type LogsInput
- type Output
- type Ran
- type Removed
- type RenameInput
- type Renamed
- type ResetInput
- type RunInput
- type ServicesInput
- type Started
- type SweepInput
- type Swept
- type TidyInput
- type URL
- type URLInput
- type UpInput
- type Where
- type Worktree
- type WorktreeInput
- type WorktreeRemoveInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AttachInput ¶ added in v0.3.0
type AttachInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Detach bool `json:"detach,omitempty" jsonschema:"disconnect again"`
}
AttachInput configures attach.
type Attached ¶ added in v0.3.0
Attached tells which environment's network the container is on now, or left.
type CommandInput ¶ added in v0.3.0
type CommandInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Name string `json:"name" jsonschema:"name of the command, as commands lists it"`
Args []string `json:"args,omitempty" jsonschema:"arguments for the command"`
}
CommandInput runs one of the project's own commands.
type Commands ¶ added in v0.3.0
type Commands struct {
Commands []CustomCommand `json:"commands"`
}
Commands lists the project's own commands.
type ComposeInput ¶ added in v0.3.0
type ComposeInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Args []string `json:"args" jsonschema:"the docker compose arguments, e.g. [\"ps\", \"--all\"]"`
Overlays []string `json:"overlays,omitempty" jsonschema:"x-mutti overlays to enable"`
}
ComposeInput is a docker compose command.
type CustomCommand ¶ added in v0.3.0
type CustomCommand struct {
Name string `json:"name"`
Short string `json:"short,omitempty"`
Service string `json:"service,omitempty" jsonschema:"the service it runs in; empty: on the host"`
}
CustomCommand is one of the project's own commands.
type Done ¶
type Done struct {
Instance string `json:"instance"`
}
Done names the instance a tool acted on.
type ExecInput ¶
type ExecInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Service string `json:"service" jsonschema:"service to run the command in"`
Command []string `` /* 155-byte string literal not displayed */
Workdir string `json:"workdir,omitempty" jsonschema:"working directory inside the container"`
Env map[string]string `json:"env,omitempty" jsonschema:"extra environment variables"`
User string `json:"user,omitempty" jsonschema:"\"host\" (your user, the default), \"service\" (the image's user) or user[:group]"`
}
ExecInput is a command for a service.
type Exited ¶
type Exited struct {
ExitCode int `json:"exitCode"`
Output string `json:"output"`
Truncated bool `json:"truncated,omitempty"`
}
Exited is what a command printed and how it ended.
type InitInput ¶ added in v0.3.0
type InitInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
NoAgents bool `json:"noAgents,omitempty" jsonschema:"leave AGENTS.md alone"`
Apply bool `json:"apply,omitempty" jsonschema:"write the changes; otherwise only show them"`
}
InitInput configures init.
type Initialized ¶ added in v0.3.0
Initialized is what init would write, or wrote.
type LogsInput ¶
type LogsInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Services []string `json:"services,omitempty" jsonschema:"services to show; default: all"`
Tail int `json:"tail,omitempty" jsonschema:"lines per service, counted from the end; default 200"`
}
LogsInput selects logs.
type Output ¶
Output is what a command printed, stdout and stderr together. Truncated means only the end of it is there.
type Ran ¶
type Ran struct {
RunID string `json:"runId"`
ExitCode int `json:"exitCode"`
Logs string `json:"logs" jsonschema:"file with the logs of all services of the run"`
Output string `json:"output"`
Truncated bool `json:"truncated,omitempty"`
}
Ran is the result of a run.
type Removed ¶ added in v0.3.0
type Removed struct {
Path string `json:"path"`
}
Removed is the path of a removed worktree.
type RenameInput ¶ added in v0.3.0
type RenameInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Name string `json:"name" jsonschema:"the new name: lower case letters, digits and -"`
}
RenameInput names the new name.
type ResetInput ¶ added in v0.3.0
type ResetInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Overlays []string `json:"overlays,omitempty" jsonschema:"x-mutti overlays to enable"`
Profiles []string `json:"profiles,omitempty" jsonschema:"Compose profiles to enable"`
Build bool `json:"build,omitempty" jsonschema:"rebuild images before starting"`
}
ResetInput configures reset.
type RunInput ¶
type RunInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Command []string `json:"command" jsonschema:"the command, run on the host with MUTTI_URL and the other MUTTI_* variables set, or in service"`
Service string `json:"service,omitempty" jsonschema:"run the command in a one-off container of this service instead of on the host"`
Start []string `json:"start,omitempty" jsonschema:"start only these services and what they depend on; default: all"`
Overlays []string `json:"overlays,omitempty" jsonschema:"x-mutti overlays to enable"`
Profiles []string `json:"profiles,omitempty" jsonschema:"Compose profiles to enable"`
Build bool `json:"build,omitempty" jsonschema:"rebuild images before starting"`
User string `json:"user,omitempty" jsonschema:"with service: \"host\" (your user), \"service\" (the image's user) or user[:group]"`
}
RunInput is a command for a throwaway environment.
type ServicesInput ¶ added in v0.2.0
type ServicesInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Services []string `json:"services,omitempty" jsonschema:"only these services; default: all"`
}
ServicesInput names services of a worktree's environment.
type Started ¶
type Started struct {
Instance string `json:"instance"`
Hostname string `json:"hostname"`
Path string `json:"path"`
URL string `json:"url,omitempty"`
Bootstrapped bool `json:"bootstrapped"` // the bootstrap hooks ran (first start)
Output string `json:"output"`
Truncated bool `json:"truncated,omitempty"`
}
Started describes a started environment.
type SweepInput ¶ added in v0.3.0
type SweepInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
OlderThan string `json:"olderThan,omitempty" jsonschema:"only runs older than this, e.g. \"1h\"; default \"24h\""`
}
SweepInput configures sweep.
type Swept ¶ added in v0.3.0
type Swept struct {
Hooks bool `json:"hooks"`
}
Swept tells whether the project's sweep hooks ran.
type TidyInput ¶ added in v0.3.0
type TidyInput struct {
Project string `json:"project,omitempty" jsonschema:"only this project's environments; default: all"`
Idle string `json:"idle,omitempty" jsonschema:"also stop running environments unused for this long, e.g. \"24h\""`
Apply bool `json:"apply,omitempty" jsonschema:"remove and stop them; otherwise only report"`
}
TidyInput configures tidy.
type URLInput ¶
type URLInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Service string `json:"service,omitempty" jsonschema:"service whose URL to return; default: the environment's main URL"`
}
URLInput selects a service.
type UpInput ¶
type UpInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Services []string `json:"services,omitempty" jsonschema:"start only these services and what they depend on; default: all"`
Overlays []string `json:"overlays,omitempty" jsonschema:"x-mutti overlays to enable"`
Profiles []string `json:"profiles,omitempty" jsonschema:"Compose profiles to enable"`
Build bool `json:"build,omitempty" jsonschema:"rebuild images before starting"`
}
UpInput configures up.
type Where ¶
type Where struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
}
Where is the worktree a tool works on.
type Worktree ¶
type Worktree struct {
Path string `json:"path" jsonschema:"pass it as dir to the other tools"`
Branch string `json:"branch"`
Started *Started `json:"started,omitempty"`
}
Worktree describes a created worktree.
type WorktreeInput ¶
type WorktreeInput struct {
Dir string `json:"dir,omitempty" jsonschema:"worktree directory, absolute or relative to where mutti mcp runs; default: that directory"`
Name string `json:"name" jsonschema:"name of the worktree, also of its new branch: lower case letters, digits and -"`
Branch string `json:"branch,omitempty" jsonschema:"check out this existing branch instead of creating one"`
From string `json:"from,omitempty" jsonschema:"base of the new branch; default: the current HEAD"`
DataFrom string `` /* 166-byte string literal not displayed */
Path string `json:"path,omitempty" jsonschema:"where to create the worktree; default: next to the main one as <repo>-<name>"`
NoUp bool `json:"noUp,omitempty" jsonschema:"only create the worktree, do not start its environment"`
Overlays []string `json:"overlays,omitempty" jsonschema:"x-mutti overlays to enable"`
Profiles []string `json:"profiles,omitempty" jsonschema:"Compose profiles to enable"`
Build bool `json:"build,omitempty" jsonschema:"rebuild images before starting"`
}
WorktreeInput describes a new worktree.
type WorktreeRemoveInput ¶ added in v0.3.0
type WorktreeRemoveInput struct {
Dir string `` /* 133-byte string literal not displayed */
Target string `json:"target" jsonschema:"name of the worktree (as given to worktree_add) or its path"`
Force bool `json:"force,omitempty" jsonschema:"also drop uncommitted changes"`
}
WorktreeRemoveInput names the worktree to remove.