@godot-mcp/mcp-server 0.0.0 → 0.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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -2
  3. package/dist/createServer.d.ts +20 -0
  4. package/dist/createServer.d.ts.map +1 -0
  5. package/dist/createServer.js +46 -0
  6. package/dist/createServer.js.map +1 -0
  7. package/dist/executeTool.d.ts +40 -0
  8. package/dist/executeTool.d.ts.map +1 -0
  9. package/dist/executeTool.js +109 -0
  10. package/dist/executeTool.js.map +1 -0
  11. package/dist/index.d.ts +12 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +12 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/registerCoreTools.d.ts +25 -0
  16. package/dist/registerCoreTools.d.ts.map +1 -0
  17. package/dist/registerCoreTools.js +88 -0
  18. package/dist/registerCoreTools.js.map +1 -0
  19. package/dist/registerEditorTools.d.ts +12 -0
  20. package/dist/registerEditorTools.d.ts.map +1 -0
  21. package/dist/registerEditorTools.js +59 -0
  22. package/dist/registerEditorTools.js.map +1 -0
  23. package/dist/registerExtensionTools.d.ts +9 -0
  24. package/dist/registerExtensionTools.d.ts.map +1 -0
  25. package/dist/registerExtensionTools.js +59 -0
  26. package/dist/registerExtensionTools.js.map +1 -0
  27. package/dist/registerInputTools.d.ts +11 -0
  28. package/dist/registerInputTools.d.ts.map +1 -0
  29. package/dist/registerInputTools.js +20 -0
  30. package/dist/registerInputTools.js.map +1 -0
  31. package/dist/registerProjectTools.d.ts +12 -0
  32. package/dist/registerProjectTools.d.ts.map +1 -0
  33. package/dist/registerProjectTools.js +54 -0
  34. package/dist/registerProjectTools.js.map +1 -0
  35. package/dist/registerRuntimeTools.d.ts +34 -0
  36. package/dist/registerRuntimeTools.d.ts.map +1 -0
  37. package/dist/registerRuntimeTools.js +147 -0
  38. package/dist/registerRuntimeTools.js.map +1 -0
  39. package/dist/registerUnsafeTools.d.ts +12 -0
  40. package/dist/registerUnsafeTools.d.ts.map +1 -0
  41. package/dist/registerUnsafeTools.js +20 -0
  42. package/dist/registerUnsafeTools.js.map +1 -0
  43. package/dist/registerVisualTools.d.ts +12 -0
  44. package/dist/registerVisualTools.d.ts.map +1 -0
  45. package/dist/registerVisualTools.js +55 -0
  46. package/dist/registerVisualTools.js.map +1 -0
  47. package/dist/stdio.d.ts +3 -0
  48. package/dist/stdio.d.ts.map +1 -0
  49. package/dist/stdio.js +30 -0
  50. package/dist/stdio.js.map +1 -0
  51. package/dist/toolResult.d.ts +4 -0
  52. package/dist/toolResult.d.ts.map +1 -0
  53. package/dist/toolResult.js +13 -0
  54. package/dist/toolResult.js.map +1 -0
  55. package/package.json +27 -6
  56. package/index.js +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Godot MCP contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,106 @@
1
- # @godot-mcp/mcp-server
1
+ # Godot MCP
2
2
 
