mcpserver

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(a *app.App, dir, version string) *mcp.Server

New returns the MCP server for the project at dir. Every tool call works on its own copy of a, with output captured for the result: stdout belongs to the protocol.

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

type Attached struct {
	Instance string `json:"instance"`
	Attached bool   `json:"attached"`
}

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 Diagnoses added in v0.2.0

type Diagnoses struct {
	Services []app.Diagnosis `json:"services"`
}

Diagnoses are the explanations of the services that are not well.

type Done

type Done struct {
	Instance string `json:"instance"`
}

Done names the instance a tool acted on.

type Empty

type Empty struct{}

Empty is the input of tools that take nothing.

type Env added in v0.3.0

type Env struct {
	Variables map[string]string `json:"variables"`
}

Env holds the MUTTI_* variables by name.

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

type Initialized struct {
	*app.InitPlan
	Written bool `json:"written"`
}

Initialized is what init would write, or wrote.

type Instances

type Instances struct {
	Instances []app.Summary `json:"instances"`
}

Instances is the output of list.

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

type Output struct {
	Output    string `json:"output"`
	Truncated bool   `json:"truncated,omitempty"`
}

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 Renamed added in v0.3.0

type Renamed struct {
	Instance string `json:"instance"`
	Hostname string `json:"hostname"`
}

Renamed describes a renamed environment.

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 URL

type URL struct {
	URL string `json:"url"`
}

URL is the output of url.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL