godot-mcp-runtime 2.1.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,242 +1,246 @@
1
- # Godot MCP Runtime
2
-
3
- [![npm version](https://img.shields.io/npm/v/godot-mcp-runtime)](https://www.npmjs.com/package/godot-mcp-runtime)
4
- [![npm downloads](https://img.shields.io/npm/dt/godot-mcp-runtime)](https://www.npmjs.com/package/godot-mcp-runtime)
5
- [![License: MIT](https://badgen.net/github/license/Erodenn/godot-mcp-runtime)](LICENSE)
6
- [![Node.js](https://img.shields.io/node/v/godot-mcp-runtime)](https://nodejs.org/)
7
-
8
- An [MCP](https://modelcontextprotocol.io/) server that gives AI assistants direct access to a running Godot 4.x game. Not just file editing, not just scene manipulation. Actual runtime control: input simulation, screenshots, UI discovery, and live GDScript execution while the game is running.
9
-
10
- When you run a project through this server, it injects a lightweight UDP bridge as an autoload, and suddenly the AI can interact with your game the same way a player would: press keys, click buttons, read what's on screen, and run arbitrary code against the live scene tree.
11
-
12
- **The distinction matters: the AI doesn't just write your game, it can check its work.**
13
-
14
- **No addon required.** Most Godot MCP servers that offer runtime support ship as a Godot addon — something you install into your project, commit to version control, and manage as a dependency. This server does none of that. The bridge script is injected on `run_project` and removed on `stop_project`. Your project files are left exactly as they were. All you need is Node.js and a Godot executable no addon installation, no project modifications, no cleanup.
15
-
16
- <a href="https://glama.ai/mcp/servers/@Erodenn/godot-runtime-mcp">
17
- <img width="380" height="200" src="https://glama.ai/mcp/servers/@Erodenn/godot-runtime-mcp/badge" alt="godot-runtime-mcp MCP server" />
18
- </a>
19
-
20
- Think of it as [Playwright MCP](https://github.com/microsoft/playwright-mcp), but for Godot. Playwright lets agents verify that a web app actually works by driving a real browser. This does the same thing for games: run the project, take a screenshot, simulate input, read what's on screen, execute a script against the live scene tree. The agent closes the loop on its own changes rather than handing off to you to verify.
21
-
22
- This is not a playtesting replacement. It doesn't catch the subtle feel issues that only a human notices, and it won't tell you if your game is fun. What it does is let an agent confirm that a scene loads, a button responds, a value updated, a script ran without errors. That's a fundamentally different development workflow, and it's what this server is built for.
23
-
24
- Every operation is its own tool with only its relevant parameters — no operation discriminators, no conditional schemas. Each tool teaches agents how to use it through its description and response messages: what to call next, when to wait, and how to recover from errors.
25
-
26
- ## What It Does
27
-
28
- **Headless editing.** Create scenes, add nodes, set properties, attach scripts, connect signals, manage UIDs, validate GDScript. All the standard operations, no editor window required.
29
-
30
- **Runtime bridge.** When `run_project` is called, the server injects `McpBridge` as an autoload. This opens a UDP channel on port 9900 (localhost only) and enables:
31
-
32
- - **Screenshots:** Capture the viewport at any point during gameplay
33
- - **Input simulation:** Batched sequences of key presses, mouse clicks, mouse motion, UI element clicks by name or path, Godot action events, and timed waits
34
- - **UI discovery:** Walk the live scene tree and collect every visible Control node with its position, type, text content, and disabled state
35
- - **Live script execution:** Compile and run arbitrary GDScript with full SceneTree access while the game is running
36
-
37
- **Background mode.** Pass `background: true` to `run_project` and the Godot window moves off-screen with physical input blocked borderless, unfocusable, mouse-passthrough. Programmatic input, screenshots, and all runtime tools work exactly the same. Useful for automated agent-driven testing where the window shouldn't be visible or interactive.
38
-
39
- The bridge cleans itself up automatically when `stop_project` is called. No leftover autoloads, no modified project files.
40
-
41
- ## Quick Start
42
-
43
- ### Prerequisites
44
-
45
- - [Node.js](https://nodejs.org/) v18+
46
- - [Godot 4.x](https://godotengine.org/)
47
-
48
- That's it. No Godot addon, no project modifications.
49
-
50
- ### Configure Your MCP Client
51
-
52
- Add the following to your MCP client config. Works with Claude Code, Claude Desktop, Cursor, or any MCP-compatible client.
53
-
54
- **Zero-install via npx (recommended):**
55
-
56
- ```json
57
- {
58
- "mcpServers": {
59
- "godot": {
60
- "command": "npx",
61
- "args": ["-y", "godot-mcp-runtime"],
62
- "env": {
63
- "GODOT_PATH": "<path-to-godot-executable>"
64
- }
65
- }
66
- }
67
- }
68
- ```
69
-
70
- **Or install globally:**
71
-
72
- ```bash
73
- npm install -g godot-mcp-runtime
74
- ```
75
-
76
- ```json
77
- {
78
- "mcpServers": {
79
- "godot": {
80
- "command": "godot-mcp-runtime",
81
- "env": {
82
- "GODOT_PATH": "<path-to-godot-executable>"
83
- }
84
- }
85
- }
86
- }
87
- ```
88
-
89
- **Or clone from source:**
90
-
91
- ```bash
92
- git clone https://github.com/Erodenn/godot-mcp-runtime.git
93
- cd godot-mcp-runtime
94
- npm install
95
- npm run build
96
- ```
97
-
98
- ```json
99
- {
100
- "mcpServers": {
101
- "godot": {
102
- "command": "node",
103
- "args": ["<path-to>/godot-mcp-runtime/dist/index.js"],
104
- "env": {
105
- "GODOT_PATH": "<path-to-godot-executable>"
106
- }
107
- }
108
- }
109
- }
110
- ```
111
-
112
- If Godot is on your `PATH`, you can omit `GODOT_PATH` entirely. The server will auto-detect it. Set `"DEBUG": "true"` in `env` for verbose logging.
113
-
114
- ### Verify
115
-
116
- Ask your AI assistant to call `get_project_info`. If it returns a Godot version string (e.g., `4.4.stable`), you're connected and working.
117
-
118
- ## Tools
119
-
120
- ### Project Management
121
-
122
- | Tool | Description |
123
- |------|-------------|
124
- | `launch_editor` | Open the Godot editor GUI for a project |
125
- | `run_project` | Run a project in debug mode and inject the MCP bridge. Pass `background: true` to hide the window |
126
- | `stop_project` | Stop the running project and remove the bridge |
127
- | `get_debug_output` | Read stdout/stderr from the running project |
128
- | `list_projects` | Find Godot projects in a directory |
129
- | `get_project_info` | Get project metadata and Godot version |
130
-
131
- ### Runtime (requires `run_project` first)
132
-
133
- After calling `run_project`, wait 2-3 seconds for the bridge to initialize before using these tools.
134
-
135
- | Tool | Description |
136
- |------|-------------|
137
- | `take_screenshot` | Capture a PNG of the running viewport |
138
- | `simulate_input` | Send batched input: key, mouse, click_element, action, wait |
139
- | `get_ui_elements` | Get all visible Control nodes with positions, types, and text |
140
- | `run_script` | Execute arbitrary GDScript at runtime with full SceneTree access |
141
-
142
- ### Scene Editing (headless)
143
-
144
- All mutation operations save automatically. Use `save_scene` only for save-as (`newPath`) or to re-canonicalize a `.tscn` file.
145
-
146
- | Tool | Description |
147
- |------|-------------|
148
- | `create_scene` | Create a new scene file |
149
- | `add_node` | Add a node to an existing scene (supports promoted spatial params) |
150
- | `load_sprite` | Set a texture on a Sprite2D, Sprite3D, or TextureRect |
151
- | `save_scene` | Re-pack and save the scene, or save-as with `newPath` |
152
- | `export_mesh_library` | Export scenes as a MeshLibrary for GridMap |
153
- | `batch_scene_operations` | Run multiple add_node/load_sprite/save ops in a single Godot process |
154
-
155
- ### Node Editing (headless)
156
-
157
- All mutation operations save automatically.
158
-
159
- | Tool | Description |
160
- |------|-------------|
161
- | `get_scene_tree` | Get the full scene tree hierarchy (use `maxDepth: 1` for shallow listing) |
162
- | `get_node_properties` | Read properties from a node |
163
- | `batch_get_node_properties` | Read properties from multiple nodes in one process |
164
- | `set_node_property` | Set a property on a node |
165
- | `batch_set_node_properties` | Set multiple properties in one process |
166
- | `attach_script` | Attach a GDScript to a node |
167
- | `duplicate_node` | Duplicate a node within the scene |
168
- | `delete_node` | Remove a node from the scene |
169
- | `get_node_signals` | List all signals on a node with their connections |
170
- | `connect_signal` | Connect a signal to a method on another node |
171
- | `disconnect_signal` | Disconnect a signal connection |
172
-
173
- ### Project Config (no Godot process required)
174
-
175
- These tools edit `project.godot` directly or read the filesystem. Safe to use even when autoloads are broken.
176
-
177
- | Tool | Description |
178
- |------|-------------|
179
- | `list_autoloads` | List all registered autoloads with paths and singleton status |
180
- | `add_autoload` | Register a new autoload |
181
- | `remove_autoload` | Unregister an autoload by name |
182
- | `update_autoload` | Modify an existing autoload's path or singleton flag |
183
- | `get_project_settings` | Read settings from `project.godot` by section and key |
184
- | `get_project_files` | Get the project file tree with types and extensions |
185
- | `search_project` | Search for a string across project source files |
186
- | `get_scene_dependencies` | List all resources a scene depends on |
187
-
188
- ### Validation: `validate`
189
-
190
- Validate before attaching or running. Catches syntax errors and missing resource references before they cause headless crashes or runtime failures. Supports `scriptPath`, `source` (inline GDScript), `scenePath`, or a `targets` array for batch validation.
191
-
192
- ### UIDs: `manage_uids` (Godot 4.4+)
193
-
194
- | Operation | Description |
195
- |-----------|-------------|
196
- | `get` | Get a resource's UID |
197
- | `update` | Resave all resources to update UID references |
198
-
199
- ## Architecture
200
-
201
- ```
202
- src/
203
- ├── index.ts # MCP server entry point, routes tool calls
204
- ├── tools/
205
- │ ├── project-tools.ts # Project, runtime, autoload, filesystem, search, settings
206
- │ ├── scene-tools.ts # Scene creation, node addition, sprite loading, batch ops, UIDs
207
- ├── node-tools.ts # Node properties, scripts, tree, duplication, signals
208
- │ └── validate-tools.ts # GDScript and scene validation
209
- ├── scripts/
210
- │ ├── godot_operations.gd # Headless GDScript operations
211
- └── mcp_bridge.gd # UDP autoload for runtime communication
212
- └── utils/
213
- └── godot-runner.ts # Process spawning, output parsing, shared validation helpers
214
- ```
215
-
216
- Headless operations spawn Godot with `--headless --script godot_operations.gd`, perform the operation, and return JSON. Runtime operations communicate over UDP with the injected `McpBridge` autoload.
217
-
218
- ## How the Bridge Works
219
-
220
- When `run_project` is called:
221
-
222
- 1. `mcp_bridge.gd` is copied into the project directory
223
- 2. It's registered as an autoload in `project.godot`
224
- 3. The project launches with the bridge listening on `127.0.0.1:9900`
225
- 4. Runtime tools send JSON commands to the bridge and await responses
226
- 5. When `stop_project` is called, the autoload entry and bridge script are removed
227
-
228
- Files generated during runtime (screenshots, executed scripts) are stored in `.mcp/` inside the project directory. This directory is automatically added to `.gitignore` and has a `.gdignore` so Godot won't import it.
229
-
230
- ## Broken Autoloads
231
-
232
- If any registered autoload fails to initialize (syntax error, missing resource, display dependency), Godot's headless process will crash before any operation runs. Use `list_autoloads` and `remove_autoload` to inspect and remove the failing autoload. These tools edit `project.godot` directly, with no Godot process involved.
233
-
234
- ## Acknowledgments
235
-
236
- Built on the foundation laid by [Coding-Solo/godot-mcp](https://github.com/Coding-Solo/godot-mcp) for headless Godot operations.
237
-
238
- Developed with [Claude Code](https://claude.ai/code).
239
-
240
- ## License
241
-
242
- [MIT](LICENSE)
1
+ # Godot MCP Runtime
2
+
3
+ [![npm version](https://img.shields.io/npm/v/godot-mcp-runtime)](https://www.npmjs.com/package/godot-mcp-runtime)
4
+ [![npm downloads](https://img.shields.io/npm/dt/godot-mcp-runtime)](https://www.npmjs.com/package/godot-mcp-runtime)
5
+ [![License: MIT](https://badgen.net/github/license/Erodenn/godot-mcp-runtime)](LICENSE)
6
+ [![Node.js](https://img.shields.io/node/v/godot-mcp-runtime)](https://nodejs.org/)
7
+
8
+ An [MCP](https://modelcontextprotocol.io/) server that gives AI assistants direct access to a running Godot 4.x game. Not just file editing, not just scene manipulation. Actual runtime control: input simulation, screenshots, UI discovery, and live GDScript execution while the game is running.
9
+
10
+ When you run a project through this server, it injects a lightweight UDP bridge as an autoload, and suddenly the AI can interact with your game the same way a player would: press keys, click buttons, read what's on screen, and run arbitrary code against the live scene tree.
11
+
12
+ **The distinction matters: the AI doesn't just write your game, it can check its work.**
13
+
14
+ **No addon required.** Most Godot MCP servers that offer runtime support ship as a Godot addon — something you install into your project, commit to version control, and manage as a dependency. This server does none of that. The bridge script is injected on `run_project` or `attach_project`, then removed on `stop_project` or `detach_project`. Your project files are left exactly as they were. All you need is Node.js and a Godot executable, no addon installation, no project modifications, no cleanup.
15
+
16
+ Think of it as [Playwright MCP](https://github.com/microsoft/playwright-mcp), but for Godot. Playwright lets agents verify that a web app actually works by driving a real browser. This does the same thing for games: run the project, take a screenshot, simulate input, read what's on screen, execute a script against the live scene tree. The agent closes the loop on its own changes rather than handing off to you to verify.
17
+
18
+ This is not a playtesting replacement. It doesn't catch the subtle feel issues that only a human notices, and it won't tell you if your game is fun. What it does is let an agent confirm that a scene loads, a button responds, a value updated, a script ran without errors. That's a fundamentally different development workflow, and it's what this server is built for.
19
+
20
+ Every operation is its own tool with only its relevant parameters, no operation discriminators, no conditional schemas. Each tool teaches agents how to use it through its description and response messages: what to call next, when to wait, and how to recover from errors.
21
+
22
+ <a href="https://glama.ai/mcp/servers/@Erodenn/godot-runtime-mcp">
23
+ <img width="380" height="200" src="https://glama.ai/mcp/servers/@Erodenn/godot-runtime-mcp/badge" alt="godot-runtime-mcp MCP server" />
24
+ </a>
25
+
26
+ ## What It Does
27
+
28
+ **Headless editing.** Create scenes, add nodes, set properties, attach scripts, connect signals, manage UIDs, validate GDScript. All the standard operations, no editor window required.
29
+
30
+ **Runtime bridge.** When `run_project` or `attach_project` is called, the server injects `McpBridge` as an autoload. This opens a UDP channel on port 9900 (localhost only) and enables:
31
+
32
+ - **Screenshots:** Capture the viewport at any point during gameplay
33
+ - **Input simulation:** Batched sequences of key presses, mouse clicks, mouse motion, UI element clicks by name or path, Godot action events, and timed waits
34
+ - **UI discovery:** Walk the live scene tree and collect every visible Control node with its position, type, text content, and disabled state
35
+ - **Live script execution:** Compile and run arbitrary GDScript with full SceneTree access while the game is running
36
+
37
+ **Background mode.** Pass `background: true` to `run_project` and the Godot window moves off-screen with physical input blocked: borderless, unfocusable, mouse-passthrough. Programmatic input, screenshots, and all runtime tools work exactly the same. Useful for automated agent-driven testing where the window shouldn't be visible or interactive.
38
+
39
+ **Manual attach mode.** When something other than MCP launches the game (a CI pipeline, an external debugger, your own shell), call `attach_project` first. It injects the bridge and marks the project active without spawning Godot, so when you launch the game manually, runtime tools work against it. The tradeoff: `get_debug_output` is unavailable in attached mode because stdout and stderr only flow through processes MCP started itself. Use `detach_project` when done.
40
+
41
+ The bridge cleans itself up automatically when `stop_project` or `detach_project` is called. No leftover autoloads, no modified project files.
42
+
43
+ ## Quick Start
44
+
45
+ ### Prerequisites
46
+
47
+ - [Node.js](https://nodejs.org/) v18+
48
+ - [Godot 4.x](https://godotengine.org/)
49
+
50
+ That's it. No Godot addon, no project modifications.
51
+
52
+ ### Configure Your MCP Client
53
+
54
+ Add the following to your MCP client config. Works with Claude Code, Claude Desktop, Cursor, or any MCP-compatible client.
55
+
56
+ **Zero-install via npx (recommended):**
57
+
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "godot": {
62
+ "command": "npx",
63
+ "args": ["-y", "godot-mcp-runtime"],
64
+ "env": {
65
+ "GODOT_PATH": "<path-to-godot-executable>"
66
+ }
67
+ }
68
+ }
69
+ }
70
+ ```
71
+
72
+ **Or install globally:**
73
+
74
+ ```bash
75
+ npm install -g godot-mcp-runtime
76
+ ```
77
+
78
+ ```json
79
+ {
80
+ "mcpServers": {
81
+ "godot": {
82
+ "command": "godot-mcp-runtime",
83
+ "env": {
84
+ "GODOT_PATH": "<path-to-godot-executable>"
85
+ }
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ **Or clone from source:**
92
+
93
+ ```bash
94
+ git clone https://github.com/Erodenn/godot-mcp-runtime.git
95
+ cd godot-mcp-runtime
96
+ npm install
97
+ npm run build
98
+ ```
99
+
100
+ ```json
101
+ {
102
+ "mcpServers": {
103
+ "godot": {
104
+ "command": "node",
105
+ "args": ["<path-to>/godot-mcp-runtime/dist/index.js"],
106
+ "env": {
107
+ "GODOT_PATH": "<path-to-godot-executable>"
108
+ }
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ If Godot is on your `PATH`, you can omit `GODOT_PATH` entirely. The server will auto-detect it. Set `"DEBUG": "true"` in `env` for verbose logging.
115
+
116
+ ### Verify
117
+
118
+ Ask your AI assistant to call `get_project_info`. If it returns a Godot version string (e.g., `4.4.stable`), you're connected and working.
119
+
120
+ ## Tools
121
+
122
+ ### Project Management
123
+
124
+ | Tool | Description |
125
+ |------|-------------|
126
+ | `launch_editor` | Open the Godot editor GUI for a project |
127
+ | `run_project` | Run a project and inject the MCP bridge. Pass `background: true` to hide the window |
128
+ | `attach_project` | Inject the MCP bridge for a project you'll launch yourself |
129
+ | `detach_project` | Remove the injected bridge after manual-launch use, leaving the external process alone |
130
+ | `stop_project` | Stop the running project and remove the bridge (also detaches attached-mode state) |
131
+ | `get_debug_output` | Read stdout/stderr from an MCP-spawned project (unavailable in attached mode) |
132
+ | `list_projects` | Find Godot projects in a directory |
133
+ | `get_project_info` | Get project metadata and Godot version |
134
+
135
+ ### Runtime (requires `run_project` or `attach_project` first)
136
+
137
+ After `run_project`, or after `attach_project` plus launching Godot manually, wait 2-3 seconds for the bridge to initialize before using these tools.
138
+
139
+ | Tool | Description |
140
+ |------|-------------|
141
+ | `take_screenshot` | Capture a PNG of the running viewport |
142
+ | `simulate_input` | Send batched input: key, mouse, click_element, action, wait |
143
+ | `get_ui_elements` | Get all visible Control nodes with positions, types, and text |
144
+ | `run_script` | Execute arbitrary GDScript at runtime with full SceneTree access |
145
+
146
+ ### Scene Editing (headless)
147
+
148
+ All mutation operations save automatically. Use `save_scene` only for save-as (`newPath`) or to re-canonicalize a `.tscn` file.
149
+
150
+ | Tool | Description |
151
+ |------|-------------|
152
+ | `create_scene` | Create a new scene file |
153
+ | `add_node` | Add a node to an existing scene (supports promoted spatial params) |
154
+ | `load_sprite` | Set a texture on a Sprite2D, Sprite3D, or TextureRect |
155
+ | `save_scene` | Re-pack and save the scene, or save-as with `newPath` |
156
+ | `export_mesh_library` | Export scenes as a MeshLibrary for GridMap |
157
+ | `batch_scene_operations` | Run multiple add_node/load_sprite/save ops in a single Godot process |
158
+
159
+ ### Node Editing (headless)
160
+
161
+ All mutation operations save automatically.
162
+
163
+ | Tool | Description |
164
+ |------|-------------|
165
+ | `get_scene_tree` | Get the full scene tree hierarchy (use `maxDepth: 1` for shallow listing) |
166
+ | `get_node_properties` | Read properties from a node |
167
+ | `batch_get_node_properties` | Read properties from multiple nodes in one process |
168
+ | `set_node_property` | Set a property on a node |
169
+ | `batch_set_node_properties` | Set multiple properties in one process |
170
+ | `attach_script` | Attach a GDScript to a node |
171
+ | `duplicate_node` | Duplicate a node within the scene |
172
+ | `delete_node` | Remove a node from the scene |
173
+ | `get_node_signals` | List all signals on a node with their connections |
174
+ | `connect_signal` | Connect a signal to a method on another node |
175
+ | `disconnect_signal` | Disconnect a signal connection |
176
+
177
+ ### Project Config (no Godot process required)
178
+
179
+ These tools edit `project.godot` directly or read the filesystem. Safe to use even when autoloads are broken.
180
+
181
+ | Tool | Description |
182
+ |------|-------------|
183
+ | `list_autoloads` | List all registered autoloads with paths and singleton status |
184
+ | `add_autoload` | Register a new autoload |
185
+ | `remove_autoload` | Unregister an autoload by name |
186
+ | `update_autoload` | Modify an existing autoload's path or singleton flag |
187
+ | `get_project_settings` | Read settings from `project.godot` by section and key |
188
+ | `get_project_files` | Get the project file tree with types and extensions |
189
+ | `search_project` | Search for a string across project source files |
190
+ | `get_scene_dependencies` | List all resources a scene depends on |
191
+
192
+ ### Validation: `validate`
193
+
194
+ Validate before attaching or running. Catches syntax errors and missing resource references before they cause headless crashes or runtime failures. Supports `scriptPath`, `source` (inline GDScript), `scenePath`, or a `targets` array for batch validation.
195
+
196
+ ### UIDs: `manage_uids` (Godot 4.4+)
197
+
198
+ | Operation | Description |
199
+ |-----------|-------------|
200
+ | `get` | Get a resource's UID |
201
+ | `update` | Resave all resources to update UID references |
202
+
203
+ ## Architecture
204
+
205
+ ```
206
+ src/
207
+ ├── index.ts # MCP server entry point, routes tool calls
208
+ ├── tools/
209
+ ├── project-tools.ts # Project, runtime, autoload, filesystem, search, settings
210
+ │ ├── scene-tools.ts # Scene creation, node addition, sprite loading, batch ops, UIDs
211
+ ├── node-tools.ts # Node properties, scripts, tree, duplication, signals
212
+ └── validate-tools.ts # GDScript and scene validation
213
+ ├── scripts/
214
+ │ ├── godot_operations.gd # Headless GDScript operations
215
+ │ └── mcp_bridge.gd # UDP autoload for runtime communication
216
+ └── utils/
217
+ └── godot-runner.ts # Process spawning, output parsing, shared validation helpers
218
+ ```
219
+
220
+ Headless operations spawn Godot with `--headless --script godot_operations.gd`, perform the operation, and return JSON. Runtime operations communicate over UDP with the injected `McpBridge` autoload.
221
+
222
+ ## How the Bridge Works
223
+
224
+ When `run_project` or `attach_project` is called:
225
+
226
+ 1. `mcp_bridge.gd` is copied into the project directory
227
+ 2. It's registered as an autoload in `project.godot`
228
+ 3. Godot launches with the bridge listening on `127.0.0.1:9900`. With `run_project`, MCP spawns the process; with `attach_project`, you launch it yourself.
229
+ 4. Runtime tools send JSON commands to the bridge and await responses
230
+ 5. `stop_project` or `detach_project` removes the bridge script and autoload entry
231
+
232
+ Files generated during runtime (screenshots, executed scripts) are stored in `.mcp/` inside the project directory. This directory is automatically added to `.gitignore` and has a `.gdignore` so Godot won't import it.
233
+
234
+ ## Broken Autoloads
235
+
236
+ If any registered autoload fails to initialize (syntax error, missing resource, display dependency), Godot's headless process will crash before any operation runs. Use `list_autoloads` and `remove_autoload` to inspect and remove the failing autoload. These tools edit `project.godot` directly, with no Godot process involved.
237
+
238
+ ## Acknowledgments
239
+
240
+ Built on the foundation laid by [Coding-Solo/godot-mcp](https://github.com/Coding-Solo/godot-mcp) for headless Godot operations.
241
+
242
+ Developed with [Claude Code](https://claude.ai/code).
243
+
244
+ ## License
245
+
246
+ [MIT](LICENSE)
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
11
11
  import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } from '@modelcontextprotocol/sdk/types.js';
12
12
  import { GodotRunner } from './utils/godot-runner.js';
13
13
  // Project tools
14
- import { projectToolDefinitions, handleLaunchEditor, handleRunProject, handleGetDebugOutput, handleStopProject, handleListProjects, handleGetProjectInfo, handleTakeScreenshot, handleSimulateInput, handleGetUiElements, handleRunScript, handleListAutoloads, handleAddAutoload, handleRemoveAutoload, handleUpdateAutoload, handleGetProjectFiles, handleSearchProject, handleGetSceneDependencies, handleGetProjectSettings, } from './tools/project-tools.js';
14
+ import { projectToolDefinitions, handleLaunchEditor, handleRunProject, handleAttachProject, handleDetachProject, handleGetDebugOutput, handleStopProject, handleListProjects, handleGetProjectInfo, handleTakeScreenshot, handleSimulateInput, handleGetUiElements, handleRunScript, handleListAutoloads, handleAddAutoload, handleRemoveAutoload, handleUpdateAutoload, handleGetProjectFiles, handleSearchProject, handleGetSceneDependencies, handleGetProjectSettings, } from './tools/project-tools.js';
15
15
  // Scene tools
16
16
  import { sceneToolDefinitions, handleCreateScene, handleAddNode, handleLoadSprite, handleSaveScene, handleExportMeshLibrary, handleBatchSceneOperations, handleManageUids, } from './tools/scene-tools.js';
17
17
  // Node tools
@@ -25,7 +25,7 @@ class GodotMcpServer {
25
25
  this.runner = new GodotRunner(config);
26
26
  this.server = new Server({
27
27
  name: 'godot-mcp',
28
- version: '2.1.0',
28
+ version: '2.2.1',
29
29
  }, {
30
30
  capabilities: {
31
31
  tools: {},
@@ -33,10 +33,10 @@ class GodotMcpServer {
33
33
  instructions: `Godot MCP Server — AI-driven Godot 4.x project manipulation.
34
34
 
35
35
  Tool categories:
36
- - Project management: launch_editor, run_project, stop_project, get_debug_output, list_projects, get_project_info
36
+ - Project management: launch_editor, run_project, attach_project, detach_project, stop_project, get_debug_output, list_projects, get_project_info
37
37
  - Scene editing (headless): create_scene, add_node, load_sprite, save_scene, export_mesh_library, batch_scene_operations
38
38
  - Node editing (headless): delete_node, set_node_property, batch_set_node_properties, get_node_properties, batch_get_node_properties, attach_script, get_scene_tree, duplicate_node, get_node_signals, connect_signal, disconnect_signal
39
- - Runtime (requires run_project): take_screenshot, simulate_input, get_ui_elements, run_script
39
+ - Runtime (requires run_project or attach_project): take_screenshot, simulate_input, get_ui_elements, run_script
40
40
  - Project config (no Godot process): list_autoloads, add_autoload, remove_autoload, update_autoload, get_project_files, search_project, get_scene_dependencies, get_project_settings
41
41
  - Validation: validate
42
42
  - UIDs (Godot 4.4+): manage_uids
@@ -45,8 +45,10 @@ Key behaviors:
45
45
  - All mutation operations (add_node, set_node_property, delete_node, etc.) save the scene automatically. Only use save_scene for save-as (newPath) or re-canonicalization.
46
46
  - Headless Godot initializes ALL registered autoloads. If any autoload is broken, headless operations will fail. Use list_autoloads / remove_autoload to diagnose.
47
47
  - After run_project, wait 2-3 seconds before using runtime tools (take_screenshot, simulate_input, get_ui_elements, run_script). The MCP bridge needs time to initialize.
48
+ - attach_project is the fallback path for a manually launched Godot process. It injects the bridge and marks the project active, but it does not spawn Godot or capture stdout/stderr.
48
49
  - click_element in simulate_input resolves by node path or node name (BFS search), NOT by visible text. Use get_ui_elements to discover valid element identifiers.
49
- - run_script expects GDScript with "extends RefCounted" and "func execute(scene_tree: SceneTree) -> Variant".`,
50
+ - run_script expects GDScript with "extends RefCounted" and "func execute(scene_tree: SceneTree) -> Variant".
51
+ - run_project spawns Godot without -d so runtime errors do not pause execution; the \`breakpoint\` keyword in user code is a no-op (no debugger is attached). SCRIPT ERROR output and GDScript backtraces still appear in stderr.`,
50
52
  });
51
53
  this.setupToolHandlers();
52
54
  this.server.onerror = (error) => console.error('[MCP Error]', error);
@@ -85,6 +87,10 @@ Key behaviors:
85
87
  return await handleLaunchEditor(this.runner, args);
86
88
  case 'run_project':
87
89
  return await handleRunProject(this.runner, args);
90
+ case 'attach_project':
91
+ return await handleAttachProject(this.runner, args);
92
+ case 'detach_project':
93
+ return handleDetachProject(this.runner);
88
94
  case 'get_debug_output':
89
95
  return handleGetDebugOutput(this.runner, args);
90
96
  case 'stop_project':
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,sBAAsB,EACtB,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAqB,MAAM,yBAAyB,CAAC;AAEzE,gBAAgB;AAChB,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,E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
6
6
 
7
7
  func _ready() -> void:
8
+ process_mode = Node.PROCESS_MODE_ALWAYS
8
9
  udp_server = UDPServer.new()
9
10
  var err = udp_server.listen(port, "127.0.0.1")
10
11
  if err != OK:
@@ -155,6 +156,12 @@ func _handle_input(peer: PacketPeerUDP, actions: Array) -> void:
155
156
 
156
157
  _is_processing_input = false
157
158
 
159
+ # Allow queued input events to dispatch and any signal handlers
160
+ # (and their runtime errors) to fire before we reply, so the
161
+ # Node-side stderr scan in sendCommandWithErrors sees them.
162
+ await get_tree().process_frame
163
+ await get_tree().process_frame
164
+
158
165
  if error_msg != "":
159
166
  _send_response(peer, {"error": error_msg, "actions_processed": processed})
160
167
  else: