Player guide: https://killrunmp.eu/map-creator-mcp Tool schemas: https://killrunmp.eu/map-creator-mcp-tools.json # Level Editor MCP (preview) An opt-in **local stdio MCP server** lets an agent inspect and edit an already open arena in Killrun's runtime Level Editor. Windows and Linux/Proton use the same file protocol. The Python server runs on the host OS, outside Proton. There is no internet endpoint, TCP listener, arbitrary Lua evaluator, console tool, desktop screenshot or gameplay control. The lab bridge is not enabled. In the user-opened Linux/Proton preview 3 session, all 12 original tools were called. Placement, position/rotation/scale, ground, grid material, duplication, grouping, deletion, undo/redo, rename, selection, camera movement/framing, validation, viewport capture and save/export succeeded. Ungrouping exposed a locked-group selection toggle bug. The original 19-object scene, selection and camera were restored exactly before save/export. No harness or additional game instance was launched. Native Windows remains unverified. Preview 4 fixes group selection and adds three workflow tools (15 tools total), batch references, relative transforms, filtered reads and dry-run planning. These additions passed a user-led Linux/Proton live test on `testmcp`: 23 requests without errors, three-piece grouped placement with named references and grid material, translation, 45-degree yaw, 150% scale, 2×2 grid repetition, custom-offset repetition, ungroup/regroup, filtered reads, dry-run planning and camera framing. Returned transforms confirmed preserved spacing and copy properties. All 15 temporary objects were removed; the original 19 objects, selection and camera matched the initial snapshot exactly. No map was saved during this test. Windows behavior and gameplay traversal remain unverified. ## Install and connect The player guide is at **https://killrunmp.eu/map-creator-mcp**, with generated Windows/Proton commands for Codex, Claude, Antigravity/agy, Pi, Hermes and generic local MCP clients. Open it from **Level Editor → Help / F1 → Open MCP guide**. Close help with its cross, Escape, F1 or a click outside the panel before asking the agent to edit. The help panel blocks automation like other editor dialogs. Install the matching mod package, including its `native/krmp_native.dll` and `mcp/` folder, while Killrun is closed. Keep the existing maps and settings. A DLL already loaded by the game cannot gain the new commands until restart. Python 3.10 or newer is required. The SDK is pinned in `requirements.txt`. In the installed `ue4ss/Mods/KillrunMP` directory, Linux/Proton: ```sh python3 -m venv mcp/.venv mcp/.venv/bin/python -m pip install -r mcp/requirements.txt mcp/.venv/bin/python mcp/setup.py enable --mod-dir "$PWD" > editor-mcp-client.json ``` Windows PowerShell, from the same mod directory: ```powershell py -3 -m venv mcp/.venv .\mcp\.venv\Scripts\python.exe -m pip install -r mcp/requirements.txt .\mcp\.venv\Scripts\python.exe mcp/setup.py enable --mod-dir "$PWD" | Out-File -Encoding utf8 editor-mcp-client.json ``` Merge the `killrun-editor` entry in `editor-mcp-client.json` into your agent client's MCP server configuration. It contains an absolute Python executable, server script and mod directory; it contains **no token**. Clients using a configuration format other than `mcpServers` need the same command and args in their own format. The client launches the server on demand over stdio. Do not run `server.py` interactively and expect a web interface. Restart Killrun after enabling. Open **Level Editor**, then create or edit an arena. The agent can call `editor_get_context` to check availability. Every other tool is rejected outside the Level Editor. The availability response outside the editor contains no scene, camera or gameplay state. Editor commands are also refused during a modal dialog, prefab editing, pending placement, or a conflicting mouse/camera/gizmo gesture. To disable immediately on the next game tick: ```sh mcp/.venv/bin/python mcp/setup.py disable --mod-dir "$PWD" ``` Use the Windows Python path above on Windows. Re-enabling requires a game restart. If configuration is removed or changes during a running session, the service stops. Its HUD status remains visible as Off. ## HUD status The arena editor header contains a coloured MCP dot and a readable action label beside the arena title. The same badge appears in the Level Editor library and its dialogs, so availability is visible before an arena opens. It inherits the editor's 75% layout and does not intercept mouse input. | Dot | Meaning | | --- | --- | | Grey | MCP disabled | | Killrun blue | Waiting for an agent, or for the arena view to be available | | Green | Agent server connected / last request complete | | Amber | Reading context, library or scene; editing, selecting, moving camera, validating, saving or exporting | | Purple | Capturing the editor viewport | | Red | Request failed or bridge unavailable/stopped | A client heartbeat expires after six seconds. “Agent connected” means that an MCP server process owns this instance, not that a model is currently issuing a command. Actual operations get a named action label. Errors remain visible for eight seconds; fatal bridge errors remain until restart. The indicator exists only in Level Editor screens, never in the general main menu or match HUD. ## Tools and workflow 1. `editor_get_context`: availability, arena title/ID, dirty state, camera and scene revision. 2. `editor_get_constraints`: units, limits, required markers, traversal rules and unsupported features, drawn from the map schema. 3. `editor_list_assets`: live catalog, categories, installed pack assets and prefab entries. Use returned asset IDs and `can_place`; never guess tags. 4. `editor_get_scene`: paged objects with stable IDs, transforms, groups, marker semantics and supported editable properties. Filter by `ids`, `query`, `kind`, `group` and/or `selected`; filters intersect. `total` counts matches, `scene_total` counts the full scene, and `groups` lists complete group membership so agents can include every member of a locked group. Page through `total`; pages used together must have the same `scene_revision`. 5. `editor_edit`: up to 32 sequential actions: `place`, `transform`, `transform_group`, `parameters`, `duplicate`, `delete`, `group`, `ungroup`, `ground`, `rename`, `undo`, `redo`. Undo/redo must be the sole action in a request. `ref` on place/duplicate binds the resulting IDs; later `ids` or final `focus_ids` may include `@ref`. Unknown/forward/duplicate references are rejected before editing. `dry_run` validates the plan without edits. 6. `editor_select`, `editor_set_camera`, `editor_frame_objects`: scene selection and the native editor camera, including Frame Selection. 7. `editor_screenshot`: PNG content plus before/after scene context. Keep the editor window rendering. `show_ui` defaults to true. This captures the game viewport, excluding the OS hardware cursor. Delivered PNGs are removed from the transport directory. A scene change during capture is reported. 8. `editor_validate`: the same validation used to save arenas; reports the first blocking issue. It does not simulate gameplay or test collisions. 9. `editor_save`, `editor_export`: validate and persist; export also saves, using the normal editor export location. They cannot write arbitrary paths. 10. `editor_place_group`: build a layout from local object positions plus a world `origin` and optional `yaw`. Objects accept live `asset_id`, optional rotation, scale, supported parameters and a reference `name`. Grouping and framing default to true. Placement still uses native snapping. 11. `editor_repeat_objects`: repeat a selection at explicit world translation `offsets` **or** a `grid` with axis `counts` and `step`. Grid counts include the original cell, which is skipped; offsets always refer to the original selection. At most 31 copies. Zero/duplicate offsets are rejected. `group` optionally joins the new copies, excluding the source; `focus` defaults true. Result references are `copy_1`, `copy_2`, etc. 12. `editor_transform_group`: preserve relative spacing while applying uniform `factor`, world-Z `yaw`, then world `translation`. `pivot` defaults to the mean of selected object origins, not mesh bounds. Existing object pitch/ roll are retained. Both grouped and ungrouped selections work; marker rotation and scale restrictions still apply. Optional `focus` defaults false. All three workflow tools accept `dry_run` and send one bounded editor batch. At most **32 actions and 128 newly created objects** per request. Parameter and group actions count toward the 32-action limit. A dry run checks references, types, transforms and cumulative capacities; it cannot prove native group behavior, final snapping, live property availability or collision clearance. Mutations, camera and selection require the current `expected_revision`. If a player changes the scene between reading and editing, `SCENE_CHANGED` rejects the request. Re-read before proceeding. Selection/camera changes do not alter that scene revision. Camera metadata comes from the rendered frame cache; a camera movement can appear in the next observation. IDs survive native undo recreation but are scoped to the current editor session; re-read after loading another arena. Example `editor_edit` arguments, substituting the real revision and asset ID: ```json { "expected_revision": "", "actions": [ { "op": "place", "asset_id": "", "position": {"x": 0, "y": 0, "z": 100}, "rotation": {"pitch": 0, "yaw": 90, "roll": 0}, "scale": {"x": 4, "y": 1, "z": 2} } ] } ``` Placement follows the editor's current move snapping; read back the resulting transform after placement. Transform edits are **absolute**, positions are centimetres and rotation is in degrees (X forward, Y right, Z up). Duplicate takes a translation `offset`. Read the returned object ID and `supported_properties` before changing its colour, stair corner, ground steps, intensity or grid material. New IDs cannot be guessed; use `ref`/`@ref` to target them within a batch. Native undo covers scene operations; arena renaming follows the existing draft-title behaviour and is not a native geometry undo event. For example, `editor_place_group` builds and frames two named walls in one request (substitute a live asset ID and current scene revision): ```json { "expected_revision": "", "origin": {"x": 0, "y": 0, "z": 30300}, "objects": [ {"name": "left", "asset_id": "", "position": {"x": -400, "y": 0, "z": 0}, "scale": {"x": 1, "y": 8, "z": 6}}, {"name": "right", "asset_id": "", "position": {"x": 400, "y": 0, "z": 0}, "scale": {"x": 1, "y": 8, "z": 6}} ], "group": true, "focus": true } ``` Edit replies contain `references` mapping names to real IDs, per-action `affected` IDs, and up to 128 surviving changed `objects` with actual transforms and supported properties. Reuse these and `context.scene_revision` for the next call. Only fetch a filtered scene page when more information is needed. Deleted IDs remain in `affected` but are absent from `objects`; history operations still require a scene read. Catalog lookup is skipped for batches without placement, and the HUD palette refresh happens once after the batch rather than after every action. No gameplay/FPS performance improvement is claimed. **Batches are not atomic.** Preflight rejects invalid initial arguments, but a runtime failure returns the completed prefix and may leave part of the failed action. Do not replay a failed or timed-out batch. Inspect, then use native Undo or a targeted correction. A timeout can mean the command applied but the response was lost. The transport never retries a mutation automatically. If final framing fails, `failed_stage: "focus"` explicitly reports that the edits have completed; do not replay them. A whole layout has multiple native undo steps, not a single atomic undo transaction. ## Constraints and current limits - Only supported multiplayer geometry, lights, installed pack assets and S&D / ladder / vault markers can be placed. Prefab placement/editing is UI-only. - Limits come from shared map validation: 1,024 geometry/pack objects, 32 lights, 16 packs, 1–5 starts per team, one shootout start per team, one bomb, A/B sites, two bounds corners, up to 256 ladders and 256 vault boxes. - Required markers can be temporarily missing while editing. Validation/save reject invalid final arenas. Placement and duplication enforce count limits. - Only sites, ladders and vault boxes have saved editable dimensions. Starts and shootout starts save position/yaw; bomb and bounds markers save position. - Ladder/vault and site volumes stay upright and rotate around yaw. Scale × 100 gives their full size in cm. Ladder/vault full dimensions: 2–20,000 cm; site dimensions: 50–20,000 cm. Use constraints output for coordinate limits. - Ladder arrows face away from the wall; vault arrows face the landing. Actual player clearance, collisions and traversal need a human playtest. - Traversal maps require schema 5 support on all peers. MCP does not change gameplay networking or expose server administration. - The player opens/creates the arena. No menu automation, travel, import, pack downloads, publishing, playtesting or arbitrary filesystem API exists. - Calls run on the game thread, on demand. Large batches/scene reads can take time; use small batches and page size. The HUD status itself does not scan the scene or read files per frame. ## Isolation and protocol `setup.py enable` creates `editor-mcp.json` with a random 256-bit token and an explicit instance (default `EditorMain`). It creates `editor-mcp//` for requests, responses, sessions and client heartbeat. These are local credentials/runtime files; they are ignored by Git and are never included in a release. Treat this as a local same-user integration, not a security boundary against other processes running as your OS user. One Python server holds an OS file lock per instance. The game checks token, instance, session ID, deadline, method and editor context, then consumes a request before executing it. Session IDs change on restart. A recent existing game session blocks another from taking ownership. Use **separate mod installations** for multiple games, not just different client instance names. A dedicated server never starts this service. If `KRMP_INST` is set, it must match the configured instance exactly; existing lab instances are not used. Requests and replies are bounded JSON files, published by rename. The game accepts only typed editor operations. Screenshot filenames are generated from request IDs inside the fixed instance directory. There is no eval, class-path spawn, general console command, shell invocation or path parameter. Source: `tools/editor_mcp/`, `editor_api.lua`, `editor_mcp.lua`, and the small native readiness/placement extension in `native/editor_objects.hpp`.