godot-mcp-server
v1.1.2MCP server that connects AI coding assistants to the Godot 4.2+ editor (scenes, nodes, scripts, ClassDB, playtests) via the companion godot-mcp-toolkit plugin.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
scene_get_tree
Return the current edited scene's node tree as nested JSON { name, class, path, children }. Paths use "." for root — pass them directly to other editor commands.
| Parameter | Type | Description |
|---|---|---|
include_properties | boolean | Embed property snapshot per node. Default false. |
max_depth | number | Tree depth. Default 2. Use -1 for full tree. |
scene_create_node
Create a node of class_name under parent. Supports engine + user-defined class_name classes. Idempotent: 'returned' on collision, 'created' on fresh. Example: class_name: "CharacterBody2D", parent_path: ".", node_name: "Player"
| Parameter | Type | Description |
|---|---|---|
class_name * | string | |
parent_path * | string | |
layout_mode | number | Layout mode for Control nodes: 0=free, 1=anchors. Auto-sets 1 when parent is Container. |
node_name | string | |
properties | object | Inline property values set after creation. Same coercion as node_set_property. Partial failure keeps the node — check properties_failed. Dict iteration order is not guaranteed. |
unique_name | boolean | Mark as scene-unique node for %Name access in scripts. Warns if name collides with existing unique node. |
scene_delete_node
Delete the node at path (NodePath). Refuses to delete the edited scene root.
| Parameter | Type | Description |
|---|---|---|
node_path * | string |
scene_create
Create .tscn at file_path. Root name = filename stem at '.'. root_type default Node. Idempotent: created|returned|replaced. if_exists: return|fail|replace. Use scene_open afterward to edit.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | |
if_exists | string | |
root_name | string | Root node name override (default: filename stem). |
root_type | string |
node_get_property
Read a property from the node at path. Returns { value } (engine types are dict-wrapped).
| Parameter | Type | Description |
|---|---|---|
node_path * | string | |
property * | string | Property name. Use ':' to chain into sub-resources (e.g. 'material:shader_parameter/value'). |
node_set_property
Set a property on a node in the EDITOR scene tree (saved to .tscn files). Does NOT affect the running game — for runtime property changes during playtesting, use runtime_set_property. Node paths are relative to the edited scene root: "." is root, "./Player" is a direct child, "./Player/Sprite2D" for deeper nodes. Engine types: {type:'Vector2',x,y}. Inline sub-resources: {type:'NewResource',class:'CircleShape2D',properties:{radius:50}}. External resources (textures, audio, tilesets, materials): {type:'Resource', path:'res://path/to/file.tres'}. Packed arrays: {type:'PackedVector2Array', val…
| Parameter | Type | Description |
|---|---|---|
batch | array | Batch mode: array of {node_path, property, value, make_unique?}. Omit for single-property operations. When present, top-level node_path/property/value are ignored. |
make_unique | boolean | When true and the compound path targets an external (.tres) sub-resource, auto-duplicate it as an inline copy before setting. Equivalent to the Inspector's 'Make Unique'. Only needed for compound path… |
node_path | string | Single mode: path to target node |
property | string | Single mode: property name. Compound '/' paths supported. Use ':' for sub-resource chaining (e.g. 'material:shader_parameter/value'). |
value |
node_get_property_list
Introspect node properties. mask: common (default), all, groups, script. 'script' returns all script variables with public/private label; use visibility param to filter.
| Parameter | Type | Description |
|---|---|---|
node_path * | string | |
mask | string | Property filter. 'common' (default) returns 8-12 most-edited. 'all' returns full list. 'groups' returns names+usage only. 'script' returns script variables with visibility label. Prefer 'common' or no… |
visibility | string | Filter for mask='script'. 'public' = no _ prefix, 'private' = _ prefix, 'all' = both. |
node_set_script
Attach a script (.gd/.cs) to a node. On Godot 4.2.2+, a .gd changed on disk since it was loaded is reloaded first, for every node running it. Returns @export properties. Empty script_path detaches.
| Parameter | Type | Description |
|---|---|---|
node_path * | string | |
script_path * | string |
control_set_layout
Set anchor preset + optional margins on a Control node in one call. Uses set_anchors_and_offsets_preset(). Returns final_rect.
| Parameter | Type | Description |
|---|---|---|
node_path * | string | |
preset * | string | Layout preset: PRESET_TOP_LEFT, PRESET_TOP_RIGHT, PRESET_BOTTOM_LEFT, PRESET_BOTTOM_RIGHT, PRESET_CENTER_LEFT, PRESET_CENTER_TOP, PRESET_CENTER_RIGHT, PRESET_CENTER_BOTTOM, PRESET_CENTER, PRESET_LEFT_… |
margins | object | Additive offsets applied after the preset (in pixels). |
resize_mode | string | keep_size (default) preserves size; set_to_anchors resizes to anchor region. |
node_call_method
Call method with args on an edited-scene node (editor-only; for runtime nodes use execute_code).
| Parameter | Type | Description |
|---|---|---|
method_name * | string | |
node_path * | string | |
args | array |
script_read
Read a script file (res:// only). Returns the file content as text in an <untrusted> envelope. Read large scripts in successive line windows via start_line/end_line (1-indexed, inclusive). Paged: returned, total_lines, has_more. When has_more, page via next_start_line until has_more is false.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | |
end_line | integer | 1-based last line to read (inclusive). |
start_line | integer | 1-based first line (default 1); pass next_start_line back as start_line to page. |
script_write
Write .gd/.cs/.gdshader/.gdshaderinc at file_path (res:// only, creates or overwrites). For .gd files, returns inline diagnostics (valid: bool, diagnostics: [...]) — check valid before proceeding. Not idempotent. Use script.delete to remove; resource.create for .tres; scene.create for .tscn.
| Parameter | Type | Description |
|---|---|---|
content * | string | |
file_path * | string |
script_edit
Surgically replace a span in an existing .gd/.cs/.gdshader/.gdshaderinc file (res:// only) — the MCP analogue of the native Edit tool. old_string must match the file byte-for-byte (whitespace and indentation included); no regex, no fuzzy match. old_string not found -> NOT_FOUND; matches more than once without replace_all -> NOT_UNIQUE. new_string:'' deletes the span. replace_all replaces every occurrence and returns replacements:N. edits applies several edits in order in one call, writing nothing if any fails. Prefer this over rewriting the whole file with script_write for a small change —…
| Parameter | Type | Description |
|---|---|---|
file_path * | string | |
edits | array | several edits in one call, instead of old_string/new_string/replace_all; each applies to the text the earlier ones leave, and nothing is written if any fails |
new_string | string | replacement text; empty string deletes the span; omit when passing edits |
old_string | string | exact byte-for-byte span to replace (whitespace/indent must match); omit when passing edits |
replace_all | boolean | replace every occurrence instead of requiring a unique match (default false) |
script_check
Offline GDScript validation — pass/fail + diagnostics. A class_name clash always carries its line (1-based); a compile error only on 4.5+. Columns are lsp_diagnostics' domain. Works headless.
| Parameter | Type | Description |
|---|---|---|
file_path * | string | res:// path to a .gd file |
editor_save_scene
Save the current edited scene. Optional file_path triggers save-as.
| Parameter | Type | Description |
|---|---|---|
file_path | string |
scene_open
Open a scene (.tscn / .scn) as the active edited scene. res:// only; NOT_FOUND if the file doesn't exist.
| Parameter | Type | Description |
|---|---|---|
file_path * | string |
project_get_settings
List ProjectSettings keys + values. Optional prefix filter. Keys matching /password|token|secret|key/i are dropped (MVP filter).
| Parameter | Type | Description |
|---|---|---|
prefix | string |
editor_get_console
Tail editor Output. source='buffer' (default): live editor console on 4.5+, game-log tail on 4.2-4.4. source='file': the newest log — the game's, or the editor's own when launched with --log-file (4.3+; not 4.4 on Windows). level_filter, since_id, text_filter (is_regex=true for regex). Carries returned/total_lines/has_more + next_id — page via since_id. Primary post-crash diagnostic tool — reads runtime errors even after game_stop.
| Parameter | Type | Description |
|---|---|---|
clear_buffer | boolean | Clear the log buffer before reading. Use when stale errors persist after successful script recompilation. |
is_regex | boolean | Treat text_filter as a regex pattern instead of a plain substring (default false). |
level_filter | Single level or array of levels to filter by | |
limit | number | |
since_id | number | |
source | string | |
text_filter | string | Substring to match against message text (case-insensitive). Set is_regex=true for regex patterns. |
project_set_setting
Write a ProjectSettings key and persist via ProjectSettings.save. Refuses mcp_toolkit/*, mcp/*, and editor/* prefixes. Returns previous_value. Update (no status).
| Parameter | Type | Description |
|---|---|---|
setting * | string | ProjectSettings key (e.g. 'application/config/name') |
value * |
folder_create
Create directory at res:// path (recursive — parents auto-created). Idempotent: status created on fresh, returned if pre-existing.
| Parameter | Type | Description |
|---|---|---|
path * | string |
game_start
Start playtest. Blocks until runtime is ready by default; wait_for_runtime:false launches without blocking. scene_path:'main'|'current'(default)|res://path. if_running:'return' for idempotent mode.
| Parameter | Type | Description |
|---|---|---|
if_running | string | |
runtime_poll | boolean | With if_running:'return', re-check whether the already-running game's runtime has since connected. Default false. |
scene_path | string | |
wait_for_runtime | boolean | Defaults true — blocks until runtime connects (or times out) so runtime tools are immediately available. Pass wait_for_runtime:false to launch without blocking. |
game_stop
Stop the currently-playing scene (idempotent — returns was_running:false if nothing was running). No params.
runtime_screenshot
Capture the running game window. Requires an active playtest (game_start). Use editor_screenshot for the editor viewport. image_response_mode 'disk' saves the PNG and returns only its path.
| Parameter | Type | Description |
|---|---|---|
force_foreground_game | boolean | If true, un-minimize + raise/focus the game window before capturing (default false). Set it when runtime_screenshot reports RUNTIME_WINDOW_MINIMIZED; leave false to avoid fighting for focus (esp. para… |
image_detail | string | Resolution of the returned inline image only. full = native; mid ≈ 1024 px long edge; low ≈ 512 px (gross layout/motion only — not for reading text). Does not affect files written to disk. |
image_response_mode | string | How to return the capture: 'inline' (default) embeds the PNG; 'disk' persists it and returns only the path — use for very large captures or to conserve context tokens; 'both' does both. Files writte… |
save_path | string | Destination .png used by image_response_mode disk/both (user://screenshots/ only); auto-named when omitted. |
debugger_get_log
Game output log. Works during gameplay AND after crash (auto-serves cached output). print()/push_* from a running game are captured here on every version (4.2-4.7) — the 'read my own prints to validate a flow' path. Compile errors will NOT appear here (the game must run); use script_check (one file) or lsp_project_diagnostics (whole project). source='buffer'|'file'. limit=200. text_filter + is_regex for search. +returned/total_lines/has_more (capped tail). Right after game_stop the first call may return GAME_NOT_RUNNING while the session registry settles — retry once (the cache serves the…
| Parameter | Type | Description |
|---|---|---|
is_regex | boolean | Treat text_filter as a regex pattern instead of a plain substring (default false). |
limit | integer | |
source | string | |
text_filter | string | Substring to match against log message text (case-insensitive). Set is_regex=true for regex. |
input_simulate
Inject input into the running game. events: single {event_type, event_data?, delay_before_ms?, delay_after_ms?} for one action, or an array for a sequence of actions (prefer a single call with multiple events over separate calls). Types: key|mouse_button|mouse_motion|action|click|click_node|send_text. click is a composite: press + 50ms delay + release via push_input (no OS focus/warp; parallel-safe). click_node takes {node_path} — calls grab_focus + emits pressed on BaseButtons (no coordinate guessing). send_text types a string into the focused text field (or the event_data.node_path-targete…
| Parameter | Type | Description |
|---|---|---|
events * | ||
summary | boolean |
runtime_get_script_vars
Get script variables (names, values, public/private) for a live game node. Complements runtime_get_node_state (engine props only). visibility param filters.
| Parameter | Type | Description |
|---|---|---|
node_path * | string | |
visibility | string |
execute_code
DANGER: evaluates a GDScript expression. Expression-only — no var/return/if/for statements, no = assignment. channel: 'runtime' (default) runs in the running game, 'editor' runs in the editor process. To set properties: get_node('/root/Main/Player').set('speed', 400) To call methods: get_node('/root/Main/Player').call('take_damage', 25) To read values: get_node('/root/Main/Player').position Prefer runtime_set_property for single property changes (safer, no expression syntax). Use execute_code for complex multi-step operations or method calls with specific arguments. If C# project, managed…
| Parameter | Type | Description |
|---|---|---|
code * | string | |
channel | string | 'runtime' (default) evaluates in the running game — needs game_start first, else GAME_NOT_RUNNING; 'editor' evaluates in the editor process, no running game needed — use it for editor-state expres… |
scope_path | string |
signal_list
List signals on a node. include_connections=true adds targets ({target_path, method_name, flags}). flags & 2 = CONNECT_PERSIST (saved in .tscn).
| Parameter | Type | Description |
|---|---|---|
node_path * | string | |
include_connections | boolean |
signal_manage
Connect or disconnect a signal (editor-time, CONNECT_PERSIST — saved in .tscn, survives save/load). Idempotent connect (status 'returned' on collision).
| Parameter | Type | Description |
|---|---|---|
action * | string | |
method_name * | string | |
node_path * | string | |
signal_name * | string | |
target_path * | string |
node_manage
Structural node operations on the edited scene tree. action: rename — requires new_name. action: reparent — requires new_parent_path, optional keep_global_transform (default true). action: reorder — requires new_index (0-based sibling index). action: duplicate — optional new_name, parent_path, properties (overrides like {position:{x,y}}).
| Parameter | Type | Description |
|---|---|---|
action * | string | |
node_path * | string | |
keep_global_transform | boolean | For reparent: preserve world transform. Default true. |
new_index | integer | For reorder: 0-based sibling index. |
new_name | string | Required for rename; optional for duplicate. |
new_parent_path | string | Required for reparent. |
parent_path | string | For duplicate: target parent. Defaults to same parent. |
properties | object | For duplicate: property overrides on the copy (e.g. {position:{x:100,y:200}}). |
node_groups
Manage node group membership. Groups are the idiomatic Godot way to tag and query game objects (e.g. 'coins', 'enemies'). Single mode: node_path + group (node_path required for add/remove/list). Batch mode: entries array of {node_path, group} carries per-item paths, and the top-level node_path/group are ignored. action: add — requires group. action: remove — requires group. action: list — returns all groups (single only).
| Parameter | Type | Description |
|---|---|---|
action * | string | |
entries | array | Batch mode (add/remove only): array of {node_path, group}. When present, processes all entries as a batch.node_path and group params are ignored in batch mode. |
group | string | Group name. Required for single add/remove. |
node_path | string | Single mode: target node path. Required for single add/remove/list; omit in batch mode (provide entries instead). |
persistent | boolean | For add: save to .tscn. Default true. |
autoload_manage
Manage project autoload singletons (GameManager, AudioManager, etc.). Writes to project.godot; takes effect on next game launch. action: register — requires name + script_path. action: unregister — requires name. action: list — returns all.
| Parameter | Type | Description |
|---|---|---|
action * | string | |
enabled | boolean | For register: auto-initialize on startup. Default true. |
name | string | Autoload name (e.g. 'GameManager'). Required for register/unregister. |
script_path | string | Script path (e.g. 'res://scripts/game_manager.gd'). Required for register. |
scene_query
Search scene tree with filters (class, group, name glob, property conditions). Returns matching nodes. Faster than scene_get_tree + manual filtering. Paged: returned, total_matches, has_more. When has_more, page via next_offset until has_more is false. Stable only if the source is unchanged between calls. Results are returned in deterministic depth-first order; nodes echoes offset/limit. limit is 1-200 (default 50, clamped above 200). If the tree changes between paged reads (nodes added, removed, or reordered) results may skip or repeat — re-query from offset 0.
| Parameter | Type | Description |
|---|---|---|
class_filter | string | Class name filter (inheritance-aware, e.g. 'CollisionShape2D', 'Control') |
group_filter | string | Node group membership filter |
include_properties | array | Property names to include in results |
limit | integer | Page size (default per tool); a request above the cap is clamped and limit_clamped is set. |
max_depth | integer | Max traversal depth (-1 = unlimited, default -1) |
name_pattern | string | Glob pattern for node name (e.g. 'Enemy*', '*Collision*') |
offset | integer | Skip the first N (default 0); pass next_offset back as offset until has_more is false. |
property_filters | array | Property value conditions (AND logic) |
root_path | string | Subtree root path (default: scene root) |
scene_spatial_map
Spatial layout of the current scene: per-node world position, bounds (2D Rect2 / 3D AABB), size, plus computed overlaps/gaps/containment. Call before placing or moving nodes to find clear space. Paged: returned, total_nodes, has_more. Cursor-less — narrow with subtree/class/region/radius or raise max_nodes for more.
| Parameter | Type | Description |
|---|---|---|
center | array | Center for radius filter: [x,y] (2D) or [x,y,z] (3D) |
class | string | Only include nodes of this class (ancestry-aware) |
detail | string | brief = position/size only; normal = + bounds + overlaps; full = + containment + nearest-neighbour gaps |
max_nodes | number | Response cap (default 200, max 1000) |
radius | number | Only nodes within this distance of center |
region | array | Only nodes intersecting this box: [x,y,w,h] (2D) or [x,y,z,sx,sy,sz] (3D) |
subtree | string | Map only this node and its descendants (node path relative to the scene root) |
discover_tools
Find and activate tool groups by name or domain keyword. Activate only the groups needed for your current task (up to ~5) — loading many groups at once floods the tool list and degrades response quality. No params → full catalog. reset: true → deactivate ALL groups; reset: ['group_a'] → deactivate only group_a. Groups: runtime_advanced [available] — Inspect live node state, set node properties, and control AnimationPlayer during playtests; signals [available] — Emit signals on scene nodes at editor-time or runtime; animation_authoring [available] — Inspect and author keyframes, e…
| Parameter | Type | Description |
|---|---|---|
activate | boolean | Auto-activate matching groups. Default true. Set false to browse without loading. |
include_schemas | boolean | Include full parameter schemas and annotations in the response. Default false. Only needed when you activated a group but the new tools are missing from your tool list. |
request | Names or keywords to find tool groups. Built-in: runtime_advanced, signals, animation_authoring, input_map, resource_io, asset_ops, placeholders, cleanup, user_data, scene_advanced, editor_advanced, t… | |
reset | Deactivate groups. true = reset ALL on-demand groups. Array of group names = selectively deactivate only those groups (e.g. reset: ["tilemap", "audio"]). false or omitted = keep current groups active. |
extensions_refresh
Force a filesystem rescan and re-discover extension scripts. Call after creating, modifying, or deleting extension files from outside the Godot editor. Returns the updated list of extension commands.