godot-mcp-runtime 2.1.0 → 2.2.0
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 +246 -242
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/scripts/mcp_bridge.gd +1 -0
- package/dist/tools/project-tools.d.ts +24 -0
- package/dist/tools/project-tools.d.ts.map +1 -1
- package/dist/tools/project-tools.js +118 -14
- package/dist/tools/project-tools.js.map +1 -1
- package/dist/utils/godot-runner.d.ts +11 -4
- package/dist/utils/godot-runner.d.ts.map +1 -1
- package/dist/utils/godot-runner.js +49 -2
- package/dist/utils/godot-runner.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,242 +1,246 @@
|
|
|
1
|
-
# Godot MCP Runtime
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/godot-mcp-runtime)
|
|
4
|
-
[](https://www.npmjs.com/package/godot-mcp-runtime)
|
|
5
|
-
[](LICENSE)
|
|
6
|
-
[](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`
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
|
125
|
-
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
|
151
|
-
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
|
164
|
-
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
|
182
|
-
|
|
183
|
-
| `
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
###
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
├──
|
|
210
|
-
│ ├──
|
|
211
|
-
│
|
|
212
|
-
└──
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
##
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
[
|
|
1
|
+
# Godot MCP Runtime
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/godot-mcp-runtime)
|
|
4
|
+
[](https://www.npmjs.com/package/godot-mcp-runtime)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](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 in debug mode 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.
|
|
28
|
+
version: '2.2.0',
|
|
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,6 +45,7 @@ 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
50
|
- run_script expects GDScript with "extends RefCounted" and "func execute(scene_tree: SceneTree) -> Variant".`,
|
|
50
51
|
});
|
|
@@ -85,6 +86,10 @@ Key behaviors:
|
|
|
85
86
|
return await handleLaunchEditor(this.runner, args);
|
|
86
87
|
case 'run_project':
|
|
87
88
|
return await handleRunProject(this.runner, args);
|
|
89
|
+
case 'attach_project':
|
|
90
|
+
return await handleAttachProject(this.runner, args);
|
|
91
|
+
case 'detach_project':
|
|
92
|
+
return handleDetachProject(this.runner);
|
|
88
93
|
case 'get_debug_output':
|
|
89
94
|
return handleGetDebugOutput(this.runner, args);
|
|
90
95
|
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,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAElC,cAAc;AACd,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,aAAa;AACb,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,4BAA4B,EAC5B,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,iBAAiB;AACjB,OAAO,EACL,uBAAuB,EACvB,cAAc,GACf,MAAM,2BAA2B,CAAC;AAEnC,MAAM,cAAc;IACV,MAAM,CAAS;IACf,MAAM,CAAc;IAE5B,YAAY,MAA0B;QACpC,IAAI,CAAC,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;QAEtC,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CACtB;YACE,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,OAAO;SACjB,EACD;YACE,YAAY,EAAE;gBACZ,KAAK,EAAE,EAAE;aACV;YACD,YAAY,EAAE
|
|
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,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,iBA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