mcpforunityserver 8.6.0__tar.gz → 9.4.0b20260203062603__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 (131) hide show
  1. mcpforunityserver-9.4.0b20260203062603/PKG-INFO +328 -0
  2. mcpforunityserver-9.4.0b20260203062603/README.md +287 -0
  3. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/pyproject.toml +36 -1
  4. mcpforunityserver-9.4.0b20260203062603/src/cli/__init__.py +3 -0
  5. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/__init__.py +3 -0
  6. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/animation.py +84 -0
  7. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/asset.py +280 -0
  8. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/audio.py +125 -0
  9. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/batch.py +171 -0
  10. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/code.py +182 -0
  11. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/component.py +190 -0
  12. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/editor.py +447 -0
  13. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/gameobject.py +487 -0
  14. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/instance.py +93 -0
  15. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/lighting.py +123 -0
  16. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/material.py +239 -0
  17. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/prefab.py +248 -0
  18. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/scene.py +231 -0
  19. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/script.py +222 -0
  20. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/shader.py +226 -0
  21. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/texture.py +540 -0
  22. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/tool.py +58 -0
  23. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/ui.py +258 -0
  24. mcpforunityserver-9.4.0b20260203062603/src/cli/commands/vfx.py +421 -0
  25. mcpforunityserver-9.4.0b20260203062603/src/cli/main.py +281 -0
  26. mcpforunityserver-9.4.0b20260203062603/src/cli/utils/__init__.py +31 -0
  27. mcpforunityserver-9.4.0b20260203062603/src/cli/utils/config.py +58 -0
  28. mcpforunityserver-9.4.0b20260203062603/src/cli/utils/confirmation.py +37 -0
  29. mcpforunityserver-9.4.0b20260203062603/src/cli/utils/connection.py +254 -0
  30. mcpforunityserver-9.4.0b20260203062603/src/cli/utils/constants.py +23 -0
  31. mcpforunityserver-9.4.0b20260203062603/src/cli/utils/output.py +195 -0
  32. mcpforunityserver-9.4.0b20260203062603/src/cli/utils/parsers.py +112 -0
  33. mcpforunityserver-9.4.0b20260203062603/src/cli/utils/suggestions.py +34 -0
  34. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/core/config.py +15 -4
  35. mcpforunityserver-9.4.0b20260203062603/src/core/constants.py +4 -0
  36. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/core/telemetry.py +20 -2
  37. mcpforunityserver-9.4.0b20260203062603/src/main.py +845 -0
  38. mcpforunityserver-9.4.0b20260203062603/src/mcpforunityserver.egg-info/PKG-INFO +328 -0
  39. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/mcpforunityserver.egg-info/SOURCES.txt +49 -3
  40. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/mcpforunityserver.egg-info/entry_points.txt +1 -0
  41. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/mcpforunityserver.egg-info/requires.txt +2 -0
  42. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/mcpforunityserver.egg-info/top_level.txt +1 -2
  43. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/models/__init__.py +2 -2
  44. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/models/unity_response.py +24 -1
  45. mcpforunityserver-9.4.0b20260203062603/src/services/api_key_service.py +235 -0
  46. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/custom_tool_service.py +179 -19
  47. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/resources/__init__.py +6 -1
  48. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/resources/active_tool.py +4 -3
  49. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/resources/custom_tools.py +3 -3
  50. mcpforunityserver-9.4.0b20260203062603/src/services/resources/editor_state.py +304 -0
  51. mcpforunityserver-9.4.0b20260203062603/src/services/resources/gameobject.py +243 -0
  52. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/resources/layers.py +4 -3
  53. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/resources/menu_items.py +3 -2
  54. mcpforunityserver-9.4.0b20260203062603/src/services/resources/prefab.py +191 -0
  55. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/resources/prefab_stage.py +4 -3
  56. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/resources/project_info.py +4 -3
  57. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/resources/selection.py +4 -3
  58. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/resources/tags.py +4 -3
  59. mcpforunityserver-9.4.0b20260203062603/src/services/resources/tests.py +88 -0
  60. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/resources/unity_instances.py +8 -5
  61. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/resources/windows.py +4 -3
  62. mcpforunityserver-9.4.0b20260203062603/src/services/state/external_changes_scanner.py +245 -0
  63. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/__init__.py +9 -2
  64. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/batch_execute.py +24 -9
  65. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/debug_request_context.py +8 -2
  66. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/execute_custom_tool.py +6 -1
  67. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/execute_menu_item.py +6 -3
  68. mcpforunityserver-9.4.0b20260203062603/src/services/tools/find_gameobjects.py +110 -0
  69. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/find_in_file.py +26 -19
  70. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/manage_asset.py +19 -43
  71. mcpforunityserver-9.4.0b20260203062603/src/services/tools/manage_components.py +131 -0
  72. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/manage_editor.py +9 -8
  73. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/manage_gameobject.py +88 -82
  74. mcpforunityserver-9.4.0b20260203062603/src/services/tools/manage_material.py +111 -0
  75. mcpforunityserver-9.4.0b20260203062603/src/services/tools/manage_prefabs.py +209 -0
  76. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/manage_scene.py +34 -13
  77. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/manage_script.py +62 -19
  78. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/manage_scriptable_object.py +22 -10
  79. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/manage_shader.py +8 -1
  80. mcpforunityserver-9.4.0b20260203062603/src/services/tools/manage_texture.py +581 -0
  81. mcpforunityserver-9.4.0b20260203062603/src/services/tools/manage_vfx.py +120 -0
  82. mcpforunityserver-9.4.0b20260203062603/src/services/tools/preflight.py +110 -0
  83. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/read_console.py +70 -17
  84. mcpforunityserver-9.4.0b20260203062603/src/services/tools/refresh_unity.py +153 -0
  85. mcpforunityserver-9.4.0b20260203062603/src/services/tools/run_tests.py +317 -0
  86. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/script_apply_edits.py +15 -7
  87. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/tools/set_active_instance.py +18 -10
  88. mcpforunityserver-9.4.0b20260203062603/src/services/tools/utils.py +348 -0
  89. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/transport/legacy/port_discovery.py +2 -2
  90. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/transport/legacy/unity_connection.py +152 -27
  91. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/transport/models.py +6 -0
  92. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/transport/plugin_hub.py +312 -48
  93. mcpforunityserver-9.4.0b20260203062603/src/transport/plugin_registry.py +182 -0
  94. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/transport/unity_instance_middleware.py +46 -15
  95. mcpforunityserver-9.4.0b20260203062603/src/transport/unity_transport.py +94 -0
  96. mcpforunityserver-9.4.0b20260203062603/src/utils/focus_nudge.py +589 -0
  97. mcpforunityserver-9.4.0b20260203062603/tests/test_cli.py +1312 -0
  98. mcpforunityserver-9.4.0b20260203062603/tests/test_cli_commands_characterization.py +1051 -0
  99. mcpforunityserver-9.4.0b20260203062603/tests/test_core_infrastructure_characterization.py +1352 -0
  100. mcpforunityserver-9.4.0b20260203062603/tests/test_models_characterization.py +933 -0
  101. mcpforunityserver-9.4.0b20260203062603/tests/test_param_normalizer.py +151 -0
  102. mcpforunityserver-9.4.0b20260203062603/tests/test_transport_characterization.py +1122 -0
  103. mcpforunityserver-8.6.0/PKG-INFO +0 -194
  104. mcpforunityserver-8.6.0/README.md +0 -155
  105. mcpforunityserver-8.6.0/src/main.py +0 -479
  106. mcpforunityserver-8.6.0/src/mcpforunityserver.egg-info/PKG-INFO +0 -194
  107. mcpforunityserver-8.6.0/src/services/resources/editor_state.py +0 -51
  108. mcpforunityserver-8.6.0/src/services/resources/tests.py +0 -55
  109. mcpforunityserver-8.6.0/src/services/tools/manage_material.py +0 -95
  110. mcpforunityserver-8.6.0/src/services/tools/manage_prefabs.py +0 -62
  111. mcpforunityserver-8.6.0/src/services/tools/run_tests.py +0 -101
  112. mcpforunityserver-8.6.0/src/services/tools/utils.py +0 -77
  113. mcpforunityserver-8.6.0/src/transport/__init__.py +0 -0
  114. mcpforunityserver-8.6.0/src/transport/plugin_registry.py +0 -123
  115. mcpforunityserver-8.6.0/src/transport/unity_transport.py +0 -113
  116. mcpforunityserver-8.6.0/src/utils/reload_sentinel.py +0 -9
  117. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/LICENSE +0 -0
  118. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/setup.cfg +0 -0
  119. {mcpforunityserver-8.6.0/src → mcpforunityserver-9.4.0b20260203062603/src/core}/__init__.py +0 -0
  120. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/core/logging_decorator.py +0 -0
  121. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/core/telemetry_decorator.py +0 -0
  122. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/mcpforunityserver.egg-info/dependency_links.txt +0 -0
  123. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/models/models.py +0 -0
  124. {mcpforunityserver-8.6.0/src/core → mcpforunityserver-9.4.0b20260203062603/src/services}/__init__.py +0 -0
  125. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/registry/__init__.py +0 -0
  126. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/registry/resource_registry.py +0 -0
  127. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/services/registry/tool_registry.py +0 -0
  128. {mcpforunityserver-8.6.0/src/routes → mcpforunityserver-9.4.0b20260203062603/src/transport}/__init__.py +0 -0
  129. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/transport/legacy/stdio_port_registry.py +0 -0
  130. {mcpforunityserver-8.6.0 → mcpforunityserver-9.4.0b20260203062603}/src/utils/module_discovery.py +0 -0
  131. /mcpforunityserver-8.6.0/src/services/__init__.py → /mcpforunityserver-9.4.0b20260203062603/tests/test_utilities_characterization.py +0 -0
