mcp-sh-godot

command module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 10 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.

README

mcp-sh-godot

A sandboxed bash shell over the live Godot editor, or a running game, served over MCP. Built on mcp-sh. The binary carries its own addon, a native mcp-sh host on 127.0.0.1:9510 in the editor (9511 in a game). The agent runs gdsh commands with pipes, loops and jq.

mcp-sh-godot run 'tree root | tree nodes --recursive | grep -c Camera'

Install

curl -fsSL https://raw.githubusercontent.com/brohd11/mcp-sh-godot/main/install.sh | sh
mcp-sh-godot setup        # ~/.mcp-sh/godot/ + prints the claude/codex mcp add commands

On Windows: irm https://raw.githubusercontent.com/brohd11/mcp-sh-godot/main/install.ps1 | iex.

Then, in each Godot project:

mcp-sh-godot addon install    # writes res://addons/mcp_sh_godot/, versioned with this binary
mcp-sh-godot addon status     # addon vs binary version, gdsh, editor_console
mcp-sh-godot commands         # check what the shell can reach

Enable mcp-sh-godot in Project Settings > Plugins. It listens while the editor is open. Run mcp-sh-godot addon install again after mcp-sh-godot update, so the addon matches the binary. addon remove takes it out.

Which commands it offers:

  • With Editor Console enabled, its commands are offered. They run in the console's context (.gdrc, the undo stack), taking turns with what you type into it.
  • Without it, gdsh's own commands are offered, plus gdsh_lib's tree and utils when installed. gdsh is found by its GDSh class wherever gdaddon put it (gdaddon install brohd11/godot-gdsh).
  • Either way, commands from bridge.json are added.

Commands get their arguments exactly as bash passed them: no gdsh quoting, variables or aliases apply. cd and pwd are gdsh's (mcp-sh hands bash's to them), as are cn and pwn for the working node. Both carry over between calls, separate from the console prompt.

In a running game

The bridge is a node, so a game or app adds it the way the plugin does. Then register the mcp-sh-godot-game entry that setup (and --help) prints for each agent; it sets MCP_SH_GODOT_PORT=9511.

const McpShBridge = preload("res://addons/mcp_sh_godot/bridge.gd")

func _ready():
    var bridge = McpShBridge.new()
    bridge.host = my_console.create_host()  # optional: any GDSh.Host; plain gdsh when null
    add_child(bridge)
  • It listens on 9511 unless port is set, and says godot runtime in list_commands.
  • Release builds don't listen unless serve_in_release is set: commands can run any code.
  • Without a host it serves gdsh's builtins and gdsh_lib, which work on the live tree. Use GDSh.Host.new({"command_dirs": ["res://game/commands"]}) for the game's own commands.

Bridge config

The addon reads ~/.mcp-sh/godot/bridge.json, then res://.mcp-sh/godot/bridge.json. Later files win, and commandDirs/exclude add up. Use Project > Tools > Restart mcp-sh-godot Bridge after editing them.

{
  "port": 0,
  "token": "",
  "autostart": true,
  "editorConsole": true,
  "gdshLib": true,
  "commandDirs": ["res://tools/agent"],
  "commands": {"bake": "res://tools/bake_command.gd"},
  "exclude": ["settings"],
  "include": ["echo"]
}
  • commandDirs are gdsh command folders. commands maps a name to one command script. Relative paths are relative to the config file, and ~/ is the home folder.
  • port 0 is 9510 in the editor.
  • exclude hides commands. The defaults hide gdsh's session builtins, the text tools the shell already has (grep, head, tail) and os/term. include brings a default back.
  • With a token, set the same one for the shell: MCP_SH_GODOT_TOKEN. A different port needs MCP_SH_GODOT_PORT. The editor also reads both variables as defaults, if it was started with them.

Shell overrides go in ~/.mcp-sh/godot/config.json (or ./.mcp-sh/godot.json for one project). See the mcp-sh README for the config keys.

Development

make           # host build -> build/<os>-<arch>/mcp-sh-godot
make test
make package   # release archives for every platform

The addon's source is addon/mcp_sh_godot/, embedded into the binary. To work on it, symlink that folder into a project's addons/.

The makefile body, installers, workflows and cliff.toml are rendered from sh-templates by the workspace's render-go.sh. Only the config blocks above # ---- end config ---- are edited here. Pushing a v* tag releases.

Documentation

Overview

mcp-sh-godot: a sandboxed bash shell over Godot, served over MCP. See `mcp-sh-godot --help` and the README.

Jump to

Keyboard shortcuts

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