Godot MCP Loop

v0.9.0
io.github.AI-osho/godot-mcp-loop Checked 6 hours ago Published 1 month ago

Drive a live Godot 4 editor: edit scenes and scripts, run and test the game, record GIFs.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

godot_status Godot status

Check the connection to the Godot editor and get basic state: Godot version, project name, currently edited scene and whether the game is running. Call this first.

project_list List Godot projects

List the Godot projects this server may switch to: folders with project.godot below the --projects-root folders (up to 3 levels down, hidden folders skipped), each with its name, whether the MCP Loop addon is installed, whether an editor is running for it, and which one is current. Use project_connect to switch.

project_connect Switch project

Point this running server at another Godot project, so the following tool calls work on it — one MCP registration for many games. Only projects below the folders given with --projects-root are allowed (without it the server stays on its --project). Returns the new project's status like godot_status, or, when no editor is open for it, how to open one. The previous project's editor and game keep running. Don't switch while another tool call runs.

ParameterTypeDescription
path *stringProject folder (the one with project.godot): absolute, ~/..., or relative to a projects root, e.g. 'games/shooter'.

editor_launch Open the Godot editor

Open the Godot editor on the current project and wait until the MCP Loop bridge answers, then return the same fields as godot_status. Does nothing when an editor already runs for the project. Godot is found from the server's --godot / GODOT_BIN, else PATH and the usual install folders (4.5+ required). The project needs the MCP Loop addon installed and enabled. headless: true opens it without a window (no screenshots; for servers and CI). The editor keeps running after the server stops; editor_quit closes editors opened here.

ParameterTypeDescription
headlessbooleanStart the editor without a window (default false).
timeout_msintegerHow long to wait for the bridge (default 120000; the first open of a project imports every asset).

editor_quit Close the Godot editor

Close the Godot editor of the current project — only one this server opened with editor_launch (an editor the user opened is refused with EDITOR_NOT_LAUNCHED). Stops a running game, saves the open scenes unless save: false, quits, and waits for the process to end (stopped with SIGTERM after timeout_ms).

ParameterTypeDescription
savebooleanSave all open scenes first (default true).
timeout_msintegerHow long to wait for the editor to exit (default 20000).

project_export Export the project

