mcpforunityserver 9.3.0b20260129121506__tar.gz → 9.3.0b20260131004250__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/PKG-INFO +117 -5
  2. mcpforunityserver-9.3.0b20260131004250/README.md +287 -0
  3. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/pyproject.toml +1 -1
  4. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/utils/connection.py +28 -32
  5. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/core/config.py +15 -0
  6. mcpforunityserver-9.3.0b20260131004250/src/core/constants.py +4 -0
  7. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/main.py +306 -174
  8. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/mcpforunityserver.egg-info/PKG-INFO +117 -5
  9. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/mcpforunityserver.egg-info/SOURCES.txt +2 -0
  10. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/models/__init__.py +2 -2
  11. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/models/unity_response.py +24 -1
  12. mcpforunityserver-9.3.0b20260131004250/src/services/api_key_service.py +235 -0
  13. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/active_tool.py +2 -1
  14. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/editor_state.py +7 -7
  15. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/layers.py +2 -1
  16. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/menu_items.py +2 -1
  17. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/prefab_stage.py +2 -1
  18. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/project_info.py +2 -1
  19. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/selection.py +2 -1
  20. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/tags.py +2 -1
  21. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/tests.py +3 -2
  22. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/unity_instances.py +6 -3
  23. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/windows.py +2 -1
  24. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/set_active_instance.py +6 -3
  25. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/transport/legacy/unity_connection.py +29 -7
  26. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/transport/models.py +5 -0
  27. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/transport/plugin_hub.py +236 -34
  28. mcpforunityserver-9.3.0b20260131004250/src/transport/plugin_registry.py +182 -0
  29. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/transport/unity_instance_middleware.py +42 -12
  30. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/transport/unity_transport.py +41 -10
  31. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/tests/test_cli.py +0 -32
  32. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/tests/test_core_infrastructure_characterization.py +4 -2
  33. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/tests/test_transport_characterization.py +2 -2
  34. mcpforunityserver-9.3.0b20260129121506/README.md +0 -175
  35. mcpforunityserver-9.3.0b20260129121506/src/transport/plugin_registry.py +0 -126
  36. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/LICENSE +0 -0
  37. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/setup.cfg +0 -0
  38. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/__init__.py +0 -0
  39. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/__init__.py +0 -0
  40. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/animation.py +0 -0
  41. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/asset.py +0 -0
  42. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/audio.py +0 -0
  43. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/batch.py +0 -0
  44. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/code.py +0 -0
  45. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/component.py +0 -0
  46. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/editor.py +0 -0
  47. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/gameobject.py +0 -0
  48. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/instance.py +0 -0
  49. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/lighting.py +0 -0
  50. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/material.py +0 -0
  51. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/prefab.py +0 -0
  52. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/scene.py +0 -0
  53. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/script.py +0 -0
  54. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/shader.py +0 -0
  55. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/texture.py +0 -0
  56. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/tool.py +0 -0
  57. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/ui.py +0 -0
  58. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/commands/vfx.py +0 -0
  59. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/main.py +0 -0
  60. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/utils/__init__.py +0 -0
  61. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/utils/config.py +0 -0
  62. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/utils/confirmation.py +0 -0
  63. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/utils/constants.py +0 -0
  64. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/utils/output.py +0 -0
  65. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/utils/parsers.py +0 -0
  66. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/cli/utils/suggestions.py +0 -0
  67. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/core/__init__.py +0 -0
  68. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/core/logging_decorator.py +0 -0
  69. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/core/telemetry.py +0 -0
  70. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/core/telemetry_decorator.py +0 -0
  71. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/mcpforunityserver.egg-info/dependency_links.txt +0 -0
  72. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/mcpforunityserver.egg-info/entry_points.txt +0 -0
  73. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/mcpforunityserver.egg-info/requires.txt +0 -0
  74. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/mcpforunityserver.egg-info/top_level.txt +0 -0
  75. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/models/models.py +0 -0
  76. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/__init__.py +0 -0
  77. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/custom_tool_service.py +0 -0
  78. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/registry/__init__.py +0 -0
  79. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/registry/resource_registry.py +0 -0
  80. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/registry/tool_registry.py +0 -0
  81. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/__init__.py +0 -0
  82. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/custom_tools.py +0 -0
  83. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/gameobject.py +0 -0
  84. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/resources/prefab.py +0 -0
  85. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/state/external_changes_scanner.py +0 -0
  86. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/__init__.py +0 -0
  87. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/batch_execute.py +0 -0
  88. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/debug_request_context.py +0 -0
  89. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/execute_custom_tool.py +0 -0
  90. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/execute_menu_item.py +0 -0
  91. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/find_gameobjects.py +0 -0
  92. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/find_in_file.py +0 -0
  93. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_asset.py +0 -0
  94. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_components.py +0 -0
  95. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_editor.py +0 -0
  96. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_gameobject.py +0 -0
  97. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_material.py +0 -0
  98. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_prefabs.py +0 -0
  99. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_scene.py +0 -0
  100. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_script.py +0 -0
  101. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_scriptable_object.py +0 -0
  102. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_shader.py +0 -0
  103. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_texture.py +0 -0
  104. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/manage_vfx.py +0 -0
  105. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/preflight.py +0 -0
  106. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/read_console.py +0 -0
  107. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/refresh_unity.py +0 -0
  108. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/run_tests.py +0 -0
  109. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/script_apply_edits.py +0 -0
  110. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/services/tools/utils.py +0 -0
  111. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/transport/__init__.py +0 -0
  112. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/transport/legacy/port_discovery.py +0 -0
  113. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/transport/legacy/stdio_port_registry.py +0 -0
  114. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/utils/focus_nudge.py +0 -0
  115. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/src/utils/module_discovery.py +0 -0
  116. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/tests/test_cli_commands_characterization.py +0 -0
  117. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/tests/test_models_characterization.py +0 -0
  118. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/tests/test_param_normalizer.py +0 -0
  119. {mcpforunityserver-9.3.0b20260129121506 → mcpforunityserver-9.3.0b20260131004250}/tests/test_utilities_characterization.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcpforunityserver
