Godot MCP Toolkit — Architecture

Architecture as of 3a34324 — the toolkit installs its own updates: the self_update/ domain checks a release against its signed update manifest and the trust chain, stages it in the update folder addons/.godot_mcp_toolkit_update/, and swaps it into the addon folder at the editor’s exit (ADR 0029; §7, §10, §12). Before that, at 8a1496e, the runtime-autoload identity/registration was split out of the plugin orchestrator into a pure-const leaf (core/autoload_identity.gd) plus a behaviour module (core/autoload_registration.gd), shared with the export-strip domain (ADR 0013); listen ports gained deterministic env-driven pin/band config (transport/port_config.gd, bind-exact-or-fail; ADR 0015); .mcp.json emission became OS-aware (ADR 0016), and its macOS absolute-node auto-emit (ADR 0017) was reverted to a plain per-OS npx command by ADR 0018 after a real-Mac finding; the editor-channel handshake added a headless field (ADR 0014); dispatch cancellation keys were peer-scoped; and the support ceiling reached Godot 4.7. Structural baseline unchanged from the cohesion refactor (thin orchestrators over single-responsibility children; DDD domain folders such as commands/, contract/, transport/, registry/, extensions/; the Modules preload registry + the EditorAccess facade); self_update/ is one more such domain.

This document explains how the toolkit is built, for users and contributors who want to understand it without reading all 113 GDScript files. It covers the major subsystems and their responsibilities, the boundaries between them — especially the editor↔runtime split — the transport + contract surface the server depends on, and the key design decisions (linked to the ADRs).

The toolkit is the editor-side half of a two-repo system. It turns a running Godot 4.2+ editor (and, separately, a running game) into a localhost MCP server. The other half — the godot-mcp-server npm bridge — is what an AI assistant actually speaks MCP to; the bridge forwards calls to this toolkit over a WebSocket. This doc is about the toolkit; the wire contract between them is summarised in §13.


Maintaining this document

This file is the canonical architecture doc. It renders two ways from one source:

  • On github.com — browsing to docs/architecture/ auto-renders this README.md, Mermaid diagrams included, with zero setup. This is the always-available surface.
  • On GitHub Pages — just-the-docs renders the same file as the polished, searchable front door (nav + native Mermaid). One source, two surfaces — there is no hand-authored HTML twin.

