godot-mcp-server

v1.1.2
@npgamedev/godot-mcp-server Checked 10 hours ago Published 1 month ago

MCP 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.

ParameterTypeDescription
include_propertiesbooleanEmbed property snapshot per node. Default false.
max_depthnumberTree 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"

ParameterTypeDescription
class_name *string
parent_path *string
layout_modenumberLayout mode for Control nodes: 0=free, 1=anchors. Auto-sets 1 when parent is Container.
node_namestring
propertiesobjectInline 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_namebooleanMark 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.

ParameterTypeDescription
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.

ParameterTypeDescription
file_path *string
if_existsstring
root_namestringRoot node name override (default: filename stem).
root_typestring

node_get_property

Read a property from the node at path. Returns { value } (engine types are dict-wrapped).

ParameterTypeDescription
node_path *string
property *stringProperty 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…

ParameterTypeDescription
batcharrayBatch 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_uniquebooleanWhen 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_pathstringSingle mode: path to target node
propertystringSingle 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.

ParameterTypeDescription
node_path *string
maskstringProperty 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…
visibilitystringFilter 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.

ParameterTypeDescription
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.

ParameterTypeDescription
node_path *string
preset *stringLayout 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_…
marginsobjectAdditive offsets applied after the preset (in pixels).
resize_modestringkeep_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).

ParameterTypeDescription
method_name *string
node_path *string
argsarray

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.

ParameterTypeDescription
file_path *string
end_lineinteger1-based last line to read (inclusive).
start_lineinteger1-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.

ParameterTypeDescription
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 —…

ParameterTypeDescription
file_path *string
editsarrayseveral 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_stringstringreplacement text; empty string deletes the span; omit when passing edits
old_stringstringexact byte-for-byte span to replace (whitespace/indent must match); omit when passing edits
replace_allbooleanreplace 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.

ParameterTypeDescription
file_path *stringres:// path to a .gd file

editor_save_scene

Save the current edited scene. Optional file_path triggers save-as.

ParameterTypeDescription
file_pathstring

scene_open

Open a scene (.tscn / .scn) as the active edited scene. res:// only; NOT_FOUND if the file doesn't exist.

ParameterTypeDescription
file_path *string

project_get_settings

List ProjectSettings keys + values. Optional prefix filter. Keys matching /password|token|secret|key/i are dropped (MVP filter).

ParameterTypeDescription
prefixstring

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.

ParameterTypeDescription
clear_bufferbooleanClear the log buffer before reading. Use when stale errors persist after successful script recompilation.
is_regexbooleanTreat text_filter as a regex pattern instead of a plain substring (default false).
level_filterSingle level or array of levels to filter by
limitnumber
since_idnumber
sourcestring
text_filterstringSubstring 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).

ParameterTypeDescription
setting *stringProjectSettings 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.

ParameterTypeDescription
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.

ParameterTypeDescription
if_runningstring
runtime_pollbooleanWith if_running:'return', re-check whether the already-running game's runtime has since connected. Default false.
scene_pathstring
wait_for_runtimebooleanDefaults 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.

ParameterTypeDescription
force_foreground_gamebooleanIf 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_detailstringResolution 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_modestringHow 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_pathstringDestination .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…

ParameterTypeDescription
is_regexbooleanTreat text_filter as a regex pattern instead of a plain substring (default false).
limitinteger
sourcestring
text_filterstringSubstring 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…

ParameterTypeDescription
events *
summaryboolean

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.

ParameterTypeDescription
node_path *string
visibilitystring

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…

ParameterTypeDescription
code *string
channelstring'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_pathstring

signal_list

List signals on a node. include_connections=true adds targets ({target_path, method_name, flags}). flags & 2 = CONNECT_PERSIST (saved in .tscn).

ParameterTypeDescription
node_path *string
include_connectionsboolean

signal_manage

Connect or disconnect a signal (editor-time, CONNECT_PERSIST — saved in .tscn, survives save/load). Idempotent connect (status 'returned' on collision).

ParameterTypeDescription
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}}).

ParameterTypeDescription
action *string
node_path *string
keep_global_transformbooleanFor reparent: preserve world transform. Default true.
new_indexintegerFor reorder: 0-based sibling index.
new_namestringRequired for rename; optional for duplicate.
new_parent_pathstringRequired for reparent.
parent_pathstringFor duplicate: target parent. Defaults to same parent.
propertiesobjectFor 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).

ParameterTypeDescription
action *string
entriesarrayBatch 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.
groupstringGroup name. Required for single add/remove.
node_pathstringSingle mode: target node path. Required for single add/remove/list; omit in batch mode (provide entries instead).
persistentbooleanFor 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.

ParameterTypeDescription
action *string
enabledbooleanFor register: auto-initialize on startup. Default true.
namestringAutoload name (e.g. 'GameManager'). Required for register/unregister.
script_pathstringScript 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.

ParameterTypeDescription
class_filterstringClass name filter (inheritance-aware, e.g. 'CollisionShape2D', 'Control')
group_filterstringNode group membership filter
include_propertiesarrayProperty names to include in results
limitintegerPage size (default per tool); a request above the cap is clamped and limit_clamped is set.
max_depthintegerMax traversal depth (-1 = unlimited, default -1)
name_patternstringGlob pattern for node name (e.g. 'Enemy*', '*Collision*')
offsetintegerSkip the first N (default 0); pass next_offset back as offset until has_more is false.
property_filtersarrayProperty value conditions (AND logic)
root_pathstringSubtree 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.

ParameterTypeDescription
centerarrayCenter for radius filter: [x,y] (2D) or [x,y,z] (3D)
classstringOnly include nodes of this class (ancestry-aware)
detailstringbrief = position/size only; normal = + bounds + overlaps; full = + containment + nearest-neighbour gaps
max_nodesnumberResponse cap (default 200, max 1000)
radiusnumberOnly nodes within this distance of center
regionarrayOnly nodes intersecting this box: [x,y,w,h] (2D) or [x,y,z,sx,sy,sz] (3D)
subtreestringMap 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…

ParameterTypeDescription
activatebooleanAuto-activate matching groups. Default true. Set false to browse without loading.
include_schemasbooleanInclude 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.
requestNames 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…
resetDeactivate 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.