# MysteryForge — quickstart for AI agents

You are about to work with **MysteryForge** (by Insurrection Studios, engine 0.101.0): a studio for classic first-person, point-and-click mystery adventure games built on Godot 4.7.2. A game is a folder of documented JSON plus assets. People edit it in MysteryForge Studio; you edit the same files through the **MysteryForge MCP server** (137 tools). Both write byte-identical canonical JSON, so your edits and a human's never fight.

This page is everything you need to connect and work. Fetchable references:

- https://mysteryforge.vivalainsurreccion.com/agents/tools.md — every tool and its arguments (generated from the server)
- https://mysteryforge.vivalainsurreccion.com/agents/art-integrations.md — working alongside QxSprite's MCP server and Blender
- https://mysteryforge.vivalainsurreccion.com/docs/spec.md — the game format (the server also serves it: `get_spec`)
- https://mysteryforge.vivalainsurreccion.com/llms-full.txt — all of the above in one file

## 1. Connect

The server is a local **stdio** MCP server. It needs Node.js 18+ and, for anything that runs the game (validation, screenshots, checks), Godot 4.7.2. The user downloads MysteryForge from https://vivalainsurreccion.itch.io/mysteryforge and unzips it; call that folder `MF` below.

**Claude Code, inside the MysteryForge folder:** nothing to do. `MF/.mcp.json` declares the server (on the bundled demo game) and `MF/AGENTS.md` is this page. Approve the project server when asked.

**Claude Code, anywhere else:**

```bash
claude mcp add mysteryforge -- /path/to/MF/mysteryforge mcp /path/to/a/game
```

**Claude Desktop** (`claude_desktop_config.json`), **Cursor** (`.cursor/mcp.json`), **Windsurf**, and most clients:

```json
{
  "mcpServers": {
    "mysteryforge": {
      "command": "/path/to/MF/mysteryforge",
      "args": ["mcp", "/path/to/a/game"]
    }
  }
}
```

**VS Code** (`.vscode/mcp.json`):

```json
{ "servers": { "mysteryforge": { "type": "stdio", "command": "/path/to/MF/mysteryforge", "args": ["mcp", "/path/to/a/game"] } } }
```

**OpenAI Codex CLI** (`~/.codex/config.toml`):

```toml
[mcp_servers.mysteryforge]
command = "/path/to/MF/mysteryforge"
args = ["mcp", "/path/to/a/game"]
```

On **Windows** the command is `C:\\path\\to\\MF\\mysteryforge.cmd`. Without the launcher, run the server directly: `node MF/mcp/dist/index.js --project <game> [--godot <path-to-godot>]`. Godot is found through `--godot`, `GODOT_BIN`, `/Applications/Godot.app`, or `godot` on the PATH. `MF/mysteryforge mcp-config [game]` prints all of these with the real paths filled in.

The game argument is optional: without it the server opens the bundled demo, and you can switch games at any time without a restart (`open_project`). One server edits one game at a time.

## 2. Orient yourself (every session)

1. **`doctor`** — is Godot found, which game is open, what is missing.
2. **`get_project_info`** — the game's title, start room, counts of everything.
3. **`get_spec`** — the format. It returns an outline; pass `section` for one heading (`"Hotspots"`, `"Actions"`, `"Conditions"`, `"Puzzle types"`, `"Actors"`…). **Read the section before you write a field you have not used.** `document: "blueprint"` and `document: "mcp"` serve the other two guides.

No game yet? `create_game` (a small, playable starter you then grow), `scaffold_from_blueprint` (a whole mystery from one document; `blueprint_template` shows the shape, `validate_blueprint` checks it first), or `open_project` on an existing folder. The first two open the game they make.

## 3. Conventions

- **Ids are snake_case** and unique within their kind. A thing is named by `<kind>_id` (`scene_id`, `item_id`, `hotspot_id`, `dialogue_id`…); a whole document is passed under the kind's name (`scene`, `item`); a game folder is `project_path`; a file you write is `output_path`. An argument a tool does not take is an **error that lists what it does take** — read it and retry.
- **Coordinates are fractions** 0..1 of the picture (x, y from the top-left). A rectangle is `[x, y, w, h]`. Rooms are designed at 1920 × 1080.
- **Paths are project-relative** (`game/assets/backgrounds/study.webp`), never `res://`.
- **All on-screen text is translatable source text**: write it in the game's language, in full sentences; `{$var}` inserts a variable's value.
- **Out-of-order references are fine.** Mutations return cheap `warnings` for references that do not resolve yet; they are reminders, not the real check.

## 4. The work loop

1. Build with the fine-grained tools: `create_scene`, `add_hotspot` / `update_hotspot`, `upsert_item`, `upsert_character`, `upsert_dialogue`, `upsert_puzzle`, `set_variable`, `upsert_clue` / `upsert_deduction`, `set_mystery`, `upsert_ending`, `upsert_hint`, `upsert_link` (doors), `upsert_region` (the map). Many alike rooms: `upsert_template` + `create_scenes_from_template`; one change across many rooms: `bulk_update_scenes` (planned first, written only with `apply`).
2. Look at what you made: **`screenshot_scene`** returns the room as the player sees it (`show_hotspots: true` outlines every hotspot; `give`, `set`, `open_container`, `verb` set up a state first). Check that boxes sit on the painted objects.
3. **Finish every edit with the checks**, in this order, and fix the game until they pass:

