godot-mcp-runtime 2.2.3 → 3.0.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 +30 -93
  2. package/dist/dispatch.d.ts +1 -11
  3. package/dist/dispatch.d.ts.map +1 -1
  4. package/dist/dispatch.js +7 -8
  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 +134 -283
  11. package/dist/scripts/mcp_bridge.gd +210 -43
  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 +187 -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 +114 -310
  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 +120 -1192
  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 +808 -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 +67 -211
  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 +35 -29
  34. package/dist/tools/validate-tools.js.map +1 -1
  35. package/dist/utils/autoload-ini.d.ts +32 -0
  36. package/dist/utils/autoload-ini.d.ts.map +1 -0
  37. package/dist/utils/autoload-ini.js +111 -0
  38. package/dist/utils/autoload-ini.js.map +1 -0
  39. package/dist/utils/bridge-manager.d.ts +29 -0
  40. package/dist/utils/bridge-manager.d.ts.map +1 -0
  41. package/dist/utils/bridge-manager.js +136 -0
  42. package/dist/utils/bridge-manager.js.map +1 -0
  43. package/dist/utils/bridge-protocol.d.ts +34 -0
  44. package/dist/utils/bridge-protocol.d.ts.map +1 -0
  45. package/dist/utils/bridge-protocol.js +65 -0
  46. package/dist/utils/bridge-protocol.js.map +1 -0
  47. package/dist/utils/godot-runner.d.ts +70 -15
  48. package/dist/utils/godot-runner.d.ts.map +1 -1
  49. package/dist/utils/godot-runner.js +309 -277
  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 +3 -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 +7 -4