3
- Version: 9.3.0b20260129121506
3
+ Version: 9.3.0b20260131004250
4
4
  Summary: MCP for Unity Server: A Unity package for Unity Editor integration via the Model Context Protocol (MCP).
5
5
  Author-email: Marcus Sanatan <msanatan@gmail.com>, David Sarno <david.sarno@gmail.com>, Wu Shutong <martinwfire@gmail.com>
6
6
  License-Expression: MIT
@@ -154,12 +154,124 @@ uv run src/main.py --transport stdio
154
154
 
155
155
  ## Configuration
156
156
 
157
- The server connects to Unity Editor automatically when both are running. No additional configuration needed.
157
+ The server connects to Unity Editor automatically when both are running. Most users do not need to change any settings.
158
+
159
+ ### CLI options
160
+
161
+ These options apply to the `mcp-for-unity` command (whether run via `uvx`, Docker, or `python src/main.py`).
162
+
163
+ - `--transport {stdio,http}` - Transport protocol (default: `stdio`)
164
+ - `--http-url URL` - Base URL used to derive host/port defaults (default: `http://localhost:8080`)
165
+ - `--http-host HOST` - Override HTTP bind host (overrides URL host)
166
+ - `--http-port PORT` - Override HTTP bind port (overrides URL port)
167
+ - `--http-remote-hosted` - Treat HTTP transport as remotely hosted
168
+ - Requires API key authentication (see below)
169
+ - Disables local/CLI-only HTTP routes (`/api/command`, `/api/instances`, `/api/custom-tools`)
170
+ - Forces explicit Unity instance selection for MCP tool/resource calls
171
+ - Isolates Unity sessions per user
172
+ - `--api-key-validation-url URL` - External endpoint to validate API keys (required when `--http-remote-hosted` is set)
173
+ - `--api-key-login-url URL` - URL where users can obtain/manage API keys (served by `/api/auth/login-url`)
174
+ - `--api-key-cache-ttl SECONDS` - Cache duration for validated keys (default: `300`)
175
+ - `--api-key-service-token-header HEADER` - Header name for server-to-auth-service authentication (e.g. `X-Service-Token`)
176
+ - `--api-key-service-token TOKEN` - Token value sent to the auth service for server authentication
177
+ - `--default-instance INSTANCE` - Default Unity instance to target (project name, hash, or `Name@hash`)
178
+ - `--project-scoped-tools` - Keep custom tools scoped to the active Unity project and enable the custom tools resource
179
+ - `--unity-instance-token TOKEN` - Optional per-launch token set by Unity for deterministic lifecycle management
180
+ - `--pidfile PATH` - Optional path where the server writes its PID on startup (used by Unity-managed terminal launches)
181
+
182
+ ### Environment variables
183
+
184
+ - `UNITY_MCP_TRANSPORT` - Transport protocol: `stdio` or `http`
185
+ - `UNITY_MCP_HTTP_URL` - HTTP server URL (default: `http://localhost:8080`)
186
+ - `UNITY_MCP_HTTP_HOST` - HTTP bind host (overrides URL host)
187
+ - `UNITY_MCP_HTTP_PORT` - HTTP bind port (overrides URL port)
188
+ - `UNITY_MCP_HTTP_REMOTE_HOSTED` - Enable remote-hosted mode (`true`, `1`, or `yes`)
189
+ - `UNITY_MCP_DEFAULT_INSTANCE` - Default Unity instance to target (project name, hash, or `Name@hash`)
190
+ - `UNITY_MCP_SKIP_STARTUP_CONNECT=1` - Skip initial Unity connection attempt on startup
191
+
192
+ API key authentication (remote-hosted mode):
193
+
194
+ - `UNITY_MCP_API_KEY_VALIDATION_URL` - External endpoint to validate API keys
195
+ - `UNITY_MCP_API_KEY_LOGIN_URL` - URL where users can obtain/manage API keys
196
+ - `UNITY_MCP_API_KEY_CACHE_TTL` - Cache TTL for validated keys in seconds (default: `300`)
197
+ - `UNITY_MCP_API_KEY_SERVICE_TOKEN_HEADER` - Header name for server-to-auth-service authentication
198
+ - `UNITY_MCP_API_KEY_SERVICE_TOKEN` - Token value sent to the auth service for server authentication
199
+
200
+ Telemetry:
201
+
202
+ - `DISABLE_TELEMETRY=1` - Disable anonymous telemetry (opt-out)
203
+ - `UNITY_MCP_DISABLE_TELEMETRY=1` - Same as `DISABLE_TELEMETRY`
204
+ - `MCP_DISABLE_TELEMETRY=1` - Same as `DISABLE_TELEMETRY`
205
+ - `UNITY_MCP_TELEMETRY_ENDPOINT` - Override telemetry endpoint URL
206
+ - `UNITY_MCP_TELEMETRY_TIMEOUT` - Override telemetry request timeout (seconds)
207
+
208
+ ### Examples
209
+
210
+ **Stdio (default):**
158
211
 
