Documentation
¶
Overview ¶
Package mcpsh is the CLI and MCP server behind an app's shell binary: a sandboxed bash shell over a running program, built from the app's layered config (see package profile). Each app is its own module and binary that embeds its config.json and commands/ and calls Main:
//go:embed config.json commands
var appFS embed.FS
func main() {
mcpsh.Main(mcpsh.Config{Name: "mcp-sh-blender", App: "blender", FS: appFS})
}
`<binary> setup` prints the commands that register it with Claude Code or Codex, and what the app needs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Name string // binary and MCP server name, e.g. "mcp-sh-blender"
App string // config folder name, e.g. "blender" for ~/.mcp-sh/blender/ (default: Name)
Version string
// VersionDetail is shown in parentheses after Version by --version, e.g. the version
// of a plugin the binary carries.
VersionDetail string
// UpdateRepo ("owner/repo") enables `update` via GitHub releases.
UpdateRepo string
// FS is the built-in config layer: config.json and an optional commands/ folder,
// usually an embed.FS. Nil means the app is configured by user files only.
FS fs.FS
// Builtins are extra Go-side commands; they win over every other command source.
Builtins []Builtin
// Subcommands are extra CLI verbs, listed in --help after the core ones.
Subcommands []Subcommand
// Options overrides where config files are looked up (tests).
Options profile.Options
// Registrations are extra MCP server entries `setup` and --help print, such as the same
// binary pointed at another port.
Registrations []Registration
}
type Registration ¶ added in v0.1.2
type Registration struct {
Suffix string // appended to the server name: "_game" -> mcp_sh_godot_game
Env map[string]string // environment for that entry
Label string // shown as a trailing comment, e.g. "running game"
}
Registration is an extra MCP server entry for the same binary.
type Subcommand ¶
type Subcommand struct {
Name string // first argument that selects it, e.g. "addon"
Usage string // help usage after the binary name, e.g. "addon install|status|remove [DIR]"
Summary string // help description
// Run gets the arguments after Name and returns the exit code.
Run func(args []string, stdout, stderr io.Writer) int
}
Subcommand is an app-specific CLI verb, such as mcp-sh-godot's `addon`. Core verbs win over a Subcommand of the same name.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package builtins provides in-process utilities so scripts can filter host output without ever starting an OS process: cat, grep, head, tail, wc, sort, uniq, cut, tr, seq, sed (s/// only), jq, and help.
|
Package builtins provides in-process utilities so scripts can filter host output without ever starting an OS process: cat, grep, head, tail, wc, sort, uniq, cut, tr, seq, sed (s/// only), jq, and help. |
|
Package engine defines the seam between mcp-sh and the interpreter that runs scripts.
|
Package engine defines the seam between mcp-sh and the interpreter that runs scripts. |
|
shengine
Package shengine is the default engine: a POSIX/bash interpreter (mvdan.cc/sh) with every side effect routed through handlers we control.
|
Package shengine is the default engine: a POSIX/bash interpreter (mvdan.cc/sh) with every side effect routed through handlers we control. |
|
Package host is the server side of the host protocol: the link between mcp-sh and the program that implements commands (Godot, Blender, ...).
|
Package host is the server side of the host protocol: the link between mcp-sh and the program that implements commands (Godot, Blender, ...). |
|
mcphost
Package mcphost makes an existing MCP server a source of shell commands.
|
Package mcphost makes an existing MCP server a source of shell commands. |
|
scripts
Package scripts turns script files into shell commands.
|
Package scripts turns script files into shell commands. |
|
Package hosttest is an in-process host speaking the host protocol, for tests of mcp-sh itself and of host binaries' Go-side builtins.
|
Package hosttest is an in-process host speaking the host protocol, for tests of mcp-sh itself and of host binaries' Go-side builtins. |
|
Package mcpserver exposes a shell.Shell as MCP tools: run, list_commands and help.
|
Package mcpserver exposes a shell.Shell as MCP tools: run, list_commands and help. |
|
Package profile describes one app's shell: an optional native host, upstream MCP servers, script commands and limits.
|
Package profile describes one app's shell: an optional native host, upstream MCP servers, script commands and limits. |
|
Package shell ties command sources (native host, upstream MCP servers, scripts), the builtins and an engine together into one runnable shell.
|
Package shell ties command sources (native host, upstream MCP servers, scripts), the builtins and an engine together into one runnable shell. |