Documentation Index
Fetch the complete documentation index at: https://mintlify.com/davidbuenov/dbv-mcp-server/llms.txt
Use this file to discover all available pages before exploring further.
bridge.py is a lightweight stdio-to-HTTP proxy that makes Unreal Engine’s MCP server consumable by any standard MCP client — Claude Desktop, Claude Code, or any other tool that speaks JSON-RPC 2.0 over stdin/stdout. It handles session negotiation, tool discovery caching, and namespace resolution entirely transparently, so the client never needs to know about Unreal’s internal transport format.
Role in the architecture
bridge.py uses only Python’s standard library (http.client, json, sys, os, re, hashlib) — no external packages are needed.
Session management
Unreal’s MCP server requires a stable session identifier to be injected as anMcp-Session-Id HTTP header after the initial handshake. bridge.py manages this transparently with a single global variable:
initialize handshake), Unreal returns an Mcp-Session-Id response header. bridge.py stores it immediately:
tools/list interception and toolset flattening
Unreal’s MCP server exposes tools through a multi-level toolset hierarchy. Most MCP clients expect a flat list of individually named tools. When bridge.py receives a tools/list request, it does not proxy it to Unreal — instead it intercepts it and calls get_flattened_tools():
- Calls
list_toolsetsinternally to get all registered toolset names. - Computes an MD5 hash of the toolset list and checks
.mcp_tools_cache.jsonon disk. - If the hash matches the cache, returns tools directly from disk (zero network calls).
- If not, calls
describe_toolsetfor each toolset, extracts everytoolentry, and appends them to the flat list alongside three built-in navigation tools (list_toolsets,describe_toolset,call_tool). - Saves the rebuilt list to
.mcp_tools_cache.jsonfor future use.
tools/call translation and namespace rewriting
Unreal tool names are fully-qualified dotted paths like editor_toolset.toolsets.scene.SceneTools.SpawnActor. When an MCP client calls a tool by that name, bridge.py intercepts the tools/call request and splits the name on the last dot:
call_tool or describe_toolset directly and passes a toolset_name argument — those are also passed through translate_toolset_name.
Namespace translation (translate_toolset_name)
MCP clients sometimes use short or partial toolset names (e.g. SceneTools) rather than fully-qualified names (e.g. editor_toolset.toolsets.scene.SceneTools). translate_toolset_name resolves these automatically by reading .mcp_tools_cache.json:
- Builds the set of all registered toolset prefixes from cached tool names (everything before the last
.). - Checks for an exact match first.
- If no exact match, performs case-insensitive suffix matching on the last segment:
SceneTools, scenetools, and editor_toolset.toolsets.scene.SceneTools all resolve to the same fully-qualified name without any manual configuration.
SSE response handling
Unreal streams tool call responses astext/event-stream. bridge.py reads the stream line-by-line, extracts data: lines, validates the JSON, and writes a single compact line to stdout:
flush=True ensures every response is delivered to the MCP client immediately without buffering.
Main loop
The bridge reads one JSON-RPC message per line from stdin, processes it, and loops:handle_request dispatches each line to the appropriate path: interception for tools/list, translation for tools/call, or transparent proxy for everything else (including the initial initialize / notifications/initialized handshake).
MCP notifications (messages without an id field) are forwarded to Unreal but their responses are consumed silently — no stdout write is performed, matching the JSON-RPC 2.0 notification contract.
Error handling
If an HTTP error or network exception occurs,bridge.py emits a well-formed JSON-RPC error response to stdout rather than crashing: