Local Unity documentation RAG + MCP server for coding agents.
UnityRAG grounds Codex and Claude answers in official Unity offline docs for your selected version, with citations from local artifacts.
MCP tools: search / resolve_symbol / open / related / list_files / status
- Clone the repo and run setup.
git clone https://github.com/Razpines/UnityRAG.git
cd UnityRAG
# Windows
setup.bat
# macOS/Linux
bash setup.shSetup will prompt you for:
- Unity docs version (auto-suggested from detected local Unity editor installs; you can override)
- MCP client auto-config:
Codex,Claude Desktop,Both, orSkip - Setup writes machine-local mode overrides to
config.local.yaml(untracked), whileconfig.yamlremains tracked defaults. - MCP server configs include
UNITY_DOCS_MCP_UNITY_VERSIONso clients run against your selected docs version. - Setup currently forces
CPU-only(index.vector: none) while CUDA/hybrid setup is WIP.
-
Restart your agent.
-
Test:
- "How do I schedule an
IJobParallelForwith batch size?" - "Open
Mesh.SetVerticesand show related docs."
If you chose Skip, configure manually using files in examples/ with an absolute unitydocs-mcp path.
If setup fails, run:
unitydocs doctor
unitydocs doctor --json
unitydocs doctor --json --with-setup-snapshot
unitydocs report --summary setup-failure --prefill-issueUse the official CPU-first container image to run the MCP HTTP server without local Python/venv setup.
Run:
docker run -d --name unityrag \
-p 8765:8765 \
-e UNITY_DOCS_MCP_UNITY_VERSION=6000.3 \
-v unityrag-data:/app/data \
ghcr.io/razpines/unityrag:latestWait / first startup:
- First startup is slow: the container downloads Unity docs, bakes artifacts, and builds the FTS index.
- Watch progress with
docker logs -f unityrag. - Data persists across container recreation via the mounted volume (
/app/data).
Verify:
- MCP HTTP endpoint is
http://localhost:8765/mcp. - A plain
GET /mcpmay return406 Not Acceptable; this is expected for streamable HTTP when the client does not sendAccept: text/event-stream.
Connect (Codex CLI):
codex mcp add unity-docs-http --url http://localhost:8765/mcpCommon adjustments:
- Port
8765already in use: map a different host port, for example-p 8876:8765, then connect tohttp://localhost:8876/mcp. - Remote-hosted server: use
http://<host>:8765/mcp(or your remapped host port). - The Docker container must stay running while your MCP client is connected.
Container defaults (advanced):
UNITY_DOCS_MCP_ROOT=/appUNITY_DOCS_MCP_CONFIG=/app/config.docker.yaml(FTS-only / CPU-safe)UNITY_DOCS_MCP_HOST=0.0.0.0UNITY_DOCS_MCP_PORT=8765UNITY_DOCS_MCP_UNITY_VERSIONis required (set it explicitly when starting the container).
Client config details (Docker-hosted MCP):
docs/docker_http_clients.md
Initial Docker scope is CPU-only / FTS-only. GPU images and Docker Compose quick start are tracked separately.
- Uses official Unity offline docs for versioned retrieval.
- Hybrid retrieval with SQLite FTS and FAISS vectors, or explicit FTS-only mode for CPU-only setups.
- Local-first artifacts and server operation.
- Idempotent download, bake, and index steps.
For development and debugging, use manual setup and server start:
python -m venv .venv
# Windows: .\.venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate
pip install -e .[dev]
# CUDA/hybrid path is currently WIP in setup scripts.
# Manual experimental install:
# pip install -e .[dev,vector]
export UNITY_DOCS_MCP_UNITY_VERSION=6000.3 # Windows PowerShell: $env:UNITY_DOCS_MCP_UNITY_VERSION='6000.3'
unitydocs install --version 6000.3 --cleanup
unitydocs mcpNotes:
- Setup scripts currently force
CPU-onlymode and configureindex.vector: none. - CUDA/hybrid setup is temporarily WIP; use manual vector installs only if you are testing that path.
Optional advanced overrides:
UNITY_DOCS_MCP_UNITY_VERSION(required for runtime commands such asunitydocs mcp)UNITY_DOCS_MCP_ROOTUNITY_DOCS_MCP_CONFIGUNITY_DOCS_MCP_HOSTUNITY_DOCS_MCP_PORT
unitydocs install --version 6000.3
unitydocs mcp
unitydocs doctor
unitydocs report --summary "search returned bad results" --prefill-issue
unitydocs-benchmark --dataset benchmarks/eval/unity_queries_v1.jsonl --output benchmarks/results/latest.json
unitydocs-bake
unitydocs-index --dry-run
pytest- Read
.github/CONTRIBUTING.md.
- Developer details:
docs/README.md - Docker-hosted MCP clients:
docs/docker_http_clients.md
This project does not include Unity documentation. During setup, it downloads Unity's official offline docs and builds local artifacts on your machine.
Unity states code snippets are under the Unity Companion License, while other Manual and Scripting Reference content is under CC BY-NC-ND 4.0.
Do not commit data/ artifacts.
Built by an indie developer using coding agents daily, focused on reliable Unity citations over stale model memory.
More projects: https://razpines.github.io