159
- **Environment Variables:**
212
+ ```bash
213
+ uvx --from mcpforunityserver mcp-for-unity --transport stdio
214
+ ```
215
+
216
+ **HTTP (local):**
217
+
218
+ ```bash
219
+ uvx --from mcpforunityserver mcp-for-unity --transport http --http-host 127.0.0.1 --http-port 8080
220
+ ```
221
+
222
+ **HTTP (remote-hosted with API key auth):**
223
+
224
+ ```bash
225
+ uvx --from mcpforunityserver mcp-for-unity \
226
+ --transport http \
227
+ --http-host 0.0.0.0 \
228
+ --http-port 8080 \
229
+ --http-remote-hosted \
230
+ --api-key-validation-url https://auth.example.com/api/validate-key \
231
+ --api-key-login-url https://app.example.com/api-keys
232
+ ```
233
+
234
+ **Disable telemetry:**
235
+
236
+ ```bash
237
+ DISABLE_TELEMETRY=1 uvx --from mcpforunityserver mcp-for-unity --transport stdio
238
+ ```
239
+
240
+ ---
241
+
242
+ ## Remote-Hosted Mode
243
+
244
+ When deploying the server as a shared remote service (e.g. for a team or Asset Store users), enable `--http-remote-hosted` to activate API key authentication and per-user session isolation.
245
+
246
+ **Requirements:**
247
+
248
+ - An external HTTP endpoint that validates API keys. The server POSTs `{"api_key": "..."}` and expects `{"valid": true, "user_id": "..."}` or `{"valid": false}` in response.
249
+ - `--api-key-validation-url` must be provided (or `UNITY_MCP_API_KEY_VALIDATION_URL`). The server exits with code 1 if this is missing.
250
+
251
+ **What changes in remote-hosted mode:**
252
+
253
+ - All MCP tool/resource calls and Unity plugin WebSocket connections require a valid `X-API-Key` header.
254
+ - Each user only sees Unity instances that connected with their API key (session isolation).
255
+ - Auto-selection of a sole Unity instance is disabled; users must explicitly call `set_active_instance`.
256
+ - CLI REST routes (`/api/command`, `/api/instances`, `/api/custom-tools`) are disabled.
257
+ - `/health` and `/api/auth/login-url` remain accessible without authentication.
258
+
259
+ **MCP client config with API key:**
260
+
261
+ ```json
262
+ {
263
+ "mcpServers": {
264
+ "UnityMCP": {
265
+ "url": "http://remote-server:8080/mcp",
266
+ "headers": {
267
+ "X-API-Key": "<your-api-key>"
268
+ }
269
+ }
270
+ }
271
+ }
272
+ ```
160
273
 
