Skip to main content
Glama

unity-api-mcp

PyPI Version PyPI Downloads MCP Registry GitHub Stars GitHub Last Commit Weekly DB Build License: MIT Python 3.10+

AIエージェントに正確なUnity APIドキュメントを提供するMCPサーバー。幻覚のシグネチャ、間違った名前空間、非推奨APIの使用を防止します。

Unity 6(マイナーバージョンごとに1つのデータベース)、Unity 2023Unity 2022 LTSをサポート。Claude Code、Cursor、Windsurf、またはMCP互換のAIツールで動作します。Unityのインストールは不要です。対応バージョンはこちらをご覧ください。新しいUnityリリースは毎週自動検出され、データベースが構築されます。

クイックスタート

MCP設定(.mcp.jsonmcp.json、またはツールのMCP設定)に追加し、UNITY_VERSIONをプロジェクトに合わせて設定します:

{
  "mcpServers": {
    "unity-api": {
      "command": "uvx",
      "args": ["unity-api-mcp"],
      "env": {
        "UNITY_VERSION": "6000.3"
      }
    }
  }
}

有効な値:Unity 6のストリーム(例:"6000.3")、または"6""2023""2022"

初回実行時に、サーバーは正しいデータベース(約20~30 MB)を~/.unity-api-mcp/にダウンロードします。

Related MCP server: Funplay MCP for Unity

仕組み

  1. バージョン検出。 サーバーは提供するUnityバージョンを次のように決定します:

優先度

ソース

1

UNITY_VERSION 環境変数

"2022""6""6000.3"、または"6000.3.8f1"

2

UNITY_PROJECT_PATH

ProjectSettings/ProjectVersion.txtを読み取り、2022.3.62f1"2022"に、6000.3.8f1"6000.3"にマッピング

3

デフォルト

"6"

  1. データベースのダウンロード。 そのバージョンのデータベースがローカルにキャッシュされていない場合、GitHubからダウンロードします。Unity 6のマイナーストリーム(6000.06000.36000.5、…)は、ストリームごとに個別のデータベースを持ち、ストリームデータベースが公開されていない場合は汎用の6データベースにフォールバックします。キャッシュされたデータベースは起動時にリリースとの鮮度がチェックされるため、週次の再構築が既存のインストールに自動的に反映されます。

  2. 提供。 すべてのツール呼び出しは、バージョン固有のSQLiteデータベースにクエリを実行します。すべてのクエリは15ms未満で返ります。

各バージョンは、そのリリースに正しいシグネチャ、非推奨警告、メンバーリストを持つ独自のデータベースを持っています。

ツール

ツール

目的

search_unity_api

キーワードでAPIを検索

"Tilemap SetTile"、"async load scene"

get_method_signature

すべてのオーバーロードを含む正確なシグネチャ

UnityEngine.Physics.Raycast

get_namespace

using ディレクティブを解決

"SceneManager" -> using UnityEngine.SceneManagement;

get_class_reference

完全なクラスリファレンスカード

"InputAction" -> すべてのメソッド/フィールド/プロパティ

get_deprecation_warnings

APIが廃止されているか確認

"WWW" -> 代わりにUnityWebRequestを使用

カバレッジ

すべてのUnityEngineおよびUnityEditorモジュールに加え、C#ソースから解析されたパッケージ:Input System、Addressables、uGUI(Unity 6ではTextMeshProを含む)、AI Navigation、Netcode。Unity 6データベースあたり約42,500レコード、それぞれ約500の非推奨警告。

完全なバージョンリスト:db-v1 リリースページ。CIはビルドのたびにそのテーブルを再生成します。新しいUnityパッチは毎週月曜日に自動検出され、データベースが構築されます。

対象外: サードパーティ製アセット(DOTween、VContainer、Newtonsoft.Json)。これらについては、プロジェクトのソースに依存してください。

ベンチマーク

測定値であり、保証ではありません:3つのテスト環境で25の調査質問を、3つのエージェント設定で回答し、各回答を事前にソースで検証した正解と照合して評価しました。完全なテストハーネスはdocs/benchmark/にあり、1つのコマンドで再実行できます。