| Check | Tool | Passing means |
|---|---|---|
| Data | `validate_project` | 0 errors (warnings explained or fixed) |
| Story | `analyze_game` | every room reachable, every clue findable, a win exists |
| Soft-locks | `find_softlocks` | the exact search completes with no point of no return, every ending reached |
| Puzzles | `check_puzzles` | every puzzle instance proved solvable at every difficulty |
| Mystery | `check_mystery` | the accusation can be made, with proof, for the culprit |
| Play | `autoplay_game` | a bot plays to the ending through the real UI (it can save the route as a walkthrough) |
| Interface | `lint_ui` | no text cut off or untranslatable at 150% size |

`run_walkthroughs` replays recorded routes as regression tests; `run_engine_tests` runs the engine's own tests; `release_check` is the whole release gate (`alpha`, `beta`, `gold`).

4. Show the human: `run_preview` launches the game in a window (`scene_id` to start in a room).

**Never weaken a check to make it pass** — no deleting a walkthrough, no loosening a puzzle's proof, no hiding a hotspot from the bot. Fix the game.

## 5. Design rules the checks cannot see

- **Clue → inference → action.** The player finds a clue, works something out, and acts on it. Never put a puzzle's answer in plain text, an item description or an unprompted line of dialogue. No trial-and-error minigames. Hints are gradual and opt-in (`upsert_hint`).
- **Every room needs a way out**, even one the story only passes through; a room with no exit hotspot slows the soft-lock search for the whole game.
- **A later hotspot is on top.** A hotspot entirely under a later, always-shown one can never be clicked (the validator errors on it).
- **Show where the talk happens.** Conversations should match the room on screen; people present in a conversation should be in the room (set the variable that shows them *before* `start_dialogue`).
- **A line is said once.** Mark conversation replies `once`, and give a hotspot a variable (or a verb's `after` line) so a second click gets a short answer, not the whole speech again.
- Use game-local scripts (`write_script`) only for genuine one-offs, never to avoid a format feature that exists.

## 6. Pictures, sound and voice

- **Placeholder art you draw:** `write_asset_text` writes an SVG (backgrounds 1920×1080, item icons 256×256, portraits 512×512). Godot's SVG renderer draws **no `<text>`**, and draws `hsl()` colours and 8-digit hex as solid black: use 6-digit hex with `fill-opacity`.
- **Real files:** `import_assets` brings files in; `replace_asset` swaps a placeholder for the real thing (even a different format) and rewrites every reference; `check_assets` lists what is still placeholder or wrong (soft, cropped, oversized, an uncompressed WAV).
- **Generated art** (`art_plan`, `art_estimate`, `art_generate`, `art_accept`, `art_calibrate`) calls paid image providers with keys **from the environment only** (`OPENAI_API_KEY`, `BLOCKADE_API_KEY`). Always run `art_estimate` and get the user's go-ahead before spending; never ask for, store or log a key.
- **Sprites and animation** from QxSprite, and **rooms rendered in Blender**: see https://mysteryforge.vivalainsurreccion.com/agents/art-integrations.md.
- **Voices:** `generate_missing_voices` records a placeholder for every unrecorded line (a stable voice per character); `list_voice_lines` / `vo_status` report coverage; real takes replace them (`import_vo_takes`). Paid AI voices (`estimate_voices`, then `record_voices`) need the user's go-ahead and a dollar cap.
- **Audio:** prefer OGG (`convert_audio`); `check_loudness` / `normalize_loudness` keep levels consistent.

## 7. Shipping

`export_game` builds for a platform (needs Godot's export templates: `MF/mysteryforge templates`). `release_check` runs the gate. Packaging, signing and store uploads are human-run scripts inside the game (`tools/package.py`, `tools/itch.py`, `tools/deploy_cloudflare.py`); see https://mysteryforge.vivalainsurreccion.com/docs/handbook.md. `upgrade_engine` brings a game's own engine copy up to date with the installed MysteryForge.

## 8. Which tool for which job

| Job | Tools |
|---|---|
| Orient | `doctor`, `get_project_info`, `get_spec`, `open_project` |
| Rooms | `list_scenes`, `get_scene`, `create_scene`, `update_scene`, `duplicate_scene`, `delete_scene`, `scene_diff` |
| Hotspots | `add_hotspot`, `update_hotspot`, `remove_hotspot`, `list_containers` |
| Things and people | `upsert_item`, `upsert_character`, `upsert_contact` (phone), `list_*` |
| Conversations | `upsert_dialogue`, `get_dialogue`, `upsert_topic` |
| Logic | `set_variable`, `write_script` |
| The mystery | `upsert_clue`, `upsert_deduction`, `set_mystery`, `get_mystery`, `upsert_ending`, `upsert_achievement` |
| Puzzles | `list_puzzle_types`, `upsert_puzzle`, `get_puzzle`, `check_puzzles` |
| Doors and map | `upsert_link`, `upsert_region` |
| Music | `get_score`, `upsert_score_entry` |
| Checks | `validate_project`, `analyze_game`, `find_softlocks`, `check_mystery`, `check_puzzles`, `autoplay_game`, `run_walkthroughs`, `lint_ui`, `check_budgets`, `release_check` |
| See and play | `screenshot_scene`, `run_preview`, `stop_preview`, `play_typed` (play as typed commands) |
| Writers and review | `export_script`, `export_vo_script`, `add_review_comment`, `list_review_comments` |
| Renames | `rename_id` (rewrites every reference, in every file) |
| Hand-off | `export_handoff` (layout guides and a shot list for an outside artist) |

The full list with every argument: https://mysteryforge.vivalainsurreccion.com/agents/tools.md.
