* Remove stray .meta file
* Add a new project that will do asset uploads
* Add asset store uploader
* refactor: Replace Debug.Log calls with McpLog helper across codebase
Standardize logging by replacing direct Debug.Log/LogWarning/LogError calls
with McpLog.Info/Warn/Error throughout helper classes and client registry.
Affected files:
- McpClientRegistry.cs
- GameObjectLookup.cs
- GameObjectSerializer.cs
- MaterialOps.cs
- McpConfigurationHelper.cs
- ObjectResolver.cs
- PropertyConversion.cs
- UnityJsonSerializer.cs
- UnityTypeResolver.cs
* feat: Add Asset Store release preparation script
Add prepare_unity_asset_store_release.py tool to automate Asset Store packaging:
- Stages temporary copy of MCPForUnity with Asset Store-specific edits
- Removes auto-popup setup window ([InitializeOnLoad] attribute)
- Renames menu entry to "Local Setup Window" for clarity
- Sets default HTTP base URL to hosted endpoint
- Defaults transport to HTTPRemote instead of HTTPLocal
- Supports dry-run mode and optional backup of existing Assets/MCPForUnity
* Show gif of MCP for Unity in Action
* Add shield with asset store link
* Update README to have asset store page unders installation section
* feat: Redesign GameObject API for better LLM ergonomics
- find_gameobjects: Search GameObjects, returns paginated instance IDs only
- manage_components: Component lifecycle (add, remove, set_property)
- unity://scene/gameobject/{id}: Single GameObject data (no component serialization)
- unity://scene/gameobject/{id}/components: All components (paginated)
- unity://scene/gameobject/{id}/component/{name}: Single component by type
- manage_scene get_hierarchy: Now includes componentTypes array
- manage_gameobject: Slimmed to lifecycle only (create, modify, delete)
- Legacy actions (find, get_components, etc.) log deprecation warnings
- ParamCoercion: Centralized int/bool/float/string coercion
- VectorParsing: Vector3/Vector2/Quaternion/Color parsing
- GameObjectLookup: Centralized GameObject search logic
- 76 new Unity EditMode tests for ManageGameObject actions
- 21 new pytest tests for Python tools/resources
- New NL/T CI suite for GameObject API (GO-0 to GO-5)
Addresses LLM confusion with parameter overload by splitting into
focused tools and read-only resources.
* feat: Add GameObject API stress tests and NL/T suite updates
Stress Tests (12 new tests):
- BulkCreate small/medium batches
- FindGameObjects pagination with by_component search
- AddComponents to single object
- GetComponents with full serialization
- SetComponentProperties (complex Rigidbody)
- Deep hierarchy creation and path lookup
- GetHierarchy with large scenes
- Resource read performance tests
- RapidFire create-modify-delete cycles
NL/T Suite Updates:
- Added GO-0..GO-10 tests in nl-gameobject-suite.md
- Fixed tool naming: mcp__unity__ → mcp__UnityMCP__
Other:
- Fixed LongUnityScriptClaudeTest.cs compilation errors
- Added reports/, .claude/local/, scripts/local-test/ to .gitignore
All 254 EditMode tests pass (250 run, 4 explicit skips)
* fix: Address code review feedback
- ParamCoercion: Use CultureInfo.InvariantCulture for float parsing
- ManageComponents: Move Transform removal check before GetComponent
- ManageGameObjectFindTests: Use try-finally for LogAssert.ignoreFailingMessages
- VectorParsing: Document that quaternions are not auto-normalized
- gameobject.py: Prefix unused ctx parameter with underscore
* fix: Address more code review feedback
NL/T Prompt Fixes:
- nl-gameobject-suite.md: Remove non-existent list_resources/read_resource from AllowedTools
- nl-gameobject-suite.md: Fix parameter names (component_type, properties)
- nl-unity-suite-nl.md: Remove unused manage_editor from AllowedTools
Test Fixes:
- GameObjectAPIStressTests: Add null check to ToJObject helper
- GameObjectAPIStressTests: Clarify AudioSource usage comment
- ManageGameObjectFindTests: Use built-in 'UI' layer instead of 'Water'
- LongUnityScriptClaudeTest: Clean up NL/T test artifacts (Counte42 typo, HasTarget)
* docs: update README tools and resources lists
- Add missing tools: manage_components, batch_execute, find_gameobjects, refresh_unity
- Add missing resources: gameobject_api, editor_state_v2
- Make descriptions more concise across all tools and resources
- Ensure documentation matches current MCP server functionality
* chore: Remove accidentally committed test artifacts
- Remove Materials folder (40 .mat files from interactive testing)
- Remove Shaders folder (5 noise shaders from testing)
- Remove test scripts (Bounce*, CylinderBounce* from testing)
- Remove Temp.meta and commit.sh
* refactor: remove deprecated manage_gameobject actions
- Remove deprecated switch cases: find, get_components, get_component, add_component, remove_component, set_component_property
- Remove deprecated wrapper methods (423 lines deleted from ManageGameObject.cs)
- Delete ManageGameObjectFindTests.cs (tests deprecated 'find' action)
- Remove deprecated test methods from ManageGameObjectTests.cs
- Add GameObject resource URIs to README documentation
- Add batch_execute performance tips to README, tool description, and gameobject_api resource
- Enhance batch_execute description to emphasize 10-100x performance gains
Total: ~1200 lines removed. New API (find_gameobjects, manage_components, resources) is the recommended path forward.
* refactor: consolidate shared services across MCP tools
Major architectural improvements:
- Create UnityJsonSerializer for shared JSON/Unity type conversion
- Create ObjectResolver for unified object resolution (GameObjects, Components, Assets)
- Create UnityTypeResolver for consolidated type resolution with caching
- Create PropertyConversion for unified JSON→Unity property conversion
- Create ComponentOps for low-level component operations
- Create Pagination helpers for standardized pagination across tools
Tool simplifications:
- ManageGameObject: Remove 68-line prefab redirect anti-pattern, delegate to helpers
- ManageAsset: Remove ~80 lines duplicate ConvertJTokenToType
- ManageScriptableObject: Remove ~40 lines duplicate ResolveType
- ManageComponents: Use ComponentOps, UnityTypeResolver (~90 lines saved)
- ManageMaterial: Standardize to SuccessResponse/ErrorResponse patterns
- FindGameObjects: Use PaginationRequest/PaginationResponse
- GameObjectLookup: FindComponentType delegates to UnityTypeResolver
Tests: 242/246 passed, 4 skipped (expected)
* Apply code review feedback: consolidate utilities and improve compatibility
Python Server:
- Extract normalize_properties() to shared utils.py (removes duplication)
- Move search_term validation before preflight() for fail-fast
- Fix manage_script.py documentation (remove incorrect 'update' reference)
- Remove stale comments in execute_menu_item.py, manage_editor.py
- Remove misleading destructiveHint from manage_shader.py
C# Unity:
- Add Vector4Converter (commonly used, was missing)
- Fix Unity 2021 compatibility: replace FindObjectsByType with FindObjectsOfType
- Add path normalization in ObjectResolver before StartsWith check
- Improve ComponentOps.SetProperty conversion error detection
- Add Undo.RecordObject in ManageComponents before property modifications
- Improve error message clarity in ManageMaterial.cs
- Add defensive error handling to stress test ToJObject helper
- Increase CI timeout thresholds for test stability
GitHub Workflows:
- Fix GO test sorting in markdown output (GO-10 now sorts after GO-9)
- Add warning logging for fragment parsing errors
* Fix animator hash names in test fixture to match parameter names
BlendXHash/BlendYHash now use 'reachX'/'reachY' to match the
actual animator parameter names.
* fix(windows): improve HTTP server detection and auto-start reliability
- Fix netstat detection on Windows by running netstat.exe directly instead
of piping through findstr (findstr returns exit code 1 when no matches,
causing false detection failures)
- Increase auto-start retry attempts (20→30) and delays (2s→3s) to handle
slow server starts during first install, version upgrades, and dev mode
- Only attempt blind connection after 20 failed detection attempts to reduce
connection error spam during server startup
- Remove verbose debug logs that were spamming the console every frame
* fix: auto-create tags and remove deprecated manage_gameobject actions
- ManageGameObject.cs: Check tag existence before setting; auto-create
undefined tags using InternalEditorUtility.AddTag() instead of relying
on exception handling (Unity logs warning, doesn't throw)
- manage_gameobject.py: Remove deprecated actions (find, get_components,
add_component, remove_component, set_component_property, get_component)
from Literal type - these are now handled by find_gameobjects and
manage_components tools
- Update test suite and unit tests to reflect new auto-create behavior
* fix: address code review feedback
Bug fixes:
- Fix searchInactive flag ignored in FindObjectsOfType (use includeInactive overload)
- Fix property lookup to try both original and normalized names for backwards compat
- Remove dead code for deprecated 'find' action validation
- Update error message to list only valid actions
Improvements:
- Add destructiveHint=True to manage_shader tool
- Limit fallback connection attempts (every 3rd attempt) to avoid spamming errors
- Consolidate PropertyConversion exception handlers to single catch block
- Add tag existence assertion and cleanup in tag auto-creation tests
Test fixes:
- Update SetComponentProperties_ContinuesAfterException log regex for new error format
- Update test_manage_gameobject_param_coercion to test valid actions only
* feat: Redesign GameObject API for better LLM ergonomics
## New Tools
- find_gameobjects: Search GameObjects, returns paginated instance IDs only
- manage_components: Component lifecycle (add, remove, set_property)
## New Resources
- unity://scene/gameobject/{id}: Single GameObject data (no component serialization)
- unity://scene/gameobject/{id}/components: All components (paginated)
- unity://scene/gameobject/{id}/component/{name}: Single component by type
## Updated
- manage_scene get_hierarchy: Now includes componentTypes array
- manage_gameobject: Slimmed to lifecycle only (create, modify, delete)
- Legacy actions (find, get_components, etc.) log deprecation warnings
## Extracted Utilities
- ParamCoercion: Centralized int/bool/float/string coercion
- VectorParsing: Vector3/Vector2/Quaternion/Color parsing
- GameObjectLookup: Centralized GameObject search logic
## Test Coverage
- 76 new Unity EditMode tests for ManageGameObject actions
- 21 new pytest tests for Python tools/resources
- New NL/T CI suite for GameObject API (GO-0 to GO-5)
Addresses LLM confusion with parameter overload by splitting into
focused tools and read-only resources.
* feat: Add static gameobject_api helper resource for UI discoverability
Adds unity://scene/gameobject-api resource that:
- Shows in Cursor's resource list UI (no parameters needed)
- Documents the parameterized gameobject resources
- Explains the workflow: find_gameobjects → read resource
- Lists examples and related tools
* feat: Add GO tests to main NL/T CI workflow
- Adds GO pass (GO-0 to GO-5) after T pass in claude-nl-suite.yml
- Includes retry logic for incomplete GO tests
- Updates all regex patterns to recognize GO-* test IDs
- Updates DESIRED lists to include all 21 tests (NL-0..4, T-A..J, GO-0..5)
- Updates default_titles for GO tests in markdown summary
- Keeps separate claude-gameobject-suite.yml for standalone runs
* feat: Add GameObject API stress tests and NL/T suite updates
Stress Tests (12 new tests):
- BulkCreate small/medium batches
- FindGameObjects pagination with by_component search
- AddComponents to single object
- GetComponents with full serialization
- SetComponentProperties (complex Rigidbody)
- Deep hierarchy creation and path lookup
- GetHierarchy with large scenes
- Resource read performance tests
- RapidFire create-modify-delete cycles
NL/T Suite Updates:
- Added GO-0..GO-10 tests in nl-gameobject-suite.md
- Fixed tool naming: mcp__unity__ → mcp__UnityMCP__
Other:
- Fixed LongUnityScriptClaudeTest.cs compilation errors
- Added reports/, .claude/local/, scripts/local-test/ to .gitignore
All 254 EditMode tests pass (250 run, 4 explicit skips)
* fix: Address code review feedback
- ParamCoercion: Use CultureInfo.InvariantCulture for float parsing
- ManageComponents: Move Transform removal check before GetComponent
- ManageGameObjectFindTests: Use try-finally for LogAssert.ignoreFailingMessages
- VectorParsing: Document that quaternions are not auto-normalized
- gameobject.py: Prefix unused ctx parameter with underscore
* fix: Address additional code review feedback
- ManageComponents: Reuse GameObjectLookup.FindComponentType instead of duplicate
- ManageComponents: Log warnings when SetPropertiesOnComponent fails
- GameObjectLookup: Make FindComponentType public for reuse
- gameobject.py: Extract _normalize_response helper to reduce duplication
- gameobject.py: Add TODO comment for unused typed response classes
* fix: Address more code review feedback
NL/T Prompt Fixes:
- nl-gameobject-suite.md: Remove non-existent list_resources/read_resource from AllowedTools
- nl-gameobject-suite.md: Fix parameter names (component_type, properties)
- nl-unity-suite-nl.md: Remove unused manage_editor from AllowedTools
Test Fixes:
- GameObjectAPIStressTests: Add null check to ToJObject helper
- GameObjectAPIStressTests: Clarify AudioSource usage comment
- ManageGameObjectFindTests: Use built-in 'UI' layer instead of 'Water'
- LongUnityScriptClaudeTest: Clean up NL/T test artifacts (Counte42 typo, HasTarget)
* docs: Add documentation for API limitations and behaviors
- GameObjectLookup.SearchByPath: Document and warn that includeInactive
has no effect (Unity API limitation)
- ManageComponents.TrySetProperty: Document case-insensitive lookup behavior
* More test fixes and tighten parameters on python tools
* fix: Align test expectation with implementation error message case
* docs: update README tools and resources lists
- Add missing tools: manage_components, batch_execute, find_gameobjects, refresh_unity
- Add missing resources: gameobject_api, editor_state_v2
- Make descriptions more concise across all tools and resources
- Ensure documentation matches current MCP server functionality
* fix: Address code review feedback
- ParamCoercion: Use InvariantCulture for int/double parsing consistency
- ManageComponents: Remove redundant Undo.RecordObject (AddComponent handles undo)
- ManageScene: Replace deprecated FindObjectsOfType with FindObjectsByType
- GameObjectLookup: Add explanatory comment to empty catch block
- gameobject.py: Extract _validate_instance_id helper to reduce duplication
- Tests: Fix assertion for instanceID (Unity IDs can be negative)
* chore: Remove accidentally committed test artifacts
- Remove Materials folder (40 .mat files from interactive testing)
- Remove Shaders folder (5 noise shaders from testing)
- Remove test scripts (Bounce*, CylinderBounce* from testing)
- Remove Temp.meta and commit.sh
* test: Improve delete tests to verify actual deletion
- Delete_ByTag_DeletesMatchingObjects: Verify objects are actually destroyed
- Delete_ByLayer_DeletesMatchingObjects: Assert deletion using Unity null check
- Delete_MultipleObjectsSameName_DeletesCorrectly: Document first-match behavior
- Delete_Success_ReturnsDeletedCount: Verify count value if present
All tests now verify deletion occurred rather than just checking for a result.
* refactor: remove deprecated manage_gameobject actions
- Remove deprecated switch cases: find, get_components, get_component, add_component, remove_component, set_component_property
- Remove deprecated wrapper methods (423 lines deleted from ManageGameObject.cs)
- Delete ManageGameObjectFindTests.cs (tests deprecated 'find' action)
- Remove deprecated test methods from ManageGameObjectTests.cs
- Add GameObject resource URIs to README documentation
- Add batch_execute performance tips to README, tool description, and gameobject_api resource
- Enhance batch_execute description to emphasize 10-100x performance gains
Total: ~1200 lines removed. New API (find_gameobjects, manage_components, resources) is the recommended path forward.
* fix: Remove starlette stubs from conftest.py
Starlette is now a proper dependency via the mcp package, so we don't need
to stub it anymore. The real package handles all HTTP transport needs.
* fix: Multi-session UI improvements and HTTP instance recognition
- Separate server and session lifecycle in HTTP Local mode
- Show 'Start Server' / 'Stop Server' button for server control
- Show 'Start Session' / 'End Session' button when server is running
- No auto-join on server start (requires manual session start)
- Show instance name instead of port in session status (e.g. 'Session Active (ramble)')
- Use native project_hash for HTTP instance recognition instead of computed SHA256
- Fix test expectations for manage_asset JSON parsing error messages
* fix: Multi-session UI improvements and HTTP instance recognition
- Separate server and session lifecycle in HTTP Local mode
- Show 'Start Server' / 'Stop Server' button for server control
- Show 'Start Session' / 'End Session' button when server is running
- Auto-start session when THIS instance starts the server
- Require manual session start when connecting to external server
- Auto-detect and end orphaned sessions when server stops
- Show instance name instead of port in session status
- Use native project_hash for HTTP instance recognition
- Guard against empty hash with warning log
- Remove dead code (duplicate _safe_response)
- Add defensive path handling for instance name extraction
* Optimize read_console defaults and paging
* Fix read_console truncate test expectations
* Reduce read_console default count from 50 to 10
Further optimize token usage by reducing the default count from 50 to 10 entries. Even 10-20 messages with stack traces can be token-heavy. Added tests for default behavior and paging functionality. Updated tool description to document defaults and paging support.
* Fix ReadConsoleTests to include log type messages
The default types filter changed to ['error', 'warning'] (excluding 'log'), so tests using Debug.Log() need to explicitly request log messages. Also added format='detailed' to HandleCommand_Get_Works test since it accesses structured message fields.
* Address CodeRabbit review feedback
- Fix property naming consistency: next_cursor -> nextCursor (C# camelCase)
- Remove redundant EndGettingEntries call from catch block (already in finally)
- Extract stacktrace stripping to helper function (reduce duplication)
- Fix test mock to match actual C# response structure (items, nextCursor, truncated, total)
* perf: add early exit optimization for ReadConsole paging
- Add early exit in paging loop once page is filled, avoiding iteration
through remaining console entries (total becomes 'at least N')
- Prefix unused mock arguments with underscores in test_read_console_truncate.py
to suppress Ruff linter warnings
* refactor: give pageSize independent default, clarify count semantics
- Change pageSize resolution from 'pageSize ?? count ?? 50' to 'pageSize ?? 50'
so pageSize has its own default independent of count
- count now only serves as the non-paging limit
- Add XML docs to GetConsoleEntries with clear parameter descriptions
- Update Python tool annotations to document pageSize default (50) and
clarify that count is ignored when paging
* Add editor readiness v2, refresh tool, and preflight guards
* Detect external package changes and harden refresh retry
* feat: add TestRunnerNoThrottle and async test running with background stall prevention
- Add TestRunnerNoThrottle.cs: Sets editor to 'No Throttling' mode during test runs
with SessionState persistence across domain reload
- Add run_tests_async and get_test_job tools for non-blocking test execution
- Add TestJobManager for async test job tracking with progress monitoring
- Add ForceSynchronousImport to all AssetDatabase.Refresh() calls to prevent stalls
- Mark DomainReloadResilienceTests as [Explicit] with documentation explaining
the test infrastructure limitation (internal coroutine waits vs MCP socket polling)
- MCP workflow is unaffected - socket messages provide external stimulus that
keeps Unity responsive even when backgrounded
* refactor: simplify and clean up code
- Remove unused Newtonsoft.Json.Linq import from TestJobManager
- Add throttling to SessionState persistence (once per second) to reduce overhead
- Critical job state changes (start/finish) still persist immediately
- Fix duplicate XML summary tag in DomainReloadResilienceTests
* docs: add async test tools to README, document domain reload limitation
- Add run_tests_async and get_test_job to main README tools list
- Document background stall limitation for domain reload tests in DEV readme
* ci: add separate job for domain reload tests
Run [Explicit] domain_reload tests in their own job using -testCategory
* ci: run domain reload tests in same job as regular tests
Combines into single job with two test steps to reuse cached Library
* fix: address coderabbit review issues
- Fix TOCTOU race in TestJobManager.StartJob (single lock scope for check-and-set)
- Store TestRunnerApi reference with HideAndDontSave to prevent GC/serialization issues
* docs: update tool descriptions to prefer run_tests_async
- run_tests_async is now marked as preferred for long-running suites
- run_tests description notes it blocks and suggests async alternative
* docs: update README screenshot to v8.6 UI
* docs: add v8.6 UI screenshot
* Update README for MCP version and instructions for v8.7
* fix: handle preflight busy signals and derive job status from test results
- manage_asset, manage_gameobject, manage_scene now check preflight return
value and propagate busy/retry signals to clients (fixes Sourcery #1)
- TestJobManager.FinalizeCurrentJobFromRunFinished now sets job status to
Failed when resultPayload.Failed > 0, not always Succeeded (fixes Sourcery #2)
* fix: increase HTTP server startup timeout for dev mode
When 'Force fresh server install' is enabled, uvx uses --no-cache --refresh
which rebuilds the package and takes significantly longer to start.
- Increase timeout from 10s to 45s when dev mode is enabled
- Add informative log message explaining the longer startup time
- Show actual timeout value in warning message
* fix: derive job status from test results in FinalizeFromTask fallback
Apply same logic as FinalizeCurrentJobFromRunFinished: check result.Failed > 0
to correctly mark jobs as Failed when tests fail, even in the fallback path
when RunFinished callback is not delivered.
* Optimize run_tests to return summary by default, reducing token usage by 98%
- Add includeFailedTests parameter: returns only failed/skipped test details
- Add includeDetails parameter: returns all test details (original behavior)
- Default behavior now returns summary only (~150 tokens vs ~13k tokens)
- Make results field optional in Python schema for backward compatibility
Token savings:
- Default: ~13k tokens saved (98.9% reduction)
- With failures: minimal tokens (only non-passing tests)
- Full details: same as before when explicitly requested
This prevents context bloat for typical test runs where you only need
pass/fail counts, while still allowing detailed debugging when needed.
* Add warning when run_tests filters match no tests; fix test organization
TDD Feature:
- Add warning message when filter criteria match zero tests
- New RunTestsTests.cs validates message formatting logic
- Modified RunTests.cs to append "(No tests matched the specified filters)" when total=0
Test Organization Fixes:
- Move MCPToolParameterTests.cs from EditMode/ to EditMode/Tools/ (matches folder hierarchy)
- Fix inconsistent namespaces to MCPForUnityTests.Editor.{Subfolder}:
- MCPToolParameterTests: Tests.EditMode → MCPForUnityTests.Editor.Tools
- DomainReloadResilienceTests: Tests.EditMode.Tools → MCPForUnityTests.Editor.Tools
- Matrix4x4ConverterTests: MCPForUnityTests.EditMode.Helpers → MCPForUnityTests.Editor.Helpers
* Refactor test result message formatting
* Simplify RunTests warning assertions
* Tests: de-flake cold-start EditMode runs
- Make ManageScriptableObjectTests setup yield-based with longer Unity-ready timeout
- Mark DomainReloadResilienceTests explicit to avoid triggering domain reload during Run All
* Avoid blocking Claude CLI status checks on focus
* Fix Claude Code registration to remove existing server before re-registering
When registering with Claude Code, if a UnityMCP server already exists,
remove it first before adding the new registration. This ensures the
transport mode (HTTP vs stdio) is always updated to match the current
UseHttpTransport EditorPref setting.
Previously, if a stdio registration existed and the user tried to register
with HTTP, the command would fail with 'already exists' and the old stdio
configuration would remain unchanged.
* Fix Claude Code transport validation to parse CLI output format correctly
The validation code was incorrectly parsing the output of 'claude mcp get UnityMCP' by looking for JSON format ("transport": "http"), but the CLI actually returns human-readable text format ("Type: http"). This caused the transport mismatch detection to never trigger, allowing stdio to be selected in the UI while HTTP was registered with Claude Code.
Changes:
- Fix parsing logic to check for "Type: http" or "Type: stdio" in CLI output
- Add OnTransportChanged event to refresh client status when transport changes
- Wire up event handler to trigger client status refresh on transport dropdown change
This ensures that when the transport mode in Unity doesn't match what's registered with Claude Code, the UI will correctly show an error status with instructions to re-register.
* Fix Claude Code registration UI blocking and thread safety issues
This commit resolves three issues with Claude Code registration:
1. UI blocking: Removed synchronous CheckStatus() call after registration
that was blocking the editor. Status is now set immediately with async
verification happening in the background.
2. Thread safety: Fixed "can only be called from the main thread" errors
by capturing Application.dataPath and EditorPrefs.GetBool() on the main
thread before spawning async status check tasks.
3. Transport mismatch detection: Transport mode changes now trigger immediate
status checks to detect HTTP/stdio mismatches, instead of waiting for the
45-second refresh interval.
The registration button now turns green immediately after successful
registration without blocking, and properly detects transport mismatches
when switching between HTTP and stdio modes.
* Enforce thread safety for Claude Code status checks at compile time
Address code review feedback by making CheckStatusWithProjectDir thread-safe
by design rather than by convention:
1. Made projectDir and useHttpTransport parameters non-nullable to prevent
accidental background thread calls without captured values
2. Removed nullable fallback to EditorPrefs.GetBool() which would cause
thread safety violations if called from background threads
3. Added ArgumentNullException for null projectDir instead of falling back
to Application.dataPath (which is main-thread only)
4. Added XML documentation clearly stating threading contracts:
- CheckStatus() must be called from main thread
- CheckStatusWithProjectDir() is safe for background threads
5. Removed unreachable else branch in async status check code
These changes make it impossible to misuse the API from background threads,
with compile-time enforcement instead of runtime errors.
* Consolidate local HTTP Start/Stop and auto-start session
* HTTP improvements: Unity-owned server lifecycle + UI polish
* Deterministic HTTP stop via pidfile+token; spawn server in terminal
* Fix review feedback: token validation, host normalization, safer casts
* Fix stop heuristics edge cases; remove dead pid capture
* Fix unity substring guard in stop heuristics
* Fix local server cleanup and connection checks
* Fix read_console default limits; cleanup Unity-managed server vestiges
* Fix unfocused reconnect stalls; fast-fail retryable Unity commands
* Simplify PluginHub reload handling; honor run_tests timeout
* Fix Windows Claude CLI status check threading
* The default URL is already set when we call the function
* Remove placeholer for HTTP URL in the UI
When we load the UI, we use `HttpEndpointUtility.GetBaseUrl()`, so we don't need this
* Optimize tool loading so startup is fast again
We lazy load tools, remove the expensive AssetPath property, and reflect for only `McpForUnityToolAttribute`, so it's much faster.
A 6 second startup is now back to 400ms. Can still be optimised but this is good
* Remove .meta file from tests
The tests automatically cleans this up, so it likely got pushed by accident
* Add EditorPrefs management window for MCP configuration debugging
Meant to help with dev and testing, not so much the average user
* Update MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Revert "Update MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs"
This reverts commit 09bb4e1d2582678bc87d0ace45f9d8c3c88c3203.
* Reapply "Update MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs"
This reverts commit 6ccbc5e478f0bd2b61c992ae60db0ca367d651ae.
* Fix EditorPrefs type detection using sentinel values and null handling
* Simplify EditorPrefs type detection using known type mapping and basic parsing
Replace complex sentinel-based type detection with a dictionary of known pref types and simple TryParse fallback for unknown keys. Remove null handling and HasKey checks for known keys since they're defined in EditorPrefKeys.
* Make the menu item more clear
* Remove rounded borders and spacing from EditorPrefs list items
Minor visual tweak [skip ci]
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Add EditorPrefs management window for MCP configuration debugging
Meant to help with dev and testing, not so much the average user
* Update MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Revert "Update MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs"
This reverts commit 09bb4e1d2582678bc87d0ace45f9d8c3c88c3203.
* Reapply "Update MCPForUnity/Editor/Windows/EditorPrefs/EditorPrefsWindow.cs"
This reverts commit 6ccbc5e478f0bd2b61c992ae60db0ca367d651ae.
* Fix EditorPrefs type detection using sentinel values and null handling
* Simplify EditorPrefs type detection using known type mapping and basic parsing
Replace complex sentinel-based type detection with a dictionary of known pref types and simple TryParse fallback for unknown keys. Remove null handling and HasKey checks for known keys since they're defined in EditorPrefKeys.
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Fix test teardown to avoid dropping MCP bridge
CodexConfigHelperTests was calling MCPServiceLocator.Reset() in TearDown, which disposes the active bridge/transport during MCP-driven test runs. Replace with restoring only the mutated service (IPlatformService).
* Avoid leaking PlatformService in CodexConfigHelperTests
Capture the original IPlatformService before this fixture runs and restore it in TearDown. This preserves the MCP connection safety fix (no MCPServiceLocator.Reset()) while avoiding global state leakage to subsequent tests.
* Fix SO MCP tooling: validate folder roots, normalize paths, expand tests; remove vestigial SO tools
* Remove UnityMCPTests stress artifacts and ignore Assets/Temp
* Ignore UnityMCPTests Assets/Temp only
* Clarify array_resize fallback logic comments
* Refactor: simplify action set and reuse slash sanitization
* Enhance: preserve GUID on overwrite & support Vector/Color types in ScriptableObject tools
* Fix: ensure asset name matches filename to suppress Unity warnings
* Fix: resolve Unity warnings by ensuring asset name match and removing redundant import
* Refactor: Validate assetName, strict object parsing for vectors, remove broken SO logic from ManageAsset
* Hardening: reject Windows drive paths; clarify supported asset types
* Delete FixscriptableobjecPlan.md
* Paginate get_hierarchy and get_components to prevent large payload crashes
* dev: add uvx dev-mode refresh + safer HTTP stop; fix server typing eval
* Payload-safe paging defaults + docs; harden asset search; stabilize Codex tests
* chore: align uvx args + coercion helpers; tighten safety guidance
* chore: minor cleanup + stabilize EditMode SO tests
* Fix test teardown to avoid dropping MCP bridge
CodexConfigHelperTests was calling MCPServiceLocator.Reset() in TearDown, which disposes the active bridge/transport during MCP-driven test runs. Replace with restoring only the mutated service (IPlatformService).
* Avoid leaking PlatformService in CodexConfigHelperTests
Capture the original IPlatformService before this fixture runs and restore it in TearDown. This preserves the MCP connection safety fix (no MCPServiceLocator.Reset()) while avoiding global state leakage to subsequent tests.
* Fix SO MCP tooling: validate folder roots, normalize paths, expand tests; remove vestigial SO tools
* Remove UnityMCPTests stress artifacts and ignore Assets/Temp
* Ignore UnityMCPTests Assets/Temp only
* Clarify array_resize fallback logic comments
* Refactor: simplify action set and reuse slash sanitization
* Enhance: preserve GUID on overwrite & support Vector/Color types in ScriptableObject tools
* Fix: ensure asset name matches filename to suppress Unity warnings
* Fix: resolve Unity warnings by ensuring asset name match and removing redundant import
* Refactor: Validate assetName, strict object parsing for vectors, remove broken SO logic from ManageAsset
* Hardening: reject Windows drive paths; clarify supported asset types
* Delete FixscriptableobjecPlan.md
* docs: Add manage_scriptable_object tool description to README
* Fix#478: Add Matrix4x4Converter to prevent Cinemachine serialization crash
The `get_components` action crashes Unity when serializing Cinemachine
camera components because Newtonsoft.Json accesses computed Matrix4x4
properties (lossyScale, rotation) that call ValidTRS() on non-TRS matrices.
This fix adds a safe Matrix4x4Converter that only accesses raw matrix
elements (m00-m33), avoiding the dangerous computed properties entirely.
Changes:
- Add Matrix4x4Converter to UnityTypeConverters.cs
- Register converter in GameObjectSerializer serializer settings
Tested with Cinemachine 3.1.5 on Unity 6 - get_components now returns
full component data without crashing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add unit tests for Matrix4x4Converter
Tests cover:
- Identity matrix serialization/deserialization
- Translation matrix round-trip
- Degenerate matrix (determinant=0) - key regression test
- Non-TRS matrix (projection) - validates ValidTRS() is never called
- Null handling
- Ensures dangerous properties are not in output
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Address code review feedback
- Fix null handling consistency: return zero matrix instead of identity
(consistent with missing field defaults of 0f)
- Improve degenerate matrix test to verify:
- JSON only contains raw mXY properties
- Values roundtrip correctly
- Rename test to reflect expanded coverage
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Move tests to TestProject per review feedback
Moved Matrix4x4ConverterTests from MCPForUnity/Editor/Tests/ to
TestProjects/UnityMCPTests/Assets/Tests/EditMode/Helpers/ as requested.
Also added MCPForUnity.Runtime reference to the test asmdef since
the converter lives in the Runtime assembly.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix Matrix4x4 deserialization guard + UI Toolkit USS warning
---------
Co-authored-by: Alexander Mangel <cygnusfear@gmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Add missing meta files
* Re-generate .meta files
It was for safety as some were AI generated before. Only minor changes were made
* Remove distribution settings and hardcode default localhost URL
Removes the McpDistributionSettings system that allowed different defaults for Asset Store vs git distributions. Hardcodes the default HTTP base URL to "http://localhost:8080" directly in HttpEndpointUtility and WebSocketTransportClient. Removes the setup window skip logic for remote defaults.
It didn't work in practice, best thing to do is replace the placeholder in the UXML
- Change migration to always clean up legacy keys, even on partial failures
- Upgrade migration messages from Debug to Warn/Info for better visibility
- Add explicit warning when failures occur that manual configuration is needed
- Remove early return on failures to ensure legacy keys are always deleted
- Prevents migration retry loops when some clients fail to configure
Adds KiloCodeConfigurator to enable automatic MCP configuration for
Kilo Code VS Code extension users.
Closes#250
Co-authored-by: Berkant <Nonanti@users.noreply.github.com>
* Fix script path handling and FastMCP Context API usage
1. Fix script path doubling when Assets prefix is used
- ManageScript.TryResolveUnderAssets now properly handles both Assets and Assets/ prefixes
- Previously, paths like Assets/Script.cs would create files at Assets/Assets/Script.cs
- Now correctly strips the prefix and creates files at the intended location
2. Fix FastMCP Context API call in manage_asset
- Changed ctx.warn() to ctx.warning() to match FastMCP Context API
- Fixes AttributeError when manage_asset encounters property parse errors
- Affects ScriptableObject creation and other asset operations with invalid properties
* Fix manage_asset error handling to use ctx.error
Changed ctx.warning to ctx.error for property parse errors in manage_asset
tool to properly handle error cases. This ensures parse errors are reported
as errors rather than warnings, and fixes compatibility with FastMCP Context API.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* Update github-repo-stats.yml
* Server: refine shutdown logic per bot feedback\n- Parameterize _force_exit(code) and use timers with args\n- Consistent behavior on BrokenPipeError (no immediate exit)\n- Exit code 1 on unexpected exceptions\n\nTests: restore telemetry module after disabling to avoid bleed-over
* Revert "Server: refine shutdown logic per bot feedback\n- Parameterize _force_exit(code) and use timers with args\n- Consistent behavior on BrokenPipeError (no immediate exit)\n- Exit code 1 on unexpected exceptions\n\nTests: restore telemetry module after disabling to avoid bleed-over"
This reverts commit 74d35d371a28b2d86cb7722e28017b29be053efd.
* Add fork-only Unity tests workflow and guard upstream run
* Move fork Unity tests workflow to root
* Fix MCP server install step in NL suite workflow
* Harden NL suite prompts for deterministic anchors
* update claude haiku version for NL/T tests
* Fix CI: share unity-mcp status dir
* update yaml
* Add Unity bridge debug step in CI
* Fail fast when Unity MCP status file missing
* Allow Unity local share writable for MCP status
* Mount Unity cache rw and dump Editor log for MCP debug
* Allow Unity config dir writable for MCP heartbeat/logs
* Write Unity logs to file and list config dir in debug
* Use available Anthropic models for T pass
* Use latest claude sonnet/haiku models in workflow
* Fix YAML indentation for MCP preflight step
* Point MCP server to src/server.py and fix preflight
* another try
* Add MCP preflight workflow and update NL suite
* Fixes to improve CI testing
* Cleanup
* fixes
* diag
* fix yaml
* fix status dir
* Fix YAML / printing to stdout --> stderr
* find in file fixes.
* fixes to find_in_file and CI report format error
* Only run the stats on the CoPlay main repo, not forks.
* Coderabbit fixes.
* Fixed ArrayPool conflict with CString.dll ArrayPool in Tolua
Fixed ArrayPool conflict with CString.dll ArrayPool in Tolua
* ScreenCapture在Unity2022中才支持
ScreenCapture在Unity2022中才支持,增加Unity版本判断
* [FEATURE] Local MCPForUnity Deployment
Similar to deploy.bat, but sideload it to MCP For Unity for easier deployment inside Unity menu.
* Update PackageDeploymentService.cs
* Update with meta file
* Updated Readme
* Updates on Camera Capture Feature
* Enable Camera Capture through both play and editor mode
Notes: Because the standard ScreenCapture.CaptureScreenshot does not work in editor mode, so we use ScreenCapture.CaptureScreenshotIntoRenderTexture to enable it during play mode.
* The user can access the camera access through the tool menu or through direct LLM calling. Both tested on Windows with Claude Desktop.
* Minor changes
nitpicking changes
* WIP: Material management tool implementation and tests
- Add ManageMaterial tool for creating and modifying materials
- Add MaterialOps helper for material property operations
- Add comprehensive test suite for material management
- Add string parameter parsing support for material properties
- Update related tools (ManageGameObject, manage_asset, etc.)
- Add test materials and scenes for material testing
* refactor: unify material property logic into MaterialOps
- Move and logic from to
- Update to delegate to
- Update to use enhanced for creation and property setting
- Add texture path loading support to
* Add parameter aliasing support: accept 'name' as alias for 'target' in manage_gameobject modify action
* Refactor ManageMaterial and fix code review issues
- Fix Python server tools (redundant imports, exception handling, string formatting)
- Clean up documentation and error reports
- Improve ManageMaterial.cs (overwrite checks, error handling)
- Enhance MaterialOps.cs (robustness, logging, dead code removal)
- Update tests (assertions, unused imports)
- Fix manifest.json relative path
- Remove temporary test artifacts and manual setup scripts
* Remove test scene
* remove extra mat
* Remove unnecessary SceneTemplateSettings.json
* Remove unnecessary SceneTemplateSettings.json
* Fix MaterialOps issues
* Fix: Case-insensitive material property lookup and missing HasProperty checks
* Rabbit fixes
* Improve material ops logging and test coverage
* Fix: NormalizePath now handles backslashes correctly using AssetPathUtility
* Fix: Address multiple nitpicks (test robustness, shader resolution, HasProperty checks)
* Add manage_material tool documentation and fix MaterialOps texture property checks
- Add comprehensive ManageMaterial tool documentation to MCPForUnity/README.md
- Add manage_material to tools list in README.md and README-zh.md
- Fix MaterialOps.cs to check HasProperty before SetTexture calls to prevent Unity warnings
- Ensures consistency with other property setters in MaterialOps
* Fix ManageMaterial shader reflection for Unity 6 and improve texture logging
* Update .Bat file and Bug fix on ManageScript
* Update the .Bat file to include runtime folder
* Fix the inconsistent EditorPrefs variable so the GUI change on Script Validation could cause real change.
* Further changes
String to Int for consistency
* [Custom Tool] Roslyn Runtime Compilation
Allows users to generate/compile codes during Playmode
* Fix based on CR
* Create claude_skill_unity.zip
Upload the unity_claude_skill that can be uploaded to Claude for a combo of unity-mcp-skill.
* Update for Custom_Tool Fix and Detection
1. Fix Original Roslyn Compilation Custom Tool to fit the V8 standard
2. Add a new panel in the GUI to see and toggle/untoggle the tools. The toggle feature will be implemented in the future, right now its implemented here to discuss with the team if this is a good feature to add;
3. Add few missing summary in certain tools
* Revert "Update for Custom_Tool Fix and Detection"
This reverts commit ae8cfe5e256c70ac4a16c79d50341a39cbac18ba.
* Update README.md
* Reapply "Update for Custom_Tool Fix and Detection"
This reverts commit f423c2f25e9ccff4f3b89d1d360ee9cf13143733.
* Update ManageScript.cs
Fix the layout problem of manage_script in the panel
* Update
To comply with the current server setting
* Update on Batch
Tested object generation/modification with batch and it works perfectly! We should push and let users test for a while and see
PS: I tried both VS Copilot and Claude Desktop. Claude Desktop works but VS Copilot does not due to the nested structure of batch. Will look into it more.
* Revert "Merge pull request #1 from Scriptwonder/batching"
This reverts commit 55ee76810be161d414e1f5f5abaa5ee30ddd0052, reversing
changes made to ae2eedd7fb2c6a66ff008bacac481aefb1b0d176.
* Update .Bat file and Bug fix on ManageScript
* Update the .Bat file to include runtime folder
* Fix the inconsistent EditorPrefs variable so the GUI change on Script Validation could cause real change.
* Further changes
String to Int for consistency
* [Custom Tool] Roslyn Runtime Compilation
Allows users to generate/compile codes during Playmode
* Fix based on CR
* Create claude_skill_unity.zip
Upload the unity_claude_skill that can be uploaded to Claude for a combo of unity-mcp-skill.
* Update for Custom_Tool Fix and Detection
1. Fix Original Roslyn Compilation Custom Tool to fit the V8 standard
2. Add a new panel in the GUI to see and toggle/untoggle the tools. The toggle feature will be implemented in the future, right now its implemented here to discuss with the team if this is a good feature to add;
3. Add few missing summary in certain tools
* Revert "Update for Custom_Tool Fix and Detection"
This reverts commit ae8cfe5e256c70ac4a16c79d50341a39cbac18ba.
* Update README.md
* Reapply "Update for Custom_Tool Fix and Detection"
This reverts commit f423c2f25e9ccff4f3b89d1d360ee9cf13143733.
* Update ManageScript.cs
Fix the layout problem of manage_script in the panel
* Update
To comply with the current server setting
* Update on Batch
Tested object generation/modification with batch and it works perfectly! We should push and let users test for a while and see
PS: I tried both VS Copilot and Claude Desktop. Claude Desktop works but VS Copilot does not due to the nested structure of batch. Will look into it more.
* Revert "Merge branch 'main' into batching"
This reverts commit 51fc4b4deb9e907cab3404d8c702131e3da85122, reversing
changes made to 318c824e1b78ca74701a1721a5a94f5dc567035f.
* Fix macOS port conflict: Disable SO_REUSEADDR and improve UI port display
- StdioBridgeHost.cs: Disable ReuseAddress on macOS to force AddressAlreadyInUse exception on conflict.
- PortManager.cs: Add connection check safety net for macOS.
- McpConnectionSection.cs: Ensure UI displays the actual live port instead of just the requested one.
* Fix macOS port conflict: Disable SO_REUSEADDR and improve UI port display
- StdioBridgeHost.cs: Disable ReuseAddress on macOS to force AddressAlreadyInUse exception on conflict.
- PortManager.cs: Add connection check safety net for macOS.
- McpConnectionSection.cs: Ensure UI displays the actual live port instead of just the requested one.
* Address CodeRabbit feedback: UX improvements and code quality fixes
- McpConnectionSection.cs: Disable port field when session is running to prevent editing conflicts
- StdioBridgeHost.cs: Refactor listener creation into helper method and update EditorPrefs on port fallback
- unity_instance_middleware.py: Narrow exception handling and preserve SystemExit/KeyboardInterrupt
- debug_request_context.py: Document that debug fields expose internal implementation details
* Fix: Harden Python detection on Windows to handle App Execution Aliases
* Refactor: Pre-resolve conflicts for McpConnectionSection and middleware
* Fix: Remove leftover merge conflict markers in StdioBridgeHost.cs
* fix: clarify create_script tool description regarding base64 encoding
* fix: improve python detection on macOS by checking specific Homebrew paths
* Fix duplicate SetEnabled call and improve macOS Python detection
* Fix port display not reverting to saved preference when session ends
Tackle the requests in Issue#267, tested and no bugs found.
(1)LLM can duplicate an gameobject based on request
(2)LLM can move a gameobject relative to another gameobject
* Fix: HTTP/Stdio transport routing and middleware session persistence
- Ensure session persistence for stdio transport by using stable client_id/global fallback.
- Fix Nagle algorithm latency issues by setting TCP_NODELAY.
- Cleanup duplicate logging and imports.
- Resolve C# NullReferenceException in EditorWindow health check.
* Fix: thread-safe middleware singleton and re-enable repo stats schedule
* Temp Update on Material Assignment
Previously it was shader assignment by request or iterative order from URP to Unlit, but LLM usually assign Standard in a URP setting.
This small fix introduce the helper to resolve some of the conflicts, while give warnings in the log to show if the user is creating a shader in a non-compatible setting.
* Update RenderPipelineUtility.cs
* fix: Changed flag management to EditorPrefs
* refactor: Improve code readability and error handling in MCP window toggle
* fix: Refactor MCP window toggle logic to use new helper methods for better readability and maintainability
* fix: Reorder using directives and improve error logging format in MCP window
* Address CodeRabbit feedback: use McpLog.Warn and guard against repeated CreateGUI calls
---------
Co-authored-by: David Sarno <david@lighthaus.us>
* Fix Claude Windows config and CLI status refresh
* Fix Claude uvx path resolution
* Address review feedback for Claude uvx
* Polish config cleanup and status errors
* Tidy Claude status refresh
* Standardize import ordering and whitespace in plugin
The whitespace gave a warning in the asset store submission
* Fix manage_prefab tool structure
* Fix manage_editor actions
* Add get_component singular to manage_gameobject
* Improve uv cache clear error handling with lock detection and combined output
Replace simple stderr-only error reporting with combined stdout/stderr output. Add detection for "currently in-use" lock errors with helpful hint about waiting or using --force flag. Provide fallback message when command fails with no output.
* Improve error message formatting in uv cache clear failure logging
* Add distribution settings for Asset Store vs git defaults
Introduce McpDistributionSettings ScriptableObject to configure different defaults for Asset Store and git distributions without code forking. Add skipSetupWindowWhenRemoteDefault flag to bypass setup wizard when shipping with hosted MCP URL. Replace hardcoded localhost:8080 defaults with configurable defaultHttpBaseUrl from distribution settings in HttpEndpointUtility and WebSocketTransportClient.
* Improve local address detection in McpDistributionSettings with comprehensive IP range checks
Replace simple string-based localhost/127.0.0.1 checks with robust IsLocalAddress method that validates loopback addresses, private IPv4 ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16), IPv6 link-local and loopback addresses, and .local hostnames using proper URI parsing and IPAddress validation.
* Fix error
* First pass at MCP client refactor
* Restore original text instructions
Well most of them, I modified a few
* Move configurators to their own folder
It's less clusterd
* Remvoe override for Windsurf because we no longer need to use it
* Add Antigravity configs
Works like Windsurf, but it sucks ass
* Add some docs for properties
* Add comprehensive MCP client configurators documentation
* Add missing imports (#7)
* Handle Linux paths when unregistering CLI commands
* Construct a JSON error in a much more secure fashion
* Fix stdio auto-reconnect after domain reloads
We mirror what we've done with the HTTP/websocket connection
We also ensure the states from the stdio/HTTP connections are handled separately. Things now work as expected
* Fix ActiveMode to return resolved transport mode instead of preferred mode
The ActiveMode property now calls ResolvePreferredMode() to return the actual active transport mode rather than just the preferred mode setting.
* Minor improvements for stdio bridge
- Consolidated the !useHttp && isRunning checks into a single shouldResume flag.
- Wrapped the fire-and-forget StopAsync in a continuation that logs faults (matching the HTTP handler pattern).
- Wrapped StartAsync in a continuation that logs failures and only triggers the health check on success.
* Refactor TransportManager to use switch expressions and improve error handling
- Replace if-else chains with switch expressions for better readability and exhaustiveness checking
- Add GetClient() helper method to centralize client retrieval logic
- Wrap StopAsync in try-catch to log failures when stopping a failed transport
- Use client.TransportName instead of mode.ToString() for consistent naming in error messages
* First pass at MCP client refactor
* Restore original text instructions
Well most of them, I modified a few
* Move configurators to their own folder
It's less clusterd
* Remvoe override for Windsurf because we no longer need to use it
* Add Antigravity configs
Works like Windsurf, but it sucks ass
* Add some docs for properties
* Add comprehensive MCP client configurators documentation
* Add missing imports (#7)
* Handle Linux paths when unregistering CLI commands
* Construct a JSON error in a much more secure fashion
* Harden PlayMode test runs
- Guard against starting tests while already in Play Mode.
- Pre-save dirty scenes before PlayMode runs to avoid SaveModifiedSceneTask failures.
- Temporarily disable domain reload during PlayMode tests to keep the MCP bridge alive; restore settings afterward.
- Avoid runSynchronously because it can freeze Unity
* Handle the not too uncommon case where we have an empty scene
* Remove temp folder from repo
* Ignore boot.config
* Remove buttons to download or rebuild the server
* Remove embedded MCP server in plugin
We'll reference the remote server in GitHub and configure clients to use `uvx`
* As much as possible, rip out logic that installs a server
* feat: migrate to uvx-based server configuration
- Replaced local server execution with uvx package-based configuration for improved reliability
- Added GetUvxCommand helper to generate correct package version command string
- Updated config generation to use `uvx mcp-for-unity` instead of local Python server
- Modified Codex and client configuration validation to support uvx-based setup
- Removed unused server source directory handling and related preferences
- Updated tests to verify uvx command generation
* Cleanup the temp folders created by tests
We don't commit temp folders, tests are expected to clean up after themselves
* The test kept failing but the results looked correct, floating point comparisons are not precise
* feat: migrate from local server to uvx-based configuration
- Replaced local server path detection with uvx-based package installation from git repository
- Updated all configuration generators to use structured uvx command parts (command, --from URL, package)
- Renamed UV path references to UVX for clarity and consistency
- Added GetUvxCommandParts() helper to centralize uvx command generation
- Added GetMcpServerGitUrl() to handle git repository URL construction
- Updated client configuration validation
* refactor: use dynamic package version instead of hardcoded value
* Update CI so it only updates the Server folder
* feat: implement uvx package source path resolution
- Added GetUvxPackageSourcePath method to locate unity-mcp package in uv cache by traversing git checkouts
- Replaced hardcoded "Dummy" path in PythonToolSyncProcessor with dynamic path resolution
- Added validation for Server directory structure and pyproject.toml to ensure correct package location
* refactor: replace Python tool syncing with custom tool registration system
- Removed PythonToolsAsset and file-based sync processor in favor of attribute-based tool discovery
- Implemented CustomToolRegistrationProcessor with automatic registration on startup and script reload
- Added registration enable/disable preference and force re-registration capability
* feat: add HTTP transport support and cache management
- Implemented HTTP transport option with configurable URL/port alongside existing stdio mode
- Added cache management service with menu item to clear uvx package cache
- Updated config builder to generate transport-specific arguments and VSCode type field based on selected mode
* refactor: simplify HTTP configuration to use URL-based approach
- Replaced separate host/port arguments with single --http-url parameter for cleaner configuration
- Updated server to parse URL and allow individual host/port overrides when needed
- Consolidated HTTP client implementation with connection testing and tool execution support
* refactor: standardize transport configuration with explicit --transport flag
- Replaced --enable-http-server flag with --transport choice parameter (stdio/http) for clearer intent
- Removed redundant HTTP port field from UI since HTTP mode uses the same URL/port as MCP client
- Simplified server startup logic by consolidating transport mode determination
* refactor: move MCP menu items under Window menu
* feat: restructure config generation for HTTP transport mode
- Changed HTTP mode to use URL-based configuration instead of command-line arguments
- Added proper cleanup of incompatible fields when switching between stdio and HTTP transports
- Moved uvx command parsing inside stdio-specific block to avoid unnecessary processing in HTTP mode
* feat: add local HTTP server management with Git URL override
- Implemented server management service with menu item to start local HTTP server in new terminal window
- Added Git URL override setting in advanced configuration to allow custom server source for uvx --from
- Integrated server management into service locator with validation for local-only server startup
* fix: remove automatic HTTP protocol prefix from URL field
- Removed auto-prefixing logic that added "http://" to URLs without protocol
- Added placeholder text to guide users on expected URL format
- Created dedicated url-field style class for better URL input styling
* feat: implement proper MCP session lifecycle with HTTP transport
- Added initialize, ping, and disconnect methods to HttpMcpClient for proper MCP protocol session management
- Implemented session ID tracking and header management for stateful HTTP connections
- Added cross-platform terminal launcher support for Windows and Linux (previously macOS-only)
* feat: implement JSON-RPC protocol for MCP tool execution
- Added proper JSON-RPC 2.0 request/response handling with request ID tracking
- Included MCP protocol headers (version, session ID) for standard compliance
- Added error handling for JSON-RPC error responses
* feat: improve text wrapping in editor window UI
- Added white-space: normal and flex-shrink properties to section headers and override labels to prevent text overflow
- Created new help-text style class for consistent formatting of help text elements
* refactor: refresh git URL override from EditorPrefs on validation
* fix: improve responsive layout for editor window settings
- Added flex-wrap to setting rows to prevent overflow on narrow windows
- Set flex-shrink: 0 on labels to maintain consistent width
- Replaced max-width and margin-left with flex-basis for better flex behavior
* refactor: improve thread safety in tool registration
- Capture Unity API calls on main thread before async operations to prevent threading issues
- Update RegisterAllTools to use Task.Run pattern instead of GetAwaiter().GetResult() to avoid potential deadlocks
- Add optional projectId parameter to RegisterAllToolsAsync for pre-captured values
* refactor: replace MCP tool calls with direct HTTP endpoints for tool registration
- Removed synchronous registration method and unused MCP bridge logic from CustomToolRegistrationService
- Changed tool registration to use direct HTTP POST to /register-tools endpoint instead of MCP protocol
- Added FastAPI HTTP routes alongside existing MCP tools for more flexible tool management access
* refactor: centralize HTTP endpoint URL management
- Created HttpEndpointUtility to normalize and manage base URLs consistently
- Replaced scattered EditorPrefs calls with utility methods that handle URL normalization
- Ensured base URL storage excludes trailing paths like "/mcp" for cleaner configuration
* refactor: simplify custom tools management with in-memory registry
- Removed CustomToolsManager and fastmcp_tool_registry modules in favor of inline implementation
- Replaced class-based tool management with direct HTTP route handlers using FastMCP's custom_route decorator
- Consolidated tool registration logic into simple dictionary-based storage with helper functions
* feat: add dynamic custom tool registration system
- Implemented CustomToolService to manage project-scoped tool registration with validation and conflict detection
- Added HTTP endpoints for registering, listing, and unregistering custom tools with proper error handling
- Converted health and registry endpoints from HTTP routes to MCP tools for better integration
* feat: add AutoRegister flag to control tool registration
- Added AutoRegister property to McpForUnityToolAttribute (defaults to true)
- Modified registration service to filter and only register tools with AutoRegister enabled
- Disabled auto-registration for all built-in tools that already exist server-side
* feat: add function signature generation for dynamic tools
- Implemented _build_signature method to create proper inspect.Signature objects for dynamically created tools
- Signature includes Context parameter and all tool parameters with correct required/optional defaults
- Attached generated signature to dynamic_tool functions to improve introspection and type checking
* refactor: remove unused custom tool registry endpoints
* test: add transport configuration validation for MCP client tests
- Added HTTP transport preference setup in test fixtures to ensure consistent behavior
- Implemented AssertTransportConfiguration helper to validate both HTTP and stdio transport modes
- Added tests to verify stdio transport fallback when HTTP preference is disabled
* refactor: simplify uvx path resolution to use PATH by default
- Removed complex platform-specific path detection logic and verification
- Changed to rely on system PATH environment variable instead of searching common installation locations
- Streamlined override handling to only use EditorPrefs when explicitly set by user
* feat: use serverUrl property for Windsurf HTTP transport
- Changed Windsurf configs to use "serverUrl" instead of "url" for HTTP transport to match Windsurf's expected format
- Added cleanup logic to remove stale transport properties when switching between HTTP and stdio modes
- Updated Windsurf to exclude "env" block (only required for Kiro), while preserving it for clients that need it
* feat: ensure client configurations stay current on each setup
- Removed skip logic for already-configured clients to force re-validation of core fields
- Added forced re-registration for ClaudeCode clients to keep transport settings up-to-date
* feat: add automatic migration for legacy embedded server configuration
- Created LegacyServerSrcMigration to detect and migrate old EditorPrefs keys on startup
- Automatically reconfigures all detected clients to use new uvx/stdio path
- Removes legacy keys only after successful migration to prevent data loss
* feat: add automatic stdio config migration on package updates
- Implemented StdIoVersionMigration to detect package version changes and refresh stdio MCP client configurations
- Added support for detecting stdio usage across different client types (Codex, VSCode, and generic JSON configs)
- Integrated version tracking via EditorPrefs to prevent redundant migrations
* Centralize where editor prefs are defined
It's really hard to get a view of all the editor prfes in use.
This should help humans and AI know what's going on at a glance
* Update custom tools docs
* refactor: consolidate server management UI into main editor window
- Removed server and maintenance menu items from top-level menu
- Moved "Start Local HTTP Server" and "Clear UVX Cache" buttons into editor window settings
- Added dynamic button state management based on transport protocol and server availability
* Don't show error logs when custom tools are already registerd with the server
* Only autoconnect to port 6400 if the user is using stdio for connections
* Don't double register tools on startup
* feat: switch to HTTP transport as default connection method
- Changed default transport from stdio to HTTP with server running on localhost:8080
- Added UI controls to start/stop local HTTP server directly from Unity window
- Updated all documentation and configuration examples to reflect HTTP-first approach with stdio as fallback option
* Automatically bump the versions in the READMEs.
The `main` branch gets updated before we do a release. Using versions helps users get a stable, tested installation
* docs: add HTTP transport configuration examples
- Added HTTP transport setup instructions alongside existing stdio examples
- Included port mapping and URL configuration for Docker deployments
- Reorganized client configuration sections to clearly distinguish between HTTP and stdio transports
* feat: add WebSocket-based plugin hub for Unity connections
- Implemented persistent WebSocket connections with session management, heartbeat monitoring, and command routing
- Created PluginRegistry for tracking active Unity instances with hash-based lookup and automatic reconnect handling
- Added HTTP endpoints for session listing and health checks, plus middleware integration for instance-based routing
* refactor: consolidate Unity instance discovery with shared registry
- Introduced StdioPortRegistry for centralized caching of Unity instance discovery results
- Refactored UnityConnection to use stdio_port_registry instead of direct PortDiscovery calls
- Improved error handling with specific exception types and enhanced logging clarity
* Use websockets so that local and remote MCP servers can communicate with Unity
The MCP server supports HTTP and stdio protocols, and the MCP clients use them to communicate.
However, communication from the MCP server to Unity is done on the local port 6400, that's somewhat hardcoded.
So we add websockets so oure remotely hosted MCP server has a valid connection to the Unity plugin, and can communicate with
- Created ProjectIdentityUtility for centralized project hash, name, and session ID management
- Moved command processing logic from MCPForUnityBridge to new TransportCommandDispatcher service
- Added WebSocket session ID and URL override constants to EditorPrefKeys
- Simplified command queue processing with async/await pattern and timeout handling
- Removed duplicate command execution code in favor of shared dispatcher implementation
* refactor: simplify port management and improve port field validation
- Removed automatic port discovery and fallback logic from GetPortWithFallback()
- Changed GetPortWithFallback() to return stored port or default without availability checks
- Added SetPreferredPort() method for explicit port persistence with validation
- Replaced Debug.Log calls with McpLog.Info/Warn for consistent logging
- Added port field validation on blur and Enter key press with error handling
- Removed automatic port waiting
* Launch the actual local webserver via the button
* Autoformat
* Minor fixes so the server can start
* Make clear uvx button work
* Don't show a dialog after clearing cache/starting server successfully
It's annoying, we can just log when successful, and popup if something failed
* We no longer need a Python importer
* This folder has nothing in it
* Cleanup whitespace
Most AI generated code contains extra space, unless they're hooked up to a linter. So I'm just cleaning up what's there
* We no longer need this folder
* refactor: move MCPForUnityBridge to StdioBridgeHost and reorganize transport layer
- Renamed MCPForUnityBridge class to StdioBridgeHost and moved to Services.Transport.Transports namespace
- Updated all references to StdioBridgeHost throughout codebase (BridgeControlService, TelemetryHelper, GitHub workflow)
- Changed telemetry bridge_version to use AssetPathUtility.GetPackageVersion() instead of hardcoded version
- Removed extensive inline comments and documentation throughout StdioBridgeHost
* Skip tools registration if the user is not connected to an HTTP server
* Fix VS Code configured status in UI
Serializing the config as dynamic and then reading null properties (in this case, args) caused the error. So we just walk through the properities and use JObject, handling null value explicitily
* Stop blocking the main thread when connecting via HTTP
Now that the bridge service is asynchronous, messages back and forth the server work well (including the websocket connection)
* Separate socket keep-alive interval from application keep-alive interval
Split the keep-alive configuration into two distinct intervals: _keepAliveInterval for application-level keep-alive and _socketKeepAliveInterval for WebSocket-level keep-alive. This allows independent control of socket timeout behavior based on server configuration while maintaining the application's keep-alive settings.
* Add a debug log line
* Fix McpLog.Debug method, so it actually reads the checkbox value from the user
* Add HTTP bridge auto-resume after domain reload
Implement HttpBridgeReloadHandler to automatically resume HTTP/HttpPush transports after Unity domain reloads, matching the behavior of the legacy stdio bridge. Add ResumeHttpAfterReload EditorPref key to persist state across reloads and expose ActiveMode property in IBridgeControlService to check current transport mode.
* Add health verification after HTTP bridge auto-resume
Trigger health check in all open MCPForUnityEditorWindow instances after successful HTTP bridge resume following domain reload. Track open windows using static HashSet and schedule async health verification via EditorApplication.delayCall to ensure UI updates reflect the restored connection state.
* Add name and path fields to code coverage settings
Initialize m_Name and m_Path fields in code coverage Settings.json to match Unity's expected settings file structure.
* Only register custom tools AFTER we established a healthy HTTP connection
* Convert custom tool handlers to async functions
Update dynamic_tool wrapper to use async/await pattern and replace synchronous send_with_unity_instance/send_command_with_retry calls with their async counterparts (async_send_with_unity_instance/async_send_command_with_retry).
* Correctly parse responses from Unity in the server so tools and resources can process them
We also move the logic to better places than the __init__.py file for tools, since they're shared across many files, including resources
* Make some clarifications for custom tools in docs
* Use `async_send_with_unity_instance` instead of `send_with_unity_instance`
The HTTP protocol doesn't working with blocking commands, so now we have our tools set up to work with HTTP and stdio fullly. It's coming together :-)
* Fix calls to async_send_with_unity_instance in manage_script
* Rename async_send_with_unity_instance to send_with_unity_instance
* Fix clear uv cache command
Helps a lot with local development
* Refactor HTTP server command generation into reusable method and display in UI
Extract HTTP server command building logic from StartLocalHttpServer into new TryGetLocalHttpServerCommand method. Add collapsible foldout in editor window to display the generated command with copy button, allowing users to manually start the server if preferred. Update UI state management to refresh command display when transport or URL settings change.
* Ctrl/Cmd + Shift + M now toggles the window
Might as well be able to close the window as well
* Fallback to a git URL that points to the main branch for the MCP git URL used by uvx
* Add test setup/teardown to preserve and reset Git URL override EditorPref
Implement OneTimeSetUp/OneTimeTearDown to save and restore the GitUrlOverride EditorPref state, and add SetUp to delete the key before each test. This ensures tests run with deterministic Git URLs while preserving developer overrides between test runs.
* Update docs, scripts and GH workflows to use the new MCP server code location
* Update plugin README
* Convert integration tests to async/await pattern
Update all integration tests to use pytest.mark.asyncio decorator and async/await syntax. Change test functions to async, update fake_send/fake_read mocks to async functions with **kwargs parameter, and patch async_send_command_with_retry instead of send_command_with_retry. Add await to all tool function calls that now return coroutines.
* Update image with new UI
* Remove unused HttpTransportClient client
Before I had the realization that I needed webscokets, this was my first attempt
* Remove copyright notice
* Add a guide to all the changes made for this version
A lot of code was written by AI, so I think it's important that humans can step through how all these new systems work, and know where to find things.
All of these docs were written by hand, as a way to vet that I understand what the code I wrote and generated are doing, but also to make ti easy to read for you.
* Organize imports and remove redundant import statements
Clean up import organization by moving imports to the top of the file, removing duplicate imports scattered throughout the code, and sorting imports alphabetically within their groups (standard library, third-party, local). Remove unnecessary import aliases and consolidate duplicate urlparse and time imports.
* Minor edits
* Fix stdio serializer to use the new type parameter like HTTP
* Fix: Automatic bridge reconnection after domain reload without requiring Unity focus
- Add immediate restart attempt in OnAfterAssemblyReload() when Unity is not compiling
- Enhanced compile detection to check both EditorApplication.isCompiling and CompilationPipeline.isCompiling
- Add brief port release wait in StdioBridgeHost before switching ports to reduce port thrash
- Fallback to delayCall/update loop only when Unity is actively compiling
This fixes the issue where domain reloads (e.g., script edits) would cause connection loss until Unity window was refocused, as EditorApplication.update only fires when Unity has focus.
* Make the server work in Docker
We use HTTP mode by default in docker, this is what will be hosted remotely if one chooses to.
We needed to update the uvicorn package to a version with websockets, at least so the right version is explicitly retrieved
* Cache project identity on initialization to avoid repeated computation
Add static constructor with [InitializeOnLoad] attribute to cache project hash and name at startup. Introduce volatile _identityCached flag and cached values (_cachedProjectName, _cachedProjectHash) to store computed identity. Schedule cache refresh on initialization and when project changes via EditorApplication.projectChanged event. Extract ComputeProjectHash and ComputeProjectName as private methods that perform the actual computation. Update public
* Fix typos
* Add unity_instance_middleware to py-modules list in pyproject.toml
* Remove Foldout UI elements and simplify HTTP server command section
Replace Foldout with VisualElement for http-server-command-section to display HTTP server command directly without collapsible wrapper. Remove unused manualConfigFoldout field and associated CSS styles. Remove unused _identityCached volatile flag from ProjectIdentityUtility as caching logic no longer requires it.
* Reduce height of HTTP command box
* Refresh HTTP server command display when Git URL override changes
* Make the box a bit smaller
* Split up main window into various components
Trying to avoid to monolithic files, this is easier to work, for humans and LLMs
* Update the setup wizard to be a simple setup popup built with UI toolkit
We also fix the Python/uv detectors. Instead of searching for binaries, we just test that they're available in the PATH
* Ensure that MCP configs are updated when users switch between HTTP and stdio
These only work for JSON configs, we'll have to handle Codex and Claude Code separately
* Detect Codex configuration when using HTTP or stdio configs
* Use Claude Code's list command to detect whether this MCP is configured
It's better than checking the JSON and it can verify both HTTP and stdio setups
* Fix and add tests for building configs
* Handle Unity reload gaps by retrying plugin session resolution
* Add polling support for long-running tools with state persistence
Introduce polling middleware to handle long-running operations that may span domain reloads. Add McpJobStateStore utility to persist tool state in Library folder across reloads. Extend McpForUnityToolAttribute with RequiresPolling and PollAction properties. Update Response helper with Pending method for standardized polling responses. Implement Python-side polling logic in custom_tool_service.py with configurable intervals and 10-minute timeout.
* Polish domain reload resilience tests and docs
* Refactor Response helper to use strongly-typed classes instead of anonymous objects
Replace static Response.Success/Error/Pending methods with SuccessResponse, ErrorResponse, and PendingResponse classes. Add IMcpResponse interface for type safety. Include JsonProperty attributes for serialization and JsonIgnore properties for backward compatibility with reflection-based tests. Update all tool and resource classes to use new response types.
* Rename Setup Wizard to Setup Window and improve UV detection on macOS/Linux
Rename SetupWizard class to SetupWindowService and update all references throughout the codebase. Implement platform-specific UV detection for macOS and Linux with augmented PATH support, including TryValidateUv methods and BuildAugmentedPath helpers. Split single "Open Installation Links" button into separate Python and UV install buttons. Update UI styling to improve installation section layout with proper containers and button
* Update guide on what's changed in v8
Lots of feedback, lots of changes
* Update custom tool docs to use new response objects
* Update image used in README
Slightly more up to date but not final
* Restructure backend
Just make it more organized, like typical Python projects
* Remove server_version.txt
* Feature/http instance routing (#5)
* Fix HTTP instance routing and per-project session IDs
* Drop confusing log message
* Ensure lock file references later version of uvicorn with key fixes
* Fix test imports
* Update refs in docs
---------
Co-authored-by: David Sarno <david@lighthaus.us>
* Generate the session ID from the server
We also make the identifying hashes longer
* Force LLMs to choose a Unity instance when multiple are connected
OK, this is outright the best OSS Unity MCP available
* Fix tests caused by changes in session management
* Whitespace update
* Exclude stale builds so users always get the latest version
* Set Pythonpath env var so Python looks at the src folder for modules
Not required for the fix, but it's a good guarantee regardless of the working directory
* Replace Optional type hints with modern union syntax (Type | None)
Update all Optional[Type] annotations to use the PEP 604 union syntax Type | None throughout the transport layer and mcp_source.py script
* Replace Dict type hints with modern dict syntax throughout codebase
Update all Dict[K, V] annotations to use the built-in dict[K, V] syntax across services, transport layer, and models for consistency with PEP 585
* Remove unused type imports across codebase
Clean up unused imports of Dict, List, and Path types that are no longer needed after migration to modern type hint syntax
* Remove the old telemetry test
It's working, we have a better integration test in any case
* Clean up stupid imports
No AI slop here lol
* Replace dict-based session data with Pydantic models for type safety
Introduce Pydantic models for all WebSocket messages and session data structures. Replace dict.get() calls with direct attribute access throughout the codebase. Add validation and error handling for incoming messages in PluginHub.
* Correctly call `ctx.info` with `await`
No AI slop here!
* Replace printf-style logging with f-string formatting across transport and telemetry modules
Convert all logger calls using %-style string formatting to use f-strings for consistency with modern Python practices. Update telemetry configuration logging, port discovery debug messages, and Unity connection logging throughout the codebase.
* Register custom tools via websockets
Since we'll end up using websockets for HTTP and stdio, this will ensure custom tools are available to both.
We want to compartmentalize the custom tools to the session. Custom tools in 1 unity project don't apply to another one.
To work with our multi-instance logic, we hide the custom tools behind a custom tool function tool. This is the execute_custom_tool function.
The downside is that the LLM has to query before using it.
The upside is that the execute_custom_tool function goes through the standard routing in plugin_hub, so custom tools are always isolated by project.
* Add logging decorator to track tool and resource execution with arguments and return values
Create a new logging_decorator module that wraps both sync and async functions to log their inputs, outputs, and exceptions. Apply this decorator to all tools and resources before the telemetry decorator to provide detailed execution traces for debugging.
* Fix JSONResponse serialization by converting Pydantic model to dict in plugin sessions endpoint
* Whitespace
* Move import of get_unity_instance_from_context to module level in unity_transport
Relocate the import from inside the with_unity_instance decorator function to the top of the file with other imports for better code organization and to avoid repeated imports on each decorator call.
* Remove the tool that reads resources
They don't perform well at all, and confuses the models most times.
However, if they're required, we'll revert
* We have buttons for starting and stopping local servers
Instead of a button to clear uv cache, we have start and stop buttons.
The start button pulls the latest version of the server as well.
The stop button finds the local process of the server and kills.
Need to test on Windows but it works well
* Consolidate cache management into ServerManagementService and remove standalone CacheManagementService
Move the ClearUvxCache method from CacheManagementService into ServerManagementService since cache clearing is primarily used during server operations. Remove the separate ICacheManagementService interface and CacheManagementService class along with their service locator registration. Update StartLocalServer to call the local ClearUvxCache method instead of going through the service locator.
* Update MCPForUnity/Editor/Helpers/ProjectIdentityUtility.cs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Update .github/workflows/claude-nl-suite.yml
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Cancel existing background loops before starting a new connection
Nice bug found from CodeRabbit
* Try to kill all processes using the port of the local webserver
* Some better error handling when stopping a server
* Cache fallback session ID to maintain consistency when EditorPrefs are unavailable
Store the fallback session ID in a static field instead of generating a new GUID on each call when EditorPrefs are unavailable during batch tests. Clear the cached fallback ID when resetting the session to ensure a fresh ID is generated on the next session.
* Clean up empty parent temp folder after domain reload tests complete
Check if Assets/Temp folder is empty after deleting test-specific temp directories and remove it if no other files or directories remain. Also remove trailing blank lines from the file.
* Minor fixes
* Change "UV" to "uv" in strings. Capitlization looks weird
* Rename functions that capitalized "UV"
* Ensure WebSocket transport is properly stopped before disposing shared resources
Add disposal guard and call StopAsync() in Dispose() to prevent race conditions when disposing the WebSocket transport while background loops are still running. Log warnings if cleanup fails but continue with resource disposal.
* Replace volatile bool with Interlocked operations for reconnection flag to prevent race conditions
* Replace byte array allocation with ArrayPool to reduce GC pressure in WebSocket message receiving
Rent buffer from ArrayPool<byte>.Shared instead of allocating new byte arrays for each receive operation. Pre-size MemoryStream to 8192 bytes and ensure rented buffer is returned in finally block to prevent memory leaks.
* Consolidate some of the update/refresh logic
* UI tweak disable start/stop buttons while they code is being fired
* Add error dialog when Unity socket port persistence fails
* Rename WebSocketSessionId to SessionId in EditorPrefKeys
By the next version stdio will use Websockets as well, so why be redundant
* No need to send session ID in pong payload
* Add a debug message when we don't have an override for the uvx path
* Remove unused function
* Remove the unused verifyPath argument
* Simplify server management logic
* Remove unused `GetUvxCommand()` function
We construct it in parts now
* Remove `IsUvxDetected()`
The flow changed so it checks editor prefs and then defaults to the command line default. So it's always true.
* Add input validation and improve shell escaping in CreateTerminalProcessStartInfo
- Validate command is not empty before processing
- Strip carriage returns and newlines from command
- macOS: Use osascript directly instead of bash to avoid shell injection, escape backslashes and quotes for AppleScript
- Windows: Add window title and escape quotes in command
- Linux: Properly escape single quotes for bash -c and double quotes for process arguments
* Update technical changes guide
* Add custom_tools resource and execute_custom_tool to README documentation
* Update v8 docs
* Update docs UI image
* Handle when properties are sent as a JSON string in manage_asset
* Fix backend tests
---------
Co-authored-by: David Sarno <david@lighthaus.us>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Add a function to reload the domain
Closes#357
* feat: restructure server instructions into workflow-focused format
- Reorganized instructions from flat bullet list into categorized workflow sections
- Emphasized critical script management workflow with numbered steps
- Improved readability and scannability for AI agents using the MCP server
It doesn't make sense to repeat the fucnction tools, they're already parsed
* docs: reorder tool list alphabetically in README + add reload_domain tool
* feat: add Unity editor state and project info resources
- Implemented resources for querying active tool, editor state, prefab stage, selection, and open windows
- Added project configuration resources for layers and project metadata
- Organized new resources into Editor and Project namespaces for better structure
* feat: clarify script management workflow in system prompt
- Expanded guidance to include scripts created by any tool, not just manage_script
- Added "etc" to tools examples for better clarity
* refactor: remove reload_domain tool and update script management workflow
- Removed reload_domain tool as Unity automatically recompiles scripts when modified
- Updated script management instructions to rely on editor_state polling and console checking instead of manual domain reload
- Simplified workflow by removing unnecessary manual recompilation step
* Change name of menu items resource as the LLM seems it
* refactor: reorganize tests into src/tests/integration directory
- Moved all test files from root tests/ to MCPForUnity/UnityMcpServer~/src/tests/integration/ for better organization
- Added conftest.py with telemetry and dependency stubs to simplify test setup
- Removed redundant path manipulation and module loading code from individual test files
* feat: expand Unity test workflow triggers
- Run tests on all branches instead of only main
- Add pull request trigger to catch issues before merge
- Maintain path filtering to run only when relevant files change
* chore: add GitHub Actions workflow for Python tests
- Configured automated testing on push and pull requests using pytest
- Set up uv for dependency management and Python 3.10 environment
- Added test results artifact upload for debugging failed runs
* refactor: update import path for fastmcp Context
* docs: update development setup instructions to use uv
- Changed installation commands from pip to uv pip for better dependency management
- Updated test running instructions to use uv run pytest
- Added examples for running integration and unit tests separately
* Formatting [skip ci]
* refactor: optimize CI workflow with path filters and dependency installation
- Added path filters to only trigger tests when Python source or workflow files change
- Split dependency installation into sync and dev install steps for better clarity
- Fixed YAML indentation for improved readability
* Update .github/workflows/python-tests.yml
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* fix: standardize test mode values to match Unity's naming convention
- Changed default mode from "edit" to "EditMode" in C# code
- Updated Python tool to use "EditMode" and "PlayMode" instead of lowercase variants
* refactor: convert test imports to relative imports
- Changed absolute imports to relative imports in integration tests for better package structure
- Removed test packages from pyproject.toml package list
* refactor: use Field with default_factory for mutable default in TagsResponse
* refactor: remove duplicate PrefabStageUtility call
* Update this as well [skip ci]
* Update MCPForUnity/UnityMcpServer~/src/tests/integration/test_script_tools.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* chore: remove pull_request triggers from test workflows [skip ci]
It's already covered by pushes
* refactor: update resource function return types to include MCPResponse union
* refactor: remove manual domain reload tool
- Removed reload_domain tool as Unity handles script recompilation automatically
- Updated documentation to reflect automatic compilation workflow
- Simplified script management workflow instructions in server description
* refactor: add context support to resource handlers
- Updated all resource handlers to accept Context parameter for Unity instance routing
- Replaced direct async_send_command_with_retry calls with async_send_with_unity_instance wrapper
- Added imports for get_unity_instance_from_context and async_send_with_unity_instance helpers
* fix: correct grammar in menu items documentation
* docs: update README with expanded tools and resources documentation
- Added new tools: manage_prefabs, create_script, delete_script, get_sha
- Added new resources: editor state, windows, project info, layers, and tags
- Clarified manage_script as compatibility router with recommendation to use newer edit tools
- Fixed run_test to run_tests for consistency
* refactor: convert unity_instances function to async [skip ci]
- Changed function signature from synchronous to async
- Added await keywords to ctx.info() and ctx.error() calls to properly handle async context methods
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Add support for multiple Unity instances
* fix port detection
* add missing unity_instance parameter
* add instance params for resources
* Fix CodeRabbit review feedback
- Fix partial framed response handling in port discovery
Add _recv_exact() helper to ensure complete frame reading
Prevents healthy Unity instances from being misidentified as offline
- Remove unused default_conn variables in server.py (2 files)
Fixes Ruff F841 lint error that would block CI/CD
- Preserve sync/async nature of resources in wrapper
Check if original function is coroutine before wrapping
Prevents 'dict object is not awaitable' runtime errors
- Fix reconnection to preserve instance_id
Add instance_id tracking to UnityConnection dataclass
Reconnection now targets the same Unity instance instead of any available one
Prevents operations from being applied to wrong project
- Add instance logging to manage_asset for debugging
Helps troubleshoot multi-instance scenarios
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix CodeRabbit feedback: reconnection fallback and annotations safety
Address 3 CodeRabbit review comments:
1. Critical: Guard reconnection fallback to prevent wrong instance routing
- When instance_id is set but rediscovery fails, now raises ConnectionError
- Added 'from e' to preserve exception chain for better debugging
- Prevents silently connecting to different Unity instance
- Ensures multi-instance routing integrity
2. Minor: Guard __annotations__ access in resource registration
- Use getattr(func, '__annotations__', {}) instead of direct access
- Prevents AttributeError for functions without type hints
3. Minor: Remove unused get_type_hints import
- Clean up unused import in resources/__init__.py
All changes applied to both Server/ and MCPForUnity/ directories.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix instance sorting and logging issues
- Fix sorting logic for instances without heartbeat data: use epoch timestamp instead of current time to properly deprioritize instances with None last_heartbeat
- Use logger.exception() instead of logger.error() in disconnect_all() to include stack traces for better debugging
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* update uv.lock to prepare for merging into main
* Restore Python 3.10 lockfiles and package list_unity_instances tool
* Deduplicate Unity instance discovery by port
* Scope status-file reload checks to the active instance
* refactor: implement FastMCP middleware for session-based instance routing
Replaces module-level session_state.py with UnityInstanceMiddleware class
that follows FastMCP best practices. Middleware intercepts all tool calls
via on_call_tool hook and injects active Unity instance into request state.
Key changes:
- Add UnityInstanceMiddleware class with on_call_tool hook
- Tools now use ctx.get_state("unity_instance") instead of direct session_state calls
- Remove unity_instance parameter from all tool schemas to prevent LLM hallucination
- Convert list_unity_instances tool to unity_instances resource (read-only data)
- Update error messages to reference unity://instances resource
- Add set_state/get_state methods to DummyContext test helper
- All 67 tests passing (55 passed, 5 skipped, 7 xpassed)
Architecture benefits:
- Centralized session management in middleware
- Standard FastMCP patterns (middleware + request state)
- Cleaner separation of concerns
- Prevents AI hallucination of invalid instance IDs
* fix: convert resource templates to static resources for discoverability
Convert MCP resources from URI templates with query parameters to static
resources to fix discoverability in MCP clients like Claude Code.
Changes:
- Remove {?force_refresh} from unity://instances
- Remove {?unity_instance} from mcpforunity://menu-items
- Remove {?unity_instance} from mcpforunity://tests
- Keep {mode} path parameter in mcpforunity://tests/{mode} (legitimate)
Root cause: Query parameters {?param} trigger ResourceTemplate registration,
which are listed via resources/templates/list instead of resources/list.
Claude Code's ListMcpResourcesTool only queries resources/list, making
templates undiscoverable.
Solution: Remove optional query parameters from URIs. Instance routing is
handled by middleware/context, and force_refresh was cache control that
doesn't belong in resource identity.
Impact: Resources now discoverable via standard resources/list endpoint and
work with all MCP clients including Claude Code and Cursor.
Requires FastMCP >=2.13.0 for proper RFC 6570 query parameter support.
* feat: improve material properties and sync Server resources
Material Property Improvements (ManageAsset.cs):
- Add GetMainColorPropertyName() helper that auto-detects shader color properties
- Tries _BaseColor (URP), _Color (Standard), _MainColor, _Tint, _TintColor
- Update both named and array color property handling to use auto-detection
- Add warning messages when color properties don't exist on materials
- Split HasProperty check from SetColor to enable error reporting
This fixes the issue where simple color array format [r,g,b,a] defaulted to
_Color property, causing silent failures with URP Lit shader which uses _BaseColor.
Server Resource Sync:
- Sync Server/resources with MCPForUnity/UnityMcpServer~/src/resources
- Remove query parameters from resource URIs for discoverability
- Use session-based instance routing via get_unity_instance_from_context()
* fix: repair instance routing and simplify get_unity_instance_from_context
PROBLEM:
Instance routing was failing - scripts went to wrong Unity instances.
Script1 (intended: ramble) -> went to UnityMCPTests ❌
Script2 (intended: UnityMCPTests) -> went to ramble ❌
ROOT CAUSE:
Two incompatible approaches for accessing active instance:
1. Middleware: ctx.set_state() / ctx.get_state() - used by most tools
2. Legacy: ctx.request_context.meta - used by script tools
Script tools were reading from wrong location, middleware had no effect.
FIX:
1. Updated get_unity_instance_from_context() to read from ctx.get_state()
2. Removed legacy request_context.meta code path (98 lines removed)
3. Single source of truth: middleware state only
TESTING:
- Added comprehensive test suite (21 tests) covering all scenarios
- Tests middleware state management, session isolation, race conditions
- Tests reproduce exact 4-script failure scenario
- All 88 tests pass (76 passed + 5 skipped + 7 xpassed)
- Verified fix with live 4-script test: 100% success rate
Files changed:
- Server/tools/__init__.py: Simplified from 75 lines to 15 lines
- MCPForUnity/UnityMcpServer~/src/tools/__init__.py: Same simplification
- tests/test_instance_routing_comprehensive.py: New comprehensive test suite
* refactor: standardize instance extraction and remove dead imports
- Standardize all 18 tools to use get_unity_instance_from_context() helper
instead of direct ctx.get_state() calls for consistency
- Remove dead session_state imports from with_unity_instance decorator
that would cause ModuleNotFoundError at runtime
- Update README.md with concise instance routing documentation
* fix: critical timezone and import bugs from code review
- Remove incorrect port safety check that treated reclaimed ports as errors
(GetPortWithFallback may legitimately return same port if it became available)
- Fix timezone-aware vs naive datetime mixing in unity_connection.py sorting
(use timestamp() for comparison to avoid TypeError)
- Normalize all datetime comparisons in port_discovery.py to UTC
(file_mtime and last_heartbeat now consistently timezone-aware)
- Add missing send_with_unity_instance import in Server/tools/manage_script.py
(was causing NameError at runtime on lines 108 and 488)
All 88 tests pass (76 passed + 5 skipped + 7 xpassed)
---------
Co-authored-by: Sakura <sakurachan@qq.com>
Co-authored-by: Claude <noreply@anthropic.com>
* feat: lower minimum Python requirement to 3.10+
- Updated Python version requirement from 3.11+ to 3.10+ across all platform detectors
- Added Python 3.10 to MacOS framework search paths for broader compatibility
- Modified version validation logic to accept Python 3.10 or higher
- Updated documentation and error messages to reflect new minimum Python version
- Changed pyproject.toml requires-python field to ">=3.10"
- Updated badges and requirements in README files to show Python 3.10 support
* feat: add Python 3.10 and 3.11 to Windows path detection
- Added Python 3.10 installation path to LocalApplicationData search locations
- Added Python 3.10 and 3.11 paths to ProgramFiles search locations
- Expanded Python version compatibility to support older installations while maintaining support for newer versions
* feat: add Python 3.14 support and update path detection
- Added Python 3.14 installation paths to Windows and macOS platform detectors
- Removed legacy Python 3.9 paths from Windows path detection
- Updated Windows installation recommendations to suggest Python 3.10 or higher
- Added additional Python framework paths (3.10, 3.11) for macOS UV package manager detection
- Extended UV executable path detection to include Python 3.14 locations on both platforms
* Reduce size of README img
* Revert "Reduce size of README img"
This reverts commit 6fb99c7047bdef3610fb94dd3741c71c9e3ffcc1.
* Adjust size in README to maintain quality but be smaller
* Update .Bat file and Bug fix on ManageScript
* Update the .Bat file to include runtime folder
* Fix the inconsistent EditorPrefs variable so the GUI change on Script Validation could cause real change.
* Further changes
String to Int for consistency
* feat: add JSON property handling for materials; add tests for JSON coercion and end-to-end; update test project manifest and ProjectVersion
* fix(manage_asset): support structured texture blocks case-insensitively; resolve _BaseMap/_MainTex automatically and apply when missing name
* Update MCPForUnity/Editor/Tools/ManageAsset.cs
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* refactor(manage_asset): remove goto; reuse alias resolver for structured texture (supports 'albedo'); tests: self-sufficient texture asset and _BaseColor/_Color guards; python: assert success in invalid JSON case
* chore(manage_asset): remove duplicate return in modify case
* tests: fix mocks/patching for manage_asset/manage_gameobject; make invalid-json case tolerant; ensure prefab modify test patches transport correctly
* ci: allow manual dispatch for Unity EditMode tests (workflow_dispatch)
---------
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* Remove legacy UI and correct priority ordering of menu items
* Remove old UI screen
Users now have the new UI alone, less confusing and more predictable
* Remove unused config files
* Remove test for window that doesn't exist
* Remove unused code
* Remove dangling .meta file
* refactor: remove client configuration step from setup wizard
* refactor: remove menu item attributes and manual window actions from Python tool sync
* feat: update minimum Python version requirement from 3.10 to 3.11
The docs have 3.12. However, feature wise it seems that 3.11 is required
* fix: replace emoji warning symbol with unicode character in setup wizard dialogs
* docs: reorganize images into docs/images directory and update references
* docs: add UI preview image to README
* docs: add run_test function and resources section to available tools list
The recent changes should close#311
* fix: add SystemRoot env var to Windows config to support Python path resolution
Closes#315
* refactor: consolidate package installation and detection into unified lifecycle manager
Duplicate code for pretty much no reason, as they both initialized there was a small chance of a race condition as well. Consolidating made sense here
* Doc fixes from CodeRabbit
* Excellent bug catch from CodeRabbit
* fix: preserve existing environment variables when updating codex server config
* Update docs so the paths match the original name
* style: fix list indentation in README-DEV.md development docs
* refactor: simplify env table handling in CodexConfigHelper by removing preservation logic
* refactor: simplify configuration logic by removing redundant change detection
Always overwrite configs
* feat: ensure config directory exists before writing config files
* feat: persist server installation errors and show retry UI instead of auto-marking as handled
* refactor: consolidate configuration helpers by merging McpConfigFileHelper into McpConfigurationHelper
* Small fixes from CodeRabbit
* Remove test because we overwrite Codex configs
* Remove unused function
* feat: improve server cleanup and process handling on Windows
- Added DeleteDirectoryWithRetry helper to handle Windows file locking with retries and readonly attribute clearing
- Implemented KillWindowsUvProcesses to safely terminate Python processes in virtual environments using WMIC
- Extended TryKillUvForPath to work on Windows, preventing file handle locks during server deletion
- Improved error messages to be more descriptive about file locking issues
- Replaced direct Directory.Delete calls with
* fix: improve TCP socket cleanup to prevent CLOSE_WAIT states
- Added proper socket shutdown sequence using Socket.Shutdown() before closing connections
- Enhanced error handling with specific catches for SocketException vs general exceptions
- Added debug logging for socket shutdown errors to help diagnose connection issues
- Restructured HandleClientAsync to ensure socket cleanup happens in the correct order
- Implemented proper socket teardown in both client handling and connection cleanup paths
* Add TDD tests for MCP material management issues
- MCPMaterialTests.cs: Tests for material creation, assignment, and data reading
- MCPParameterHandlingTests.cs: Tests for JSON parameter parsing issues
- SphereMaterialWorkflowTests.cs: Tests for complete sphere material workflow
These tests document the current issues with:
- JSON parameter parsing in manage_asset and manage_gameobject tools
- Material creation with properties
- Material assignment to GameObjects
- Material component data reading
All tests currently fail (Red phase of TDD) and serve as specifications
for what needs to be fixed in the MCP system.
* Refine TDD tests to focus on actual MCP tool parameter parsing issues
- Removed redundant tests that verify working functionality (GameObjectSerializer, Unity APIs)
- Kept focused tests that document the real issue: MCP tool parameter validation
- Tests now clearly identify the root cause: JSON string parsing in MCP tools
- Tests specify exactly what needs to be fixed: parameter type flexibility
The issue is NOT in Unity APIs or serialization (which work fine),
but in MCP tool parameter validation being too strict.
* Fix port discovery protocol mismatch
- Update _try_probe_unity_mcp to recognize Unity bridge welcome message
- Unity bridge sends 'WELCOME UNITY-MCP' instead of JSON pong response
- Maintains backward compatibility with JSON pong format
- Fixes MCP server connection to Unity Editor
* Resolve merge: unify manage_gameobject param coercion and schema widening
* Tests: add MaterialParameterToolTests; merge port probe fix; widen tool schemas for JSON-string params
* feat(material): support direct shader property keys and texture paths; add EditMode tests
* chore(tests): track required .meta files; remove ephemeral Assets/Editor test helper
* fix(manage_gameobject): validate parsed component_properties is a dict; return clear error
* Add TDD tests for MCP material management issues
- MCPMaterialTests.cs: Tests for material creation, assignment, and data reading
- MCPParameterHandlingTests.cs: Tests for JSON parameter parsing issues
- SphereMaterialWorkflowTests.cs: Tests for complete sphere material workflow
These tests document the current issues with:
- JSON parameter parsing in manage_asset and manage_gameobject tools
- Material creation with properties
- Material assignment to GameObjects
- Material component data reading
All tests currently fail (Red phase of TDD) and serve as specifications
for what needs to be fixed in the MCP system.
* Refine TDD tests to focus on actual MCP tool parameter parsing issues
- Removed redundant tests that verify working functionality (GameObjectSerializer, Unity APIs)
- Kept focused tests that document the real issue: MCP tool parameter validation
- Tests now clearly identify the root cause: JSON string parsing in MCP tools
- Tests specify exactly what needs to be fixed: parameter type flexibility
The issue is NOT in Unity APIs or serialization (which work fine),
but in MCP tool parameter validation being too strict.
* Fix port discovery protocol mismatch
- Update _try_probe_unity_mcp to recognize Unity bridge welcome message
- Unity bridge sends 'WELCOME UNITY-MCP' instead of JSON pong response
- Maintains backward compatibility with JSON pong format
- Fixes MCP server connection to Unity Editor
* Resolve merge: unify manage_gameobject param coercion and schema widening
* Tests: add MaterialParameterToolTests; merge port probe fix; widen tool schemas for JSON-string params
* refactor: extract JSON coercion helper; docs + exception narrowing\nfix: fail fast on bad component_properties JSON\ntest: unify setup, avoid test-to-test calls\nchore: use relative MCP package path
* chore(tests): track MCPToolParameterTests.cs.meta to keep GUID stable
* test: decouple MaterialParameterToolTests with helpers (no inter-test calls)
* Editor: prevent material/mesh instantiation in edit mode
- GameObjectSerializer: in edit mode, normalize material/mesh access
- material -> sharedMaterial
- materials -> sharedMaterials
- mesh -> sharedMesh
- also guard materials/sharedMaterial/sharedMaterials property names
- Tests: add strong instanceID equality checks for Renderer/MeshFilter
- prove no instantiation by shared instanceID before/after
- cover multi-material, null cases; prune brittle presence/console tests
- Clean up and relax ManageGameObject tests to avoid false negatives
* Address review: simplify edit-mode guard; include protected/internal [SerializeField]; fix tests to destroy temp primitives and use dictionary access; strengthen instanceID assertions
* Fix resource leaks in test files
- ManageGameObjectTests.cs: Destroy temporary primitive GameObject after extracting sharedMesh
- MaterialMeshInstantiationTests.cs: Destroy instantiated uniqueMesh after test completion
These fixes prevent resource leaks in Unity test files by properly cleaning up temporary objects created during tests.
* Fix reflection bug in GetComponentData tests
- Replace incorrect reflection-based field access with proper dictionary key access
- GetComponentData() returns Dictionary<string, object> where 'properties' is a key, not a field
- Tests now properly access the properties dictionary and run assertions
- Fixes ineffective tests that were silently failing due to reflection returning null
* feat: add package update service with version check and GitHub integration
* feat: add migration warning banner and dialog for legacy package users
* test: remove redundant cache expiration and clearing tests from PackageUpdateService
* test: add package update service tests for expired cache and asset store installations
Before discovering the Tommy library I tried to parse TOML files directly. Some of the methods lingered from that time, which were messing up configuration on Windows.
Now we use Tommy more, it should work. Also consolidated some code with fresh eyes
Closes#311
* Fix issue #308: Find py files in MCPForUnityTools and version.txt
This allows for auto finding new tools. A good dir on a custom tool would look like this:
CustomTool/
├── CustomTool.MCPEnabler.asmdef
├── CustomTool.MCPEnabler.asmdef.meta
├── ExternalAssetToolFunction.cs
├── ExternalAssetToolFunction.cs.meta
├── external_asset_tool_function.py
├── external_asset_tool_function.py.meta
├── version.txt
└── version.txt.meta
CS files are left in the tools folder. The asmdef is recommended to allow for dependency on MCPForUnity when MCP For Unity is installed:
asmdef example
{
"name": "CustomTool.MCPEnabler",
"rootNamespace": "MCPForUnity.Editor.Tools",
"references": [
"CustomTool",
"MCPForUnity.Editor"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
* Follow-up: address CodeRabbit feedback for #308 (<GetToolsFolderIdentifier was duplicated>)
* Follow-up: address CodeRabbit feedback for #308 – centralize GetToolsFolderIdentifier, fix tools copy dir, and limit scan scope
* Fixing so the MCP don't removes _skipDirs e.g. __pycache__
* skip empty folders with no py files
* Rabbit: "Fix identifier collision between different package roots."
* Update MCPForUnity/Editor/Helpers/ServerInstaller.cs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Rabbbit: Cleanup may delete server’s built-in tool subfolders — restrict to managed names.
* Fixed minor + missed onadding rabit change
* Revert "Fixed minor + missed onadding rabit change"
This reverts commit 571ca8c5de3d07da3791dad558677909a07e886d.
* refactor: remove Unity project tools copying and version tracking functionality
* refactor: consolidate module discovery logic into shared utility function
* Remove unused imports
* feat: add Python tool registry and sync system for MCP server integration
* feat: add auto-sync processor for Python tools with Unity editor integration
* feat: add menu item to reimport all Python files in project
Good to give users a manual option
* Fix infinite loop error
Don't react to PythonToolAsset changes - it only needs to react to Python file changes.
And we also batch asset edits to minimise the DB refreshes
* refactor: move Python tool sync menu items under Window/MCP For Unity/Tool Sync
* Update docs
* Remove duplicate header
* feat: add OnValidate handler to sync Python tools when asset is modified
This fixes the issue with deletions in the asset, now file removals are synced
* test: add unit tests for Python tools asset and sync services
* Update MCPForUnity/Editor/Helpers/PythonToolSyncProcessor.cs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* style: remove trailing whitespace from Python tool sync files
* test: remove incomplete unit tests from ToolSyncServiceTests
* perf: optimize Python file reimport by using AssetDatabase.FindAssets instead of GetAllAssetPaths
---------
Co-authored-by: Johan Holtby <72528418+JohanHoltby@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* chore: update Unity version from 2021.3.45f1 to 2021.3.45f2
Older Unity version had the security vulnerability, so we update it
* feat: add dynamic version display in editor window settings
* refactor: remove manual license file handling from Unity test workflow
* Revert "refactor: remove manual license file handling from Unity test workflow"
This reverts commit a6ab3d982e792039c01a4afd353e61c7e22a2c3c.
* feat: add Unity license credentials to Docker containers in CI workflow
* refactor: replace manual Unity license activation with game-ci/unity-activator
* refactor: simplify Unity CI setup by removing game-ci activation and using built-in license handling
* fix: improve Unity license activation in CI by using unityci image's built-in activation flow
* refactor: activate once in a temporary container, then reuse the license in the long-running container
Now we got the license secret to be read, we got this error: "Machine bindings don't match". So it seems that the license I generated locally can't be used.
So we need to activate the license within the container
* Revert "refactor: activate once in a temporary container, then reuse the license in the long-running container"
This reverts commit f6a9aa68f910df37cede6f83d535098be2a9f80b.
* Revert "fix: improve Unity license activation in CI by using unityci image's built-in activation flow"
This reverts commit a9f4c0223bc3467442be6dafa1d9303479623a7c.
* Revert "refactor: simplify Unity CI setup by removing game-ci activation and using built-in license handling"
This reverts commit 4e5ffc0051a7b15b9d87ecaa06fa646f8b13b0b9.
* Revert "refactor: replace manual Unity license activation with game-ci/unity-activator"
This reverts commit e9520ee768c4e9d48efc81b1a9c3cac3986cc96a.
* Revert "feat: add Unity license credentials to Docker containers in CI workflow"
This reverts commit 01b8879e35baaf88239988b51e6d4f1e5daaa1cf.
* deps: add tomli>=2.3.0 dependency to UnityMcpServer package
* feat: dynamically fetch package version from pyproject.toml for telemetry
* Add pydantic
* feat: add resource registry for MCP resource auto-discovery
* feat: add telemetry decorator for tracking MCP resource usage
* feat: add auto-discovery and registration system for MCP resources
* feat: add resource registration to MCP server initialization
* feat: add MCPResponse model class for standardized API responses
* refactor: replace Debug.Log calls with McpLog wrapper for consistent logging
* feat: add test discovery endpoints for Unity Test Framework integration
We haven't connected them as yet, still thinking about how to do this neatly
* Fix server setup
* refactor: reduce log verbosity by changing individual resource/tool registration logs to debug level
* chore: bump mcp[cli] dependency from 1.15.0 to 1.17.0
* refactor: remove Context parameter and add uri keyword argument in resource decorator
The Context parameter doesn't work on our version of FastMCP
* chore: upgrade Python base image to 3.13 and simplify Dockerfile setup
* fix: apply telemetry decorator before mcp.tool to ensure proper wrapping order
* fix: swap order of telemetry and resource decorators to properly wrap handlers
* fix: update log prefixes for consistency in logging methods
* Fix compile errors
* feat: extend command registry to support both tools and resources
* Run get tests as a coroutine because it doesn't return results immediately
This works but it spams logs like crazy, maybe there's a better/simpler way
* refactor: migrate from coroutines to async/await for test retrieval and command execution
* feat: add optional error field to MCPResponse model
* Increased timeout because loading tests can take some time
* Make message optional so error responses that only have success and error don't cause Pydantic errors
* Set max_retries to 5
This connection module needs a lookover. The retries should be an exponential backoff and we could structure why it's failing so much
* Use pydantic model to structure the error output
* fix: initialize data field in GetTestsResponse to avoid potential errors
* Don't return path parameter
* feat: add Unity test runner execution with structured results and Python bindings
* refactor: simplify GetTests by removing mode filtering and related parsing logic
* refactor: move test runner functionality into dedicated service interface
* feat: add resource retrieval telemetry tracking with new record type and helper function
* fix: convert tool functions to async and await ctx.info calls
* refactor: reorganize menu item functionality into separate execute and get commands
An MCP resource for retrieval, and a simple command to execute. Because it's a resource, it's easier for the user to see what's in the menu items
* refactor: rename manage_menu_item to execute_menu_item and update tool examples to use async/await
We'll eventually put a section for resources
* Revert "fix: convert tool functions to async and await ctx.info calls"
This reverts commit 012ea6b7439bd1f2593864d98d03d9d95d7bdd03.
* fix: replace tomllib with tomli for Python 3.10 compatibility in telemetry module
* Remove confusing comment
* refactor: improve error handling and simplify test retrieval logic in GetTests commands
* No cache by default
* docs: remove redundant comment for HandleCommand method in ExecuteMenuItem
* First pass at new UI
* Point to new UI
* Refactor: New Service-Based MCP Editor Window Architecture
We separate the business logic from the UI rendering of the new editor window with new services.
I didn't go full Dependency Injection, not sure if I want to add those deps to the install as yet, but service location is fairly straightforward.
Some differences with the old window:
- No more Auto-Setup, users will manually decide what they want to do
- Removed Python detection warning, we have a setup wizard now
- Added explicit path overrides for `uv` and the MCP server itself
* style: add flex-shrink and overflow handling to improve UI element scaling
* fix: update UI configuration and visibility when client status changes
* feat: add menu item to open legacy MCP configuration window
* refactor: improve editor window lifecycle handling with proper update subscription
* feat: add auto-verification of bridge health when connected
* fix: update Claude Code MCP server registration to use lowercase unityMCP name and correct the manual installation instructions
* fix: add Claude CLI directory to PATH for node/nvm environments
* Clarify how users will see MCP tools
* Add a keyboard shortcut to open the window
* feat: add server download UI and improve installation status messaging
This is needed for the Unity Asset Store, which doesn't have the Python server embedded.
* feat: add dynamic asset path detection to support both Package Manager and Asset Store installations
* fix: replace unicode emojis with escaped characters in status messages
* feat: add server package creation and GitHub release publishing to version bump workflow
* fix: add v prefix to server package filename in release workflow
* Fix download location
* style: improve dropdown and settings layout responsiveness with flex-shrink and max-width
* feat: add package.json version detection and refactor path utilities
* refactor: simplify imports and use fully qualified names in ServerInstaller.cs
* refactor: replace Unity Debug.Log calls with custom McpLog class
* fix: extract server files to temp directory before moving to final location
* docs: add v6 UI documentation and screenshots with service architecture overview
* docs: add new UI Toolkit-based editor window with service architecture and path overrides
* feat: improve package path resolution to support Package Manager and Asset Store installations
* Change Claude Code's casing back to "UnityMCP"
There's no need to break anything as yet
* fix: update success dialog text to clarify manual bridge start requirement
* refactor: move RefreshDebounce and ManageScriptRefreshHelpers classes inside namespace
* feat: add Asset Store fallback path detection for package root lookup
* fix: update server installation success message to be more descriptive
* refactor: replace Unity Debug.Log calls with custom McpLog utility
* fix: add file existence check before opening configuration file
* refactor: simplify asset path handling and remove redundant helper namespace references
* docs: update code block syntax highlighting in UI changes doc
* docs: add code block syntax highlighting for file structure example
* feat: import UnityEditor.UIElements namespace for UI components for Unity 2021 compatibility
* refactor: rename Python server references to MCP server for consistency
* fix: reset client status label color after error state is cleared
* Replace the phrase "Python server" with "MCP server"
* MInor doc clarification
* docs: add path override methods for UV and Claude CLI executables
* docs: update service locator registration method name from SetCustomImplementation to Register
* Copy UnityMcpBridge into a new MCPForUnity folder
This is to close#284
* refactor: rename UnityMcpBridge directory to MCPForUnity in docs
* chore: rename UnityMcpBridge directory to MCPForUnity across workflow files
* chore: rename UnityMcpBridge directory to MCPForUnity across all files
* refactor: update import paths from UnityMcpBridge to MCPForUnity across test files
* fix: update module import paths to use MCPForUnity instead of UnityMcpBridge
* chore: update unity-mcp package path to MCPForUnity directory
* feat: add OneTimeSetUp to initialize CommandRegistry before tests run
Hopefully fix the CI failures
* Apply recent fix to new folder
* Temporarily trigger tests to see if CI works
* Revert "Temporarily trigger tests to see if CI works"
It works!
This reverts commit 8c6eaaad07545cef047769f2c52fe506545a8161.