mcpserver

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mcpserver exposes the daemon to coding agents over the Model Context Protocol (stdio). Agents can reuse running servers instead of launching duplicates, start what they need, and read logs.

Index

Constants

This section is empty.

Variables

View Source
var Modes = []Mode{ReadOnly, Start, Full}

Modes lists the modes in order of what they allow.

Functions

func Run

func Run(ctx context.Context, c *client.Client, opts Options) error

Run serves MCP on stdin/stdout until the client disconnects.

Types

type Container

type Container struct {
	Name         string   `json:"name"`
	Service      string   `json:"service,omitempty" jsonschema:"compose service"`
	Project      string   `json:"project,omitempty" jsonschema:"compose project"`
	Server       string   `json:"server,omitempty" jsonschema:"the server it belongs to"`
	Shared       []string `json:"sharedWith,omitempty" jsonschema:"other servers that use this container too"`
	IssueFor     []string `json:"issueFor,omitempty" jsonschema:"servers it needs attention for: unhealthy, restarting, or failed while the server ran"`
	Image        string   `json:"image"`
	State        string   `json:"state" jsonschema:"created, running, paused, restarting, removing, exited or dead"`
	Status       string   `json:"status" jsonschema:"the engine's summary, e.g. Up 3 hours (healthy)"`
	Health       string   `json:"health,omitempty" jsonschema:"starting, healthy or unhealthy"`
	Buildable    bool     `json:"buildable,omitempty" jsonschema:"the compose service is known to build its image"`
	Failed       bool     `json:"failed,omitempty" jsonschema:"exited in failure (not finished or stopped on request), or dead"`
	ExitCode     *int     `json:"exitCode,omitempty"`
	Restarts     int      `json:"restarts,omitempty"`
	Ports        []string `json:"ports,omitempty" jsonschema:"published ports as host:container/protocol"`
	NetworkPorts []int    `` /* 153-byte string literal not displayed */
	Dir          string   `json:"projectDir,omitempty" jsonschema:"compose project directory, where docker compose commands for it run"`
}

Container is the compact view of a container returned to agents.

type Mode added in v0.3.0

type Mode string

Mode is what the tools may change.

const (
	// ReadOnly offers only the tools that change nothing, and never starts
	// the daemon.
	ReadOnly Mode = "read-only"
	// Start adds ensure_server, which may start the daemon and servers.
	Start Mode = "start"
	// Full also offers restarting and stopping servers and container actions.
	Full Mode = "full"
)

func ParseMode added in v0.3.0

func ParseMode(s string) (Mode, error)

ParseMode reads a mode name.

func (Mode) Flags added in v0.3.0

func (m Mode) Flags() []string

Flags are the arguments after `mcp` that select m; none for the default.

type Options added in v0.3.0

type Options struct {
	// Mode is what the tools may change; "" is Full.
	Mode Mode
	// Dirs limits every tool to the projects in these directories; none
	// means every project.
	Dirs []string
}

Options select what the MCP server offers.

type Server

type Server struct {
	RestartPending bool    `json:"restartPending"`
	ListenPorts    []int   `json:"listenPorts,omitempty"`
	Listening      bool    `json:"listening"`
	Name           string  `json:"name"`
	Group          string  `json:"group,omitempty"`
	Status         string  `json:"status" jsonschema:"stopped, starting, running, stopping, crashed, exited or blocked"`
	Oneshot        bool    `` /* 180-byte string literal not displayed */
	Schedule       string  `json:"schedule,omitempty" jsonschema:"crontab expression in local time that starts the server"`
	NextRun        string  `json:"nextRun,omitempty" jsonschema:"when the schedule next starts it (RFC 3339)"`
	URL            string  `json:"url,omitempty" jsonschema:"direct URL on loopback"`
	Alias          string  `json:"alias,omitempty" jsonschema:"same server through http://<name>.localhost"`
	Port           int     `json:"port,omitempty"`
	Dir            string  `json:"dir"`
	Cmd            string  `json:"cmd"`
	Note           string  `json:"note,omitempty"`
	External       string  `json:"external,omitempty" jsonschema:"set when another process holds the port"`
	CPU            float64 `json:"cpuPercent,omitempty"`
	MemMB          int64   `json:"memMB,omitempty"`
	Exposure       string  `` /* 312-byte string literal not displayed */
	NetworkWarning bool    `` /* 177-byte string literal not displayed */

	Containers []Container `json:"containers,omitempty" jsonschema:"containers attached by project mapping, directory or local project ID"`
	Outcome    string      `json:"outcome,omitempty" jsonschema:"what ensure_server did: reused (already running) or started"`
	Computer   string      `json:"computer,omitempty" jsonschema:"the other computer the server runs on; its URLs open from this one"`
	Temporary  bool        `` /* 160-byte string literal not displayed */
	Origin     string      `json:"origin,omitempty" jsonschema:"the configured server a temporary server copies"`
	Worktree   string      `json:"worktree,omitempty" jsonschema:"the checkout a temporary server runs in"`
}

Server is the compact view returned to agents.

Jump to

Keyboard shortcuts

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