TrenchBroom MCP
Enables autonomous level design and compilation for GoldSource/Valve engine games, including parsing and validating Valve 220 .map files, driving the VHLT (hlcsg/hlbsp/hlvis/hlrad) compilation pipeline, analyzing BSPs for leaks and budgets, and verifying maps in HLDS/ReHLDS.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
TrenchBroom MCP
An autonomous GoldSource & TrenchBroom v2026.2 level design system built on FastMCP, a native C++/Qt TCP JSON-RPC bridge inside TrenchBroom, and a pure-Python GoldSource .map / VHLT analysis & compilation engine.
Architecture
┌──────────────────────────────────────────────────────────────────────┐
│ Tier 4 docs/MAPPING_DOCTRINE.md & docs/KNOWN_BSP_PITFALLS.md │
└───────────────────────────────▲──────────────────────────────────────┘
┌───────────────────────────────┴──────────────────────────────────────┐
│ Tier 3 mcp_server/server.py (FastMCP) & mcp_server/tbcli.py │
└───────▲───────────────────────────────────────────▲──────────────────┘
│ NDJSON JSON-RPC (127.0.0.1:6161) │ Python / subprocess
┌───────┴──────────────────────────┐ ┌────────────┴──────────────────┐
│ Tier 1 tb-bridge/ │ │ Tier 2 tools/ │
│ TrenchBroom C++ bridge │ │ goldsource_engine/ │
│ (lib/TbUiLib) │ │ wadgen.py │
└──────────────────────────────────┘ └───────────────────────────────┘Tier 1 (
tb-bridge/) — Native C++20/Qt6 TCP bridge (127.0.0.1:6161) patched into TrenchBroomv2026.2. Exposes 44+ RPC methods for document management, layers, CSG, vertex/edge/face sculpting, UV/texture alignment, entity creation, viewport camera control, and live OpenGL screenshot capture—all wrapped inmdl::Transactionfor full undo/redo support.Tier 2 (
tools/goldsource_engine/,tools/wadgen.py) — Pure-Python Valve 220.mapparser/validator, FGD parser, hull/step/clearance physics validator, A* navigation & sightline analyzer, SVG/PNG blueprint renderer, VHLT (hlcsg→hlbsp→hlvis→hlrad) pipeline driver with leak/budget parsing, and procedural WAD2 texture generator.Tier 3 (
mcp_server/) — FastMCP server (server.py) and standalone CLI (tbcli.py) exposing high-level level-design tools and raw RPC passthrough to any MCP-compatible LLM client.Tier 4 (
docs/) — Mapping doctrine, BSP pitfall reference, architecture notes, and build guides.
Related MCP server: spz-mcp
Repository Layout
├── .github/workflows/build-ubuntu22.yml # CI: builds TrenchBroom v2026.2 + MCP bridge
├── docs/
│ ├── ARCHITECTURE.md # 4-tier design & TrenchBroom 2026.2 API notes
│ ├── KNOWN_BSP_PITFALLS.md # GoldSource/VHLT limits & failure modes
│ ├── MAPPING_DOCTRINE.md # Proportions, lighting, terrain & workflow rules
│ ├── PROBLEM-BRIEF.md # Original engineering brief
│ └── WINDOWS-BUILD.md # Windows build notes
├── mcp_server/
│ ├── server.py # FastMCP server
│ ├── tb_client.py # NDJSON TCP client for the C++ bridge
│ └── tbcli.py # Standalone CLI (`tbcli`)
├── tb-bridge/
│ ├── apply.sh # Applies patch + C++ sources to TrenchBroom v2026.2
│ ├── lib/TbUiLib/ # McpServerBridge, McpNodeIndex, McpJson
│ └── patches/ # CMake + MapWindow/AppController integration patch
├── tests/
│ ├── test_e2e_autonomous_map.py # End-to-end map creation test
│ └── test_native_sculpting_dome.py # Native sculpting & dome array test
├── tools/
│ ├── goldsource_engine/ # Geometry, FGD, physics, nav, blueprint, VHLT
│ └── wadgen.py # Procedural GoldSource WAD2 generator
├── pyproject.toml
├── requirements.txt
└── LICENSEQuick Start
1. Build TrenchBroom with the MCP Bridge
You can either download the prebuilt artifact from the GitHub Actions workflow (.github/workflows/build-ubuntu22.yml) or build from source against TrenchBroom v2026.2:
git clone --branch v2026.2 --depth 1 https://github.com/TrenchBroom/TrenchBroom.git tb
cd tb && git submodule update --init --recursive && cd ..
./tb-bridge/apply.sh ./tb
cmake -S ./tb -B ./tb/build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="cmake/packages;/opt/Qt/6.10.0/gcc_64"
cmake --build ./tb/build --target TrenchBroom -j"$(nproc)"Launch TrenchBroom with the bridge enabled (listens on 127.0.0.1:6161 by default):
TB_MCP_PORT=6161 ./TrenchBroom2. Install the Python Package
Requires Python 3.10+:
pip install -e .
# Optional: include Pillow for tools/wadgen.py
pip install -e ".[wad]"Or with requirements.txt:
pip install -r requirements.txt3. Configure Your MCP Client
Add trenchbroom-mcp to your MCP client configuration (Claude Desktop, Cursor, OpenCode, Antigravity, etc.):
{
"mcpServers": {
"trenchbroom": {
"command": "trenchbroom-mcp",
"env": {
"TB_MCP_HOST": "127.0.0.1",
"TB_MCP_PORT": "6161",
"TB_MCP_WORKDIR": "/tmp/tb_mcp",
"TB_FGD": "/path/to/halflife-cs.fgd"
}
}
}
}4. Use the CLI (tbcli)
tbcli ping
tbcli state
tbcli open --game Half-Life --fgd /path/to/halflife-cs.fgd --wad /path/to/cstrike.wad
tbcli room -256,-256,0 256,256,128 --thickness 16
tbcli cap --pos 200,-200,160 --look 0,0,48 --out /tmp/preview.pngEnvironment Variables
Variable | Default | Description |
|
| Bridge TCP host |
|
| Bridge TCP port |
|
| Set |
| (unset) | Optional shared auth token for bridge RPCs |
|
| Working directory for saved |
| (unset) | Path to your |
| (unset) | Colon-separated |
| (unset) | Optional HLDS/ReHLDS root for |
License
GPL-3.0-or-later (consistent with upstream TrenchBroom).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate game-ready 3D models, textures, and audio from natural language, over MCP.
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
MCP server for AI dialogue using various LLM models via AceDataCloud
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- FlicenseCqualityDmaintenanceAn MCP server that exposes Discord bot actions as tools for LLM clients.291-
- AlicenseAqualityDmaintenanceMCP server that lets an LLM agent drive StableProjectorz, a 3D modeling app, by inspecting the loaded model, app state, viewport screenshots, and triggering UI actions via a loopback socket bridge.11MIT
- FlicenseAqualityCmaintenanceEnables AI agents to edit Quake-format .map files and see their changes appear live in TrenchBroom, with tools for reading, editing, previewing, compiling, and launching maps.172-
- AlicenseNot gradedqualityCmaintenanceEnables inspecting J.A.C.K. Map Editor documents and live selections, and previewing or applying limited native brush and entity edits through a stdio MCP client.MIT