161
- - `DISABLE_TELEMETRY=true` - Opt out of anonymous usage analytics
162
- - `LOG_LEVEL=DEBUG` - Enable detailed logging (default: INFO)
274
+ For full details, see [Remote Server Auth Guide](../docs/guides/REMOTE_SERVER_AUTH.md) and [Architecture Reference](../docs/reference/REMOTE_SERVER_AUTH_ARCHITECTURE.md).
163
275
 
164
276
  ---
165
277
 
@@ -0,0 +1,287 @@
1
+ # MCP for Unity Server
2
+
3
+ [![MCP](https://badge.mcpx.dev?status=on 'MCP Enabled')](https://modelcontextprotocol.io/introduction)
4
+ [![python](https://img.shields.io/badge/Python-3.10+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
5
+ [![License](https://img.shields.io/badge/License-MIT-red.svg 'MIT License')](https://opensource.org/licenses/MIT)
6
+ [![Discord](https://img.shields.io/badge/discord-join-red.svg?logo=discord&logoColor=white)](https://discord.gg/y4p8KfzrN4)
7
+
8
+ Model Context Protocol server for Unity Editor integration. Control Unity through natural language using AI assistants like Claude, Cursor, and more.
9
+
10
+ **Maintained by [Coplay](https://www.coplay.dev/?ref=unity-mcp)** - This project is not affiliated with Unity Technologies.
11
+
12
+ 💬 **Join our community:** [Discord Server](https://discord.gg/y4p8KfzrN4)
13
+
14
+ **Required:** Install the [Unity MCP Plugin](https://github.com/CoplayDev/unity-mcp?tab=readme-ov-file#-step-1-install-the-unity-package) to connect Unity Editor with this MCP server. You also need `uvx` (requires [uv](https://docs.astral.sh/uv/)) to run the server.
15
+
16
+ ---
17
+
18
+ ## Installation
19
+
20
+ ### Option 1: PyPI
21
+
22
+ Install and run directly from PyPI using `uvx`.
23
+
24
+ **Run Server (HTTP):**
25
+
26
+ ```bash
27
+ uvx --from mcpforunityserver mcp-for-unity --transport http --http-url http://localhost:8080
28
+ ```
29
+
30
+ **MCP Client Configuration (HTTP):**
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "UnityMCP": {
36
+ "url": "http://localhost:8080/mcp"
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ **MCP Client Configuration (stdio):**
43
+
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "UnityMCP": {
48
+ "command": "uvx",
49
+ "args": [
50
+ "--from",
51
+ "mcpforunityserver",
52
+ "mcp-for-unity",
53
+ "--transport",
54
+ "stdio"
55
+ ]
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ ### Option 2: From GitHub Source
62
+
63
+ Use this to run the latest released version from the repository. Change the version to `main` to run the latest unreleased changes from the repository.
64
+
65
+ ```json
66
+ {
67
+ "mcpServers": {
68
+ "UnityMCP": {
69
+ "command": "uvx",
70
+ "args": [
71
+ "--from",
72
+ "git+https://github.com/CoplayDev/unity-mcp@v9.2.0#subdirectory=Server",
73
+ "mcp-for-unity",
74
+ "--transport",
75
+ "stdio"
76
+ ]
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
82
+ ### Option 3: Docker
83
+
84
+ **Use Pre-built Image:**
85
+
86
+ ```bash
87
+ docker run -p 8080:8080 msanatan/mcp-for-unity-server:latest --transport http --http-url http://0.0.0.0:8080
88
+ ```
89
+
90
+ **Build Locally:**
91
+
92
+ ```bash
93
+ docker build -t unity-mcp-server .
94
+ docker run -p 8080:8080 unity-mcp-server --transport http --http-url http://0.0.0.0:8080
95
+ ```
96
+
97
+ Configure your MCP client with `"url": "http://localhost:8080/mcp"`.
98
+
99
+ ### Option 4: Local Development
100
+
101
+ For contributing or modifying the server code:
102
+
103
+ ```bash
104
+ # Clone the repository
105
+ git clone https://github.com/CoplayDev/unity-mcp.git
106
+ cd unity-mcp/Server
107
+
108
+ # Run with uv
109
+ uv run src/main.py --transport stdio
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Configuration
115
+
116
+ The server connects to Unity Editor automatically when both are running. Most users do not need to change any settings.
117
+
118
+ ### CLI options
119
+
120
+ These options apply to the `mcp-for-unity` command (whether run via `uvx`, Docker, or `python src/main.py`).
121
+
122
+ - `--transport {stdio,http}` - Transport protocol (default: `stdio`)
123
+ - `--http-url URL` - Base URL used to derive host/port defaults (default: `http://localhost:8080`)
124
+ - `--http-host HOST` - Override HTTP bind host (overrides URL host)
125
+ - `--http-port PORT` - Override HTTP bind port (overrides URL port)
126
+ - `--http-remote-hosted` - Treat HTTP transport as remotely hosted
127
+ - Requires API key authentication (see below)
128
+ - Disables local/CLI-only HTTP routes (`/api/command`, `/api/instances`, `/api/custom-tools`)
129
+ - Forces explicit Unity instance selection for MCP tool/resource calls
130
+ - Isolates Unity sessions per user
131
+ - `--api-key-validation-url URL` - External endpoint to validate API keys (required when `--http-remote-hosted` is set)
132
+ - `--api-key-login-url URL` - URL where users can obtain/manage API keys (served by `/api/auth/login-url`)
133
+ - `--api-key-cache-ttl SECONDS` - Cache duration for validated keys (default: `300`)
134
+ - `--api-key-service-token-header HEADER` - Header name for server-to-auth-service authentication (e.g. `X-Service-Token`)
135
+ - `--api-key-service-token TOKEN` - Token value sent to the auth service for server authentication
136
+ - `--default-instance INSTANCE` - Default Unity instance to target (project name, hash, or `Name@hash`)
137
+ - `--project-scoped-tools` - Keep custom tools scoped to the active Unity project and enable the custom tools resource
138
+ - `--unity-instance-token TOKEN` - Optional per-launch token set by Unity for deterministic lifecycle management
139
+ - `--pidfile PATH` - Optional path where the server writes its PID on startup (used by Unity-managed terminal launches)
140
+
141
+ ### Environment variables
142
+
143
+ - `UNITY_MCP_TRANSPORT` - Transport protocol: `stdio` or `http`
144
+ - `UNITY_MCP_HTTP_URL` - HTTP server URL (default: `http://localhost:8080`)
145
+ - `UNITY_MCP_HTTP_HOST` - HTTP bind host (overrides URL host)
146
+ - `UNITY_MCP_HTTP_PORT` - HTTP bind port (overrides URL port)
147
+ - `UNITY_MCP_HTTP_REMOTE_HOSTED` - Enable remote-hosted mode (`true`, `1`, or `yes`)
148
+ - `UNITY_MCP_DEFAULT_INSTANCE` - Default Unity instance to target (project name, hash, or `Name@hash`)
149
+ - `UNITY_MCP_SKIP_STARTUP_CONNECT=1` - Skip initial Unity connection attempt on startup
150
+
151
+ API key authentication (remote-hosted mode):
152
+
153
+ - `UNITY_MCP_API_KEY_VALIDATION_URL` - External endpoint to validate API keys
154
+ - `UNITY_MCP_API_KEY_LOGIN_URL` - URL where users can obtain/manage API keys
155
+ - `UNITY_MCP_API_KEY_CACHE_TTL` - Cache TTL for validated keys in seconds (default: `300`)
156
+ - `UNITY_MCP_API_KEY_SERVICE_TOKEN_HEADER` - Header name for server-to-auth-service authentication
157
+ - `UNITY_MCP_API_KEY_SERVICE_TOKEN` - Token value sent to the auth service for server authentication
158
+
159
+ Telemetry:
160
+
161
+ - `DISABLE_TELEMETRY=1` - Disable anonymous telemetry (opt-out)
162
+ - `UNITY_MCP_DISABLE_TELEMETRY=1` - Same as `DISABLE_TELEMETRY`
163
+ - `MCP_DISABLE_TELEMETRY=1` - Same as `DISABLE_TELEMETRY`
164
+ - `UNITY_MCP_TELEMETRY_ENDPOINT` - Override telemetry endpoint URL
165
+ - `UNITY_MCP_TELEMETRY_TIMEOUT` - Override telemetry request timeout (seconds)
166
+
167
+ ### Examples
168
+
169
+ **Stdio (default):**
170
+
171
+ ```bash
172
+ uvx --from mcpforunityserver mcp-for-unity --transport stdio
173
+ ```
174
+
175
+ **HTTP (local):**
176
+
177
+ ```bash
178
+ uvx --from mcpforunityserver mcp-for-unity --transport http --http-host 127.0.0.1 --http-port 8080
179
+ ```
180
+
181
+ **HTTP (remote-hosted with API key auth):**
182
+
183
+ ```bash
184
+ uvx --from mcpforunityserver mcp-for-unity \
185
+ --transport http \
186
+ --http-host 0.0.0.0 \
187
+ --http-port 8080 \
188
+ --http-remote-hosted \
189
+ --api-key-validation-url https://auth.example.com/api/validate-key \
190
+ --api-key-login-url https://app.example.com/api-keys
191
+ ```
192
+
193
+ **Disable telemetry:**
194
+
195
+ ```bash
196
+ DISABLE_TELEMETRY=1 uvx --from mcpforunityserver mcp-for-unity --transport stdio
197
+ ```
198
+
199
+ ---
200
+
201
+ ## Remote-Hosted Mode
202
+
203
+ When deploying the server as a shared remote service (e.g. for a team or Asset Store users), enable `--http-remote-hosted` to activate API key authentication and per-user session isolation.
204
+
205
+ **Requirements:**
206
+
207
+ - An external HTTP endpoint that validates API keys. The server POSTs `{"api_key": "..."}` and expects `{"valid": true, "user_id": "..."}` or `{"valid": false}` in response.
208
+ - `--api-key-validation-url` must be provided (or `UNITY_MCP_API_KEY_VALIDATION_URL`). The server exits with code 1 if this is missing.
209
+
210
+ **What changes in remote-hosted mode:**
211
+
212
+ - All MCP tool/resource calls and Unity plugin WebSocket connections require a valid `X-API-Key` header.
213
+ - Each user only sees Unity instances that connected with their API key (session isolation).
214
+ - Auto-selection of a sole Unity instance is disabled; users must explicitly call `set_active_instance`.
215
+ - CLI REST routes (`/api/command`, `/api/instances`, `/api/custom-tools`) are disabled.
216
+ - `/health` and `/api/auth/login-url` remain accessible without authentication.
217
+
218
+ **MCP client config with API key:**
219
+
220
+ ```json
221
+ {
222
+ "mcpServers": {
223
+ "UnityMCP": {
224
+ "url": "http://remote-server:8080/mcp",
225
+ "headers": {
226
+ "X-API-Key": "<your-api-key>"
227
+ }
228
+ }
229
+ }
230
+ }
231
+ ```
232
+
233
+ For full details, see [Remote Server Auth Guide](../docs/guides/REMOTE_SERVER_AUTH.md) and [Architecture Reference](../docs/reference/REMOTE_SERVER_AUTH_ARCHITECTURE.md).
234
+
235
+ ---
236
+
237
+ ## MCP Resources
238
+
239
+ The server provides read-only MCP resources for querying Unity Editor state. Resources provide up-to-date information about your Unity project without modifying it.
240
+
241
+ **Accessing Resources:**
242
+
243
+ Resources are accessed by their URI (not their name). Always use `ListMcpResources` to get the correct URI format.
244
+
245
+ **Example URIs:**
246
+ - `mcpforunity://editor/state` - Editor readiness snapshot
247
+ - `mcpforunity://project/tags` - All project tags
248
+ - `mcpforunity://scene/gameobject/{instance_id}` - GameObject details by ID
249
+ - `mcpforunity://prefab/{encoded_path}` - Prefab info by asset path
250
+
251
+ **Important:** Resource names use underscores (e.g., `editor_state`) but URIs use slashes/hyphens (e.g., `mcpforunity://editor/state`). Always use the URI from `ListMcpResources()` when reading resources.
252
+
253
+ **All resource descriptions now include their URI** for easy reference. List available resources to see the complete catalog with URIs.
254
+
255
+ ---
256
+
257
+ ## Example Prompts
258
+
259
+ Once connected, try these commands in your AI assistant:
260
+
261
+ - "Create a 3D player controller with WASD movement"
262
+ - "Add a rotating cube to the scene with a red material"
263
+ - "Create a simple platformer level with obstacles"
264
+ - "Generate a shader that creates a holographic effect"
265
+ - "List all GameObjects in the current scene"
266
+
267
+ ---
268
+
269
+ ## Documentation
270
+
271
+ For complete documentation, troubleshooting, and advanced usage:
272
+
273
+ 📖 **[Full Documentation](https://github.com/CoplayDev/unity-mcp#readme)**
274
+
275
+ ---
276
+
277
+ ## Requirements
278
+
279
+ - **Python:** 3.10 or newer
280
+ - **Unity Editor:** 2021.3 LTS or newer
281
+ - **uv:** Python package manager ([Installation Guide](https://docs.astral.sh/uv/getting-started/installation/))
282
+
283
+ ---
284
+
285
+ ## License
286
+
287
+ MIT License - See [LICENSE](https://github.com/CoplayDev/unity-mcp/blob/main/LICENSE)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mcpforunityserver"
3
- version = "9.3.0b20260129121506"
3
+ version = "9.3.0b20260131004250"
4
4
  description = "MCP for Unity Server: A Unity package for Unity Editor integration via the Model Context Protocol (MCP)."
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -182,38 +182,34 @@ async def list_unity_instances(config: Optional[CLIConfig] = None) -> Dict[str,
182
182
  """
183
183
  cfg = config or get_config()
184
184
 
185
- # Try the new /api/instances endpoint first, fall back to /plugin/sessions
186
- urls_to_try = [
187
- f"http://{cfg.host}:{cfg.port}/api/instances",
188
- f"http://{cfg.host}:{cfg.port}/plugin/sessions",
189
- ]
190
-
191
- async with httpx.AsyncClient() as client:
192
- for url in urls_to_try:
193
- try:
194
- response = await client.get(url, timeout=10)
195
- if response.status_code == 200:
196
- data = response.json()
197
- # Normalize response format
198
- if "instances" in data:
199
- return data
200
- elif "sessions" in data:
201
- # Convert sessions format to instances format
202
- instances = []
203
- for session_id, details in data["sessions"].items():
204
- instances.append({
205
- "session_id": session_id,
206
- "project": details.get("project", "Unknown"),
207
- "hash": details.get("hash", ""),
208
- "unity_version": details.get("unity_version", "Unknown"),
209
- "connected_at": details.get("connected_at", ""),
210
- })
211
- return {"success": True, "instances": instances}
212
- except Exception:
213
- continue
214
-
215
- raise UnityConnectionError(
216
- "Failed to list Unity instances: No working endpoint found")
185
+ url = f"http://{cfg.host}:{cfg.port}/api/instances"
186
+
187
+ try:
188
+ async with httpx.AsyncClient() as client:
189
+ response = await client.get(url, timeout=10)
190
+ response.raise_for_status()
191
+ data = response.json()
192
+ if "instances" in data:
193
+ return data
194
+ except httpx.ConnectError as e:
195
+ raise UnityConnectionError(
196
+ f"Cannot connect to Unity MCP server at {cfg.host}:{cfg.port}. "
197
+ f"Make sure the server is running and Unity is connected.\n"
198
+ f"Error: {e}"
199
+ )
200
+ except httpx.TimeoutException:
201
+ raise UnityConnectionError(
202
+ "Connection to Unity timed out while listing instances. "
203
+ "Unity may be busy or unresponsive."
204
+ )
205
+ except httpx.HTTPStatusError as e:
206
+ raise UnityConnectionError(
207
+ f"HTTP error from server: {e.response.status_code} - {e.response.text}"
208
+ )
209
+ except Exception as e:
210
+ raise UnityConnectionError(f"Unexpected error: {e}")
211
+
212
+ raise UnityConnectionError("Failed to list Unity instances")
217
213
 
218
214
 
219
215
  def run_list_instances(config: Optional[CLIConfig] = None) -> Dict[str, Any]:
@@ -15,6 +15,21 @@ class ServerConfig:
15
15
  unity_port: int = 6400
16
16
  mcp_port: int = 6500
17
17
 
18
+ # Transport settings
19
+ transport_mode: str = "stdio"
20
+
21
+ # HTTP transport behaviour
22
+ http_remote_hosted: bool = False
23
+
24
+ # API key authentication (required when http_remote_hosted=True)
25
+ api_key_validation_url: str | None = None # POST endpoint to validate keys
26
+ api_key_login_url: str | None = None # URL for users to get/manage keys
27
+ # Cache TTL in seconds (5 min default)
28
+ api_key_cache_ttl: float = 300.0
29
+ # Optional service token for authenticating to the validation endpoint
30
+ api_key_service_token_header: str | None = None # e.g. "X-Service-Token"
31
+ api_key_service_token: str | None = None # The token value
32
+
18
33
  # Connection settings
19
34
  connection_timeout: float = 30.0
20
35
  buffer_size: int = 16 * 1024 * 1024 # 16MB buffer
@@ -0,0 +1,4 @@
1
+ """Server-wide protocol constants."""
2
+
3
+ # HTTP header name for API key authentication
4
+ API_KEY_HEADER = "X-API-Key"