Skip to content

About

TrenchBroom level editor with a built-in MCP server: let Claude Code, Codex and other AI agents inspect and edit Quake maps (brushes, entities, CSG, camera, screenshots) over local HTTP.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

 
 

Repository files navigation

TrenchBroom MCP

TrenchBroom Icon

TrenchBroom MCP is a fork of TrenchBroom, the modern cross-platform level editor for Quake-engine based games. It adds a Model Context Protocol server inside the editor, so AI agents such as Claude Code, Codex or Gemini CLI can inspect and edit the open map. Everything else is upstream TrenchBroom.

Report problems with this fork in its issues, not upstream's. For TrenchBroom itself:

The MCP server

Enabling it

Open Preferences → MCP and check Enable MCP server. The setting is saved, and the server starts and stops immediately. It listens on http://127.0.0.1:6767/mcp by default; the port can be changed in the same tab. Then connect your agent:

claude mcp add --transport http trenchbroom http://127.0.0.1:6767/mcp
codex mcp add trenchbroom --url http://127.0.0.1:6767/mcp
gemini mcp add --transport http trenchbroom http://127.0.0.1:6767/mcp

Other clients, such as Cursor, accept {"mcpServers": {"trenchbroom": {"url": "http://127.0.0.1:6767/mcp"}}} in their mcp.json.

Tools

The tools act on the map in the front window. Each call is a single step in the undo history, so you can undo anything the agent did; batch runs several calls as one step.

Area Tools
Inspect get_map_info (including groups, the game's brush entity classes and its description of worldspawn), list_entities, list_brushes (filter by box or material, optionally with exact faces; brushes and entities have ids), list_materials, list_entity_definitions, probe (floor, ceiling, headroom and whether the player fits at a point, standing or crouching, and which entities' models are in the way), reach (rooms and points the player can't get to from the start, flying or walking), set_player (crouch, step and jump heights the game doesn't tell the editor, stored in the map), list_issues (the editor's issue browser)
Select select (all, none, invert, classname, material, group, everything fully or partly inside a box; by id; adding to or removing from the selection; inside a named group, opening it first), group_selection, ungroup_selection, open_group, close_group
Build build_voids (rooms from their air space, see below), carve_opening (doors and windows), move_opening (moves a doorway along a wall, or the gap where a moved passage meets one, closing the wall behind it), create_shape (stairs, ramp, cylinder, cone, sphere, pipe, arch), create_box_brush, create_brush_from_points, create_entity
Edit set_entity_property, set_material, set_face_materials (by face direction), translate_selection, stretch (moves everything past a plane, optionally within a box, so the brushes crossing it get longer or shorter: resizes and moves rooms with their contents), rotate_selection, scale_selection (by factors, or to exact bounds), duplicate_selection, delete_selection, csg (merge, subtract, intersect, hollow with a wall thickness)
View render_view (labelled top, front and side plans with a coordinate grid), set_camera, screenshot (PNG of the 3D view, from its camera or from any point without moving the user's view)
File batch, undo, redo, save

build_voids takes the inside of each room or corridor and builds floor, ceiling and walls around it. The wall pieces butt together without overlapping, and voids in the same call that touch are connected. A room built later reuses existing walls instead of doubling them, and only cuts into existing brushes when asked to (carve), which also opens it into the room behind. For outdoor areas, sides of a room can be left open, such as the top of a street under a skybox. Each room becomes a named group. Materials can be given per face direction (top, bottom, sides, +x, ...), with a separate material for outer faces that defaults to the game's caulk.

The server also tells agents the suggested workflow on connect, and get_map_info reports the player's size from the game's player start, so agents scale rooms and doors to the game. build_voids and carve_opening can also fill each room or opening with a brush entity (fill), for games that mark open space with one; agents are told to look for such a class before building.

Every edit also reports the problems it causes, checked on what it added or changed, leaving out problems the changed things already had: overlapping world brushes, entities stuck in brushes or in each other (by the size of their models, not just their class's box), walkable surfaces with less headroom than the player is tall, and new editor issues (except empty property values and non-integer vertices, which list_issues still lists).

Security

The server is off by default and only accepts connections from this computer. It rejects requests from web pages by checking the Origin header. There is no authentication, so while the server is on, any local program can control the editor. save only writes absolute .map paths and never overwrites a file other than the map's own.

Building

This fork also needs the Qt HttpServer module, in addition to what BUILD.md lists. With the official Qt installer, select Qt HTTP Server under Additional Libraries. Without a Qt account, you can install it with aqtinstall, for example aqt install-qt windows desktop 6.10.3 win64_msvc2022_64 -m qthttpserver qtwebsockets.

Features

  • General
    • Full support for editing in 3D and in up to three 2D views
    • High performance renderer with support for huge maps
    • Unlimited Undo and Redo
    • Macro-like command repetition
    • Issue browser with automatic quick fixes
    • Point file support
    • Automatic backups
    • .obj file export
    • Free and cross platform
  • Brush Editing
    • Robust vertex editing with edge and face splitting and manipulating multiple vertices together
    • Clipping tool with two and three points
    • Scaling and shearing tools
    • CSG operations: merge, subtract, intersect
    • UV view for easy texture manipulations
    • Precise texture lock for all brush editing operations
    • Multiple material collections
  • Entity Editing
    • Entity browser with drag and drop support
    • Support for FGD and DEF files for entity definitions
    • Mod support
    • Entity link visualization
    • Displays 3D models in the editor
    • Smart entity property editors
  • Supported Games
    • Quake (Standard and Valve 220 file formats)
    • Quake 2
    • Quake 3 (partial, no patches or brush primitives yet)
    • Hexen 2
    • Daikatana
    • Generic (for custom engines)
    • More games can be supported with custom game configurations

Releases

There are no builds of TrenchBroom MCP yet, so build it yourself (see Compiling). It doesn't update itself, because upstream's releases don't include the MCP server, and it shares its preferences and game configurations with an installed TrenchBroom.

Compiling

Read BUILD.md for instructions.

Contributing

See CONTRIBUTING.md for more information.

Credits

Changes

See this fork's commits for its changes, and TrenchBroom's releases for upstream's.

About

TrenchBroom level editor with a built-in MCP server: let Claude Code, Codex and other AI agents inspect and edit Quake maps (brushes, entities, CSG, camera, screenshots) over local HTTP.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages