godot-mcp-runtime 2.3.0 → 3.1.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.
Files changed (59) hide show
  1. package/README.md +46 -132
  2. package/dist/dispatch.d.ts +1 -11
  3. package/dist/dispatch.d.ts.map +1 -1
  4. package/dist/dispatch.js +32 -33
  5. package/dist/dispatch.js.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +12 -10
  9. package/dist/index.js.map +1 -1
  10. package/dist/scripts/godot_operations.gd +268 -382
  11. package/dist/scripts/mcp_bridge.gd +206 -44
  12. package/dist/tools/autoload-tools.d.ts +51 -0
  13. package/dist/tools/autoload-tools.d.ts.map +1 -0
  14. package/dist/tools/autoload-tools.js +191 -0
  15. package/dist/tools/autoload-tools.js.map +1 -0
  16. package/dist/tools/node-tools.d.ts +9 -78
  17. package/dist/tools/node-tools.d.ts.map +1 -1
  18. package/dist/tools/node-tools.js +188 -312
  19. package/dist/tools/node-tools.js.map +1 -1
  20. package/dist/tools/project-tools.d.ts +0 -168
  21. package/dist/tools/project-tools.d.ts.map +1 -1
  22. package/dist/tools/project-tools.js +191 -1240
  23. package/dist/tools/project-tools.js.map +1 -1
  24. package/dist/tools/runtime-tools.d.ts +108 -0
  25. package/dist/tools/runtime-tools.d.ts.map +1 -0
  26. package/dist/tools/runtime-tools.js +994 -0
  27. package/dist/tools/runtime-tools.js.map +1 -0
  28. package/dist/tools/scene-tools.d.ts +6 -48
  29. package/dist/tools/scene-tools.d.ts.map +1 -1
  30. package/dist/tools/scene-tools.js +76 -212
  31. package/dist/tools/scene-tools.js.map +1 -1
  32. package/dist/tools/validate-tools.d.ts.map +1 -1
  33. package/dist/tools/validate-tools.js +115 -51
  34. package/dist/tools/validate-tools.js.map +1 -1
  35. package/dist/utils/autoload-ini.d.ts +38 -0
  36. package/dist/utils/autoload-ini.d.ts.map +1 -0
  37. package/dist/utils/autoload-ini.js +124 -0
  38. package/dist/utils/autoload-ini.js.map +1 -0
  39. package/dist/utils/bridge-manager.d.ts +46 -0
  40. package/dist/utils/bridge-manager.d.ts.map +1 -0
  41. package/dist/utils/bridge-manager.js +186 -0
  42. package/dist/utils/bridge-manager.js.map +1 -0
  43. package/dist/utils/bridge-protocol.d.ts +37 -0
  44. package/dist/utils/bridge-protocol.d.ts.map +1 -0
  45. package/dist/utils/bridge-protocol.js +78 -0
  46. package/dist/utils/bridge-protocol.js.map +1 -0
  47. package/dist/utils/godot-runner.d.ts +102 -16
  48. package/dist/utils/godot-runner.d.ts.map +1 -1
  49. package/dist/utils/godot-runner.js +497 -284
  50. package/dist/utils/godot-runner.js.map +1 -1
  51. package/dist/utils/handler-helpers.d.ts +34 -0
  52. package/dist/utils/handler-helpers.d.ts.map +1 -0
  53. package/dist/utils/handler-helpers.js +55 -0
  54. package/dist/utils/handler-helpers.js.map +1 -0
  55. package/dist/utils/logger.d.ts +4 -0
  56. package/dist/utils/logger.d.ts.map +1 -0
  57. package/dist/utils/logger.js +11 -0
  58. package/dist/utils/logger.js.map +1 -0
  59. package/package.json +8 -4
package/README.md CHANGED
@@ -1,43 +1,62 @@
1
1
  # Godot MCP Runtime
2
2
 
3
- <a href="https://glama.ai/mcp/servers/@Erodenn/godot-mcp-runtime">
4
- <img width="380" height="200" src="https://glama.ai/mcp/servers/@Erodenn/godot-runtime-mcp/badge" alt="godot-runtime-mcp MCP server" />
5
- </a>
3
+ <p align="center">
4
+ <a href="https://glama.ai/mcp/servers/@Erodenn/godot-mcp-runtime"><img width="380" height="200" src="https://glama.ai/mcp/servers/@Erodenn/godot-runtime-mcp/badge" alt="godot-runtime-mcp MCP server"></a>
5
+ </p>
6
6
 