設定

正解

部分正解

誤り

幻覚API

MCP + 対象を絞ったRead

24/25

1

0

0

熟練(Grep+Read)

20/25

3

2

1

単純(全Read)

19/25

3

3

1

再現された1つの幻覚は示唆に富んでいます。SceneManager.LoadSceneAsyncのオーバーロード一覧を求められたとき、MCP以外の両エージェントは存在しない単一パラメータのLoadSceneAsync(string)LoadSceneAsync(int)のオーバーロードをでっち上げました。それらに基づいて書かれたコードはコンパイルできません。MCPエージェントは正確な4つの実際のオーバーロードを返しました。

なぜ正確性でトークン節約ではないのか?エージェンティックツールは現在コード検索が得意です。Claude Codeは最初からGrepツールを搭載しており、現在のモデルはまず検索してから狭い行範囲を読むため、生のトークン使用量はすべての設定でほぼ同等でした。しかし、正確なオーバーロード、名前空間、非推奨情報はプロジェクトファイルにはまったく含まれていません。MCPなしのエージェントは使用例から推測するしかなく、間違った推測をするとビルドが壊れるという代償を払うことになります。

  • 3つのテスト環境:実際のUnity 6ゲームプロジェクト(11問)、純粋なUnity APIルックアップ(8問)、2,700~4,600行のファイルを含むUnity Input Systemパッケージソース(6問)

  • 3つの設定、同じモデルとターン制限:MCPツール + Grep/Read、Grep/Readのみ、Readのみ

  • 正解はすべての実行前にソースを読んで検証。回答は別のモデルセッションでその正解と照合して判定。トークン使用量はAPI使用量フィールドから取得

  • 自分で実行:python docs/benchmark/run.py --project <unity-project-path>(2026年7月の結果。エージェントの動作は変化するため、引用前には再実行してください)

CLAUDE.md スニペット

プロジェクトのCLAUDE.md(または同等の指示ファイル)に追加してください。この手順は重要です。 これがないと、AIはツールを持っていても、いつそれを使うべきかわかりません。

## Unity API Lookup (unity-api MCP)

Use the `unity-api` MCP tools to verify Unity API usage instead of guessing. **Do not hallucinate signatures.**

| When | Tool | Example |
|------|------|---------|
| Unsure about a method's parameters or return type | `get_method_signature` | `get_method_signature("UnityEngine.Tilemaps.Tilemap.SetTile")` |
| Need the `using` directive for a type | `get_namespace` | `get_namespace("SceneManager")` |
| Want to see all members on a class | `get_class_reference` | `get_class_reference("InputAction")` |
| Searching for an API by keyword | `search_unity_api` | `search_unity_api("async load scene")` |
| Checking if an API is deprecated | `get_deprecation_warnings` | `get_deprecation_warnings("FindObjectOfType")` |

**Rules:**
- Before writing a Unity API call you haven't used in this conversation, verify the signature with `get_method_signature`
- Before adding a `using` directive, verify with `get_namespace` if unsure
- Covers: all UnityEngine/UnityEditor modules, Input System, Addressables, uGUI/TextMeshPro, AI Navigation, Netcode
- Does NOT cover: DOTween, VContainer, Newtonsoft.Json (third-party)

セットアップの詳細

UNITY_VERSIONを設定する代わりに、Unityプロジェクトを指定することもできます。サーバーはProjectSettings/ProjectVersion.txtを自動的に読み取ります:

{
  "mcpServers": {
    "unity-api": {
      "command": "uvx",
      "args": ["unity-api-mcp"],
      "env": {
        "UNITY_PROJECT_PATH": "/path/to/your/unity-project"
      }
    }
  }
}

pip install を使用:

pip install unity-api-mcp
{
  "mcpServers": {
    "unity-api": {
      "command": "unity-api-mcp",
      "args": [],
      "env": {
        "UNITY_VERSION": "6000.3"
      }
    }
  }
}

変数

目的

UNITY_VERSION

提供するUnityバージョン

6000.36000.3.8f1620232022

UNITY_PROJECT_PATH

プロジェクトからバージョンを自動検出