The rules that keep it honest:

  1. Every diagram is Mermaid source (a fenced ` ```mermaid ` block) — never a pasted image. A raster can show what a UI looks like, but no architectural claim may rest on a picture an agent cannot read (that is how diagrams silently drift out of sync).
  2. Each diagram carries a provenance comment immediately above its fence: <!-- data-depicts="<source files>" data-verified="<short-sha>" -->. data-depicts lists the files the diagram is drawn from; data-verified is the commit it was last checked-correct against. Bumping data-verified is an attestation that a human or agent re-read the diagram against the code at that SHA — it is never auto-generated. The comment is invisible on both render surfaces.
  3. When the architecture changes, edit the affected diagram’s Mermaid source, bump its data-verified, and update the document-level stamp at the top (the SHA + one-line definition of the last major architectural change).
  4. Find what to re-check by grepping data-depicts for a file you changed; an advisory freshness check (scripts/check_arch_freshness.sh) lists diagrams whose depicted files moved since their data-verified SHA. It over-flags by design — a false re-check costs a glance; a missed drift ships a lying diagram. The script never fails a build, but whoever moves a depicted file must follow that change with a commit that re-attests the affected diagram; the release rule is in the release runbook.

Diagrams below are verified against eb4c9fa — each diagram’s own data-verified comment is authoritative.


1. The big picture

An AI assistant talks MCP to the npm bridge; the bridge talks JSON-RPC over a localhost WebSocket to the toolkit. The toolkit runs two servers — one inside the editor (the Editor channel, for authoring) and one inside a running game (the Runtime channel, for runtime inspection; code comments label these two hosts Mode A and Mode B internally) — and publishes a small registry file so the bridge can discover every live instance on the machine.

flowchart LR
    AI["AI assistant<br/>(MCP client)"]
    subgraph server["godot-mcp-server · npm · TypeScript"]
      Bridge["MCP bridge<br/>tools/list · tools/call"]
    end
    subgraph toolkit["godot-mcp-toolkit · addon · GDScript"]
      ModeA["Editor channel<br/>mcp_server.gd · ports 6550-6560"]
      ModeB["Runtime channel<br/>mcp_runtime_server.gd · ports 6570-6585"]
    end
    Registry[("projects.json<br/>machine-wide registry")]
    AI -->|"MCP / stdio"| Bridge
    Bridge -->|"JSON-RPC / WebSocket"| ModeA
    Bridge -->|"JSON-RPC / WebSocket"| ModeB
    ModeA -.->|"publishes entry"| Registry
    ModeB -.->|"publishes runtime port"| Registry
    Bridge -.->|"discovers instances"| Registry

Figure 1 — system context · verified 79edab4

Everything binds to 127.0.0.1 and is gated by a per-instance auth token; the real security boundary is localhost + token + a human at the editor (see §10).

The addon is organised into domain folders that map almost one-to-one onto the sections below:

Folder Responsibility Section
transport/ + transport/dispatch/ editor server, WebSocket framing, request routing, concurrency lanes §3, §4
runtime/ the in-game (Runtime channel) server §2, §3
contract/ response envelope, error codes, type coercion, the command registry §5, §6
commands/ the ~100 built-in tool handlers §6
core/ plugin composition root, tool menu, the Modules preload registry, EditorAccess §7
extensions/ third-party extension discovery, loading, hot-reload §8
registry/ + registry/store/ multi-instance discovery (projects.json) §9
security/ auth token, path guard, audit log, untrusted-content wrapping §10
self_update/ the self-update: the trust chain and the release check, the download and the stage, the swap at editor exit and the settle at the next start (ADR 0029) §7
paths/, logging/, scene/, versioning/, ui/ supporting services and the dock throughout

2. The editor↔runtime split

This is the single most important seam in the toolkit, and it is enforced by the GDScript parser, not by a runtime if.

GDScript resolves identifiers at parse time, before any Engine.is_editor_hint() / OS.has_feature("editor") guard runs. So a script that merely names an editor-only type (EditorInterface, EditorPlugin, EditorSettings, …) — or preloads one that does — fails to load with a parse error in any export where it ships unstripped (godotengine/godot#91713, unfixed 4.2–4.6). Runtime guards gate behaviour; they cannot gate parsing. Therefore the split must be by the static dependency graph.

The runtime server (runtime/mcp_runtime_server.gd) ships inside the player’s exported game, so its entire preload closure must be export-clean — name no editor type, transitively. The editor server (transport/mcp_server.gd) has no such constraint and freely reaches EditorInterface.

flowchart TB
    ModeB["mcp_runtime_server.gd<br/>ships in the game"]
    ModeA["mcp_server.gd<br/>editor only"]
    subgraph clean["Export-clean closure — names no Editor* type (runtime-safe)"]
      direction LR
      C1["coerce.gd · property_set_check.gd<br/>declared_type_fitter.gd<br/>pagination.gd · execute_hints.gd<br/>screenshot_response.gd"]
      C2["untrusted.gd · scrubber.gd"]
      C3["auth.gd"]
      C4["log_helpers.gd · log_buffer.gd"]
      C5["registry_client.gd<br/>+ registry/store/*"]
      C6["notifier.gd · ws_transport.gd"]
      C7["signal_pair_resolver.gd · text_input_synth.gd<br/>runtime_opt_out.gd"]
      C8["port_config.gd<br/>(env pin/band resolve)"]
      C9["file_guard.gd · mcp_version_utils.gd<br/>project_paths.gd · project_key.gd<br/>(transitive preloads)"]
      C10["peer_compat.gd<br/>(floor verdict; editor server only)"]
    end
    subgraph tainted["Editor-only — names EditorInterface / EditorPlugin / EditorSettings"]
      direction LR
      D1["server_request_router.gd · dispatch_lane.gd"]
      D2["mutation_watchdog.gd · scene_lease.gd"]
      D3["modules.gd · editor_access.gd"]
      D4["command_registry + commands/*"]
      D5["lsp_publisher.gd · unfocused_sleep_controller.gd"]
      D6["ui/*"]
    end
    ModeB --> clean
    ModeA --> clean
    ModeA --> tainted

Figure 2 — the editor↔runtime taint boundary · verified c046c91

Consequences that shape the rest of the architecture:

  • Shared infrastructure lives in the clean set. ws_transport.gd (TCP/WebSocket lifecycle + framing) and notifier.gd (JSON-RPC send/broadcast) are used by both servers, so they name no editor type. port_config.gd (env-driven listen-port resolution, §3) is likewise preloaded by both, so it reads only OS environment and names no editor type. registry_client.gd is @tool but editor-clean — it takes the LSP host/port as parameters rather than reading EditorSettings, precisely so the runtime can preload it (ADR 0008).
  • The runtime server is deliberately smaller. It has no mutation queue, no scene lease, and no dispatcher lanes; it dispatches a fixed handful of runtime.* / signal.* / input.* / execute.* handlers inline. Anything needing the editor (saving scenes, undo/redo, filesystem scans) stays on the editor side by construction.
  • The runtime autoload self-disables four ways in _ready(): it returns inert if Engine.is_editor_hint(), if --check-only is on the command line (without --script the engine ignores that flag and runs the main scene), if GODOT_MCP_RUNTIME is 0/false/off (an opt-out for scripted and headless runs, read through the export-clean runtime_opt_out.gd, which the editor’s game.start hint reads too), or — the security-load-bearing one — if not OS.has_feature("editor"), which is false in every export template. A shipped game never starts the server; only an editor-feature build (the dev running their own game from the editor) does. _exit_tree() stops the server and clears the runtime registry entry only when _ready() started it, so an inert copy never deletes another run’s entry.

The export-strip plugin (ADR 0028) nulls the runtime autoload entry and strips addon source from the player’s build as defence-in-depth, but the parse-time discipline above is what actually keeps the game from crashing on a stray editor reference.


3. Transport & connection

Both servers share the same shape: a TCPServer on a scanned localhost port, each accepted connection upgraded to a WebSocketPeer, one JSON object per frame, and a mandatory first-frame auth handshake. The shared mechanics live in ws_transport.gd (listen / accept / poll / auth framing) and notifier.gd (result / error / notification / broadcast). The two servers differ only in what they inject into that base and how they pump it.

sequenceDiagram
    participant C as Bridge (client)
    participant T as WsTransport
    participant S as mcp_server (editor)
    participant P as PeerCompat
    participant R as ServerRequestRouter
    C->>T: TCP connect, WebSocket upgrade
    C->>T: first frame — auth token (plus version, server_version, min_toolkit)
    T->>S: build_auth_ack
    S-->>C: authed = true (plus godot_version, plugin version, headless, min_server)
    S->>P: assess(server_version, min_toolkit, skip_version_check)
    P-->>S: verdict + line to print (advisory, never refuses)
    Note over C,S: no valid auth within 2000 ms of the WebSocket opening (the auth deadline) closes the socket (1008)
    C->>T: JSON-RPC request (e.g. scene.create)
    T->>S: _handle_message (peer authed)
    S->>R: route_request
    R->>R: select lane, call handler
    R-->>C: JSON-RPC result (success + status)

Figure 3 — connect → auth handshake → dispatch · verified 79edab4

Ports & framing. By default the Editor channel scans 6550–6560 and the Runtime channel scans 6570–6585; both bind 127.0.0.1. The listen configuration is resolved from the environment by the shared, export-clean transport/port_config.gd: a per-channel env var pins an exact port (GODOT_MCP_EDITOR_PORT / GODOT_MCP_RUNTIME_PORT, bind-exact-or-fail with a bounded same-port grace — never a silent scan-fallback), or a *_PORT_MIN / *_PORT_MAX pair relocates the scan band; pin and band are mutually exclusive per channel, and a malformed or out-of-range value is a fatal config error, never a silent clamp (ADR 0015). The registry always publishes the actually bound port, including a pinned port that frees and binds late. Each accepted peer’s inbound and outbound buffers are sized once, at accept, from a size the owning server supplies; ws_transport.gd reads no setting itself. The editor server supplies the effective ws_buffer_kb from core/response_limits.gd: the env override the bridge pushes with meta.set_limits after every auth (from GODOT_MCP_WS_BUFFER_LIMIT), else the mcp_toolkit/limits/ws_buffer_kb ProjectSetting (default 1024 KiB), never below 256 KiB. A pushed value applies from the next connection the editor accepts. The runtime server supplies the project value, because env overrides live only in the editor process. A response frame larger than the peer buffer is dropped wholesale by the engine (no chunking), which is why oversized reads are guarded centrally and save.read / script.read paginate.

Auth. The token is a 256-bit CSPRNG value (auth.gd), written to a per-instance file; its globalized absolute path is published in the registry entry (get_published_token_path() — ProjectSettings.globalize_path of the user:// token file) so the bridge can read and structurally validate it without re-deriving the path (ADR 0011). In-engine readers keep the user:// form. The handshake reply differs by server: the editor server returns godot_version + plugin version + a headless flag (the server’s version-gating and headless-degradation inputs; ADR 0014) + its declared server floor min_server, the runtime server returns {"authed":true} only. The editor server also checks the MCP server’s version (server_version, or version from a 1.0.x server) against the declared floors (ADR 0024). The facade triggers the check after each auth and clears it when the last peer disconnects, while its transport/peer_compat.gd child holds the verdict and the record of printed errors. A server below the toolkit’s MIN_SERVER_VERSION, or a toolkit below the server’s min_toolkit, logs one error to the editor console (once per state and server version) and shows a line in the dock, in place of the product-version message. Otherwise it compares the versions (version_skew in versioning/mcp_version_utils.gd): a major difference logs an error, a minor one a warning, and a patch difference nothing. A local server build skips the check with one line per connection: plugin.gd sets the facade’s skip_version_check flag from the local-server-path setting, and the .mcp.json write sets GODOT_MCP_SKIP_VERSION_CHECK=1 on that entry so the server skips its own side. None of it refuses the connection.

The editor poll loop is deliberately indirect. Editor mutations must not run re-entrantly inside _process (a scene save pumps the main loop, which could resume a coroutine mid-pump). So the editor server defers its poll and throttles it to every 4th frame:

flowchart TD
    proc["_process(delta)"] --> skip{"4th frame?"}
    skip -->|no| ret["return"]
    skip -->|yes| defer["call_deferred(_poll_connections)"]
    defer --> pump["transport.pump()"]
    pump --> listen["ensure_listening — throttled ~1s"]
    pump --> accept["accept_pending peers"]
    pump --> drain["poll_peers → await _on_message per frame"]
    pump --> clean["cleanup closed peers"]

Figure 4 — the deferred, frame-skipped editor poll · verified 79edab4

The mutation watchdog (§4) ticks every frame unconditionally — independent of this poll cadence — so a wedged mutation is always recovered on time. The runtime server, running in a game with no EditorFileSystem re-entrancy to dodge, pumps inline every frame with no call_deferred and no await. It sets PROCESS_MODE_ALWAYS, so that pump keeps running while the game tree is paused (a pause menu, for example).


4. Dispatch & concurrency

Once a request is authed and parsed, server_request_router.gd routes it. A few methods are handled inline (_cancel, echo); an unknown method is a -32601. Everything else is classified into one of three execution lanes by flags the command registry exposes.

flowchart TD
    msg["authed JSON-RPC request"] --> router["ServerRequestRouter.route_request"]
    router --> special{"_cancel / echo?"}
    special -->|yes| inline["handle inline — no lane"]
    special -->|no| known{"registry.has_command?"}
    known -->|no| err["-32601 method not found"]
    known -->|yes| sel["lane_kind_for(method)"]
    sel --> scene{"scene.open or<br/>active_scene_required?"}
    scene -->|yes| L3["SceneLeaseLane<br/>tab-affinity queue"]
    scene -->|no| mut{"needs_serialization?"}
    mut -->|yes| L2["MutationLane<br/>single-flight FIFO + watchdog"]
    mut -->|no| L1["ReadOnlyLane<br/>immediate, no lock"]
    L3 -.->|"affinity matches → fall through"| L2
    L3 -.-> L1

Figure 5 — the three dispatch lanes · verified eb4c9fa

  • ReadOnlyLane — read-only commands bypass all locking and run immediately. They are marked read_only, which is also the value the server publishes as the tool’s readOnlyHint — annotation correctness is load-bearing for both concurrency and the read-only filter (§10).
  • MutationLane — anything that mutates serialises single-in-flight, FIFO. A second mutation arriving while one is in flight gets a _queued notification and waits; on completion the lane drain()s the next. This is what makes blind, parallel LLM calls safe.
  • SceneLeaseLane — commands that need a specific edited scene to be the active tab route through the scene lease, which queues them until that scene is active (and scene.open switches tabs). Once affinity matches, the request falls through to the mutation or read lane.

The mutation watchdog (mutation_watchdog.gd) is a separate object with its own lifecycle so it can tick every frame regardless of poll state. It arms a per-mutation deadline and a generation counter; if a mutation overruns, it emits a -32000 timeout to the client, cooperatively cancels the handler’s MCPToolkitToolContext, bumps the generation (so the wedged coroutine’s tail bails), and force-clears the lock.

stateDiagram-v2
    [*] --> Idle
    Idle --> Executing: drive — not in flight — arm watchdog
    Idle --> Queued: drive — in flight — send _queued
    Queued --> Executing: drain picks next
    Executing --> Idle: handler returns — disarm — drain
    Executing --> ForceCleared: deadline exceeded — -32000 — ctx.cancel — generation++
    ForceCleared --> Idle: drain

Figure 6 — mutation lane single-flight + watchdog recovery · verified eb4c9fa

The scene lease coordinates multiple connected peers against Godot’s single active-scene-tab model:

flowchart TD
    req["command requiring the active scene"] --> open{"method == scene.open?"}
    open -->|yes| grant["open/switch tab → grant lease to peer"]
    open -->|no| match{"peer affinity == active tab?"}
    match -->|yes| through["fall through to mutation / read lane"]
    match -->|no| queue["queue until this peer's scene is active"]
    grant --> drainq["drain queued commands for that scene"]
    drainq --> through

Figure 7 — scene-lease lifecycle · verified eb4c9fa


5. The response contract

Every handler returns a Dictionary in one of two shapes, and the registry enforces the shape at dispatch (ADR 0004) — a handler that returns a non-dict or omits success is converted to an INTERNAL error rather than reaching the LLM malformed.

  • Success — MCPToolkitSuccess.ok(data) returns data with success: true added. Success payloads never carry code.
  • Error — MCPToolkitError.fail(code, message, hint) → {"success": false, "error": <message>, "code": <code>}, plus "hint" when one is passed or when code is in DEFAULT_HINTS. Error payloads never carry status.

Error-code vocabulary. MCPToolkitError.CODES is the closed set of 56 codes; DEFAULT_HINTS auto-attaches a recovery hint for 7 of them (e.g. TIMEOUT, PATH_DENIED, GAME_NOT_RUNNING, RESPONSE_TOO_LARGE). LOG_BUSY / LOG_UNAVAILABLE are deliberately not in DEFAULT_HINTS — their recovery advice is version-gated (a source:"buffer" fallback exists only on Godot 4.5+), so each emit site passes an explicit version-gated hint instead. fail() asserts code ∈ CODES in debug builds, so a typo’d or off-vocabulary code is caught at the source instead of drifting into the contract.

Type coercion. Godot’s complex types cross JSON as tagged dicts and coerce.gd translates them bidirectionally (coerce_value ⟷ serialize_value). There are 18 tags: Vector2/3/4, Vector2i/3i, Color, Rect2/Rect2i, Transform2D/Transform3D, NodePath, Resource, ResourceRef, NewResource, PackedVector2Array/PackedVector3Array/PackedColorArray, and LayerMask. An unknown tag is rejected, not passed through — the symmetry is the contract.

Idempotency (§contract C6). The if_exists creates (scene.create and the asset writers) return a status discriminator, so a blind retry is safe by default:

flowchart TD
    create["create command with if_exists"] --> exists{"target exists?"}
    exists -->|no| make["create → status: created"]
    exists -->|yes| pol{"if_exists"}
    pol -->|"return (default)"| noop["no-op → status: returned"]
    pol -->|"fail"| ae["ALREADY_EXISTS"]
    pol -->|"replace"| repl["overwrite → status: replaced"]

Figure 8 — the idempotent create / if_exists decision · verified ffe0ab2

The shared write_asset_with_settle helper centralises the path-guard → extension-allowlist → if_exists → write → import-settle bracket for assets/textures/sounds, so the idempotency contract is one implementation, not three (ADR 0010). resource.write takes no if_exists: it is an upsert that updates an existing file’s properties in place, and only a create (which needs type) returns status: created.


6. Command registry & catalogue

MCPToolkitCommandRegistry (transport/mcp_toolkit_command_registry.gd) is the central dispatch table and the single seam the rest of the system routes through. Registration (add()) version-gates the command, maps the friendly annotations to MCP hints, and clamps the timeout to [1s, 300s]. Dispatch (call_command()) writes the audit entry, runs any declarative path-guards (ADR 0009), invokes the handler, and enforces the response contract. The registry is also the facade extensions call (§8).

Built-in commands are registered by a single explicit enumerator, transport/builtin_command_registration.gd, which calls each module’s static register(registry, server). Each module owns one domain.* namespace and adds its verbs with a fluent MCPToolkitCommandOptions describing the annotations:

static func register(registry: MCPToolkitCommandRegistry, server: Node) -> void:
    registry.add("scene.get_tree", func(parameters: Dictionary) -> Dictionary:
        return _cmd_scene_get_tree(parameters)
    , MCPToolkitCommandOptions.new().mark_read_only())
    registry.add("scene.create", func(parameters: Dictionary) -> Dictionary:
        return await _cmd_scene_create(parameters)
    , MCPToolkitCommandOptions.new().mark_scene_independent())
    # … more verbs

There are ~100 built-in handlers across 30 modules; the server projects these into the MCP tool surface (the authoritative, generated per-tool list is the server’s tool reference), owns the tool groups and on-demand activation, and the domain.verb ⟷ tool-name mapping stays in lockstep across the two repos.

Domain area Modules (selected)
Scene tree & node authoring scene_commands (11), node_commands (9), spatial_commands
Script & code script_commands, commands/editor/editor_execute (execute.code)
Resources, assets, files resource_commands, asset_commands, file_commands, folder_commands
Visual & spatial 3d_commands, path_commands, texture_commands, spriteframes_commands, theme_commands, tilemap_commands
Tileset authoring commands/tileset/* (11 verbs)
Procedural & synthesis procedural_commands, sound_commands, texture_commands
Animation & particles animation_commands, particle_commands
Audio audiobus_commands
Input & navigation commands/input_map/*, navigation_commands
Signals signal_commands
Playtest & debug commands/playtest/*, debug_commands
Editor, project, introspection, save commands/editor/*, classdb_commands, project_commands, save_commands, meta_commands

The decomposition pattern. The cohesion refactor that defines this version turned the large files into a thin orchestrator over single-responsibility children. The registry’s own multi-instance store is the clearest example:

flowchart TD
    rc["registry_client.gd<br/>thin orchestrator — façade + sequencing"]
    rc --> pk["project_key.gd<br/>project hash"]
    rc --> rp["registry_paths.gd<br/>on-disk layout authority"]
    rc --> ref["registry_entry_file.gd<br/>atomic entry read/write/delete"]
    rc --> proj["registry_projection.gd<br/>fan-in → projects.json"]
    rc --> lock["file_lock.gd<br/>machine-wide lock, stale by age"]

Figure 9 — orchestrator + SRP-children (registry) · verified 716b4fb

The same shape recurs across the codebase: mcp_server.gd over its transport/dispatch children, plugin.gd over PluginComposer (§7), dock.gd over its panel components, extension_loader.gd over its services (§8), and the former tileset / editor / playtest god-files over the leaves now under commands/tileset/, commands/editor/, and commands/playtest/.


7. Plugin lifecycle

plugin.gd is a thin EditorPlugin. _enter_tree prints a one-line startup banner with the plugin version, wires EditorAccess and registers the ProjectSettings, then self-heals the runtime autoload via AutoloadRegistration.ensure_registered() — re-asserting MCPRuntimeServer before the graph is wired if the project was enabled out-of-band with the [autoload] entry missing (ADR 0013) — then delegates the whole collaborator graph to PluginComposer.compose(), which returns a Handle; _exit_tree calls Handle.dispose(), which tears the graph down in exact reverse order — the add/remove registration symmetry that keeps plugin reload clean. The autoload’s identity (name/path pairs + the autoload/<name> = *<path> derivation) lives in a pure-const leaf (core/autoload_identity.gd) that both the registration module and the export-strip plugin preload, so the two share one SSOT without coupling to each other.

flowchart TD
    plugin["plugin.gd<br/>_enter_tree / _exit_tree (thin)"]
    plugin -->|"AutoloadRegistration.ensure_registered() — pre-compose"| heal["re-assert runtime autoload<br/>(identity leaf + registration module ·<br/>enabled-out-of-band gap · ADR 0013)"]
    plugin -->|"compose()"| composer["PluginComposer → Handle"]
    plugin -->|"on start + EditorSettings settings_changed"| skip["server.skip_version_check<br/>(local server build ⇒ connect-time check off)"]
    composer --> reg["registry + mcp_server"]
    composer --> tracker["DebugSessionTracker<br/>(session state + latest session ·<br/>editor port: EditorInterface)"]
    plugin -->|"_build() → Handle.note_editor_build()<br/>clears a pending deploy"| tracker
    composer --> bridge["debugger plugin (debug_bridge.gd)<br/>(thin EditorDebuggerPlugin adapter)"]
    bridge -->|"session signals + error captures ·<br/>debugger node's breaked (reason text)<br/>+ stack_dump (frame 0: file, line)"| tracker
    composer --> builtins["BuiltinCommandRegistration.register_all()"]
    builtins -->|"debugger log reader reads the latest session"| tracker
    composer --> ext["ExtensionLoader.load_all + start_watcher"]
    composer --> exp["export-strip plugin"]
    composer --> deploy["remote-deploy detector<br/>(EditorExportPlugin · _export_begin only)"]
    deploy -->|"export with the remote-debug flag"| tracker
    composer --> mon["user_path_monitor"]
    composer --> detect["PlaytestEndDetector"]
    composer --> start["server.start() + register in registry"]
    composer --> ui["write flow + dialog presenter<br/>(shared UI · ADR 0016)"]
    composer --> upd["update check runner<br/>(plugin child · read by the dock's badge and status panel)"]
    composer --> inst["update installer<br/>(plugin child · follows the check runner ·<br/>settles the last exit at start · driven by the badge)"]
    upd -->|"newer version"| inst
    inst -->|"in place at staging · kept or removed at each start"| recov["recovery plugin<br/>(second EditorPlugin · addons/.godot_mcp_toolkit_recovery/ ·<br/>only while an update is in flight)"]
    composer --> pin["server pin move<br/>(RefCounted · holds this start's outcome)"]
    inst -->|"update_settled, connected before it enters the tree"| pin
    composer --> dock["dock UI"]
    pin -->|"outcome and Undo for the badge's notice · preview line"| dock
    plugin -->|"ask mode, at an editor start the wizard leaves free"| prompt["update prompt"]
    pin -->|"preview line"| prompt
    plugin -.->|"_exit_tree → Handle.dispose() — reverse order"| composer
    plugin -.->|"_exit_tree after dispose, unless disabling"| apply["UpdateLifecycle.apply_at_exit()<br/>(swaps a staged update in · never in a headless editor)"]

Figure 10 — plugin composition root · verified ffe0ab2

The composer builds in a behaviour-critical order: registry and server first, then the debug-session tracker and the debugger plugin that feeds it, then all built-in commands, then extensions and their hot-reload watcher, the export-strip plugin and the remote-deploy detector, the user-path monitor (which re-homes user:// paths when the project is renamed), the playtest-end detector, the server start + registry registration, then the shared .mcp.json write-flow + dialog presenter, the update check runner (a plugin child that checks for a newer toolkit version whether or not the dock is shown, and that the dock’s update badge and status panel read), the update installer (a plugin child built after the runner because it follows the runner’s newer version; in _ready it settles what the editor’s last exit left, and the badge drives its download and staging; its own child, the release verifier (self_update/release_verifier.gd), walks the trust chain and checks a release’s manifest and signature, and goes when the installer is freed), the server pin move (ui/mcp_json/server_pin_move.gd, a RefCounted that moves the toolkit’s own .mcp.json pin after an update, C11 in the contract; the composer connects it to the installer’s update_settled before the installer enters the tree, so the pin has moved before the badge first renders the update notice), and finally the dock, which receives the pin move for that notice and its offer’s preview line. The write-flow and dialog presenter are injected into the dock, the tool menu, and the onboarding wizard alike — the dock consumes them like any other UI surface rather than acting as a service locator for them (ADR 0016). One link runs back: once its UI is built, the dock hands the presenter its read-only badge’s cached state, so the Info dialog shows what the badge shows (with no dock, the presenter reads .mcp.json the way the badge does). dispose() reverses the graph precisely, including PlaytestCommands.clear_session_tracker(), the reverse of handing the debug-session tracker to PlaytestCommands.register; it drops the tracker only after the debugger plugin, the debugger log reader and the remote-deploy detector that hold it are gone, and last clears the response limits’ env overrides (core/response_limits.gd), static state that would otherwise outlive a plugin reload; teardown uses immediate (not deferred) free() throughout — for the dock control, the update installer (before the runner it follows), the update check runner, the dialog presenter’s dialogs, and the server, and (in plugin.gd’s own _exit_tree) for the tool menu and the onboarding wizard — so nothing outlives ObjectDB’s exit-time leak check. The one exception is the EditorDock wrapper that holds the dock on 4.6+: it holds no GDScript, and the editor still reads a removed dock in a deferred update, so the composer queue_frees it after freeing the control. The tool menu, per-user EditorSettings (the unfocused-editor preferences, the setup wizard’s mcp_toolkit/setup_wizard/show_optional_steps and the machine-local mcp_toolkit/server/local_path), the Godot-version warning, and the onboarding wizard (the setup wizard) are wired by plugin.gd itself after compose returns. plugin.gd connects the wizard’s step_seen to the setup step tracker, the one writer of the seen-steps file, and a deferred call asks the run planner which steps to show. It also passes compose() a callable that the dock’s footer Setup Wizard button calls, which starts a button run of every step, seen or not; the dock never holds the wizard. The planner tells an editor start from a mid-session enable by a flag _enable_plugin() sets: the editor calls it only for a mid-session enable, synchronously after _enter_tree (ADR 0027). So is the version-check opt-out: plugin.gd copies MCPJsonWriteFlow.uses_local_server() (the local-path setting, else GODOT_MCP_DEV_SERVER_PATH) onto the server’s skip_version_check once at start and again on every EditorSettings settings_changed, so the next connection already reflects an edit, and _exit_tree disconnects that watch because the EditorSettings singleton outlives the plugin. The project-wide mcp_toolkit/server/version key is registered earlier, with the other ProjectSettings. Disabling the plugin (not a reload) scrubs every mcp_toolkit/* ProjectSettings key, that one included, and hands the machine-wide EditorSettings prompt, local_path among its keys, to a detached DisableCleanupCoordinator that outlives the plugin.

plugin.gd also carries the self-update’s two ends. After the deferred onboarding call, in the ask install mode, it opens the update prompt when the installer holds a verified release, unless the wizard is open or the plugin was enabled mid-session, and passes it the handle’s pin move, which supplies the prompt’s line about the pin. The prompt is a non-exclusive window: on 4.4+ the editor reparents its own progress and save dialogs under the last exclusive window, and closing that window would free them with it. When the wizard reports its update-install step seen, it has the installer decide again, since the consent gate reads that step. At exit, once dispose() has freed the graph, _exit_tree calls UpdateLifecycle.apply_at_exit(), which swaps a staged update into the addon folder while nothing can reload those files. A headless editor neither settles nor applies (self_update/update_lifecycle.gd), and a disable skips the apply: _disable_plugin() sets a flag first, has the installer call off a running download or stage, then clears the update journal and removes the recovery plugin, so a staged update is dropped with its files instead of being installed into a plugin being removed.

While an update is in flight the project holds a second editor plugin, the recovery plugin. Its template ships inside the toolkit (self_update/recovery/). Before the journal says staged, the installer copies it to res://addons/.godot_mcp_toolkit_recovery/, enables it and saves its entry in project.godot (self_update/recovery_files.gd); the Plugins list and the editor’s scan skip a dot folder, and the editor still starts the plugin from that saved entry. After each start’s settle the installer keeps it in place while the journal is staged or applying, or applied to a version other than the one running, and removes it otherwise (a headless editor changes nothing). When the settle finds an applying journal stamped within 60 seconds of now, either way, another editor’s exit may still be applying, so the installer settles nothing, offers no install and holds update_settled until a timer runs the settle again past that window. The recovery plugin loads nothing from the toolkit’s folder. A settle delay after the editor’s first scan, when the toolkit is not enabled, it finishes or rolls back an apply a kill stopped, or puts the backup back over a version that did not load, then asks for a restart. When the toolkit is enabled but never started (Godot 4.2, after an update that moves a global class) it moves nothing and asks for one more restart; when it cannot set things right it shows the manual steps (self_update/recovery/recovery_plugin.gd, its decisions in recovery_journal.gd).

The debugger’s session state lives in transport/debug_session_tracker.gd, a RefCounted the unit runner can build headless: whether a game is attached and stopped at a break, the error buffer, the editor’s reason text and location for an error break, and whose game the latest debugger session is (none yet, a playtest this editor ran, or a game elsewhere). An error break, which the game cannot continue from, records a break entry in an empty buffer; a breakpoint pause records none. The entry carries the source, function and line of frame 0 of the editor debugger’s stack dump, and its text names that file and line. When the reason is a failed script preload, the engine breaks on the preloading line, so the text also names the preloaded script that holds the error. It reads the one editor fact it needs, whether the editor is running a playtest, through an injected port; the composer passes EditorInterface. transport/debug_bridge.gd stays the EditorDebuggerPlugin. It forwards the session’s signals and error captures to the tracker and sends debug.continue to the live session. It also forwards two signals of the editor’s ScriptEditorDebugger node behind that session: breaked, because it carries the reason text (Parser Error: …) that the session’s own breaked drops, and stack_dump, whose frame 0 is where the game stopped. It finds the node as the one whose four-argument breaked connects to the session, and without a match the break entry goes without the reason, file and line; a node without a one-argument stack_dump leaves the entry without the file and line. The composer hands the same tracker to that plugin, to the debugger log reader (through PlaytestCommands.register) and to the remote-deploy detector (core/remote_deploy_detector.gd), an EditorExportPlugin of its own that implements only _export_begin. A one-click deploy with remote debug runs the editor’s build step, then exports with the remote-debug flag before its game attaches, so plugin.gd’s _build hook clears any pending deploy and the detector marks one. A session that starts while the editor plays and no deploy is pending counts as a local playtest; any other counts as elsewhere, whose log this machine’s godot.log does not hold.


8. Extension system

Third parties add tools by shipping an MCPToolkitExtension subclass (GDScript) or an MCPToolkit-prefixed .cs class (C#) anywhere in the project. The toolkit finds them by reflection over the global class list — not a directory walk — and loads each through a guarded lifecycle. extension_loader.gd is a 36-line orchestrator over four services under extensions/services/: extension_discovery (one-shot startup pass), extension_support (the shared load/validate/probe leaf), extension_watcher (live hot-reload), and extension_meta_commands (the extensions.list surface).

flowchart TD
    scan["scan ProjectSettings.get_global_class_list()"] --> cand{"candidate?<br/>GDScript base == MCPToolkitExtension<br/>or C# MCPToolkit*.cs"}
    cand -->|no| skip["skip"]
    cand -->|yes| enabled{"addon enabled?"}
    enabled -->|no| skip
    enabled -->|yes| load["ResourceLoader.load<br/>(4.2 REUSE · 4.3+ IGNORE)"]
    load --> new["script.new()"]
    new --> validate["contract-validate<br/>base class / duck-typed register()"]
    validate --> guard["registry.begin_extension_load()"]
    guard --> register["instance.register(registry, server)"]
    register --> collide["end_extension_load() →<br/>reject built-in / cross-extension collisions"]
    collide --> reserved["reserved-prefix guard on new methods"]
    reserved --> mark["registry.mark_extension(method)"]
    mark --> retain["retain instance (C# GC safety)"]

Figure 11 — extension discovery → validate → guarded register · verified da1d5d2

Two guards protect the built-in surface: a collision guard window (opened by begin_extension_load, drained by end_extension_load) rejects an extension that tries to overwrite a built-in or another extension’s command, and a reserved-prefix check forbids new commands under the built-in namespaces (scene., node., runtime., …). The threat model treats extensions as full-trust (ADR 0009) — these guards prevent accidental collision, not malice.

Single-level discovery (ADR 0005) avoids the last-writer-wins double-registration that nested discovery would cause, and it matches what the export strip removes. Loaded instances are retained on a registry meta array because a C# extension’s registered Callables are bound to its instance; without a live reference the GC would collect it and break the callbacks.

Hot-reload. extension_watcher listens for EditorFileSystem.filesystem_changed and ProjectSettings.settings_changed, debounces ~500 ms, computes an added/removed/modified class diff, applies it, and broadcasts extensions.changed to all authed peers. A class counts as modified when its tools or the GDScript source the loader reads change, so a reload never leaves a registered Callable from before it. extensions.list / extensions.refresh are the pull counterparts. (Because Claude Code drops tools/list_changed notifications, the bridge cannot rely on the broadcast alone — the pull path is the reliable one.) On Godot 4.2 the loader reads the editor’s cached script, which a toolkit write that compiles reloads (on 4.2.2; the toolkit reloads nothing in place on 4.2.0 and 4.2.1), so the watcher checks each edit against that cache: an edit that never reached it gets a restart hint in extensions.refresh, and a file that does not compile gets a hint to fix it.

The extension API is the nine public MCPToolkit* classes plus the registry facade. C# extensions in particular cannot await GDScript statics, so the registry handed to register() exposes everything they need as plain methods: create_options / create_extension_options / create_undo_action / queue_save / check_save / fail / require. Cancellable handlers receive an MCPToolkitToolContext second argument and poll is_cancelled().


9. Multi-project registry

The bridge has to find every editor and every running game on the machine. The toolkit solves this lock-light: each instance writes its own entry file, and a locked rebuild fans them into the single projects.json the bridge reads.

flowchart TD
    subgraph writers["each instance writes ONE unique file"]
      e1["editor A → entries/&lt;hashA&gt;.json"]
      e2["editor B → entries/&lt;hashB&gt;.json"]
      r1["running game → entries/&lt;hashA&gt;.runtime.json"]
    end
    lock["acquire file_lock<br/>pid:ts · backoff · overwrite after 10 s"]
    rebuild["registry_projection.rebuild()<br/>scan → port-prune → overlay runtime"]
    pj[("projects.json")]
    e1 --> lock
    e2 --> lock
    r1 --> lock
    lock --> rebuild --> pj
    pj --> bridge["server bridge — discovers all instances"]

Figure 12 — registry fan-in · verified 716b4fb

The registry directory is machine-wide, not user:// — %APPDATA%\godot-mcp-toolkit on Windows, ~/Library/Application Support/godot-mcp-toolkit on macOS, $XDG_DATA_HOME on Linux — so independent editors share it. Because every writer owns a unique file (keyed by a 12-hex project hash, with the runtime writing a separate .runtime.json), there is no contention on the writes; the file_lock only serialises the rebuild. The lock stores pid:ts, backs off exponentially, overwrites a lock older than 10 s, and force-writes after the retry budget so a caller always makes progress. It judges a lock by age alone: OS.is_process_running() is documented for the calling process’s own children only, on every platform, so it cannot say on every platform whether another editor is alive. Rebuild output is written two-phase (.tmp → .bak → target) so a crash never leaves a half-written projects.json. GC is by port-conflict pruning only, with no PID-based GC, for the same reason.

Two editors on one project share one entry file, so register() overwrites an entry another PID left. If that entry names another port it warns, since a second editor may still hold that port; if it names the port this editor just bound, the old editor is gone and it prints an info line.


10. Security & trust boundaries

The toolkit assumes a single local user with a human at the editor; the boundary is localhost + token, not a defence against an adversary who can already write project files. Within that model, several layers keep an LLM’s requests honest.

flowchart TD
    llm["LLM-authored request"] --> token{"valid token?<br/>(first frame)"}
    token -->|no| close["WS close 1008"]
    token -->|yes| filter["server-authoritative read-only filter<br/>(tools/list)"]
    filter --> audit["Audit.log_call — params hashed"]
    audit --> guard["FileGuard.resolve_safe / resolve_safe_delete / resolve_safe_user"]
    guard --> deny["deny ..-traversal, plugin source dir, update and recovery folders,<br/>token & audit files (any case or alias spelling),<br/>reserved paths on delete"]
    deny --> handler["command handler"]
    handler --> wrap["read paths → Untrusted.wrap + Scrubber.scrub"]

Figure 13 — request trust boundaries · verified ffe0ab2

  • FileGuard (security/file_guard.gd) is the path keystone: resolve_safe confines writes to res:// (rejecting .. traversal and absolute OS paths via a globalize → simplify → re-verify pass, and an absolute path right after the scheme, such as res:///…, by a prefix check on the res:/// or user:/// start), and refuses the toolkit’s own source and the self-update’s folder, res://addons/.godot_mcp_toolkit_update/ (is_update_folder), which holds the staged release, the backup and the journal, and the recovery plugin’s folder, res://addons/.godot_mcp_toolkit_recovery/ (is_recovery_folder), whose scripts the next editor start runs (the self-update itself does not come through this guard); the file deletes (file.delete, resource.delete, scene.delete, script.delete, through delete_res_file) remove only the project-relative path project_relative_path returns, and answer PATH_DENIED when it has none; resolve_safe_delete adds, for file.delete, folder.delete, resource.delete, scene.delete and script.delete, a refusal of reserved paths (any dot-named segment such as .git, any project.godot or override.cfg, and any Windows-alias-shaped segment); and resolve_safe_user confines save.* to user:// while denying the plugin’s own internal directory — that denial is what protects the token and audit files from being read or rewritten through the tools. folder.delete also refuses the host folders (res://, res://addons and the toolkit’s source) with FOLDER_PROTECTED, through FileGuard.is_host_folder. Every host-folder check compares one canonical spelling of the path: backslashes made slashes, simplified, case-folded (with the long s and Kelvin sign APFS reads as s and k), and each segment cut at an NTFS stream : and trailing dots or spaces. A folder directly under res://addons/ or user://addons/ named like an 8.3 short name counts as the toolkit’s too. Each refusal ends with SAME_FOLDER_NOTE, so a caller who spelled the folder another way learns why it matched.
  • Read-only is server-authoritative. The toolkit does not gate dispatch on GODOT_MCP_READ_ONLY; the server filters tools/list by the readOnlyHint / destructiveHint the toolkit publishes. The toolkit consumes its own read_only flag only for concurrency routing and a best-effort dock badge. (Gating dispatch on a mirrored env var is exactly the desync bug an earlier feature-gate subsystem had, and was removed.)
  • Audit (security/audit.gd) appends an intent trail — ISO-8601 timestamp, method, and the SHA-256 of the params (not the plaintext, so no secret leaks) — for both lanes, in the token-protected instance directory.
  • Untrusted content read back from the project (script text, console output) is wrapped in a nonce-delimited <untrusted-…> envelope (with pre-existing tags scrubbed to prevent breakout). Console text, a running game’s log and save-file text also run through Scrubber, which redacts secrets before they reach the LLM; script text is never scrubbed. This applies to read paths only, never to writes or binary.
  • The self-update (ADR 0029) is the one path that writes what it downloads into the project, and what it writes is the toolkit’s own code, so it trusts the signature, not the host. A release counts only when its update manifest is signed by a release key the latest trust document lists (self_update/release_signature.gd). The chain starts at the document the installed release embeds (self_update/embedded_trust_document.gd); each next document must be signed by enough of the previous one’s root keys, and the ones accepted are stored per machine in the OS’s data folder, outside the project, and verified again from the embedded one on every load (self_update/trust_chain.gd; the procedures are in docs/dev/trust-chain.md). The manifest pins the zip by size and SHA-256 and names the oldest Godot the release runs on (self_update/release_manifest.gd); the file list inside the zip, release_files.sha256, says what the stage must hold (self_update/release_file_list.gd), and self_update/release_archive.gd refuses a zip with an entry outside the addon folder or a file the list does not name. Every URL is built from the version or the document’s number alone (self_update/release_assets.gd), and self_update/update_downloader.gd follows each redirect by hand, over HTTPS, only to github.com or a githubusercontent.com host other than raw.githubusercontent.com, at most five hops; that narrows where a request goes, while the signature and hash decide what is used. The installer offers to install a release, rather than link to it, only when the consent gate allows it (may_install_updates in core/consent.gd: the update check may run, the setup step that explains installing has been seen, and mcp_toolkit/updates/install_mode reads ask, self_update/install_mode.gd) and the installed release embeds a readable trust document; the zip downloads only once the user clicks Update. A major release never installs, nor does one that needs a newer Godot, nor any into the toolkit’s own repository, a linked addon folder, a git checkout or submodule, or a headless editor (self_update/install_guards.gd, self_update/update_installer.gd). At the editor’s exit the applier checks again, offline and from the stored chain, the guards, the signature, the engine floor, the zip’s hash, that the version is newer and the zip’s layout against its list, before its two renames (self_update/update_applier.gd); it also waits while the project.godot on disk does not enable the recovery plugin, which puts the backup back if the new version does not load. That plugin is copied from the running toolkit’s own folder, never from the stage (self_update/recovery_files.gd). The tools cannot reach the staged files or the recovery plugin: FileGuard refuses both folders, above.

11. Cross-version compatibility

The toolkit supports Godot 4.2 (floor) through 4.7 (GODOT_TESTED_MAX_VERSION), on the same parse-time principle as the editor↔runtime split: a version-specific API that doesn’t exist in an older engine must not appear as an identifier, or the script won’t parse there. So version-specific features are reached by dynamic dispatch — has_method() + call(), has_signal(), ClassDB.class_exists(), is_class() — never by naming the new symbol directly.

MCPVersionUtils (versioning/mcp_version_utils.gd, pure static and editor-clean) is the comparison helper. There are two gating layers: a registration hard-gate (registry.add blocks a command whose min/max Godot version doesn’t match — e.g. scene.close is 4.5+), and in-handler capability checks that degrade gracefully (e.g. an AnimationTree listing returns [] below 4.5). A forward-compat warning fires (non-blocking) when the running engine is newer than the tested maximum. Parse-time syntax gates (typed dictionaries 4.4+, @abstract 4.5+, @export_tool_button 4.4+) are simply kept out of the source.


12. Distribution

The two repos ship through different channels so users never fetch what they don’t need (Pattern B):

  • Toolkit → the Godot Asset Library (the GitHub archive) plus a GitHub-Releases zip built by scripts/build-plugin-release.{ps1,sh}. The package contains only the addons/godot_mcp_toolkit/ subtree — which is why this docs/ folder, the ADRs, and the dev docs never reach end users. The Releases zip also holds the release file list, addons/godot_mcp_toolkit/release_files.sha256 (one SHA-256 and path per file, sorted, in the format sha256sum -c checks), and the release publishes the update manifest, godot-mcp-toolkit-<version>.update.json, beside it: the manifest pins the zip by size and SHA-256 and names the oldest Godot it runs on. Both build scripts write the two (scripts/lib/release_files.sh for the bash one), but only the bash build’s manifest, the one .github/workflows/release.yml builds, is ever signed. The workflow checks the booted tree against the list and the manifest against the zip (scripts/check_release_files.sh), then attaches the zip and the manifest to the GitHub Release; the maintainer adds the signature, godot-mcp-toolkit-<version>.update.json.sig, with scripts/sign-release.sh, outside the workflow. The self-update reads all three (§10). plugin.cfg declares the version and the plugin.gd entry point; icon.png at the repo root is the Asset Library listing icon, and the repo-root icon.svg is the dogfood project’s own icon (project.godot config/icon). The addon carries a separate addons/godot_mcp_toolkit/icon.svg, which is the one that ships inside the package.
  • Server → npm (@npgamedev/godot-mcp-server).

The export-strip plugin (ADR 0028) is a separate concern: it protects a toolkit user’s game export (nulling the runtime autoload, stripping addon source) — distinct from how the toolkit itself is shipped.


13. Contract surface

The contract surface is the published language the server depends on — the part of this toolkit that is not free to change without coordinating the bridge. It is catalogued in full (with toolkit-side file:line, field types, example payloads, and stability tiers) in docs/dev/contract.md; the headline rows:

# Contract Tier
C1 WebSocket transport & framing (ports, bind, buffer) public
C2 Auth handshake (first-frame token; mode-divergent reply) public
C3 Response envelope (success / error shape) public
C4 Error-code vocabulary (CODES, 53) public
C5 Dispatch + concurrency notifications (_queued / _executing / _cancel; id coercion; JSON-RPC codes) public
C6 Idempotency (status + if_exists) public
C7 Type-tag coercion vocabulary (18 tags, bidirectional) public
C8 Tool names & param schemas (domain.verb) public
C9 Read-only model (server-authoritative; published annotations) public
C10 Environment variables public
C11 .mcp.json file format public
C12 Tool group names semi-public
C13 Extension API (register; registry facades; base classes) semi-public
C14 Extension surface signaling (extensions.list / refresh / changed) semi-public
C15 LSP status round-trip (server → toolkit set_lsp_status) semi-public
C16–C22 projects.json format, project hash, token-path discovery, LSP/runtime publishing, untrusted envelope, ProjectSettings keys internal

Tiers feed semver: public = a break is a major bump; semi-public = deprecate-then-change in a minor; internal = no guarantee. The server-side consumer of each contract is described beside it in docs/dev/contract.md.


14. Key decisions (ADRs)

Architectural decisions are recorded in docs/adr/ (toolkit repo, unshipped). The ones most relevant to this document:

ADR Decision Where it shows up
0003 Typed command-options builder (MCPToolkitCommandOptions) §6
0004 Enforce the response contract at dispatch §5
0005 Single-level extension discovery (+ matching export strip) §8
0006 Warn, don’t strip, binary-token GDScript exports (superseded by 0028) §2, §12
0007 Opt-in, machine-wide, crash-safe unfocused-responsive mode §3
0008 LSP port discovery is registry-authoritative §2, §9
0009 Filesystem-content trust boundary; extensions are full-trust §8, §10
0010 Generated assets report their constructed class & skip import-settle §5
0011 Token-path authority — the toolkit publishes the globalized-absolute path; the server reads & structurally validates it §3, §10
0013 Self-heal the runtime autoload on load when enabled out-of-band §7
0014 Headless-DX response shape (headless handshake field + degraded-tool guidance) §3
0015 Deterministic env-driven listen-port config (pin/band, bind-exact-or-fail) §3
0016 The dock is a UI surface, not a service locator (shared write-flow + dialog presenter injected) §7
0017 OS-aware .mcp.json emission — resolve a macOS GUI-launch absolute node path (superseded by 0018) §3, §7
0018 Minimize the macOS .mcp.json emission — revert to bare npx (supersedes 0017) §3, §7
0027 Setup steps keyed by id, recorded when left, in a versioned file §7
0028 Order the export strip before the GDScript tokenizer (supersedes 0006) §2, §12
0029 The toolkit installs its own updates at editor exit, from a signed manifest §7

This architecture document is part of the toolkit repo and is not shipped in the addon package. The server’s architecture is documented separately in the godot-mcp-server repo.


This site uses Just the Docs, a documentation theme for Jekyll.