7
- [![](https://badge.mcpx.dev?type=server 'MCP Server')](https://modelcontextprotocol.io/introduction)
8
- [![npm version](https://img.shields.io/npm/v/godot-mcp-runtime)](https://www.npmjs.com/package/godot-mcp-runtime)
9
- [![npm downloads](https://img.shields.io/npm/dt/godot-mcp-runtime)](https://www.npmjs.com/package/godot-mcp-runtime)
10
- [![License: MIT](https://badgen.net/github/license/Erodenn/godot-mcp-runtime)](LICENSE)
11
- [![Node.js](https://img.shields.io/node/v/godot-mcp-runtime)](https://nodejs.org/)
7
+ <p align="center">
8
+ <a href="https://modelcontextprotocol.io/introduction"><img src="https://badge.mcpx.dev?type=server" alt="MCP Server"></a>
9
+ <a href="https://www.npmjs.com/package/godot-mcp-runtime"><img src="https://img.shields.io/npm/v/godot-mcp-runtime" alt="npm version"></a>
10
+ <a href="https://www.npmjs.com/package/godot-mcp-runtime"><img src="https://img.shields.io/npm/dt/godot-mcp-runtime" alt="npm downloads"></a>
11
+ <a href="LICENSE"><img src="https://badgen.net/github/license/Erodenn/godot-mcp-runtime" alt="License: MIT"></a>
12
+ <a href="https://nodejs.org/"><img src="https://img.shields.io/node/v/godot-mcp-runtime" alt="Node.js"></a>
13
+ </p>
12
14
 
13
- A lightweight [MCP](https://modelcontextprotocol.io/) server that gives AI assistants direct access to a running [Godot](https://godotengine.org/) 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.
15
+ A lightweight [MCP](https://modelcontextprotocol.io/) server that pairs comprehensive headless editing with full runtime control over a [Godot](https://godotengine.org/) 4.x project. Scene, node, autoload, and validation ops cover everything short of the most niche corners of the engine; the runtime bridge adds screenshots, input simulation, UI discovery, and live GDScript against the running scene tree.
14
16
 
15
- **The distinction matters: the AI doesn't just write your game, it can check its work.**
17
+ <p align="center"><img src="docs/assets/demo.gif" alt="Agent driving a Godot game via MCP runtime tools" width="1000"></p>
16
18
 
17
- 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.
19
+ <h3 align="center">The AI doesn't just write your game, it can check its work.</h3>
20
+ <br>
18
21
 
19
- **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. All this server needs is Node.js and a Godot executable: no addon installation, no project modifications, no cleanup.
22
+ - **Headless editing**scenes, nodes, scripts, signals, validation, no editor window
23
+ - **Runtime control** — screenshots, input simulation, UI discovery, and live GDScript against the running game
24
+ - **Zero footprint** — no Godot addon, no project commits, auto-cleanup on shutdown
25
+
26
+ **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. Use npx and there's no install or setup needed.
20
27
 
21
28
  Think of it as [Playwright MCP](https://github.com/microsoft/playwright-mcp), but for Godot. 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.
22
29
 
23
- 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. The ability to check work is crucial for AI driven workflows.
30
+ > [!NOTE]
31
+ > 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. The ability to check work is crucial for AI driven workflows.
32
+
33
+ ## Contents
24
34
 
25
- 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. Every operation is its own tool with only its relevant parameters, no operation discriminators and no conditional schemas. This server is built for agents.
35
+ - [What It Does](#what-it-does)
36
+ - [Quick Start](#quick-start)
37
+ - [Docs](#docs)
38
+ - [Acknowledgments](#acknowledgments)
39
+ - [License](#license)
26
40
 
27
41
  ## What It Does
28
42
 
29
- **Headless editing.** Create scenes, add nodes, set properties, attach scripts, connect signals, manage UIDs, validate GDScript. All the standard operations, no editor window required.
43
+ **Built for agents.** Every tool is purpose-built and self-documenting. When something fails, the response tells the agent how to fix it; when something succeeds, it points toward the next step. The result is an AI that stays unstuck and self-corrects without needing you to nudge it along.
30
44
 
31
- **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:
45
+ **Headless editing.** Create scenes, add nodes, set properties, attach scripts, connect signals, validate GDScript. All the standard operations, no editor window required.
32
46
 
33
- - **Screenshots:** Capture the viewport at any point during gameplay
47
+ **Runtime bridge.** When `run_project` or `attach_project` is called, the server injects `McpBridge` as an autoload. This opens a localhost-only TCP listener (both auto-select a free port when `bridgePort` is omitted; pass `bridgePort` to pin a specific port) and enables:
48
+
49
+ - **Screenshots:** Capture the viewport — by default returns a 960x540 preview inline plus the full PNG on disk; use `responseMode: 'full'` for pixel-perfect or `'path_only'` to skip the inline image
34
50
  - **Input simulation:** Batched sequences of key presses, mouse clicks, mouse motion, UI element clicks by name or path, Godot action events, and timed waits
35
51
  - **UI discovery:** Walk the live scene tree and collect every visible Control node with its position, type, text content, and disabled state
36
52
  - **Live script execution:** Compile and run arbitrary GDScript with full SceneTree access while the game is running
37
53
 
38
- **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.
54
+ **Background mode.** Pass `background: true` to `run_project` and the Godot window moves off-screen (positioned at `(-9999, -9999)`) 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.
55
+
56
+ **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. Use `detach_project` when done.
39
57
 
40
- **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.
58
+ > [!IMPORTANT]
59
+ > `get_debug_output` is unavailable in attached mode. stdout and stderr only flow through processes MCP started itself, so when Godot is launched externally there's no captured output to return. Use `run_project` if you need the debug stream.
41
60
 
42
61
  The bridge cleans itself up automatically when `stop_project` or `detach_project` is called. No leftover autoloads, no modified project files.
43
62
 
@@ -45,7 +64,7 @@ The bridge cleans itself up automatically when `stop_project` or `detach_project
45
64
 
46
65
  ### Prerequisites
47
66
 
48
- - [Node.js](https://nodejs.org/) v18+
67
+ - [Node.js](https://nodejs.org/) v20+
49
68
  - [Godot 4.x](https://godotengine.org/)
50
69
 
51
70
  That's it. No Godot addon, no project modifications.
@@ -112,125 +131,20 @@ npm run build
112
131
  }
113
132
  ```
114
133
 
134
+ > [!TIP]
135
+ > **Prefer pnpm?** All three install paths work with pnpm. Substitute `pnpm dlx godot-mcp-runtime` for `npx -y godot-mcp-runtime`, `pnpm add -g godot-mcp-runtime` for the global install, or `pnpm install && pnpm run build` for the source build. pnpm ships stronger defaults against npm supply-chain attacks; see [pnpm's supply chain security guide](https://pnpm.io/supply-chain-security).
136
+
115
137
  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.
116
138
 
117
139
  ### Verify
118
140
 
119
141
  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.
120
142
 
121
- ## Tools
122
-
123
- ### Project Management
124
-
125
- | Tool | Description |
126
- | ------------------ | -------------------------------------------------------------------------------------- |
127
- | `launch_editor` | Open the Godot editor GUI for a project |
128
- | `run_project` | Run a project and inject the MCP bridge. Pass `background: true` to hide the window |
129
- | `attach_project` | Inject the MCP bridge for a project you'll launch yourself |
130
- | `detach_project` | Remove the injected bridge after manual-launch use, leaving the external process alone |
131
- | `stop_project` | Stop the running project and remove the bridge (also detaches attached-mode state) |
132
- | `get_debug_output` | Read stdout/stderr from an MCP-spawned project (unavailable in attached mode) |
133
- | `list_projects` | Find Godot projects in a directory |
134
- | `get_project_info` | Get project metadata and Godot version |
135
-
136
- ### Runtime (requires `run_project` or `attach_project` first)
137
-
138
- After `run_project`, or after `attach_project` plus launching Godot manually, wait 2-3 seconds for the bridge to initialize before using these tools.
139
-
140
- | Tool | Description |
141
- | ----------------- | ---------------------------------------------------------------- |
142
- | `take_screenshot` | Capture a PNG of the running viewport |
143
- | `simulate_input` | Send batched input: key, mouse, click_element, action, wait |
144
- | `get_ui_elements` | Get all visible Control nodes with positions, types, and text |
145
- | `run_script` | Execute arbitrary GDScript at runtime with full SceneTree access |
146
-
147
- ### Scene Editing (headless)
148
-
149
- All mutation operations save automatically. Use `save_scene` only for save-as (`newPath`) or to re-canonicalize a `.tscn` file.
150
-
151
- | Tool | Description |
152
- | ------------------------ | -------------------------------------------------------------------- |
153
- | `create_scene` | Create a new scene file |
154
- | `add_node` | Add a node to an existing scene (supports promoted spatial params) |
155
- | `load_sprite` | Set a texture on a Sprite2D, Sprite3D, or TextureRect |
156
- | `save_scene` | Re-pack and save the scene, or save-as with `newPath` |
157
- | `export_mesh_library` | Export scenes as a MeshLibrary for GridMap |
158
- | `batch_scene_operations` | Run multiple add_node/load_sprite/save ops in a single Godot process |
159
-
160
- ### Node Editing (headless)
161
-
162
- All mutation operations save automatically.
163
-
164
- | Tool | Description |
165
- | --------------------------- | ------------------------------------------------------------------------- |
166
- | `get_scene_tree` | Get the full scene tree hierarchy (use `maxDepth: 1` for shallow listing) |
167
- | `get_node_properties` | Read properties from a node |
168
- | `batch_get_node_properties` | Read properties from multiple nodes in one process |
169
- | `set_node_property` | Set a property on a node |
170
- | `batch_set_node_properties` | Set multiple properties in one process |
171
- | `attach_script` | Attach a GDScript to a node |
172
- | `duplicate_node` | Duplicate a node within the scene |
173
- | `delete_node` | Remove a node from the scene |
174
- | `get_node_signals` | List all signals on a node with their connections |
175
- | `connect_signal` | Connect a signal to a method on another node |
176
- | `disconnect_signal` | Disconnect a signal connection |
177
-
178
- ### Project Config (no Godot process required)
179
-
180
- These tools edit `project.godot` directly or read the filesystem. Safe to use even when autoloads are broken.
181
-
182
- | Tool | Description |
183
- | ------------------------ | ------------------------------------------------------------- |
184
- | `list_autoloads` | List all registered autoloads with paths and singleton status |
185
- | `add_autoload` | Register a new autoload |
186
- | `remove_autoload` | Unregister an autoload by name |
187
- | `update_autoload` | Modify an existing autoload's path or singleton flag |
188
- | `get_project_settings` | Read settings from `project.godot` by section and key |
189
- | `get_project_files` | Get the project file tree with types and extensions |
190
- | `search_project` | Search for a string across project source files |
191
- | `get_scene_dependencies` | List all resources a scene depends on |
192
-
193
- ### Validation: `validate`
194
-
195
- 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.
196
-
197
- ### UIDs: `manage_uids` (Godot 4.4+)
198
-
199
- | Operation | Description |
200
- | --------- | --------------------------------------------- |
201
- | `get` | Get a resource's UID |
202
- | `update` | Resave all resources to update UID references |
203
-
204
- ## Architecture
205
-
206
- ```
207
- src/
208
- ├── index.ts # MCP server entry point, routes tool calls
209
- ├── tools/
210
- │ ├── project-tools.ts # Project, runtime, autoload, filesystem, search, settings
211
- │ ├── scene-tools.ts # Scene creation, node addition, sprite loading, batch ops, UIDs
212
- │ ├── node-tools.ts # Node properties, scripts, tree, duplication, signals
213
- │ └── validate-tools.ts # GDScript and scene validation
214
- ├── scripts/
215
- │ ├── godot_operations.gd # Headless GDScript operations
216
- │ └── mcp_bridge.gd # UDP autoload for runtime communication
217
- └── utils/
218
- └── godot-runner.ts # Process spawning, output parsing, shared validation helpers
219
- ```
220
-
221
- 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.
222
-
223
- ## How the Bridge Works
224
-
225
- When `run_project` or `attach_project` is called:
226
-
227
- 1. `mcp_bridge.gd` is copied into the project directory
228
- 2. It's registered as an autoload in `project.godot`
229
- 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.
230
- 4. Runtime tools send JSON commands to the bridge and await responses
231
- 5. `stop_project` or `detach_project` removes the bridge script and autoload entry
143
+ ## Docs
232
144
 
233
- 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.
145
+ - [`docs/tools.md`](docs/tools.md) full tool reference, grouped by category
146
+ - [`docs/tool-authoring.md`](docs/tool-authoring.md) — standards for adding or modifying tools
147
+ - [`docs/architecture.md`](docs/architecture.md) — source layout, bridge sequence diagram, lifecycle steps, runtime artifact behavior
234
148
 
235
149
  ## Acknowledgments
236
150
 
@@ -10,17 +10,7 @@
10
10
  * - Unknown tool names throw McpError(MethodNotFound, ...) — see
11
11
  * `dispatchToolCall`.
12
12
  */
13
- import type { GodotRunner, OperationParams } from './utils/godot-runner.js';
14
- export interface ToolResponse {
15
- content: Array<{
16
- type: string;
17
- text?: string;
18
- [k: string]: unknown;
19
- }>;
20
- isError?: boolean;
21
- [k: string]: unknown;
22
- }
23
- export type ToolHandler = (runner: GodotRunner, args: OperationParams) => Promise<ToolResponse> | ToolResponse;
13
+ import type { GodotRunner, OperationParams, ToolHandler, ToolResponse } from './utils/godot-runner.js';
24
14
  export declare const toolDispatch: Record<string, ToolHandler>;
25
15
  export declare function dispatchToolCall(runner: GodotRunner, toolName: string, args: OperationParams): Promise<ToolResponse>;
26
16
  //# sourceMappingURL=dispatch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAmD5E,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,CAAC;IACtE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD,MAAM,MAAM,WAAW,GAAG,CACxB,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,eAAe,KAClB,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;AAE1C,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CA+CpD,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,YAAY,CAAC,CAMvB"}
1
+ {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,WAAW,EACX,YAAY,EACb,MAAM,yBAAyB,CAAC;AAsDjC,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CA4CpD,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,YAAY,CAAC,CAMvB"}
package/dist/dispatch.js CHANGED
@@ -11,24 +11,26 @@
11
11
  * `dispatchToolCall`.
12
12
  */
13
13
  import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
14
- import { 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
- import { handleCreateScene, handleAddNode, handleLoadSprite, handleSaveScene, handleExportMeshLibrary, handleBatchSceneOperations, handleManageUids, } from './tools/scene-tools.js';
16
- import { handleDeleteNode, handleSetNodeProperty, handleBatchSetNodeProperties, handleGetNodeProperties, handleBatchGetNodeProperties, handleAttachScript, handleGetSceneTree, handleDuplicateNode, handleGetNodeSignals, handleConnectSignal, handleDisconnectSignal, } from './tools/node-tools.js';
14
+ import { handleLaunchEditor, handleRunProject, handleAttachProject, handleDetachProject, handleGetDebugOutput, handleStopProject, handleTakeScreenshot, handleSimulateInput, handleGetUiElements, handleRunScript, } from './tools/runtime-tools.js';
15
+ import { handleListAutoloads, handleAddAutoload, handleRemoveAutoload, handleUpdateAutoload, } from './tools/autoload-tools.js';
16
+ import { handleListProjects, handleGetProjectInfo, handleGetProjectFiles, handleSearchProject, handleGetSceneDependencies, handleGetProjectSettings, } from './tools/project-tools.js';
17
+ import { handleCreateScene, handleAddNode, handleLoadSprite, handleSaveScene, handleExportMeshLibrary, handleBatchSceneOperations, } from './tools/scene-tools.js';
18
+ import { handleDeleteNodes, handleSetNodeProperties, handleGetNodeProperties, handleAttachScript, handleGetSceneTree, handleDuplicateNode, handleGetNodeSignals, handleConnectSignal, handleDisconnectSignal, } from './tools/node-tools.js';
17
19
  import { handleValidate } from './tools/validate-tools.js';
18
20
  export const toolDispatch = {
19
21
  // Project tools
20
- launch_editor: (runner, args) => handleLaunchEditor(runner, args),
21
- run_project: (runner, args) => handleRunProject(runner, args),
22
- attach_project: (runner, args) => handleAttachProject(runner, args),
23
- detach_project: (runner) => handleDetachProject(runner),
24
- get_debug_output: (runner, args) => handleGetDebugOutput(runner, args),
25
- stop_project: (runner) => handleStopProject(runner),
22
+ launch_editor: handleLaunchEditor,
23
+ run_project: handleRunProject,
24
+ attach_project: handleAttachProject,
25
+ detach_project: handleDetachProject,
26
+ get_debug_output: handleGetDebugOutput,
27
+ stop_project: handleStopProject,
26
28
  list_projects: (_runner, args) => handleListProjects(args),
27
- get_project_info: (runner, args) => handleGetProjectInfo(runner, args),
28
- take_screenshot: (runner, args) => handleTakeScreenshot(runner, args),
29
- simulate_input: (runner, args) => handleSimulateInput(runner, args),
30
- get_ui_elements: (runner, args) => handleGetUiElements(runner, args),
31
- run_script: (runner, args) => handleRunScript(runner, args),
29
+ get_project_info: handleGetProjectInfo,
30
+ take_screenshot: handleTakeScreenshot,
31
+ simulate_input: handleSimulateInput,
32
+ get_ui_elements: handleGetUiElements,
33
+ run_script: handleRunScript,
32
34
  list_autoloads: (_runner, args) => handleListAutoloads(args),
33
35
  add_autoload: (_runner, args) => handleAddAutoload(args),
34
36
  remove_autoload: (_runner, args) => handleRemoveAutoload(args),
@@ -38,27 +40,24 @@ export const toolDispatch = {
38
40
  get_scene_dependencies: (_runner, args) => handleGetSceneDependencies(args),
39
41
  get_project_settings: (_runner, args) => handleGetProjectSettings(args),
40
42
  // Scene tools
41
- create_scene: (runner, args) => handleCreateScene(runner, args),
42
- add_node: (runner, args) => handleAddNode(runner, args),
43
- load_sprite: (runner, args) => handleLoadSprite(runner, args),
44
- save_scene: (runner, args) => handleSaveScene(runner, args),
45
- export_mesh_library: (runner, args) => handleExportMeshLibrary(runner, args),
46
- batch_scene_operations: (runner, args) => handleBatchSceneOperations(runner, args),
47
- manage_uids: (runner, args) => handleManageUids(runner, args),
43
+ create_scene: handleCreateScene,
44
+ add_node: handleAddNode,
45
+ load_sprite: handleLoadSprite,
46
+ save_scene: handleSaveScene,
47
+ export_mesh_library: handleExportMeshLibrary,
48
+ batch_scene_operations: handleBatchSceneOperations,
48
49
  // Node tools
49
- delete_node: (runner, args) => handleDeleteNode(runner, args),
50
- set_node_property: (runner, args) => handleSetNodeProperty(runner, args),
51
- batch_set_node_properties: (runner, args) => handleBatchSetNodeProperties(runner, args),
52
- get_node_properties: (runner, args) => handleGetNodeProperties(runner, args),
53
- batch_get_node_properties: (runner, args) => handleBatchGetNodeProperties(runner, args),
54
- attach_script: (runner, args) => handleAttachScript(runner, args),
55
- get_scene_tree: (runner, args) => handleGetSceneTree(runner, args),
56
- duplicate_node: (runner, args) => handleDuplicateNode(runner, args),
57
- get_node_signals: (runner, args) => handleGetNodeSignals(runner, args),
58
- connect_signal: (runner, args) => handleConnectSignal(runner, args),
59
- disconnect_signal: (runner, args) => handleDisconnectSignal(runner, args),
50
+ delete_nodes: handleDeleteNodes,
51
+ set_node_properties: handleSetNodeProperties,
52
+ get_node_properties: handleGetNodeProperties,
53
+ attach_script: handleAttachScript,
54
+ get_scene_tree: handleGetSceneTree,
55
+ duplicate_node: handleDuplicateNode,
56
+ get_node_signals: handleGetNodeSignals,
57
+ connect_signal: handleConnectSignal,
58
+ disconnect_signal: handleDisconnectSignal,
60
59
  // Validate tools
61
- validate: (runner, args) => handleValidate(runner, args),
60
+ validate: handleValidate,
62
61
  };
63
62
  export async function dispatchToolCall(runner, toolName, args) {
64
63
  const handler = toolDispatch[toolName];
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAIzE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,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,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,gBAAgB,EAChB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,IAAI,CAAC;IACjE,cAAc,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC;IAC5D,sBAAsB,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC;IAC3E,oBAAoB,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,wBAAwB,CAAC,IAAI,CAAC;IAEvE,cAAc;IACd,YAAY,EAAE,iBAAiB;IAC/B,QAAQ,EAAE,aAAa;IACvB,WAAW,EAAE,gBAAgB;IAC7B,UAAU,EAAE,eAAe;IAC3B,mBAAmB,EAAE,uBAAuB;IAC5C,sBAAsB,EAAE,0BAA0B;IAElD,aAAa;IACb,YAAY,EAAE,iBAAiB;IAC/B,mBAAmB,EAAE,uBAAuB;IAC5C,mBAAmB,EAAE,uBAAuB;IAC5C,aAAa,EAAE,kBAAkB;IACjC,cAAc,EAAE,kBAAkB;IAClC,cAAc,EAAE,mBAAmB;IACnC,gBAAgB,EAAE,oBAAoB;IACtC,cAAc,EAAE,mBAAmB;IACnC,iBAAiB,EAAE,sBAAsB;IAEzC,iBAAiB;IACjB,QAAQ,EAAE,cAAc;CACzB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAmB,EACnB,QAAgB,EAChB,IAAqB;IAErB,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,iBAAiB,QAAQ,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,MAAM,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,5 +7,5 @@
7
7
  * capture debug output, manipulate scenes and nodes, and more.
8
8
  */
9
9
  export declare const allToolDefinitions: import("./utils/godot-runner.js").ToolDefinition[];
10
- export declare const serverInstructions = "Godot MCP Server \u2014 AI-driven Godot 4.x project manipulation.\n\nTool categories:\n- Project management: launch_editor, run_project, attach_project, detach_project, stop_project, get_debug_output, list_projects, get_project_info\n- Scene editing (headless): create_scene, add_node, load_sprite, save_scene, export_mesh_library, batch_scene_operations\n- 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\n- Runtime (requires run_project or attach_project): take_screenshot, simulate_input, get_ui_elements, run_script\n- Project config (no Godot process): list_autoloads, add_autoload, remove_autoload, update_autoload, get_project_files, search_project, get_scene_dependencies, get_project_settings\n- Validation: validate\n- UIDs (Godot 4.4+): manage_uids\n\nKey behaviors:\n- 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.\n- Headless Godot initializes ALL registered autoloads. If any autoload is broken, headless operations will fail. Use list_autoloads / remove_autoload to diagnose.\n- run_project verifies bridge readiness before returning success. If it reports degraded status, retry runtime tools after a moment or check get_debug_output.\n- 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.\n- 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.\n- run_script expects GDScript with \"extends RefCounted\" and \"func execute(scene_tree: SceneTree) -> Variant\".\n- 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.";
10
+ export declare const serverInstructions = "Godot MCP Server \u2014 AI-driven Godot 4.x project manipulation.\n\nTool categories:\n- Project management: launch_editor, run_project, attach_project, detach_project, stop_project, get_debug_output, list_projects, get_project_info\n- Scene editing (headless): create_scene, add_node, load_sprite, save_scene, export_mesh_library, batch_scene_operations\n- Node editing (headless): delete_nodes, set_node_properties, get_node_properties, attach_script, get_scene_tree, duplicate_node, get_node_signals, connect_signal, disconnect_signal\n- Runtime (requires run_project or attach_project): take_screenshot, simulate_input, get_ui_elements, run_script\n- Project config (no Godot process): list_autoloads, add_autoload, remove_autoload, update_autoload, get_project_files, search_project, get_scene_dependencies, get_project_settings\n- Validation: validate\n\nKey behaviors:\n- All mutation operations (add_node, set_node_properties, delete_nodes, etc.) save the scene automatically. Only use save_scene for save-as (newPath) or re-canonicalization.\n- Headless Godot initializes ALL registered autoloads. If any autoload is broken, headless operations will fail. Use list_autoloads / remove_autoload to diagnose.\n- run_project verifies bridge readiness before returning success. If it reports degraded status, retry runtime tools after a moment or check get_debug_output.\n- 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.\n- 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.\n- run_script expects GDScript with \"extends RefCounted\" and \"func execute(scene_tree: SceneTree) -> Variant\".\n- 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.";
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAeH,eAAO,MAAM,kBAAkB,oDAK9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,qmEAkBmM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAkBH,eAAO,MAAM,kBAAkB,oDAO9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,mhEAiBmM,CAAC"}
package/dist/index.js CHANGED
@@ -6,16 +6,21 @@
6
6
  * It enables AI assistants to launch the Godot editor, run Godot projects,
7
7
  * capture debug output, manipulate scenes and nodes, and more.
8
8
  */
9
+ // Lower-level `Server` is deliberate; see CONTRIBUTING.md "MCP SDK: Server vs McpServer".
9
10
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
10
11
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
11
12
  import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
12
- import { GodotRunner } from './utils/godot-runner.js';
13
+ import { GodotRunner, getErrorMessage } from './utils/godot-runner.js';
13
14
  import { dispatchToolCall } from './dispatch.js';
15
+ import { runtimeToolDefinitions } from './tools/runtime-tools.js';
16
+ import { autoloadToolDefinitions } from './tools/autoload-tools.js';
14
17
  import { projectToolDefinitions } from './tools/project-tools.js';
15
18
  import { sceneToolDefinitions } from './tools/scene-tools.js';
16
19
  import { nodeToolDefinitions } from './tools/node-tools.js';
17
20
  import { validateToolDefinitions } from './tools/validate-tools.js';
18
21
  export const allToolDefinitions = [
22
+ ...runtimeToolDefinitions,
23
+ ...autoloadToolDefinitions,
19
24
  ...projectToolDefinitions,
20
25
  ...sceneToolDefinitions,
21
26
  ...nodeToolDefinitions,
@@ -26,14 +31,13 @@ export const serverInstructions = `Godot MCP Server — AI-driven Godot 4.x proj
26
31
  Tool categories:
27
32
  - Project management: launch_editor, run_project, attach_project, detach_project, stop_project, get_debug_output, list_projects, get_project_info
28
33
  - Scene editing (headless): create_scene, add_node, load_sprite, save_scene, export_mesh_library, batch_scene_operations
29
- - 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
34
+ - Node editing (headless): delete_nodes, set_node_properties, get_node_properties, attach_script, get_scene_tree, duplicate_node, get_node_signals, connect_signal, disconnect_signal
30
35
  - Runtime (requires run_project or attach_project): take_screenshot, simulate_input, get_ui_elements, run_script
31
36
  - Project config (no Godot process): list_autoloads, add_autoload, remove_autoload, update_autoload, get_project_files, search_project, get_scene_dependencies, get_project_settings
32
37
  - Validation: validate
33
- - UIDs (Godot 4.4+): manage_uids
34
38
 
35
39
  Key behaviors:
36
- - 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.
40
+ - All mutation operations (add_node, set_node_properties, delete_nodes, etc.) save the scene automatically. Only use save_scene for save-as (newPath) or re-canonicalization.
37
41
  - Headless Godot initializes ALL registered autoloads. If any autoload is broken, headless operations will fail. Use list_autoloads / remove_autoload to diagnose.
38
42
  - run_project verifies bridge readiness before returning success. If it reports degraded status, retry runtime tools after a moment or check get_debug_output.
39
43
  - 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.
@@ -47,7 +51,7 @@ class GodotMcpServer {
47
51
  this.runner = new GodotRunner(config);
48
52
  this.server = new Server({
49
53
  name: 'godot-mcp',
50
- version: '2.3.0',
54
+ version: '3.1.0',
51
55
  }, {
52
56
  capabilities: {
53
57
  tools: {},
@@ -67,7 +71,7 @@ class GodotMcpServer {
67
71
  }
68
72
  async cleanup() {
69
73
  console.error('[SERVER] Cleaning up resources');
70
- this.runner.stopProject();
74
+ await this.runner.stopProject();
71
75
  await this.server.close();
72
76
  }
73
77
  setupToolHandlers() {
@@ -96,8 +100,7 @@ class GodotMcpServer {
96
100
  console.error('Godot MCP server running on stdio');
97
101
  }
98
102
  catch (error) {
99
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
100
- console.error('[SERVER] Failed to start:', errorMessage);
103
+ console.error('[SERVER] Failed to start:', getErrorMessage(error));
101
104
  process.exit(1);
102
105
  }
103
106
  }
@@ -105,8 +108,7 @@ class GodotMcpServer {
105
108
  // Create and run the server
106
109
  const server = new GodotMcpServer();
107
110
  server.run().catch((error) => {
108
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
109
- console.error('Failed to run server:', errorMessage);
111
+ console.error('Failed to run server:', getErrorMessage(error));
110
112
  process.exit(1);
111
113
  });
112
114
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"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