unity-mcp/MCPForUnity
dsarno 6f3b869f3d
fix: speed up Claude Code config check by reading JSON directly (#682)
* fix: speed up Claude Code config check by reading JSON directly

Instead of running `claude mcp list` (15+ seconds due to health checks),
read the config directly from ~/.claude.json (instant).

Changes:
- Add ReadClaudeCodeConfig() to parse Claude's JSON config file
- Walk up directory tree to find config at parent directories
- Handle duplicate path entries (forward/backslash variants)
- Add beta/stable version mismatch detection with clear messages
- Add IsBetaPackageSource() to detect PyPI beta versions and prerelease ranges
- Change button label from "Register" to "Configure" for consistency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: speed up Claude Code config check by reading JSON directly

Instead of running `claude mcp list` (15+ seconds due to health checks),
read the config directly from ~/.claude.json (instant).

Changes:
- Add ReadClaudeCodeConfig() to parse Claude's JSON config file
- Walk up directory tree to find config at parent directories
- Handle duplicate path entries (forward/backslash variants)
- Add beta/stable version mismatch detection with clear messages
- Add IsBetaPackageSource() to detect PyPI beta versions and prerelease ranges
- Change button label from "Register" to "Configure" for consistency
- Refresh client status when switching to Connect tab or toggling beta mode

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: add VersionMismatch status for Claude Code config detection

- Add McpStatus.VersionMismatch enum value for version mismatch cases
- Show "Version Mismatch" with yellow warning indicator instead of "Error"
- Use VersionMismatch for beta/stable package source mismatches
- Keep Error status for transport mismatches and general errors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: add version mismatch warning banner in Server section

- Add version-mismatch-warning banner to McpConnectionSection.uxml
- Add UpdateVersionMismatchWarning method to show/hide the banner
- Fire OnClientConfigMismatch event when VersionMismatch status detected
- Wire up event in main window to update the warning banner
- Store mismatch details in configStatus for both Error and VersionMismatch

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: simplify version mismatch messages for non-technical users

Before: "Beta/stable mismatch: registered with beta 'mcpforunityserver>=0.0.0a0' but plugin is stable 'mcpforunityserver==9.4.0'."

After: "Configured for beta server, but 'Use Beta Server' is disabled in Advanced settings."

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: address PR review feedback

- Treat missing ~/.claude.json as "not configured" instead of error
  (distinguishes "no Claude Code installed" from actual read failures)
- Handle --from=VALUE format in ExtractPackageSourceFromConfig
  (in addition to existing --from VALUE format)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: add beta/stable version mismatch detection to all JSON-based clients

- Move GetExpectedPackageSourceForValidation() and IsBetaPackageSource()
  to base class so all configurators can use them
- Update JsonFileMcpConfigurator.CheckStatus() to use beta-aware comparison
- Show VersionMismatch status with clear messaging for Claude Desktop,
  Cursor, Windsurf, VS Code, and other JSON-based clients
- Auto-rewrite still attempts to fix mismatches automatically

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: add beta-aware validation to CodexMcpConfigurator

CodexMcpConfigurator was still using the non-beta-aware package source
comparison. Now uses GetExpectedPackageSourceForValidation() and shows
VersionMismatch status with clear messaging like other configurators.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 14:48:44 -08:00
..
Editor fix: speed up Claude Code config check by reading JSON directly (#682) 2026-02-03 14:48:44 -08:00
Runtime Update warning message for Camera Capture (#661) 2026-01-30 21:09:06 -05:00
Editor.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
README.md Update the manual commands (#638) 2026-01-26 23:32:20 -05:00
README.md.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
Runtime.meta Rename plugin folder to MCPForUnity (#303) 2025-10-03 20:23:28 -04:00
package.json chore: bump version to 9.4.0 2026-02-03 18:39:23 +00:00
package.json.meta Add .meta files (#472) 2025-12-19 18:59:19 -04:00

README.md

MCP for Unity — Editor Plugin Guide

Use this guide to configure and run MCP for Unity inside the Unity Editor. Installation is covered elsewhere; this document focuses on the Editor window, client configuration, and troubleshooting.

Open the window

  • Unity menu: Window > MCP for Unity

The window has four areas: Server Status, Unity Bridge, MCP Client Configuration, and Script Validation.


Quick start

  1. Open Window > MCP for Unity.
  2. Click “Auto-Setup”.
  3. If prompted:
    • Select the packaged server folder (Server) if you want to run the bundled implementation.
    • Install Python and/or uv/uvx if missing so the server can be managed locally.
    • For Claude Code, ensure the claude CLI is installed.
  4. Click “Start Bridge” if the Unity Bridge shows “Stopped”.
  5. Use your MCP client (Cursor, VS Code, Windsurf, Claude Code) to connect.

Server Status

  • Status dot and label:
    • Installed / Installed (Embedded) / Not Installed.
  • Mode and ports:
    • Mode: Auto or Standard.
    • Ports: Unity (varies; shown in UI), MCP 6500.
  • Actions:
    • Auto-Setup: Registers/updates your selected MCP client(s), ensures bridge connectivity. Shows “Connected ✓” after success.
    • Rebuild MCP Server: Rebuilds the Python based MCP server
    • Select server folder…: Choose the local Server folder (dev only; usually not needed when using uvx).
    • Verify again: Re-checks server presence.
    • If Python isnt detected, use “Open Install Instructions”.
  • HTTP Server Command foldout:
    • Expands to display the exact uvx command Unity will run.
    • Includes a copy button and the “Start Local HTTP Server” action so you can launch or reuse the command elsewhere.

Unity Bridge

  • Shows Running or Stopped with a status dot.
  • Start/Stop Bridge button toggles the Unity bridge process used by MCP clients to talk to Unity.
  • Tip: After Auto-Setup, the bridge may auto-start in Auto mode.

MCP Client Configuration

  • Select Client: Choose your target MCP client (e.g., Cursor, VS Code, Windsurf, Claude Code).
  • Per-client actions:
    • Cursor / VS Code / Windsurf:
      • Auto Configure: Writes/updates your config to launch the server via uvx with the current package version:
        • Command: uvx (or your overridden path)
        • Args: --from mcp-for-unity
      • Manual Setup: Opens a window with a pre-filled JSON snippet to copy/paste into your client config.
      • Choose UV Install Location: If uv/uvx isnt on PATH, select the executable.
      • A compact “Config:” line shows the resolved config file name once uv/server are detected.
    • Claude Code:
      • Register with Claude Code / Unregister MCP for Unity with Claude Code.
      • If the CLI isnt found, click “Choose Claude Install Location”.
      • The window displays the resolved Claude CLI path when detected.

Notes:

  • The UI shows a status dot and a short status text (e.g., “Configured”, “uv Not Found”, “Claude Not Found”).
  • Use “Auto Configure” for one-click setup; use “Manual Setup” when you prefer to review/copy config.

Script Validation

  • Validation Level options:
    • Basic — Only syntax checks
    • Standard — Syntax + Unity practices
    • Comprehensive — All checks + semantic analysis
    • Strict — Full semantic validation (requires Roslyn)
  • Pick a level based on your projects needs. A description is shown under the dropdown.

Troubleshooting


Tips

  • Use Cmd+Shift+M (macOS) / Ctrl+Shift+M (Windows, Linux) to toggle the MCP for Unity window.
  • Enable “Show Debug Logs” in the header for more details in the Console when diagnosing issues.