
Unity API Documentation
io.github.Codeturion由 GitHub 帳號 Codeturion 發布v2.1.1更新於 Oct 24, 2026
Accurate Unity API docs (2022/2023/6) for AI agents. Prevents hallucinated signatures.
概覽
一個本機 MCP 伺服器,為 AI 助理提供 Unity 2022、2023 與 6 的準確 API 文件,用來核對方法簽章、命名空間與棄用資訊。
- 可以做什麼
- 依關鍵字搜尋 Unity API,涵蓋 UnityEngine、UnityEditor 以及 Input System、Addressables、uGUI/TextMeshPro、AI Navigation、Netcode 等套件。取得包含所有多載的精确方法簽章,以及列出方法、欄位與屬性的完整類別參考。解析某個型別應使用的 using 指示詞,並檢查 API 是否已棄用及其替代方案。所有結果來自本機依版本區分的 SQLite 資料庫查詢。
- 適用情境
- 適合助理撰寫或審查 Unity C# 程式碼時,需要核實确切的多載、命名空間或棄用狀態,而不是從用法範例推測。最適合使用 Unity 2022 LTS、2023 或 Unity 6,且依賴內建模組與上述 Unity 套件的專案。
- 執行需求
- 以 Python 套件形式在本機執行(需 Python 3.10 以上),可透過 uvx 或 pip 安裝,不需安裝 Unity。需設定 UNITY_VERSION(例如 2022、2023、6 或 6000.3 這類版本流),或設定 UNITY_PROJECT_PATH 從 ProjectSettings/ProjectVersion.txt 自動辨識;否則預設使用 Unity 6。首次執行需連網,從網路下載約 20-30 MB 的資料庫到使用者主目錄。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Unity API Documentation,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
unity-api-mcp
[PyPI Version] [PyPI Downloads] [MCP Registry] [GitHub Stars] [GitHub Last Commit] [Weekly DB Build] [License: MIT] [Python 3.10+]
MCP server that gives AI agents accurate Unity API documentation. Prevents hallucinated signatures, wrong namespaces, and deprecated API usage.
Supports Unity 6 (one database per minor stream), Unity 2023, and Unity 2022 LTS. Works with Claude Code, Cursor, Windsurf, or any MCP-compatible AI tool. No Unity installation required. See the supported versions. New Unity releases are detected and built automatically every week.
Quick Start
Add to your MCP config (.mcp.json, mcp.json, or your tool's MCP settings), setting UNITY_VERSION to match your project:
Valid values: a Unity 6 stream like "6000.3", or "6", "2023", "2022".
On first run the server downloads the correct database (~20-30 MB) to ~/.unity-api-mcp/.
How It Works
- Version detection. The server figures out which Unity version to serve:
-
Database download. If the database for that version isn't cached locally, it downloads from GitHub. Unity 6 minor streams (
6000.0,6000.3,6000.5, …) get their own per-stream database, falling back to the generic6database when a stream database isn't published. Cached databases are freshness-checked against the release on startup, so weekly rebuilds reach existing installs automatically. -
Serve. All tool calls query the version-specific SQLite database. Every query returns in <15ms.
Each version has its own database with the correct signatures, deprecation warnings, and member lists for that release.
Tools
Coverage
All UnityEngine and UnityEditor modules, plus packages parsed from C# source: Input System, Addressables, uGUI (incl. TextMeshPro on Unity 6), AI Navigation, and Netcode. ~42,500 records per Unity 6 database, ~500 deprecation warnings each.
Full version list: db-v1 release page. CI regenerates that table on every build. New Unity patches are detected and built automatically every Monday.
Does not cover third-party assets (DOTween, VContainer, Newtonsoft.Json). For those, rely on project source.
Benchmarks
Measured, not promised: 25 research questions across 3 testbeds, answered by 3 agent configs, every answer judged against ground truth verified in the source beforehand. The full harness lives in docs/benchmark/ and re-runs with one command.
The one reproduced hallucination is instructive. Asked to list the overloads of SceneManager.LoadSceneAsync, both non-MCP agents invented single-parameter LoadSceneAsync(string) and LoadSceneAsync(int) overloads that do not exist. Code written against them does not compile. The MCP agent returned the exact four real overloads.
Why correctness and not token savings? Agentic tools are good at code search now. Claude Code has shipped a Grep tool from the start, and current models search first and then read a narrow line range, so raw token use was comparable across all configs in our runs. But exact overloads, namespaces, and deprecations are not in your project files at all. An agent without MCP can only infer them from usage examples, and when it infers wrong you pay with a broken build.
Methodology
- 3 testbeds: a real Unity 6 game project (11 questions), pure Unity API lookups (8), and Unity Input System package source with 2,700 to 4,600 line files (6)
- 3 configs, same model and turn limit: MCP tools + Grep/Read, Grep/Read only, Read only
- Ground truth verified by reading the source before any runs; answers judged by a separate model session against that ground truth; token usage taken from API usage fields
- Run it yourself:
python docs/benchmark/run.py --project <unity-project-path>(results from July 2026; agent behavior moves, so re-run before quoting)
CLAUDE.md Snippet
Add this to your project's CLAUDE.md (or equivalent instructions file). This step is important. Without it, the AI has the tools but won't know when to reach for them.
Setup Details
Auto-detect version from project path
Instead of setting UNITY_VERSION, you can point to your Unity project. The server reads ProjectSettings/ProjectVersion.txt automatically:
Alternative installation methods
Using pip install:
Environment variables
Building databases locally
If you want to build a database from your own Unity installation instead of downloading:
Databases are written to ~/.unity-api-mcp/unity_docs_{version}.db by default.
AI-Assisted Setup
If an AI agent is setting this up for you:
Add
unity-api-mcpto my MCP config usinguvxwithUNITY_VERSIONset to match my project, append the CLAUDE.md snippet from the README, and verify withget_namespace("SceneManager").
Project structure
Databases are stored in ~/.unity-api-mcp/ (downloaded on first run).
Troubleshooting
See Also
unreal-api-mcp: same concept for Unreal Engine (C++), with weekly auto-built databases per UE version.
Contact
Need a custom MCP server for your engine or framework? I build MCP tools that cut token waste and prevent hallucinations for AI-assisted game development. If you want something similar for your team's stack, reach out.
License
來源:README.md,提交 3f65d1d
工具
0版本歷史
2- v2.1.1最新Oct 12, 2026
- v2.1.0Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分