MysteryForgeby Insurrection Studios

MysteryForge MCP Server

A local stdio MCP server that turns the project into an AI-native game studio: Claude, GPT, or any MCP client can create scenes, wire puzzles, write dialogue, generate placeholder voices, validate everything, and launch live previews — while a human designer edits the same JSON files by hand or in the Godot editor.

Setup#

cd mcp && npm install && npm run build

Attach an agent in two minutes#

make mcp-build          # once: npm install + tsc
make mcp-config         # prints the exact commands below, with this checkout's absolute paths (GAME=/abs/path for another game)

Inside this repository Claude Code picks the server up on its own from the committed .mcp.json (it edits the bundled demo, runtime/; Claude Code asks you to approve a project server the first time). Anywhere else, use one of the two snippets below. Then say "run doctor": it reports whether Godot was found and which game is open. The server also hands the agent a short orientation of its own (what to read first, the conventions, and the checks to finish with).

A server edits one game at a time, but you never have to restart it to change which: open_project points every tool at another folder, and create_game / scaffold_from_blueprint open the game they make (pass open: false to stay where you are). Without a model attached, the same machinery is a command line — node mcp/dist/cli.js (blueprints, normalising audio, loudness…) — and every game carries tools/check.sh, the whole proof suite, for a CI job or a script.

Claude Code#

claude mcp add mysteryforge -- node /path/to/nd_gamemaker/mcp/dist/index.js \
  --project /path/to/nd_gamemaker/runtime

Claude Desktop (claude_desktop_config.json)#

{
  "mcpServers": {
    "mysteryforge": {
      "command": "node",
      "args": [
        "/path/to/nd_gamemaker/mcp/dist/index.js",
        "--project", "/path/to/nd_gamemaker/runtime"
      ]
    }
  }
}

--project points at the game being edited (defaults to the bundled demo). Godot is auto-discovered (PATH, /Applications/Godot.app) or set GODOT_BIN / pass --godot <path>.

The intended agent workflow#

  1. get_project_info → orient. get_spec → format reference (also per section).
  2. Author with fine-grained tools (create_scene, add_hotspot, upsert_dialogue, upsert_puzzle, set_variable, …). Out-of-order references are allowed and come back as inline warnings, so build in whatever order is natural.
  3. Draw art as SVG with write_asset_text (backgrounds 1920×1080, icons 256², portraits 512²; no <text> elements), or drop real images into game/assets/.
  4. generate_voice for one placeholder recording, generate_missing_voices for every spoken line at once (each character gets their own stable voice; list_voice_lines shows what's recorded); ship text first, re-record later at the same paths. Everything written this way is listed as a placeholder (game/assets/manifest.json): check_assets shows what's left and what will look or sound wrong (cropped/soft backgrounds, uncompressed WAVs…), and replace_asset swaps in the real file — even as a different type (PNG for SVG, OGG for WAV via convert_audio) — rewriting every reference.
  5. validate_project — the engine's own validator, run headless: referential integrity, action/condition correctness, missing assets, scene reachability.
  6. screenshot_scene — see any scene exactly as the player would, returned as an image; set it up first when the picture you want is a state, not the room as it starts (open_container, verb, give, set, show_hotspots — below). run_preview — launch the windowed game for the human (with scene_id to jump straight into the room being iterated; F5 in-game reloads JSON edits live, H shows hotspot shapes).

Argument names#

One convention across the tools: a thing is referred to by <kind>_id (scene_id, item_id, hotspot_id, template_id, walkthrough_id, comment_id…), a document is passed under the kind's own name (scene, item, hotspot, walkthrough), a game folder is project_path and a file written is output_path. (A few tools name a file or a folder their own way — export_handoff's out is a folder — and a variable or game-local script is by name, which is what it is.)

Callers do not always remember the convention, so the server reads a call before the tool sees it:

  • a spelling that another tool takes for the same thing, or that a tool used to take, is read as the real one — scene for scene_id, path / target_path / folder for project_path, a walkthrough's name, a lone id for the tool's one *_id — and the reply says so (arguments_renamed: {"scene": "scene_id"}) so the real name is learned. Two spellings of one thing are refused, not guessed;
  • an argument the tool does not take is an error that names what it does take (create_scenes_from_template has no argument 'dryrun' (did you mean 'dry_run'?). It takes: template_id (required), …). It is never silently dropped: a lost dry_run or apply would be a different call.

Screenshots of a state#

screenshot_scene takes the room as it starts. To see a state, set it up (needs a game whose engine is 0.66.3 or newer — upgrade_engine):

Argument Does
open_container a container id of this room: its panel is open (the others shut)
verb a verb id: armed, so the verb bar shows it pressed
give item ids the player is already holding
set variables to start with, {"drawer_unlocked": true}
show_hotspots outline every hotspot — the quickest check that boxes sit on the painted objects

A container, verb or item that does not exist is refused up front with what the game does have.