@@ -0,0 +1,328 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcpforunityserver
3
+ Version: 9.4.0b20260203062603
4
+ Summary: MCP for Unity Server: A Unity package for Unity Editor integration via the Model Context Protocol (MCP).
5
+ Author-email: Marcus Sanatan <msanatan@gmail.com>, David Sarno <david.sarno@gmail.com>, Wu Shutong <martinwfire@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/CoplayDev/unity-mcp.git
8
+ Project-URL: Issues, https://github.com/CoplayDev/unity-mcp/issues
9
+ Keywords: mcp,unity,ai,model context protocol,gamedev,unity3d,automation,llm,agent
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: Implementation :: CPython
21
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Games/Entertainment
24
+ Classifier: Topic :: Software Development :: Code Generators
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: httpx>=0.27.2
29
+ Requires-Dist: fastmcp==2.14.1
30
+ Requires-Dist: mcp>=1.16.0
31
+ Requires-Dist: pydantic>=2.12.5
32
+ Requires-Dist: tomli>=2.3.0
33
+ Requires-Dist: fastapi>=0.104.0
34
+ Requires-Dist: uvicorn>=0.35.0
35
+ Requires-Dist: click>=8.1.0
36
+ Provides-Extra: dev
37
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
38
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
39
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
40
+ Dynamic: license-file
41
+
42
+ # MCP for Unity Server
43
+
44
+ [![MCP](https://badge.mcpx.dev?status=on 'MCP Enabled')](https://modelcontextprotocol.io/introduction)
45
+ [![python](https://img.shields.io/badge/Python-3.10+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
46
+ [![License](https://img.shields.io/badge/License-MIT-red.svg 'MIT License')](https://opensource.org/licenses/MIT)
47
+ [![Discord](https://img.shields.io/badge/discord-join-red.svg?logo=discord&logoColor=white)](https://discord.gg/y4p8KfzrN4)
48
+
49
+ Model Context Protocol server for Unity Editor integration. Control Unity through natural language using AI assistants like Claude, Cursor, and more.
50
+
51
+ **Maintained by [Coplay](https://www.coplay.dev/?ref=unity-mcp)** - This project is not affiliated with Unity Technologies.
52
+
53
+ 💬 **Join our community:** [Discord Server](https://discord.gg/y4p8KfzrN4)
54
+
55
+ **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.
56
+
57
+ ---
58
+
59
+ ## Installation
60
+
61
+ ### Option 1: PyPI
62
+
63
+ Install and run directly from PyPI using `uvx`.
64
+
65
+ **Run Server (HTTP):**
66
+
67
+ ```bash
68
+ uvx --from mcpforunityserver mcp-for-unity --transport http --http-url http://localhost:8080
69
+ ```
70
+
71
+ **MCP Client Configuration (HTTP):**
72
+
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "UnityMCP": {
77
+ "url": "http://localhost:8080/mcp"
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ **MCP Client Configuration (stdio):**
84
+
85
+ ```json
86
+ {
87
+ "mcpServers": {
88
+ "UnityMCP": {
89
+ "command": "uvx",
90
+ "args": [
91
+ "--from",
92
+ "mcpforunityserver",
93
+ "mcp-for-unity",
94
+ "--transport",
95
+ "stdio"
96
+ ]
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ ### Option 2: From GitHub Source
103
+
104
+ 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.
105
+
106
+ ```json
107
+ {
108
+ "mcpServers": {
109
+ "UnityMCP": {
110
+ "command": "uvx",
111
+ "args": [
112
+ "--from",
113
+ "git+https://github.com/CoplayDev/unity-mcp@v9.3.1#subdirectory=Server",
114
+ "mcp-for-unity",
115
+ "--transport",
116
+ "stdio"
117
+ ]
118
+ }
119
+ }
120
+ }
121
+ ```
122
+
123
+ ### Option 3: Docker
124
+
125
+ **Use Pre-built Image:**
126
+
127
+ ```bash
128
+ docker run -p 8080:8080 msanatan/mcp-for-unity-server:latest --transport http --http-url http://0.0.0.0:8080
129
+ ```
130
+
131
+ **Build Locally:**
132
+
133
+ ```bash
134
+ docker build -t unity-mcp-server .
135
+ docker run -p 8080:8080 unity-mcp-server --transport http --http-url http://0.0.0.0:8080
136
+ ```
137
+
138
+ Configure your MCP client with `"url": "http://localhost:8080/mcp"`.
139
+
140
+ ### Option 4: Local Development
141
+
142
+ For contributing or modifying the server code:
143
+
144
+ ```bash
145
+ # Clone the repository
146
+ git clone https://github.com/CoplayDev/unity-mcp.git
147
+ cd unity-mcp/Server
148
+
149
+ # Run with uv
150
+ uv run src/main.py --transport stdio
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Configuration
156
+
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):**
211
+
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
+ ```
273
+
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).
275
+
276
+ ---
277
+
278
+ ## MCP Resources
279
+
280
+ 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.
281
+
282
+ **Accessing Resources:**
283
+
284
+ Resources are accessed by their URI (not their name). Always use `ListMcpResources` to get the correct URI format.
285
+
286
+ **Example URIs:**
287
+ - `mcpforunity://editor/state` - Editor readiness snapshot
288
+ - `mcpforunity://project/tags` - All project tags
289
+ - `mcpforunity://scene/gameobject/{instance_id}` - GameObject details by ID
290
+ - `mcpforunity://prefab/{encoded_path}` - Prefab info by asset path
291
+
292
+ **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.
293
+
294
+ **All resource descriptions now include their URI** for easy reference. List available resources to see the complete catalog with URIs.
295
+
296
+ ---
297
+
298
+ ## Example Prompts
299
+
300
+ Once connected, try these commands in your AI assistant:
301
+
302
+ - "Create a 3D player controller with WASD movement"
303
+ - "Add a rotating cube to the scene with a red material"
304
+ - "Create a simple platformer level with obstacles"
305
+ - "Generate a shader that creates a holographic effect"
306
+ - "List all GameObjects in the current scene"
307
+
308
+ ---
309
+
310
+ ## Documentation
311
+
312
+ For complete documentation, troubleshooting, and advanced usage:
313
+
314
+ 📖 **[Full Documentation](https://github.com/CoplayDev/unity-mcp#readme)**
315
+
316
+ ---
317
+
318
+ ## Requirements
319
+
320
+ - **Python:** 3.10 or newer
321
+ - **Unity Editor:** 2021.3 LTS or newer
322
+ - **uv:** Python package manager ([Installation Guide](https://docs.astral.sh/uv/getting-started/installation/))
323
+
324
+ ---
325
+
326
+ ## License
327
+
328
+ MIT License - See [LICENSE](https://github.com/CoplayDev/unity-mcp/blob/main/LICENSE)
@@ -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.3.1#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 = "8.6.0"
3
+ version = "9.4.0b20260203062603"
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"
@@ -36,12 +36,14 @@ dependencies = [
36
36
  "tomli>=2.3.0",
37
37
  "fastapi>=0.104.0",
38
38
  "uvicorn>=0.35.0",
39
+ "click>=8.1.0",
39
40
  ]
40
41
 
41
42
  [project.optional-dependencies]
42
43
  dev = [
43
44
  "pytest>=8.0.0",
44
45
  "pytest-asyncio>=0.23",
46
+ "pytest-cov>=4.1.0",
45
47
  ]
46
48
 
47
49
  [project.urls]
@@ -50,7 +52,40 @@ Issues = "https://github.com/CoplayDev/unity-mcp/issues"
50
52
 
51
53
  [project.scripts]
52
54
  mcp-for-unity = "main:main"
55
+ unity-mcp = "cli.main:main"
53
56
 
54
57
  [build-system]
55
58
  requires = ["setuptools>=64.0.0", "wheel"]
56
59
  build-backend = "setuptools.build_meta"
60
+
61
+ [tool.setuptools.packages.find]
62
+ where = ["src"]
63
+
64
+ [tool.setuptools.package-dir]
65
+ "" = "src"
66
+
67
+ [tool.setuptools]
68
+ py-modules = ["main"]
69
+
70
+ [tool.coverage.run]
71
+ source = ["src"]
72
+ omit = [
73
+ "*/tests/*",
74
+ "*/test_*.py",
75
+ ]
76
+
77
+ [tool.coverage.report]
78
+ exclude_lines = [
79
+ "pragma: no cover",
80
+ "def __repr__",
81
+ "raise AssertionError",
82
+ "raise NotImplementedError",
83
+ "if __name__ == \"__main__\":",
84
+ "if TYPE_CHECKING:",
85
+ "@abstractmethod",
86
+ ]
87
+ precision = 2
88
+ show_missing = true
89
+
90
+ [tool.coverage.html]
91
+ directory = "htmlcov"
@@ -0,0 +1,3 @@
1
+ """Unity MCP Command Line Interface."""
2
+
3
+ __version__ = "1.0.0"
@@ -0,0 +1,3 @@
1
+ """CLI command modules."""
2
+
3
+ # Commands will be registered in main.py