F:/Unity Projects/my-project

UNITY_INSTALL_PATH

Unityインストールパスを上書き(ingestのみ)

D:/Unity/6000.3.8f1

ダウンロードする代わりに、自分のUnityインストールからデータベースを構築する場合:

# Install with ingest dependencies
pip install unity-api-mcp[ingest]

# Windows
python -m unity_api_mcp.ingest --unity-version 6000.3 --unity-install "D:/Unity/6000.3.8f1" --project "F:/Unity Projects/MyProject"

# macOS
python -m unity_api_mcp.ingest --unity-version 6000.3 --unity-install "/Applications/Unity/Hub/Editor/6000.3.20f1" --project "/path/to/UnityProject"

# Legacy versions
python -m unity_api_mcp.ingest --unity-version 2022 --unity-install "D:/Unity/2022.3.62f1"

データベースはデフォルトで~/.unity-api-mcp/unity_docs_{version}.dbに書き込まれます。

AIエージェントがこれをセットアップする場合:

UNITY_VERSIONをプロジェクトに合わせて設定し、uvxを使用してunity-api-mcpをMCP設定に追加し、READMEからCLAUDE.mdスニペットを追加し、get_namespace("SceneManager")で確認してください。

unity-api-mcp/
├── src/unity_api_mcp/
│   ├── server.py          # MCP server (5 tools)
│   ├── db.py              # SQLite + FTS5 database layer
│   ├── version.py         # Version detection + DB download
│   ├── xml_parser.py      # Parse Unity XML IntelliSense files
│   ├── cs_doc_parser.py   # Parse C# doc comments from package source
│   ├── unity_paths.py     # Locate Unity install + package dirs
│   └── ingest.py          # CLI ingestion pipeline
└── pyproject.toml

データベースは~/.unity-api-mcp/に保存されます(初回実行時にダウンロード)。

トラブルシューティング

問題

修正

"Could not download Unity X database"

インターネット接続を確認。またはローカルで構築:python -m unity_api_mcp.ingest --unity-version 2022

提供されるAPIバージョンが間違っている

UNITY_VERSIONを明示的に設定。標準エラー出力を確認:unity-api-mcp: serving Unity <version> API docs

サーバーが起動しない

python --versionを確認(3.10+が必要)。パスを確認:which unity-api-mcp または where unity-api-mcp

サードパーティパッケージが結果を返さない

DOTween、VContainer、Newtonsoft.Jsonはインデックスされていません(サードパーティ製であり、Unityパッケージではありません)


関連情報

unreal-api-mcp:Unreal Engine(C++)向けの同様のコンセプト。UEバージョンごとに毎週自動構築されるデータベース。

連絡先

エンジンやフレームワーク向けのカスタムMCPサーバーが必要ですか?AI支援ゲーム開発向けに、トークンの無駄を削減し幻覚を防止するMCPツールを構築しています。チームのスタックに同様のものが必要な場合は、ご連絡ください。

fuatcankoseoglu@gmail.com

ライセンス

MIT

A
license - permissive license
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
3wRelease cycle
8Releases (12mo)
Commit activity
Issues opened vs closed

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    -
    quality
    D
    maintenance
    An intelligent MCP server that enables AI agents to crawl, index, and semantically search official framework documentation using local RAG. It prevents hallucinations by providing precise, up-to-date documentation excerpts directly into the AI's context window.
    1
  • A
    license
    -
    quality
    A
    maintenance
    This MCP server integrates AI assistants with Unity Editor, allowing them to create scenes, generate scripts, simulate input, and automate workflows using 91 built-in tools.
    214
    MIT
  • A
    license
    -
    quality
    B
    maintenance
    An MCP server that provides tools to fetch live, version-accurate documentation, changelogs, examples, and method signatures for npm and PyPI packages, preventing AI coding agents from hallucinating stale APIs.
    16
    ISC

View all related MCP servers

Related MCP Connectors

  • Augments MCP Server - A comprehensive framework documentation provider for Claude Code

  • An MCP server that gives your AI access to the source code and docs of all public github repos

  • Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Codeturion/unity-api-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server