Files
mcp-ue/README.md
Pierre-Marie Charavel 77c972977a Fix search_source: pass env vars via mcp.json interpolation, search Plugins/, cap at 40 total lines
- .mcp.json: pass UE_ENGINE_ROOT and UE_DOCS_PATH via ${VAR} interpolation so the
  MCP server subprocess inherits them without hardcoding paths
- search_source: search both Engine/Source/ and Engine/Plugins/ (path_hint applied
  under both); switch from -m 40 (per-file cap) to streaming Popen with a true
  40-line total cap; fix UE_ENGINE_ROOT to point at Engine/ not the repo root
- Update README and CLAUDE.md to reflect the above

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 18:11:46 -05:00

3.1 KiB

mcp-ue

Generates compact, agent-readable Markdown documentation from Unreal Engine C++ header files and exposes it to Claude via an MCP server for item-granularity lookups.

How it works

  1. Parsedocgen/ue_parser.py scans UE headers into dataclasses using a position-based scanner (handles nested braces, macros, delegates, namespaces).
  2. Renderdocgen/ue_markdown.py emits one .md per header: only items with C++ doc comments, no deprecated functions, compact enum format. Headers with no documented content produce no output file.
  3. Indexdocgen/generate.py produces type-index.txt: a flat TypeName: path/to/File.md lookup for instant type resolution. Only types from files that were actually written are indexed.
  4. Serveue_mcp_server.py exposes the docs to Claude as callable MCP tools.

Usage

python docgen/generate.py <input> [input2 ...] <output_dir>

# Examples
python docgen/generate.py /path/to/UnrealEngine/Engine/Source/ docs/
python docgen/generate.py Runtime/Engine/ Runtime/AIModule/ Runtime/GameplayTags/ docs/
python docgen/generate.py Runtime/Engine/Classes/GameFramework/Actor.h docs/

The last argument is always the output directory. All preceding arguments are inputs (files or directories, processed recursively). Output: one .md per .h + docs/type-index.txt.

MCP Server

ue_mcp_server.py is a Claude Code MCP server that gives Claude item-granularity access to the generated docs — fetching one class overview or one function instead of an entire file.

Setup

pip install mcp
export UE_DOCS_PATH=/path/to/your/generated/docs
export UE_ENGINE_ROOT=/path/to/UnrealEngine/Engine   # optional, for search_source

The .mcp.json at the repo root registers the server automatically when you open the project in Claude Code. It reads UE_DOCS_PATH and UE_ENGINE_ROOT from your environment via ${VAR} interpolation — no paths are hardcoded.

Available tools

Tool Purpose
search_types(pattern) Regex search over type-index.txt — locate a type
get_class_overview(class_name) Description + base classes + property/function name lists
get_member(class_name, member_name) Full doc for one function or property (all overloads)
get_file(relative_path) Full .md file — for delegates, enums, or multiple classes
search_source(pattern, path_hint) Grep UE .h files in Engine/Source/ and Engine/Plugins/; returns up to 40 lines

Typical query flow

search_types("AIController")          → resolves to AIController.md
get_class_overview("AAIController")   → description + list of 40 function names
get_member("AAIController", "MoveToActor")  → full signature + doc

3 tool calls, ~15 lines of content — vs reading an entire 100-line file.

Output format

  • Functions: ##### `Name(params)` → `ReturnType` *(flags)*
  • Properties: - `name` `type` *(flags)* — description
  • Enums: table when values have descriptions, inline Values: A, B, C otherwise
  • Inheritance: *Inherits*: [BaseClass](relative/path.md) with corpus links