Export the project with one of its export_presets.cfg presets (Godot's `--export-release`, headless, fixed argument list, no shell). The output always goes under res://build/ — pass `path` to choose the name, or omit it for res://build/<preset>/ (index.html for Web). Returns the files written with their sizes, plus the tail of Godot's log. Fails with TEMPLATES_MISSING when Godot has no export templates installed. `dry_run` shows the command and the target without exporting.

ParameterTypeDescription
preset *stringPreset name from export_presets.cfg (project_info can list them).
dry_runbooleanValidate the preset and the path, show the command, export nothing.
pathstringOutput under res://build/... — a folder or .html for Web, a file for the other platforms.
timeout_msintegerLimit for the export process (default 600000).

project_info Project info

Project overview: name, main scene, autoloads, input actions and their events (Godot's built-in ui_* actions are hidden unless include_builtin_actions), and (optionally) a file list filtered by a glob.

ParameterTypeDescription
globstringIf set, list res:// files matching this glob, e.g. '*.tscn' or 'scripts/**/*.gd'.
include_builtin_actionsbooleanAlso list Godot's built-in ui_* actions (about 90).
max_filesintegerCap on listed files (default 200).

scene_open Open scene

Open a scene in the editor and make it the edited scene. Subsequent node_* tools operate on it.

ParameterTypeDescription
path *stringres:// path of a .tscn/.scn file.

scene_create Create scene

Create a new scene file with a single root node and open it. Fails if the file already exists.

ParameterTypeDescription
path *stringres:// path ending in .tscn, e.g. 'res://levels/level_1.tscn'. Folders are created.
root_type *stringRoot node class, e.g. 'Node2D', 'Node3D', 'Control', 'CharacterBody2D'.
dry_runbooleanPreview only: validate and describe the change without applying it.
root_namestringRoot node name (default: file name in PascalCase).

scene_save Save scene

Save the currently edited scene to disk.

scene_tree Scene tree

Node hierarchy of the edited scene: name, class, relative path, attached script and instanced scene for each node.

ParameterTypeDescription
depthintegerMax depth below the subtree root (default 10).
pathstringSubtree root. Node path relative to the edited scene's root; '.' is the root itself (e.g. 'Player/Sprite2D'). Default '.'.

node_add Add node

Add a node to the edited scene (undoable). Provide either 'type' (a class like 'Sprite2D') or 'scene' (a res:// .tscn to instance). Initial properties are validated before anything is changed. Value formats: Vector2/3 as [x, y(, z)] or {x, y}; Color as '#rrggbb', '#rrggbbaa', a name like 'red', or [r, g, b, a] in 0..1; NodePath/StringName as strings; Rect2 as [x, y, w, h]; resources as {"res": "res://path"} for a file, or {"new": "RectangleShape2D", "properties": {"size": [32, 48]}} to create an embedded one (shapes, materials, styles; not scripts); null clears. Nested fields can be set with G…

ParameterTypeDescription
dry_runbooleanPreview only: validate and describe the change without applying it.
namestringNode name (made unique among siblings if taken).
parentstringParent node. Node path relative to the edited scene's root; '.' is the root itself (e.g. 'Player/Sprite2D'). Default '.'.
propertiesobjectInitial property values.
scenestringres:// path of a scene to instance instead of 'type'.
typestringNode class to create.

node_delete Delete node

Delete a node and its children from the edited scene (undoable with edit_undo). The scene root cannot be deleted.

ParameterTypeDescription
path *stringNode path relative to the edited scene's root; '.' is the root itself (e.g. 'Player/Sprite2D').
dry_runbooleanPreview only: validate and describe the change without applying it.

node_get Get node properties

Read properties of a node in the edited scene. By default returns only properties that differ from the class default plus script variables.

ParameterTypeDescription
path *stringNode path relative to the edited scene's root; '.' is the root itself (e.g. 'Player/Sprite2D').
changed_onlybooleanWhen no list is given: only non-default values (default true).
propertiesarrayOnly these properties (supports 'position:x').

node_set Set node properties

Set one or more properties on a node as a single undoable action. All values are validated first; nothing changes if any is invalid. Returns before/after values. Value formats: Vector2/3 as [x, y(, z)] or {x, y}; Color as '#rrggbb', '#rrggbbaa', a name like 'red', or [r, g, b, a] in 0..1; NodePath/StringName as strings; Rect2 as [x, y, w, h]; resources as {"res": "res://path"} for a file, or {"new": "RectangleShape2D", "properties": {"size": [32, 48]}} to create an embedded one (shapes, materials, styles; not scripts); null clears. Nested fields can be set with Godot's indexed syntax, e.g. "po…

ParameterTypeDescription
path *stringNode path relative to the edited scene's root; '.' is the root itself (e.g. 'Player/Sprite2D').
properties *objectProperty name -> new value.
dry_runbooleanPreview only: validate and describe the change without applying it.

script_read Read script

Read a text resource inside the project (GDScript, shader, .tscn, .cfg ...).

ParameterTypeDescription
path *stringres:// path.

script_write Write script

Create or overwrite a GDScript (.gd) file. The code is compiled first; on errors nothing is written and the errors (with line numbers) are returned. Returns a unified diff for changed files and a one-line summary for new ones. Undoable with edit_undo. For small changes to an existing file prefer script_edit.

ParameterTypeDescription
content *stringFull new file content.
path *stringres:// path ending in .gd.
dry_runbooleanPreview only: validate and describe the change without applying it.

script_edit Edit script

Change part of an existing GDScript file by exact text replacement, without resending the whole file. Each edit's 'old' must match exactly once (including indentation; GDScript uses tabs) unless replace_all is set; edits apply in order. The result is compiled first; on errors or a non-matching edit nothing is written. Returns a unified diff. Undoable with edit_undo.

ParameterTypeDescription
edits *array
path *stringres:// path of an existing .gd file.
dry_runbooleanPreview only: validate and describe the change without applying it.

script_attach Attach script

Attach an existing script to a node in the edited scene (undoable). Pass script=null to detach.

ParameterTypeDescription
node *stringNode path relative to the edited scene's root; '.' is the root itself (e.g. 'Player/Sprite2D').
script *string | nullres:// path of the script, or null to detach.
dry_runbooleanPreview only: validate and describe the change without applying it.

edit_undo Undo AI edits

Undo the most recent edits made through this MCP server (node, property, script changes), newest first. Stops without touching anything if a human made a later edit in the same history.

ParameterTypeDescription
stepsintegerHow many actions to undo (default 1).

file_write Write text file

Create, overwrite or partially edit a text file in the project: .yaml/.yml (e.g. scenarios), .json, .md, .txt, .csv. Give 'content' for the whole file or 'edits' (exact replacements, like script_edit). YAML syntax is checked before writing and scenario files are validated (warnings); JSON must parse. Undoable with edit_undo. Use script_write for .gd files.

ParameterTypeDescription
path *stringres:// path, e.g. 'res://tests/scenarios/jump.yaml'.
contentstringFull file content (creates or overwrites).
dry_runbooleanPreview only: validate and return the diff without writing.
editsarrayExact text replacements applied in order to the existing file.

image_write Write pixel-art PNG

Create a PNG sprite from text, NES-style: 'palette' maps single characters to colors and each string in 'rows' is one row of pixels ('.' and ' ' are transparent). 'frames' (a list of row lists) makes a horizontal sprite sheet for animation. Scaled with nearest neighbour, imported immediately, undoable with edit_undo. Use the result as {"res": path} for a Sprite2D texture.

ParameterTypeDescription
palette *objectCharacter -> color ('#rrggbb', '#rrggbbaa', a name, or [r, g, b, a] in 0..1), e.g. {"k": "#000000", "r": "#d82800"}. null or 'transparent' = see-through ('.' and ' ' already are).
path *stringres:// path ending in .png.
dry_runbooleanValidate and report the size without writing.
framesarraySeveral same-sized frames, laid out left to right. Each frame is a list of row strings: [["..##..", ...], ["..##..", ...]].
mirrorstringSymmetric sprites: give only the left half ('x'), top half ('y') or top-left quarter ('xy'); the rest is mirrored.
mirror_overlapbooleanShare the middle column/row instead of repeating it (odd widths/heights).
rowsarrayOne image: rows of palette characters, all the same length (max 256x256).
scaleintegerInteger upscale factor (default 1). Prefer 1 and scale the node instead.

input_action_set Set input action

Add or replace an input action in the project's input map (project.godot), or remove it with remove: true. Keys are matched by physical position (e.g. 'A', 'Space', 'Left', 'Shift'). Undoable with edit_undo. A running game picks up changes after game_run with restart: true.

ParameterTypeDescription
name *stringAction name, e.g. 'shoot' or 'move_up'.
deadzonenumberDefault 0.2.
dry_runboolean
joypad_buttonsarray
keysarray
mouse_buttonsarray
removebooleanRemove the action instead.

project_setting_set Set project setting

Change one project setting from a fixed list: the main scene, the viewport size, the window size override, the stretch mode/aspect, the project name and max_fps. Anything else (rendering, physics, autoloads, input map) is refused — use the editor. Values may be sent as strings. Undoable with edit_undo; the editor window and a running game pick most settings up when they start.

ParameterTypeDescription
key *stringSetting key.
value *New value; converted to the setting's type.
dry_runbooleanReturn before/after without writing.

game_run Run game

Launch the game from the editor and wait until the MCP runtime inside it is connected. Script errors in the game are logged and auto-continued unless pause_on_error=true.

ParameterTypeDescription
pause_on_errorbooleanLeave the game paused in the debugger on script errors (default false).
restartbooleanStop a running game first instead of failing.
scenestring'main' (default), 'current' (the edited scene), or a res:// scene path.
timeout_msintegerHow long to wait for the game to connect (default 20000).

game_stop Stop game

Stop the running game. Its logs stay readable with logs_read(source='game').

game_query Query running game

Read live state from the running game. With 'properties' returns those values (supports 'position:x'); without, returns the node's class, children and common properties plus script variables. It only reads properties: to call a method use game_call.

ParameterTypeDescription
nodestringNode in the running game: relative to the running scene (e.g. 'Player') or absolute (e.g. '/root/Main/Player'). Default: the running scene root.
propertiesarray

game_input Send input to game

Play a sequence of input steps in the running game (actions, keys, mouse), in order and with real timing; hold_frames/wait_frames count physics frames for deterministic timing. Inline set/call/assert/wait_for steps run inside the game between inputs with no time passing, so one call can set up, act and check (a failing step aborts and releases held input). Returns when the whole sequence has finished. To observe something brief (e.g. the top of a jump), pass 'record': the properties are sampled every frame while the steps run, and min/max (with times) are returned. min/max are computed from ev…

game_ui_audit Audit UI layout

Walk the Control nodes of the running game and report layout problems: Controls with no size, Controls outside the viewport or beyond their parent panel, text that needs more room than its rect (clipped) and overlapping labels. Returns the tree (path, class, rect, size, anchors, text) plus the issues, so a HUD can be checked without reading a screenshot.

ParameterTypeDescription
include_hiddenbooleanAlso list hidden Controls (default false).
nodestringNode in the running game: relative to the running scene (e.g. 'Player') or absolute (e.g. '/root/Main/Player'). Default: the running scene root.

game_in_view Is a node on screen

Check whether a Node3D is inside the camera's view (not behind it, projected inside the viewport) and where it lands on screen — the 3D judgement that otherwise needs a screenshot.

ParameterTypeDescription
camerastringCamera3D to use; default the active 3D camera.
nodestringNode in the running game: relative to the running scene (e.g. 'Player') or absolute (e.g. '/root/Main/Player'). Default: the running scene root (must be a Node3D).

game_ray Cast a ray in the running game

Cast a ray between two world-space points and return the hit position, normal, distance and collider (or hit: false). World axes do not follow a body's rotation, unlike a child RayCast3D.

ParameterTypeDescription
from *World start point [x, y, z].
to *World end point [x, y, z].
collide_with_areasbooleanInclude Area3D (default false).
collide_with_bodiesbooleanInclude bodies (default true).
collision_maskintegerPhysics layers to hit (default all).
excludestringCollisionObject3D to ignore (e.g. the body casting the ray).

game_contacts Contact points of a rigid body

List a RigidBody3D's contact points, normals and the bodies they touch (contact_monitor must be on), so grounding can be read instead of inferred from a picture.

ParameterTypeDescription
node *stringNode in the running game: relative to the running scene (e.g. 'Player') or absolute (e.g. '/root/Main/Player'). A RigidBody3D.

game_set Set values in running game

Change state in the running game, e.g. to set up a test: {"score": 300, "position:x": 40, "items:2": 5}. Paths may address members, array elements and dictionary keys. Values are converted to the existing type; all of them are validated first and nothing changes if one is invalid. Returns before/after per path.

ParameterTypeDescription
properties *objectProperty path -> new value.
nodestringNode in the running game: relative to the running scene (e.g. 'Player') or absolute (e.g. '/root/Main/Player'). Default: the running scene root.

game_pause Pause / resume running game

Pause (paused: true) or resume the running game. While paused, game nodes don't run but game_query, game_set, game_call and game_wait_for still work — inspect and set up a situation across several calls without time passing, then advance with game_step. Input sent with press: true stays held while stepping.

ParameterTypeDescription
paused *boolean

game_step Advance running game by N frames

Run exactly N physics frames, then leave the game paused (pauses it first if needed). Deterministic: every pausable node gets the same N _physics_process calls, independent of call latency. press/release/tap are sent just before the first stepped frame, like real input, so the game sees them in that frame as Input.is_action_just_pressed() and as input events (tap lasts one frame) — input sent with game_input while paused can't do that.

ParameterTypeDescription
frames *integerPhysics frames to run (60 per second by default).
pressarrayActions to press before the first frame and keep held.
releasearrayHeld actions to release before the first frame.
taparrayActions to press for exactly the first frame.

game_call Call method in running game

Call a method on a node in the running game (e.g. a test hook such as restart() or spawn_wave(3)) and return its result. Arguments are converted to the declared parameter types; coroutines are awaited.

ParameterTypeDescription
method *stringMethod name.
argsarrayPositional arguments.
nodestringNode in the running game: relative to the running scene (e.g. 'Player') or absolute (e.g. '/root/Main/Player'). Default: the running scene root.
timeout_msintegerHow long to wait for the result. Default 10000.

game_wait_for Wait for game condition

Wait until a property of a node in the running game (or the return value of one of its methods, e.g. {method: 'summary', property: 'state'}) satisfies a condition, checked every frame. Fails with TIMEOUT and the last observed value. timeout_ms=0 checks once (an assertion). op changed/increased/decreased waits for a change from the value seen when waiting starts.

ParameterTypeDescription
node *stringNode in the running game, relative to the running scene (e.g. 'Player') or absolute.
op *stringComparison; changed/increased/decreased compare with the value when waiting starts.
argsarrayArguments for 'method'.
messagestringExplains a failure in the test's words; prefixed to the error.
methodstringCheck this method's return value instead of a property, e.g. a summary() test hook. Called on every check, so it should only read state.
propertystringProperty path, e.g. 'position:x', 'items:2', or a script variable. With 'method': a path inside its return value (e.g. 'message').
timeout_msintegerDefault 5000.
tolerancenumberAllowed difference for numbers with ==, !=, >=, <= (default 0.0001).
valueExpected value: a number, boolean, string, null or array (vectors as [x, y]). Not used by changed/increased/decreased.

logs_read Read logs

Read captured output: prints, errors and warnings (with file/line and stack when available). source='game' (default; kept after the game stops) or 'editor'. Pass the returned 'next' as 'since' to read only new entries.

ParameterTypeDescription
limitintegerDefault 200.
min_levelstringDefault 'info'.
sinceintegerCursor from a previous call's 'next'.
sourcestring

screenshot Screenshot

Capture an image of the running game (target='game', default) or of the editor's 2D/3D viewport (target='editor'). Game captures are scaled to the project's viewport size (normalize='viewport') so repeated screenshots compare like for like; pass normalize='none' to keep the window size. The text says the size and, when it differed, the window size. Not available when running headless.

ParameterTypeDescription
max_widthintegerDownscale to at most this width (default 1280).
normalizestringGame only: scale to the project's viewport size (default) or keep the window size (editor captures are unchanged).
targetstring

scenario_run Run scenario test

Run a scripted play-test: (re)start the game, then execute steps in order — wait_for, assert, input, query, screenshot, wait_ms, assert_no_errors, set, call, repeat — stopping at the first failure. Returns a summary with per-step result, what was checked and the observed value, game errors, and screenshots; report='full' adds the JSON report. Pass a YAML/JSON file in the project (path), a folder or a list of files (paths) to run several and get one summary, or an inline scenario. save_to keeps the screenshots and a report as files in the project. movie records every frame with Godot's Movi…

ParameterTypeDescription
include_screenshotsbooleanAttach screenshots as images (default true; for a folder or paths, default is failure screenshots only).
movieobjectRecord the run with Movie Maker (one scenario; needs save_to and a game window — not with --headless in Main Run Args). Waits in the scenario are game time, so prefer frame-based steps for exact tim…
pathstringScenario file, e.g. 'res://tests/scenarios/move.yaml', or a folder to run every .yaml/.yml/.json file in it (natural name order, so 2_ runs before 10_).
pathsarraySeveral scenario files, run in the given order.
reportstring'summary' (default) or 'full' to also return the JSON report.
save_tostringFolder in the project for evidence, e.g. 'res://qa/evidence/move': every screenshot as NN-label.png, report.md and report.json (a folder run: one subfolder per scenario plus summary.md). Re-runs repla…
scenarioInline scenario as YAML text or an object: {name, scene?, steps: [...]}.
stop_on_failurebooleanWith a folder or paths: stop after the first scenario that does not pass.

test_run Run unit tests

Run the project's unit tests with GUT or GdUnit4 (whichever is installed in addons/) in a separate headless Godot process started by the editor, and return pass/fail counts, every failing test with its message, and errors from the log. Use it for game logic; use scenario_run for play. Failing tests are a normal result (not a tool error).

ParameterTypeDescription
frameworkstringDefault 'auto': the one installed.
pathstringTest folder or one test script, e.g. 'res://test/unit' or 'res://test/unit/test_player.gd'. Default: res://test or res://tests (GUT: the folders in res://.gutconfig.json when it exists).
reportstring'full' adds the JSON result with every test's status.
teststringGUT only: run the tests whose name contains this, e.g. 'test_jump'.
timeout_msintegerStop the run after this long (default 120000).