From 5cda0cc6c6823752ed57ea9152165bcf5acf4c70 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Charavel Date: Fri, 27 Feb 2026 08:22:14 -0500 Subject: [PATCH] Update README: MCP server, multi-directory input, remove samples section Co-Authored-By: Claude Sonnet 4.6 --- README.md | 56 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 8d0a991..59fda39 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,67 @@ # UnrealDocGenerator -Generates compact, agent-readable Markdown documentation from Unreal Engine C++ header files, plus a Claude Code skill for querying it. +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. **Parse** — `ue_parser.py` scans UE headers into dataclasses using a position-based scanner (handles nested braces, macros, delegates, namespaces). 2. **Render** — `ue_markdown.py` emits one `.md` per header: only items with C++ doc comments, no deprecated functions, compact enum format. 3. **Index** — `generate.py` produces `type-index.txt`: a flat `TypeName: path/to/File.md` lookup for instant type resolution. +4. **Serve** — `ue_mcp_server.py` exposes the docs to Claude as callable MCP tools. ## Usage ```bash -python generate.py +python generate.py [input2 ...] # Examples python generate.py /path/to/UnrealEngine/Engine/Source/ docs/ -python generate.py samples/AIController.h docs/ +python generate.py Runtime/Engine/ Runtime/AIModule/ Runtime/GameplayTags/ docs/ +python generate.py Runtime/Engine/Classes/GameFramework/Actor.h docs/ ``` -Output: one `.md` per `.h` + `docs/type-index.txt`. +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`. -## Querying the docs (Claude Code skill) +## MCP Server -The repo includes a Claude Code skill at `.claude/skills/ue-api/` that answers Unreal Engine API questions using the generated docs, falling back to source headers when needed. +`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. -Set two environment variables before starting Claude Code: +### Setup + +```bash +pip install mcp +``` ```bash export UE_DOCS_PATH=/path/to/your/generated/docs -export UE_ENGINE_ROOT=/path/to/UnrealEngine # optional, for source fallback +export UE_ENGINE_ROOT=/path/to/UnrealEngine # optional, for search_source ``` -The skill triggers automatically on UE-related questions. It resolves types via `$UE_DOCS_PATH/type-index.txt` in a single grep, reads the relevant `.md` files, and escalates to source headers for undocumented members, macros, or implementation details. +The `.mcp.json` at the repo root registers the server automatically when you open the project in Claude Code. -**Example lookup:** -```bash -grep "^AController:" "$UE_DOCS_PATH/type-index.txt" -# → AController: Engine/Classes/GameFramework/Controller.md +### 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 source `.h` files via `$UE_ENGINE_ROOT` | + +### 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 ``` -## Samples - -Three representative UE headers in `samples/` for testing: - -| File | Size | Contents | -|---|---|---| -| `GeomUtils.h` | ~6 KB | Free functions in `UE::AI` namespace | -| `AIController.h` | ~22 KB | `AAIController` with movement, BT, perception | -| `GameplayTagsManager.h` | ~43 KB | `UGameplayTagsManager` singleton, delegates, enums | +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` +- 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