Configuration

February 14, 2026 · View on GitHub

English | 日本語

Configuration is optional; defaults work out of the box.

This project uses:

  • Node side: environment variables
  • Unity side: Project Settings (host/port)

Node (Environment Variables)

Set environment variables when launching the Node MCP server process.

Minimal Example

export UNITY_MCP_MCP_HOST=localhost
export UNITY_MCP_PORT=6400
export UNITY_PROJECT_ROOT=.

Common Variables

EnvDefaultNotes
UNITY_PROJECT_ROOTauto-detectUnity project root (directory containing Assets/ and Packages/)
UNITY_MCP_MCP_HOSTlocalhostHost where the Node server connects to Unity
UNITY_MCP_PORT6400Unity Editor TCP port
UNITY_MCP_LOG_LEVELinfodebug, info, warn, error
UNITY_MCP_VERSION_MISMATCHwarnwarn (default), error, off
UNITY_MCP_HTTP_ENABLEDfalseEnable HTTP transport (/healthz exposed)
UNITY_MCP_HTTP_PORT6401HTTP port (when enabled)
UNITY_MCP_TELEMETRY_ENABLEDfalseCan also be controlled by command flags
UNITY_MCP_LSP_REQUEST_TIMEOUT_MS60000LSP request timeout (ms)
UNITY_MCP_TOOL_INCLUDE_CATEGORIES(unset)Comma-separated allowlist categories for tools/list (e.g. scene,gameobject,script)
UNITY_MCP_TOOL_EXCLUDE_CATEGORIES(unset)Comma-separated denylist categories for tools/list (e.g. ui,input,addressables)

Tool Category Filtering (for clients with tool-count limits)

Some MCP clients reject servers when too many tools are exposed. Use category filters to reduce tools/list output.

Example:

export UNITY_MCP_TOOL_INCLUDE_CATEGORIES=system,scene,gameobject,analysis,script
export UNITY_MCP_TOOL_EXCLUDE_CATEGORIES=ui,input,addressables,video,screenshot,profiler

Supported categories: system, gameobject, scene, analysis, playmode, ui, input, asset, prefab, material, addressables, menu, console, screenshot, video, component, compilation, test, editor, settings, package, script, profiler

Unity (Project Settings)

Unity: Edit → Project Settings → Unity MCP Server

  • Host: bind/listen host for the Unity-side TCP listener (localhost, 0.0.0.0, etc.)
  • Port: TCP port (must match UNITY_MCP_PORT)

Click Apply & Restart to restart the Unity listener (and trigger a reimport).


日本語

設定は任意です(デフォルトで動きます)。

このプロジェクトは次の方式で設定します。

  • Node側: 環境変数
  • Unity側: Project Settings(host/port)

Node(環境変数)

Node MCP サーバープロセス起動時に環境変数を設定してください。

最小例

export UNITY_MCP_MCP_HOST=localhost
export UNITY_MCP_PORT=6400
export UNITY_PROJECT_ROOT=.

よく使う環境変数

環境変数デフォルト補足
UNITY_PROJECT_ROOT自動検出Unityプロジェクトルート(Assets/Packages/ を含む)
UNITY_MCP_MCP_HOSTlocalhostNode が Unity に接続するホスト
UNITY_MCP_PORT6400Unity Editor TCPポート
UNITY_MCP_LOG_LEVELinfodebug, info, warn, error
UNITY_MCP_VERSION_MISMATCHwarnwarn(デフォルト), error, off
UNITY_MCP_HTTP_ENABLEDfalseHTTPトランスポート有効化(/healthz
UNITY_MCP_HTTP_PORT6401HTTPポート
UNITY_MCP_TELEMETRY_ENABLEDfalseコマンドフラグでも切替可能
UNITY_MCP_LSP_REQUEST_TIMEOUT_MS60000LSP リクエストタイムアウト(ms)
UNITY_MCP_TOOL_INCLUDE_CATEGORIES未設定tools/list の公開カテゴリをカンマ区切りで指定(例: scene,gameobject,script
UNITY_MCP_TOOL_EXCLUDE_CATEGORIES未設定tools/list の除外カテゴリをカンマ区切りで指定(例: ui,input,addressables

ツールカテゴリフィルタ(ツール数上限のあるクライアント向け)

一部のMCPクライアントは、ツール数が多いとサーバーを有効化できません。
カテゴリフィルタで tools/list の公開件数を減らせます。

例:

export UNITY_MCP_TOOL_INCLUDE_CATEGORIES=system,scene,gameobject,analysis,script
export UNITY_MCP_TOOL_EXCLUDE_CATEGORIES=ui,input,addressables,video,screenshot,profiler

指定可能カテゴリ: system, gameobject, scene, analysis, playmode, ui, input, asset, prefab, material, addressables, menu, console, screenshot, video, component, compilation, test, editor, settings, package, script, profiler

Unity(Project Settings)

Unity: Edit → Project Settings → Unity MCP Server

  • Host: Unity 側 TCP リスナーの待ち受けホスト(localhost, 0.0.0.0 など)
  • Port: TCP ポート(UNITY_MCP_PORT と一致させる)

Apply & Restart を押すと Unity 側のリスナーを再起動します(Reimport も実行)。