package/README.md CHANGED
@@ -14,7 +14,7 @@ A lightweight [MCP](https://modelcontextprotocol.io/) server that gives AI assis
14
14
 
15
15
  **The distinction matters: the AI doesn't just write your game, it can check its work.**
16
16
 
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.
17
+ When you run a project through this server, it injects a lightweight TCP 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.
18
18
 
19
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.
20
20
 
@@ -28,9 +28,9 @@ Each tool teaches agents how to use it through its description and response mess
28
28
 
29
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.
30
30
 
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:
31
+ **Runtime bridge.** When `run_project` or `attach_project` is called, the server injects `McpBridge` as an autoload. This opens a TCP listener on port 9900 (localhost only, override with `MCP_BRIDGE_PORT`) and enables:
32
32
 
33
- - **Screenshots:** Capture the viewport at any point during gameplay
33
+ - **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
34
  - **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
35
  - **UI discovery:** Walk the live scene tree and collect every visible Control node with its position, type, text content, and disabled state
36
36
  - **Live script execution:** Compile and run arbitrary GDScript with full SceneTree access while the game is running
@@ -45,7 +45,7 @@ The bridge cleans itself up automatically when `stop_project` or `detach_project
45
45
 
46
46
  ### Prerequisites
47
47
 
48
- - [Node.js](https://nodejs.org/) v18+
48
+ - [Node.js](https://nodejs.org/) v20+
49
49
  - [Godot 4.x](https://godotengine.org/)
50
50
 
51
51
  That's it. No Godot addon, no project modifications.
@@ -120,105 +120,34 @@ Ask your AI assistant to call `get_project_info`. If it returns a Godot version
120
120
 
121
121
  ## Tools
122
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 |
123
+ See [`docs/tools.md`](docs/tools.md) for the full tool reference, grouped by category. Authoring standards for adding or modifying tools live in [`docs/tool-authoring.md`](docs/tool-authoring.md).
203
124
 
204
125
  ## Architecture
205
126
 
206
127
  ```
207
128
  src/
208
- ├── index.ts # MCP server entry point, routes tool calls
129
+ ├── index.ts # MCP server entry point, server setup
130
+ ├── dispatch.ts # Tool-name → handler dispatch table
209
131
  ├── tools/
210
- │ ├── project-tools.ts # Project, runtime, autoload, filesystem, search, settings
211
- │ ├── scene-tools.ts # Scene creation, node addition, sprite loading, batch ops, UIDs
132
+ │ ├── project-tools.ts # Project introspection (list_projects, get_project_info, files, search, settings, scene_dependencies)
133
+ │ ├── runtime-tools.ts # Runtime/lifecycle (run_project, attach_project, take_screenshot, etc.)
134
+ │ ├── autoload-tools.ts # Autoload management (list/add/remove/update_autoload)
135
+ │ ├── scene-tools.ts # Scene creation, node addition, sprite loading, batch ops
212
136
  │ ├── node-tools.ts # Node properties, scripts, tree, duplication, signals
213
137
  │ └── validate-tools.ts # GDScript and scene validation
214
138
  ├── scripts/
215
139
  │ ├── godot_operations.gd # Headless GDScript operations
216
- │ └── mcp_bridge.gd # UDP autoload for runtime communication
140
+ │ └── mcp_bridge.gd # TCP autoload for runtime communication
217
141
  └── utils/
218
- └── godot-runner.ts # Process spawning, output parsing, shared validation helpers
142
+ ├── godot-runner.ts # Process spawning, output parsing, shared validation helpers
143
+ ├── handler-helpers.ts # executeSceneOp wrapper for headless-op handlers
144
+ ├── bridge-manager.ts # McpBridge artifact lifecycle (inject, cleanup, repair)
145
+ ├── bridge-protocol.ts # TCP framing (length-prefixed frames, port resolution)
146
+ ├── autoload-ini.ts # project.godot [autoload] INI primitives
147
+ └── logger.ts # logDebug / logError helpers
219
148
  ```
220
149
 
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.
150
+ Headless operations spawn Godot with `--headless --script godot_operations.gd`, perform the operation, and return JSON. Runtime operations communicate over a long-lived TCP connection with the injected `McpBridge` autoload (4-byte big-endian length prefix + UTF-8 JSON frames).
222
151
 
223
152
  ## How the Bridge Works
224
153
 
@@ -226,12 +155,20 @@ When `run_project` or `attach_project` is called:
226
155
 
227
156
  1. `mcp_bridge.gd` is copied into the project directory
228
157
  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
158
+ 3. Godot launches with the bridge listening on `127.0.0.1:9900` (override with `MCP_BRIDGE_PORT`). With `run_project`, MCP spawns the process; with `attach_project`, you launch it yourself.
159
+ 4. The Node side opens a long-lived TCP connection on first runtime call and sends framed JSON commands; the bridge replies on the same connection
160
+ 5. `stop_project` or `detach_project` sends a `shutdown` command (so the bridge releases the port cleanly), then removes the bridge script and autoload entry
232
161
 
233
162
  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.
234
163
 
164
+ `take_screenshot` defaults to `responseMode: "preview"` — the full PNG is saved to `.mcp/screenshots/` and a 960x540-bounded preview is returned inline. Override per call:
165
+
166
+ - `responseMode: "full"` — return the full inline PNG when the agent needs to inspect exact pixels, small UI text, or texture detail.
167
+ - `responseMode: "path_only"` — skip the inline image entirely when another tool or human will inspect the saved file.
168
+ - `previewMaxWidth` / `previewMaxHeight` — override the default 960x540 preview bounds (e.g. `{ "responseMode": "preview", "previewMaxWidth": 480, "previewMaxHeight": 270 }`).
169
+
170
+ The response is a JSON text entry (`{ responseMode, path, size, previewPath?, previewSize?, warnings? }`) plus an inline `image` entry for `full` and `preview`.
171
+
235
172
  ## Acknowledgments
236
173
 
237
174
  Built on the foundation laid by [Coding-Solo/godot-mcp](https://github.com/Coding-Solo/godot-mcp) for headless Godot operations.
@@ -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,9 +11,11 @@
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
@@ -44,13 +46,10 @@ export const toolDispatch = {
44
46
  save_scene: (runner, args) => handleSaveScene(runner, args),
45
47
  export_mesh_library: (runner, args) => handleExportMeshLibrary(runner, args),
46
48
  batch_scene_operations: (runner, args) => handleBatchSceneOperations(runner, args),
47
- manage_uids: (runner, args) => handleManageUids(runner, args),
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),
50
+ delete_nodes: (runner, args) => handleDeleteNodes(runner, args),
51
+ set_node_properties: (runner, args) => handleSetNodeProperties(runner, args),
52
52
  get_node_properties: (runner, args) => handleGetNodeProperties(runner, args),
53
- batch_get_node_properties: (runner, args) => handleBatchGetNodeProperties(runner, args),
54
53
  attach_script: (runner, args) => handleAttachScript(runner, args),
55
54
  get_scene_tree: (runner, args) => handleGetSceneTree(runner, args),
56
55
  duplicate_node: (runner, args) => handleDuplicateNode(runner, args),
@@ -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,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,4BAA4B,EAC5B,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EAC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E,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC;CACzD,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.2.3',
54
+ version: '3.0.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
- {"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,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAGnG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,GAAG,sBAAsB;IACzB,GAAG,oBAAoB;IACvB,GAAG,mBAAmB;IACtB,GAAG,uBAAuB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