3
- Namespace bootstrap only. Install the first supported release from the `latest` tag.
3
+ Godot MCP is an open-source, security-first MCP server and Godot editor addon. Phase 7 provides reversible installation, authenticated Godot 4.7 editor attachment, six default observe-only tools, explicitly gated runtime/input surfaces, permission-scoped editor authoring, native read-only GDScript debugging, and bounded structured performance evidence.
4
+
5
+ ## Requirements
6
+
7
+ - macOS (the currently certified platform)
8
+ - Node.js 22
9
+ - pnpm 11.13.0
10
+ - Godot 4.7 stable
11
+
12
+ Compatibility is evidence-gated by `release/compatibility-matrix.json`. Godot 4.4–4.6 and Linux/Windows remain experimental until their exact matrix cells carry trusted certification receipts; pending cells are not advertised as supported.
13
+
14
+ ## Source quick start
15
+
16
+ ```bash
17
+ pnpm install --frozen-lockfile
18
+ pnpm build
19
+ node /absolute/path/to/godot-mcp/packages/cli/dist/bin.js init --project /absolute/path/to/godot-project
20
+ node /absolute/path/to/godot-mcp/packages/cli/dist/bin.js doctor --project /absolute/path/to/godot-project
21
+ node /absolute/path/to/godot-mcp/packages/cli/dist/bin.js editor --project /absolute/path/to/godot-project
22
+ ```
23
+
24
+ For a verified release-to-release replacement, run `godot-mcp upgrade --project /absolute/path/to/godot-project --source /absolute/path/to/new/addons/godot_mcp`. Upgrade and rollback refuse independently modified installed files and preserve the original uninstall preimage.
25
+
26
+ Use the `editor` command for the Phase 7-certified launch. It writes a short-lived owner-only startup attestation, then starts Godot with the authenticated editor debugger and native DAP assigned to one loopback port; the debugger binds first, so unauthenticated DAP never acquires a listener. The addon consumes the attestation and connects outward only when a matching MCP runtime publishes a short-lived pairing descriptor. Opening the project through another launcher keeps earlier editor features available, but runtime debugging fails closed because secure startup cannot be proven by copied user arguments alone.
27
+
28
+ Register the source checkout with Codex using absolute paths:
29
+
30
+ ```bash
31
+ codex mcp add godot -- node /absolute/path/to/godot-mcp/packages/cli/dist/bin.js connect --project /absolute/path/to/godot-project
32
+ ```
33
+
34
+ The default registration remains observe-only. To opt into one MCP-owned instrumented runtime, explicitly grant both its tier and pack:
35
+
36
+ ```bash
37
+ codex mcp add godot-runtime -- node /absolute/path/to/godot-mcp/packages/cli/dist/bin.js connect --project /absolute/path/to/godot-project --grant runtime_control --pack runtime
38
+ ```
39
+
40
+ To launch and automate the owned runtime, grant the input pack separately:
41
+
42
+ ```bash
43
+ codex mcp add godot-runtime-input -- node /absolute/path/to/godot-mcp/packages/cli/dist/bin.js connect --project /absolute/path/to/godot-project --grant runtime_control --pack runtime --pack input
44
+ ```
45
+
46
+ To preview and apply bounded editor mutations, explicitly grant both the mutation tier and editor pack:
47
+
48
+ ```bash
49
+ codex mcp add godot-editor -- node /absolute/path/to/godot-mcp/packages/cli/dist/bin.js connect --project /absolute/path/to/godot-project --grant project_mutate --pack editor
50
+ ```
51
+
52
+ Start a fresh Codex task after registration so the newly registered MCP server is exposed. To stop using the addon while retaining its files, or remove the verified installation completely:
53
+
54
+ ```bash
55
+ node /absolute/path/to/godot-mcp/packages/cli/dist/bin.js disable --project /absolute/path/to/godot-project
56
+ node /absolute/path/to/godot-mcp/packages/cli/dist/bin.js uninstall --project /absolute/path/to/godot-project
57
+ ```
58
+
59
+ Uninstall refuses to remove the addon, project configuration, or `project.godot` if they changed independently after installation.
60
+
61
+ ## Implemented MCP tools
62
+
63
+ - `godot_session` — attachment, project identity, versions, and grants
64
+ - `godot_capabilities` — currently visible observe/core capabilities
65
+ - `godot_doctor` — installation, plugin, identity, and attachment diagnostics
66
+ - `godot_help` — built-in usage and security-boundary help
67
+ - `godot_query` — bounded editor state, open scene/tree/node metadata, indexed resources, approved project settings, and redacted diagnostics
68
+ - `godot_capture` — bounded PNG from the current 2D or selected 3D editor viewport, returned as MCP image content and persisted as session evidence
69
+
70
+ The default six tools are read-only and closed-world. A runtime-authorized session additionally exposes:
71
+
72
+ - `godot_runtime` — launch, bounded runtime queries/control, native GDScript breakpoints/stacks/variables/selector watches, monitor snapshots, and cancellable structured profiles for one authenticated child runtime
73
+ - `godot_runtime_capture` — one to eight ordered running-game PNG frames with verified evidence metadata
74
+ - `godot_input` — bounded events, frame-indexed sequences, non-passive recording, and deterministic replay for the owned runtime
75
+ - `godot_editor` — preview, apply, undo, and redo one bounded scene/node/resource/source authoring batch with durable idempotency and native editor history
76
+
77
+ For example:
78
+
79
+ ```json
80
+ { "operation": "scene_tree", "scenePath": "res://main.tscn", "maxDepth": 8, "maxNodes": 250 }
81
+ { "viewport": "2d", "maxWidth": 1280, "maxHeight": 720 }
82
+ { "operation": "launch", "scenePath": "res://main.tscn" }
83
+ { "operation": "debug_breakpoints_set", "handle": { "runId": "<run UUID>", "generation": 1 }, "breakpoints": [{ "sourcePath": "res://player.gd", "line": 42 }] }
84
+ { "operation": "profile_start", "handle": { "runId": "<run UUID>", "generation": 1 }, "durationMs": 1000, "intervalFrames": 1, "groups": ["frame", "memory"], "retainRaw": false }
85
+ { "operation": "sequence", "handle": { "runId": "<run UUID>", "generation": 1 }, "mode": "deterministic", "events": [{ "frameOffset": 0, "event": { "type": "action", "action": "jump", "pressed": true, "strengthMillionths": 1000000 } }, { "frameOffset": 1, "event": { "type": "action", "action": "jump", "pressed": false, "strengthMillionths": 0 } }] }
86
+ ```
87
+
88
+ Runtime control and input are off unless their explicit flags are present. Deterministic sequences/replay require a paused owned runtime; offsets are zero-based, so offsets 0–1 process across two rendered frames and leave it paused. Recording captures only MCP-injected events. Receipts and audit summaries omit raw action names, keycodes, coordinates, and trace payloads. There is no OS-global/editor input, arbitrary text, process, filesystem, network, method-call, or GDScript-evaluation primitive.
89
+
90
+ ## Development and certification
91
+
92
+ ```bash
93
+ GODOT_BIN=/opt/homebrew/bin/godot pnpm qa:phase-0-1
94
+ GODOT_BIN=/opt/homebrew/bin/godot pnpm qa:phase-2
95
+ GODOT_BIN=/opt/homebrew/bin/godot pnpm qa:phase-3
96
+ GODOT_BIN=/opt/homebrew/bin/godot pnpm qa:phase-4
97
+ GODOT_BIN=/opt/homebrew/bin/godot pnpm qa:phase-5
98
+ GODOT_BIN=/opt/homebrew/bin/godot pnpm qa:phase-6
99
+ GODOT_BIN=/opt/homebrew/bin/godot pnpm qa:phase-7
100
+ ```
101
+
102
+ The Phase 7 gate certifies secure shared-port editor startup, native-DAP inertness, authenticated editor-session debugging, breakpoints/stacks/variables/selector watches, bounded public monitor snapshots, completed and cancelled profiles, hostile-input rejection, published stdio behavior, and zero owned-state or fixture residue. Earlier gates remain required regressions. See [Phase 7 testing](docs/testing/phase-7.md), [Phase 6 testing](docs/testing/phase-6.md), the [threat model](docs/security/threat-model.md), the [bridge protocol](docs/protocol/bridge-v1.md), and the [master design](docs/superpowers/specs/2026-07-15-godot-mcp-master-design.md).
103
+
104
+ ## Roadmap
105
+
106
+ Later phases add declarative playtests, imports/builds/exports, evidence retrieval, compatibility lanes, and explicitly gated disposable-fixture unsafe mode. None of those capabilities are claimed by Phase 7.
@@ -0,0 +1,20 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { type CoreToolDependencies } from "./registerCoreTools.js";
3
+ import { type InputController } from "./registerInputTools.js";
4
+ import { type EditorController } from "./registerEditorTools.js";
5
+ import { type RuntimeController } from "./registerRuntimeTools.js";
6
+ import { type VisualController } from "./registerVisualTools.js";
7
+ import { type ProjectOperationsController } from "./registerProjectTools.js";
8
+ import { type UnsafeFixtureController } from "./registerUnsafeTools.js";
9
+ import { type ExtensionToolDependencies } from "./registerExtensionTools.js";
10
+ export type GodotMcpServerDependencies = CoreToolDependencies & {
11
+ runtime?: RuntimeController & Partial<InputController>;
12
+ editor?: EditorController;
13
+ visual?: VisualController;
14
+ projectOperations?: ProjectOperationsController;
15
+ unsafeFixture?: UnsafeFixtureController;
16
+ extensions?: ExtensionToolDependencies["extensions"];
17
+ extensionContext?: ExtensionToolDependencies["extensionContext"];
18
+ };
19
+ export declare function createGodotMcpServer(dependencies: GodotMcpServerDependencies): McpServer;
20
+ //# sourceMappingURL=createServer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createServer.d.ts","sourceRoot":"","sources":["../src/createServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,EAAqB,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAwB,KAAK,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACnG,OAAO,EAAuB,KAAK,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAA0B,KAAK,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAErG,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,GAAG;IAC9D,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACvD,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,iBAAiB,CAAC,EAAE,2BAA2B,CAAC;IAChD,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,UAAU,CAAC,EAAE,yBAAyB,CAAC,YAAY,CAAC,CAAC;IACrD,gBAAgB,CAAC,EAAE,yBAAyB,CAAC,kBAAkB,CAAC,CAAC;CAClE,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,0BAA0B,GAAG,SAAS,CAwCxF"}
@@ -0,0 +1,46 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { PRODUCT_VERSION } from "@godot-mcp/protocol";
3
+ import { registerCoreTools } from "./registerCoreTools.js";
4
+ import { registerInputTools } from "./registerInputTools.js";
5
+ import { registerEditorTools } from "./registerEditorTools.js";
6
+ import { registerRuntimeTools } from "./registerRuntimeTools.js";
7
+ import { registerVisualTools } from "./registerVisualTools.js";
8
+ import { registerProjectTools } from "./registerProjectTools.js";
9
+ import { registerUnsafeTools } from "./registerUnsafeTools.js";
10
+ import { registerExtensionTools } from "./registerExtensionTools.js";
11
+ export function createGodotMcpServer(dependencies) {
12
+ const server = new McpServer({ name: "godot-mcp", version: PRODUCT_VERSION });
13
+ registerCoreTools(server, dependencies);
14
+ if (dependencies.runtime &&
15
+ dependencies.grants.tiers.includes("runtime_control") &&
16
+ dependencies.grants.packs.includes("runtime"))
17
+ registerRuntimeTools(server, { ...dependencies, runtime: dependencies.runtime });
18
+ if (dependencies.runtime &&
19
+ dependencies.runtime.input &&
20
+ dependencies.grants.tiers.includes("runtime_control") &&
21
+ dependencies.grants.packs.includes("input"))
22
+ registerInputTools(server, { ...dependencies, runtime: { input: dependencies.runtime.input.bind(dependencies.runtime) } });
23
+ if (dependencies.editor &&
24
+ dependencies.grants.tiers.includes("project_mutate") &&
25
+ dependencies.grants.packs.includes("editor"))
26
+ registerEditorTools(server, { ...dependencies, editor: dependencies.editor });
27
+ if (dependencies.visual &&
28
+ dependencies.grants.tiers.includes("runtime_control") &&
29
+ dependencies.grants.packs.includes("runtime") &&
30
+ dependencies.grants.packs.includes("input") &&
31
+ dependencies.grants.packs.includes("visual"))
32
+ registerVisualTools(server, { ...dependencies, visual: dependencies.visual });
33
+ if (dependencies.projectOperations &&
34
+ dependencies.grants.tiers.includes("project_operate") &&
35
+ dependencies.grants.packs.includes("project"))
36
+ registerProjectTools(server, { ...dependencies, projectOperations: dependencies.projectOperations });
37
+ if (dependencies.unsafeFixture &&
38
+ dependencies.grants.tiers.includes("unsafe_fixture") &&
39
+ dependencies.grants.packs.includes("unsafe"))
40
+ registerUnsafeTools(server, { ...dependencies, unsafeFixture: dependencies.unsafeFixture });
41
+ if (dependencies.extensions?.visible(dependencies.grants) && dependencies.extensionContext) {
42
+ registerExtensionTools(server, { ...dependencies, extensions: dependencies.extensions, extensionContext: dependencies.extensionContext });
43
+ }
44
+ return server;
45
+ }
46
+ //# sourceMappingURL=createServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createServer.js","sourceRoot":"","sources":["../src/createServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAA6B,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAwB,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAyB,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAA0B,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAyB,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAoC,MAAM,2BAA2B,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAgC,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAkC,MAAM,6BAA6B,CAAC;AAYrG,MAAM,UAAU,oBAAoB,CAAC,YAAwC;IAC3E,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;IAC9E,iBAAiB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACxC,IACE,YAAY,CAAC,OAAO;QACpB,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QACrD,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC7C,oBAAoB,CAAC,MAAM,EAAE,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,YAAY,CAAC,O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,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC7C,oBAAoB,CAAC,MAAM,EAAE,EAAE,GAAG,YAAY,EAAE,iBAAiB,EAAE,YAAY,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACvG,IACE,YAAY,CAAC,aAAa;QAC1B,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QACpD,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC5C,mBAAmB,CAAC,MAAM,EAAE,EAAE,GAAG,YAAY,EAAE,aAAa,EAAE,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC;IAC9F,IAAI,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,gBAAgB,EAAE,CAAC;QAC3F,sBAAsB,CAAC,MAAM,EAAE,EAAE,GAAG,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,UAAU,EAAE,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC5I,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { type AuditSink, type CommandPolicy, type SessionGrants, type SessionService } from "@godot-mcp/control-plane";
2
+ import { type ProjectIdentity, type ToolResult } from "@godot-mcp/protocol";
3
+ export interface ToolExecutionDependencies {
4
+ project: ProjectIdentity;
5
+ grants: SessionGrants;
6
+ audit: AuditSink;
7
+ session: SessionService;
8
+ }
9
+ export interface ExecutedPayload<T = unknown> {
10
+ data: T;
11
+ evidence?: string[];
12
+ warnings?: string[];
13
+ changes?: unknown[];
14
+ audit?: {
15
+ targetIdentities: unknown[];
16
+ preconditions: unknown[];
17
+ idempotencyKeySha256: string | null;
18
+ partialEffects: boolean;
19
+ rollback: "not_needed" | "succeeded" | "failed" | "not_attempted";
20
+ };
21
+ image?: {
22
+ data: Uint8Array;
23
+ mimeType: "image/png";
24
+ };
25
+ images?: Array<{
26
+ data: Uint8Array;
27
+ mimeType: "image/png";
28
+ }>;
29
+ }
30
+ export interface ExecutedToolResult {
31
+ result: ToolResult;
32
+ image?: ExecutedPayload["image"];
33
+ images?: ExecutedPayload["images"];
34
+ }
35
+ export interface ToolExecutionOptions {
36
+ auditArguments?: unknown | ((correlationId: string) => unknown);
37
+ auditFallbackArguments?: unknown;
38
+ }
39
+ export declare function executeTool(dependencies: ToolExecutionDependencies, policy: CommandPolicy, argumentsValue: unknown, handler: (correlationId: string) => ExecutedPayload | Promise<ExecutedPayload>, options?: ToolExecutionOptions): Promise<ExecutedToolResult>;
40
+ //# sourceMappingURL=executeTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeTool.d.ts","sourceRoot":"","sources":["../src/executeTool.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE;QACN,gBAAgB,EAAE,OAAO,EAAE,CAAC;QAC5B,aAAa,EAAE,OAAO,EAAE,CAAC;QACzB,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;QACpC,cAAc,EAAE,OAAO,CAAC;QACxB,QAAQ,EAAE,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,eAAe,CAAC;KACnE,CAAC;IACF,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,WAAW,CAAA;KAAE,CAAC;IACpD,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAChE,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AA2BD,wBAAsB,WAAW,CAC/B,YAAY,EAAE,yBAAyB,EACvC,MAAM,EAAE,aAAa,EACrB,cAAc,EAAE,OAAO,EACvB,OAAO,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,EAC9E,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,kBAAkB,CAAC,CA+E7B"}
@@ -0,0 +1,109 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { GodotMcpException, authorize, } from "@godot-mcp/control-plane";
3
+ import { GodotMcpErrorSchema, ToolResultSchema, } from "@godot-mcp/protocol";
4
+ function normalizeError(error, correlationId) {
5
+ if (error instanceof GodotMcpException) {
6
+ return GodotMcpErrorSchema.parse({
7
+ code: error.code,
8
+ message: error.message,
9
+ retryable: error.retryable,
10
+ correlationId,
11
+ partialEffects: error.partialEffects,
12
+ rollback: error.rollback,
13
+ failedPhase: error.failedPhase,
14
+ safeRecovery: error.safeRecovery,
15
+ });
16
+ }
17
+ return GodotMcpErrorSchema.parse({
18
+ code: "INVALID_REQUEST",
19
+ message: error instanceof Error ? error.message : "Tool request failed",
20
+ retryable: false,
21
+ correlationId,
22
+ partialEffects: false,
23
+ rollback: "not_needed",
24
+ failedPhase: "request",
25
+ safeRecovery: "Review the error and retry only after correcting the request",
26
+ });
27
+ }
28
+ export async function executeTool(dependencies, policy, argumentsValue, handler, options = {}) {
29
+ const correlationId = randomUUID();
30
+ const startedAt = new Date().toISOString();
31
+ let auditArguments = typeof options.auditArguments === "function"
32
+ ? (options.auditFallbackArguments ?? argumentsValue)
33
+ : (options.auditArguments ?? options.auditFallbackArguments ?? argumentsValue);
34
+ try {
35
+ authorize(dependencies.grants, policy);
36
+ auditArguments = typeof options.auditArguments === "function" ? options.auditArguments(correlationId) : (options.auditArguments ?? argumentsValue);
37
+ const payload = await handler(correlationId);
38
+ const evidence = payload.evidence ?? [];
39
+ const warnings = payload.warnings ?? [];
40
+ const changes = payload.changes ?? [];
41
+ const auditFacts = payload.audit;
42
+ const receipt = await dependencies.audit.append({
43
+ correlationId,
44
+ sessionId: dependencies.session.snapshot().attachment?.sessionId ?? null,
45
+ projectId: dependencies.project.projectId,
46
+ event: `tool.${policy.command}`,
47
+ outcome: "success",
48
+ permissionTier: policy.tier,
49
+ startedAt,
50
+ finishedAt: new Date().toISOString(),
51
+ arguments: auditArguments,
52
+ errorCode: null,
53
+ evidence,
54
+ targetIdentities: auditFacts?.targetIdentities ?? [],
55
+ preconditions: auditFacts?.preconditions ?? [],
56
+ changes,
57
+ idempotencyKeySha256: auditFacts?.idempotencyKeySha256 ?? null,
58
+ partialEffects: auditFacts?.partialEffects ?? false,
59
+ rollback: auditFacts?.rollback ?? "not_needed",
60
+ });
61
+ return {
62
+ result: ToolResultSchema.parse({
63
+ ok: true,
64
+ data: payload.data,
65
+ warnings,
66
+ evidence,
67
+ changes,
68
+ auditId: receipt.auditId,
69
+ correlationId,
70
+ }),
71
+ ...(payload.image === undefined ? {} : { image: payload.image }),
72
+ ...(payload.images === undefined ? {} : { images: payload.images }),
73
+ };
74
+ }
75
+ catch (error) {
76
+ const normalized = normalizeError(error, correlationId);
77
+ const receipt = await dependencies.audit.append({
78
+ correlationId,
79
+ sessionId: dependencies.session.snapshot().attachment?.sessionId ?? null,
80
+ projectId: dependencies.project.projectId,
81
+ event: `tool.${policy.command}`,
82
+ outcome: "error",
83
+ permissionTier: policy.tier,
84
+ startedAt,
85
+ finishedAt: new Date().toISOString(),
86
+ arguments: auditArguments,
87
+ errorCode: normalized.code,
88
+ evidence: [],
89
+ targetIdentities: [],
90
+ preconditions: [],
91
+ changes: [],
92
+ idempotencyKeySha256: null,
93
+ partialEffects: normalized.partialEffects,
94
+ rollback: normalized.rollback,
95
+ });
96
+ return {
97
+ result: ToolResultSchema.parse({
98
+ ok: false,
99
+ data: { error: normalized },
100
+ warnings: [],
101
+ evidence: [],
102
+ changes: [],
103
+ auditId: receipt.auditId,
104
+ correlationId,
105
+ }),
106
+ };
107
+ }
108
+ }
109
+ //# sourceMappingURL=executeTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeTool.js","sourceRoot":"","sources":["../src/executeTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,iBAAiB,EACjB,SAAS,GAKV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GAIjB,MAAM,qBAAqB,CAAC;AAoC7B,SAAS,cAAc,CAAC,KAAc,EAAE,aAAqB;IAC3D,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;QACvC,OAAO,mBAAmB,CAAC,KAAK,CAAC;YAC/B,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,aAAa;YACb,cAAc,EAAE,KAAK,CAAC,cAA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AAO,EAAE,OAAO,CAAC,OAAO;gBACxB,aAAa;aACd,CAAC;SACH,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ export { createGodotMcpServer, type GodotMcpServerDependencies } from "./createServer.js";
2
+ export { registerUnsafeTools, unsafeAuditArguments, type UnsafeFixtureController, type UnsafeToolDependencies } from "./registerUnsafeTools.js";
3
+ export { registerExtensionTools, type ExtensionToolDependencies } from "./registerExtensionTools.js";
4
+ export { projectAuditArguments, registerProjectTools, type ProjectOperationsController, type ProjectToolDependencies, } from "./registerProjectTools.js";
5
+ export { registerInputTools, type InputController, type InputToolDependencies, } from "./registerInputTools.js";
6
+ export { registerRuntimeTools, type RuntimeController, type RuntimeFrame, type RuntimeToolDependencies, } from "./registerRuntimeTools.js";
7
+ export { registerCoreTools } from "./registerCoreTools.js";
8
+ export { registerEditorTools, summarizeEditorMutationForAudit, type EditorController, type EditorToolDependencies, } from "./registerEditorTools.js";
9
+ export { connectStdio } from "./stdio.js";
10
+ export { toMcpToolResult } from "./toolResult.js";
11
+ export { registerVisualTools, visualAuditArguments, type VisualController, type VisualToolDependencies, } from "./registerVisualTools.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,KAAK,uBAAuB,EAAE,KAAK,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAChJ,OAAO,EAAE,sBAAsB,EAAE,KAAK,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACrG,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,GAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,qBAAqB,GAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,uBAAuB,GAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,+BAA+B,EAC/B,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,GAC5B,MAAM,0BAA0B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ export { createGodotMcpServer } from "./createServer.js";
2
+ export { registerUnsafeTools, unsafeAuditArguments } from "./registerUnsafeTools.js";
3
+ export { registerExtensionTools } from "./registerExtensionTools.js";
4
+ export { projectAuditArguments, registerProjectTools, } from "./registerProjectTools.js";
5
+ export { registerInputTools, } from "./registerInputTools.js";
6
+ export { registerRuntimeTools, } from "./registerRuntimeTools.js";
7
+ export { registerCoreTools } from "./registerCoreTools.js";
8
+ export { registerEditorTools, summarizeEditorMutationForAudit, } from "./registerEditorTools.js";
9
+ export { connectStdio } from "./stdio.js";
10
+ export { toMcpToolResult } from "./toolResult.js";
11
+ export { registerVisualTools, visualAuditArguments, } from "./registerVisualTools.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmC,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAA6D,MAAM,0BAA0B,CAAC;AAChJ,OAAO,EAAE,sBAAsB,EAAkC,MAAM,6BAA6B,CAAC;AACrG,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GAGrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kBAAkB,GAGnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,oBAAoB,GAIrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,mBAAmB,EACnB,+BAA+B,GAGhC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GAGrB,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { type AuditSink, type EvidenceStore, type SessionGrants, type SessionService } from "@godot-mcp/control-plane";
3
+ import { type ProjectIdentity } from "@godot-mcp/protocol";
4
+ export interface BridgeCommandRequester {
5
+ request<T>(method: "editor.query" | "editor.capture", params: unknown, options?: {
6
+ timeoutMs?: number;
7
+ maxResponseBytes?: number;
8
+ correlationId?: string;
9
+ }): Promise<{
10
+ requestId: string;
11
+ data: T;
12
+ binary?: Uint8Array;
13
+ binarySha256?: string;
14
+ }>;
15
+ }
16
+ export interface CoreToolDependencies {
17
+ project: ProjectIdentity;
18
+ grants: SessionGrants;
19
+ audit: AuditSink;
20
+ session: SessionService;
21
+ bridge: () => BridgeCommandRequester | null;
22
+ evidence: EvidenceStore;
23
+ }
24
+ export declare function registerCoreTools(server: McpServer, dependencies: CoreToolDependencies): void;
25
+ //# sourceMappingURL=registerCoreTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerCoreTools.d.ts","sourceRoot":"","sources":["../src/registerCoreTools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAK7B,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,CAAC,EACP,MAAM,EAAE,cAAc,GAAG,gBAAgB,EACzC,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GAClF,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,UAAU,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxF;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,MAAM,sBAAsB,GAAG,IAAI,CAAC;IAC5C,QAAQ,EAAE,aAAa,CAAC;CACzB;AAqBD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,oBAAoB,GAAG,IAAI,CAmE7F"}
@@ -0,0 +1,88 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { z } from "zod";
3
+ import { CORE_CAPABILITIES_POLICY, CORE_CAPTURE_POLICY, CORE_DOCTOR_POLICY, CORE_HELP_POLICY, CORE_QUERY_POLICY, CORE_SESSION_POLICY, GodotMcpException, } from "@godot-mcp/control-plane";
4
+ import { EditorCaptureInputSchema, EditorCaptureResultSchema, EditorQueryInputSchema, ToolResultSchema, } from "@godot-mcp/protocol";
5
+ import { executeTool } from "./executeTool.js";
6
+ import { toMcpToolResult } from "./toolResult.js";
7
+ const annotations = {
8
+ readOnlyHint: true,
9
+ destructiveHint: false,
10
+ idempotentHint: true,
11
+ openWorldHint: false,
12
+ };
13
+ function requireBridge(bridge) {
14
+ if (bridge)
15
+ return bridge;
16
+ throw new GodotMcpException({
17
+ code: "NOT_ATTACHED",
18
+ message: "Godot editor addon is not attached",
19
+ retryable: true,
20
+ correlationId: randomUUID(),
21
+ partialEffects: false,
22
+ rollback: "not_needed",
23
+ });
24
+ }
25
+ export function registerCoreTools(server, dependencies) {
26
+ server.registerTool("godot_session", {
27
+ title: "Godot session status", description: "Read the attached Godot project, versions, state, and granted capabilities.",
28
+ inputSchema: z.object({}), outputSchema: ToolResultSchema, annotations,
29
+ }, async () => toMcpToolResult(await executeTool(dependencies, CORE_SESSION_POLICY, {}, () => ({ data: dependencies.session.snapshot() }))));
30
+ server.registerTool("godot_capabilities", {
31
+ title: "Godot capabilities", description: "List the operations visible to this least-privilege session.",
32
+ inputSchema: z.object({}), outputSchema: ToolResultSchema, annotations,
33
+ }, async () => toMcpToolResult(await executeTool(dependencies, CORE_CAPABILITIES_POLICY, {}, () => ({ data: dependencies.session.capabilities() }))));
34
+ server.registerTool("godot_doctor", {
35
+ title: "Godot MCP doctor", description: "Read installation, engine, bridge, and attachment health without changing the project.",
36
+ inputSchema: z.object({}), outputSchema: ToolResultSchema, annotations,
37
+ }, async () => toMcpToolResult(await executeTool(dependencies, CORE_DOCTOR_POLICY, {}, async () => ({ data: await dependencies.session.doctor() }))));
38
+ server.registerTool("godot_help", {
39
+ title: "Godot MCP help", description: "Read focused help for a core operation.",
40
+ inputSchema: z.object({ operation: z.string().optional() }), outputSchema: ToolResultSchema, annotations,
41
+ }, async ({ operation }) => toMcpToolResult(await executeTool(dependencies, CORE_HELP_POLICY, { operation }, () => ({ data: dependencies.session.help(operation) }))));
42
+ server.registerTool("godot_query", {
43
+ title: "Query Godot editor",
44
+ description: "Read bounded editor state, open scene metadata, indexed resources, approved project settings, or redacted diagnostics.",
45
+ inputSchema: EditorQueryInputSchema, outputSchema: ToolResultSchema, annotations,
46
+ }, async (input) => toMcpToolResult(await executeTool(dependencies, CORE_QUERY_POLICY, input, async (correlationId) => {
47
+ const response = await requireBridge(dependencies.bridge()).request("editor.query", input, {
48
+ timeoutMs: 10_000, maxResponseBytes: 512 * 1024, correlationId,
49
+ });
50
+ return { data: response.data };
51
+ })));
52
+ server.registerTool("godot_capture", {
53
+ title: "Capture Godot editor viewport",
54
+ description: "Return a bounded PNG from the current 2D or selected 3D editor viewport.",
55
+ inputSchema: EditorCaptureInputSchema, outputSchema: ToolResultSchema, annotations,
56
+ }, async (input) => toMcpToolResult(await executeTool(dependencies, CORE_CAPTURE_POLICY, input, async (correlationId) => {
57
+ const response = await requireBridge(dependencies.bridge()).request("editor.capture", input, {
58
+ timeoutMs: 15_000, maxResponseBytes: 8 * 1024 * 1024, correlationId,
59
+ });
60
+ if (!response.binary)
61
+ throw new Error("Godot capture response omitted PNG bytes");
62
+ const metadata = EditorCaptureResultSchema.parse(response.data);
63
+ const expectedViewportIndex = input.viewport === "3d" ? input.viewportIndex ?? 0 : null;
64
+ if (metadata.viewport !== input.viewport ||
65
+ (metadata.viewportIndex ?? null) !== expectedViewportIndex ||
66
+ metadata.width > input.maxWidth ||
67
+ metadata.height > input.maxHeight ||
68
+ metadata.byteLength !== response.binary.byteLength ||
69
+ metadata.sha256 !== response.binarySha256) {
70
+ throw new Error("Godot capture metadata does not match verified PNG bytes or request bounds");
71
+ }
72
+ const attachment = dependencies.session.snapshot().attachment;
73
+ if (!attachment)
74
+ return requireBridge(null);
75
+ const viewport = metadata.viewport;
76
+ const width = metadata.width;
77
+ const height = metadata.height;
78
+ const evidence = await dependencies.evidence.putPng(attachment.sessionId, response.binary, {
79
+ viewport, width, height, ...(viewport === "3d" ? { viewportIndex: input.viewportIndex ?? 0 } : {}),
80
+ });
81
+ return {
82
+ data: { ...metadata, sha256: evidence.sha256, byteLength: evidence.byteLength, evidenceUri: evidence.uri, evidenceObservationUri: evidence.observationUri },
83
+ evidence: [evidence.observationUri],
84
+ image: { data: response.binary, mimeType: "image/png" },
85
+ };
86
+ })));
87
+ }
88
+ //# sourceMappingURL=registerCoreTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerCoreTools.js","sourceRoot":"","sources":["../src/registerCoreTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAKlB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,GAEjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAmBlD,MAAM,WAAW,GAAG;IAClB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,KAAK;CACZ,CAAC;AAEX,SAAS,aAAa,CAAC,MAAqC;IAC1D,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,IAAI,iBAAiB,CAAC;QAC1B,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,oCAAoC;QAC7C,SAAS,EAAE,IAAI;QACf,aAAa,EAAE,UAAU,EAAE;QAC3B,cAAc,EAAE,KAAK;QACrB,QAAQ,EAAE,YAAY;KACvB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,YAAkC;IACrF,MAAM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AAI,CAAC,UAAU;YAAE,OAAO,aAAa,CAAC,IAAI,CAAU,CAAC;QACrD,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACnC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,EAAE;YACzF,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnG,CAAC,CAAC;QACH,OAAO;YACL,IAAI,EAAE,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,QAAQ,CAAC,GAAG,EAAE,sBAAsB,EAAE,QAAQ,CAAC,cAAc,EAAE;YAC3J,QAAQ,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;YACnC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE;SACxD,CAAC;IACJ,CAAC,CAAC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { type EditorMutationInput, type EditorMutationResult } from "@godot-mcp/protocol";
3
+ import { type ToolExecutionDependencies } from "./executeTool.js";
4
+ export interface EditorController {
5
+ execute(input: EditorMutationInput, correlationId: string): Promise<EditorMutationResult>;
6
+ }
7
+ export interface EditorToolDependencies extends ToolExecutionDependencies {
8
+ editor: EditorController;
9
+ }
10
+ export declare function summarizeEditorMutationForAudit(input: EditorMutationInput): Record<string, unknown>;
11
+ export declare function registerEditorTools(server: McpServer, dependencies: EditorToolDependencies): void;
12
+ //# sourceMappingURL=registerEditorTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerEditorTools.d.ts","sourceRoot":"","sources":["../src/registerEditorTools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAe,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAG/E,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAC3F;AAED,MAAM,WAAW,sBAAuB,SAAQ,yBAAyB;IACvE,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4BnG;AASD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,sBAAsB,GAAG,IAAI,CAsBjG"}
@@ -0,0 +1,59 @@
1
+ import { createHash } from "node:crypto";
2
+ import { EDITOR_POLICY } from "@godot-mcp/control-plane";
3
+ import { EditorMutationInputSchema, ToolResultSchema, } from "@godot-mcp/protocol";
4
+ import { executeTool } from "./executeTool.js";
5
+ import { toMcpToolResult } from "./toolResult.js";
6
+ export function summarizeEditorMutationForAudit(input) {
7
+ if (input.operation === "undo" || input.operation === "redo") {
8
+ return {
9
+ operation: input.operation,
10
+ actionId: input.actionId,
11
+ idempotencyKeySha256: createHash("sha256").update(input.idempotencyKey).digest("hex"),
12
+ };
13
+ }
14
+ const stepOperations = {};
15
+ for (const step of input.steps)
16
+ stepOperations[step.operation] = (stepOperations[step.operation] ?? 0) + 1;
17
+ const sourceSteps = input.steps.flatMap((step) => "sourcePath" in step && "content" in step
18
+ ? [{ sourcePath: String(step.sourcePath), content: String(step.content) }]
19
+ : []);
20
+ return {
21
+ operation: input.operation,
22
+ stepCount: input.steps.length,
23
+ stepOperations,
24
+ ...(sourceSteps.length === 0 ? {} : {
25
+ sourcePaths: sourceSteps.map((step) => step.sourcePath),
26
+ sourceContentSha256: sourceSteps.map((step) => createHash("sha256").update(step.content).digest("hex")),
27
+ }),
28
+ ...(input.operation === "apply"
29
+ ? {
30
+ expectedPlanDigest: input.expectedPlanDigest,
31
+ idempotencyKeySha256: createHash("sha256").update(input.idempotencyKey).digest("hex"),
32
+ }
33
+ : { idempotencyKeySha256: null }),
34
+ };
35
+ }
36
+ const annotations = {
37
+ readOnlyHint: false,
38
+ destructiveHint: true,
39
+ idempotentHint: false,
40
+ openWorldHint: false,
41
+ };
42
+ export function registerEditorTools(server, dependencies) {
43
+ server.registerTool("godot_editor", {
44
+ title: "Author and mutate Godot editor content",
45
+ description: "Preview, apply, undo, or redo one bounded transactional editor or authoring batch in an authenticated project.",
46
+ inputSchema: EditorMutationInputSchema,
47
+ outputSchema: ToolResultSchema,
48
+ annotations,
49
+ }, async (input) => toMcpToolResult(await executeTool(dependencies, EDITOR_POLICY, input, async (correlationId) => {
50
+ const data = await dependencies.editor.execute(input, correlationId);
51
+ return {
52
+ data,
53
+ warnings: data.warnings,
54
+ changes: data.changes,
55
+ audit: data.audit,
56
+ };
57
+ }, { auditArguments: summarizeEditorMutationForAudit(input) })));
58
+ }
59
+ //# sourceMappingURL=registerEditorTools.js.map