Tool catalog#

Area Tools
Meta get_project_info, update_project_info, get_spec (an outline by default; section fetches any ## / ### heading; document: 'blueprint' or 'mcp' serves the other guides), doctor, open_project (switch to another game without restarting)
Scenes list_scenes, get_scene, create_scene, update_scene, delete_scene, duplicate_scene (a copy with text swapped)
Many alike rooms upsert_template / template_from_scene / list_templates / delete_template (a room with {{parameters}}), create_scenes_from_template (rooms made from it, in bulk), bulk_update_scenes (one edit across the scenes you select — planned first, written only with apply)
Hotspots add_hotspot, update_hotspot, remove_hotspot
Containers list_containers (each drawer / trunk with the hotspot ids the engine writes for it; edit them with update_scene, see get_spec 'Containers')
Items list_items, upsert_item (incl. combine recipes), delete_item
Hints list_hints, upsert_hint, delete_hint
Phone list_contacts, upsert_contact, delete_contact
Scripts list_scripts, write_script, delete_script (game-local GDScript: custom puzzles, steps, checks)
Characters list_characters, upsert_character (incl. actor poses and the talk conversation table), delete_character
Case board list_clues, upsert_clue, delete_clue, list_deductions, upsert_deduction, delete_deduction (clues the player finds; deductions they make by connecting them)
Achievements list_achievements, upsert_achievement, delete_achievement (earned by a condition, a counter or an unlock_achievement step; rename_id kind achievement)
Review export_script (the whole game as a readable script — Markdown or CSV — with open review comments pinned in), list_review_comments, add_review_comment, set_review_comment_status (resolve / reopen / delete)
UI lint lint_ui (pseudo-localised, 150% text: every room, panel, dialogue and puzzle scanned for text off the screen, cut off, or not translatable)
Mystery get_mystery, set_mystery, delete_mystery, check_mystery (the culprit — or candidates — each suspect's means/motive/opportunity/clears clues, the accusation and its consequences; check_mystery proves the case can be made for every candidate and flags unfair or unfindable clues)
Topics list_topics, upsert_topic, delete_topic (things characters can be asked about; replies live in each character's talk.ask)
Variables list_variables, set_variable, delete_variable
Dialogues list_dialogues, get_dialogue, upsert_dialogue, delete_dialogue
Budgets check_budgets (video memory per room and with the next rooms preloaded, picture sizes, size on disk, against project.json budget)
Places list_regions, upsert_region, delete_region (the location tree: a map and inherited defaults per place; rename_id kind region)
Doors list_links, upsert_link, delete_link (one entry = both hotspots of a door, with the arrival camera set)
Puzzles list_puzzles, get_puzzle, upsert_puzzle, delete_puzzle, list_puzzle_types (every built-in type's settings, defaults and limits), check_puzzles (each puzzle's solver proves it can be won — per difficulty level too)
Production production_report (per-room completion: pictures, voice, problems, memory; language coverage)
Music get_score, upsert_score_entry, delete_score_entry (adaptive tracks of stems, stingers, ambience beds)
Voice-over export_vo_script (a recording script per speaker), import_vo_takes (takes matched by line id, highest take wins, language packs), vo_status (coverage, placeholders, stale lines = pick-ups), check_loudness (BS.1770 LUFS and peaks by kind)
Assets list_assets, write_asset_text, generate_voice, import_assets, check_assets, set_asset_status, replace_asset, convert_audio, convert_video (a background job → WebM), list_voice_lines, generate_missing_voices, estimate_voices (AI voices from game/vo/casting.json: the price, free), record_voices (records them — spends, needs apply and max_usd)
Real art art_status, art_set_bible, art_plan, art_upsert_shot, art_delete_shot, art_estimate, art_generate (background job) / art_job, art_accept, art_calibrate (vision: are the hotspots where the painted objects are?) — see "Making real art" below
Verify & run validate_project, analyze_game (story check), find_softlocks (exact soft-lock search), write_walkthrough / list_walkthroughs / get_walkthrough / delete_walkthrough / run_walkthroughs (replayable playthroughs), play_typed (play the game as typed commands and read every reply — what a player sees, and what the gate's typed replay does), autoplay_game (a bot plays the game to its ending through the real UI and can save the route it found), list_endings / upsert_ending / delete_ending (named, starred endings, best first), release_check (the release gate at alpha / beta / gold), playtest_report (where testers got stuck, from their notes), export_handoff (layout guides + shot list for an outside artist), scene_diff (what changed in the rooms between two git revisions or folders, drawn before / after on one page), run_engine_tests, run_preview, stop_preview, screenshot_scene
Ship export_game (Web/macOS/Windows/Linux; needs export templates)
Refactor rename_id (rename a scene/item/variable/dialogue/puzzle/character/topic/clue/deduction and fix every reference, including conversation-table keys and a deduction's requires)
Upgrade upgrade_engine (bring this game's engine copy up to date; dry_run first)
Scaffold create_game (a small playable starter), blueprint_template / validate_blueprint / scaffold_from_blueprint (a whole mystery written as one document — the truth, the cast, rooms as lists of exits, people and things, the clues and who they clear — laid out, drawn and wired in one call; nothing is written unless valid and apply: true; BLUEPRINT.md)

Behavioral guarantees:

  • Atomic, canonical writes. Every mutation writes whole JSON docs atomically with stable key ordering — clean git diffs even when human and agent co-edit.
  • Inline warnings, deep validation on demand. Mutations return cheap cross-reference warnings; validate_project is the engine-grade pass and is also what run_preview gates on (it refuses to launch a game with errors).
  • Typo help. Unknown ids come back with "did you mean" suggestions.
  • Delete safety. Deleting a scene/item/dialogue/puzzle/character that is referenced elsewhere is refused unless force: true, and the dangling references are listed either way.

Video#

convert_video turns any video ffmpeg can read into the WebM (VP9 + Opus, optionally transparent) the engine plays through the mf_video extension — see SPEC "Video". It's a background job: the first call returns a job_id; call it again with that job_id until state is done (the result has the path, sizes and an ffprobe summary). source (an absolute path) makes a new game/assets/video/<name>.webm; replace (an existing game asset, e.g. an .ogv) converts it in place and rewrites every reference. preset is cutscene, loop (silent background) or actor (keeps transparency); max_height caps the size. doctor says whether ffmpeg has the encoders and whether the game carries the extension (upgrade_engine brings it); check_assets then flags a clip of the wrong shape, one that's too soft, slow seeking and so on.

Making real art#

The art tools turn placeholder pictures into real ones with AI image models (OpenAI for rooms, items and portraits; Blockade Labs Skybox for 360° panoramas). The format is docs/SPEC.md "Art workbook"; the Studio's Art panel drives the same files and code, so a human and an agent can trade turns on one shot list.

Keys. Set OPENAI_API_KEY (and BLOCKADE_API_KEY for panoramas) in the environment the MCP server runs in — in Claude Code, claude mcp add … -e OPENAI_API_KEY=… or your shell profile; in Claude Desktop, the server's env block. Tools never accept a key as an argument and never write or echo one; art_status reports only whether each is present. With no key, provider: "mock" paints a free deterministic stand-in so the whole workflow can be rehearsed.

Workflow.

  1. art_set_bible — the look every picture shares (a specific style paragraph is the biggest quality lever), the characters' looks, which provider paints what, and per-image prices for estimates.
  2. art_plan — a shot per scene background/panorama, item icon and character portrait that is still a placeholder or missing, with a first-draft prompt from what the game says is in the room. Refine with art_upsert_shot.
  3. art_estimate, and tell the user the cost before bulk runs — real providers charge per image.
  4. art_generate → job_id; poll art_job until done. Candidates are PNGs under game/art/.cache/… (paths in the report) — open them, judge them against the brief, then art_accept the best or tune the prompt and go again. Repeating an identical request is free (cache).
  5. art_accept replaces the placeholder everywhere (references follow, the stand-in is removed, provenance recorded). Then import_assets and validate_project.

After a room has its real picture, art_calibrate (one scene, or all) asks a vision model where each labelled hotspot's object is and reports which hotspots are off (nudge), which polygons to look at (review) and which objects it could not find (missing); apply: true moves the nudged rectangles and circles. It costs a few cents a room with the real provider (mock rehearses for free) — say so first.

An actor (a character standing in a room) needs full-length pictures: art_plan adds a pose shot (pose: "idle", painted from the portrait) for each, then a blink once the idle is accepted — art_accept writes them into actor.poses. Other poses (a wave, a point) are art_upsert_shot with kind: "pose", a character, a pose name and the idle's path in references.

Masked variants (kind: "variant": base + mask rect + scene + overlay) repaint one region of a finished room — a lit lamp, an opened drawer — and accepting one adds the overlay to the scene.

From a case file to a game#

blueprint_template hands back a small valid blueprint; edit it (or have the model write one from your case file), validate_blueprint says in words what is missing or unfair, and scaffold_from_blueprint writes the whole game — every room laid out with placeholder pictures, hotspots wired (locked doors, one-time pickups, puzzles), the accusation, hints, endings and a map. Then validate_project, analyze_game, find_softlocks and autoplay_game prove it, and the art pipeline replaces the placeholders.

Multiple games#

create_game scaffolds a complete standalone project: an engine copy plus a small playable tutorial mystery (two scenes, an item, a character with branching dialogue, a keypad puzzle that rewards a key, using that key on a gate, and a win) so a new game opens as a working example to edit, not a blank room. Run one MCP server per game, or restart the server with a different --project. The classic adventure-series model: the engine is identical in every game; only game/ differs.

This page as Markdown: /docs/mcp.md · Engine 0.101.0