From 8caf8a5d91534406a79afa5b227c50b727cc0326 Mon Sep 17 00:00:00 2001 From: Justin Barnett Date: Sat, 22 Mar 2025 18:11:48 -0400 Subject: [PATCH 1/6] updated setuptools --- Python/pyproject.toml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Python/pyproject.toml b/Python/pyproject.toml index 17987d7..eb84efb 100644 --- a/Python/pyproject.toml +++ b/Python/pyproject.toml @@ -4,18 +4,12 @@ version = "0.1.0" description = "Unity MCP Server: A Unity package for Unity Editor integration via the Model Context Protocol (MCP)." readme = "README.md" requires-python = ">=3.12" -dependencies = [ - "httpx>=0.28.1", - "mcp[cli]>=1.4.1" -] +dependencies = ["httpx>=0.28.1", "mcp[cli]>=1.4.1"] [build-system] -requires = ["setuptools>=42", "wheel"] +requires = ["setuptools>=64.0.0", "wheel"] build-backend = "setuptools.build_meta" [tool.setuptools] -# These are the single-file modules at the root of the Python folder. py-modules = ["config", "server", "unity_connection"] - -# The "tools" subdirectory is a package. packages = ["tools"] From 9a714dcfd523667fa7dd121c2ce6ecef09b2eec7 Mon Sep 17 00:00:00 2001 From: Justin Barnett Date: Sat, 22 Mar 2025 18:15:18 -0400 Subject: [PATCH 2/6] removed requirements.txt as requirements are handled in pyproject.toml --- Python/requirements.txt | 3 --- Python/requirements.txt.meta | 7 ------- 2 files changed, 10 deletions(-) delete mode 100644 Python/requirements.txt delete mode 100644 Python/requirements.txt.meta diff --git a/Python/requirements.txt b/Python/requirements.txt deleted file mode 100644 index 4772fbc..0000000 --- a/Python/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -uvicorn -mcp -fastapi \ No newline at end of file diff --git a/Python/requirements.txt.meta b/Python/requirements.txt.meta deleted file mode 100644 index ab0018b..0000000 --- a/Python/requirements.txt.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 6e76438bce2c57540a9d9602fafdcb0a -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: From 33f6f4268fde7125318ddee9adf9a34e5e96724d Mon Sep 17 00:00:00 2001 From: Justin Barnett Date: Sat, 22 Mar 2025 18:21:28 -0400 Subject: [PATCH 3/6] updated dependency versions --- Python/pyproject.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Python/pyproject.toml b/Python/pyproject.toml index eb84efb..423cf5f 100644 --- a/Python/pyproject.toml +++ b/Python/pyproject.toml @@ -4,7 +4,12 @@ version = "0.1.0" description = "Unity MCP Server: A Unity package for Unity Editor integration via the Model Context Protocol (MCP)." readme = "README.md" requires-python = ">=3.12" -dependencies = ["httpx>=0.28.1", "mcp[cli]>=1.4.1"] +dependencies = [ + "httpx>=0.27.2", + "mcp[cli]>=1.4.1", + "uvicorn>=0.29.0", + "fastapi>=0.111.0", +] [build-system] requires = ["setuptools>=64.0.0", "wheel"] From f52b5b4424c15e6da907506d3fd503f3c21d6984 Mon Sep 17 00:00:00 2001 From: Justin Barnett Date: Sat, 22 Mar 2025 18:22:03 -0400 Subject: [PATCH 4/6] updated readme to reflect simpler install process --- README.md | 127 ++++++++++++++++++------------------------------------ 1 file changed, 41 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index 68251f8..8193bba 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A Unity package that enables seamless communication between Unity and Large Language Models (LLMs) like Claude Desktop via the **Model Context Protocol (MCP)**. This server acts as a bridge, allowing Unity to send commands to and receive responses from MCP-compliant tools, empowering developers to automate workflows, manipulate assets, and control the Unity Editor programmatically. -Welcome to the initial release of this open-source project! Whether you're looking to integrate LLMs into your Unity workflow or contribute to an exciting new tool, I appreciate you taking the time to check out my project. +Welcome to the initial release of this open-source project! Whether you're looking to integrate LLMs into your Unity workflow or contribute to an exciting new tool, I appreciate you taking the time to check it out! ## Overview @@ -18,97 +18,55 @@ This project is perfect for developers who want to leverage LLMs to enhance thei ## Installation -### Prerequisites +To use the Unity MCP Package, ensure you have the following installed: -- Unity 2020.3 LTS or newer (⚠️ only works in URP projects currently) -- Python 3.7 or newer -- uv package manager +- **Unity 2020.3 LTS or newer** (⚠️ Currently only works in URP projects) +- **Python 3.12 or newer** +- **uv package manager** -**If you're on Mac, please install uv as** +### Step 1: Install Python -```bash -brew install uv -``` +Download and install Python 3.12 or newer from [python.org](https://www.python.org/downloads/). Make sure to add Python to your system’s PATH during installation. -**On Windows** +### Step 2: Install uv -```bash -powershell -c "irm https://astral.sh/uv/install.ps1 | iex" -``` +uv is a Python package manager that simplifies dependency management. Install it using the command below based on your operating system: -and then add to your PATH: +- **Mac**: -```bash -set Path=%USERPROFILE%\.local\bin;%Path% -``` + ```bash + brew install uv + ``` -**On Linux** +- **Windows**: -```bash -curl -LsSf https://astral.sh/uv/install.sh | sh -``` + ```bash + powershell -c "irm https://astral.sh/uv/install.ps1 | iex" + ``` -Otherwise, installation instructions are on their website: [Install uv](https://docs.astral.sh/uv/getting-started/installation/) + Then, add uv to your PATH: -**⚠️ Do not proceed before installing UV** + ```bash + set Path=%USERPROFILE%\.local\bin;%Path% + ``` -### Unity Package Installation +- **Linux**: -1. **Add the Unity Package** + ```bash + curl -LsSf https://astral.sh/uv/install.sh | sh + ``` - - Open Unity Package Manager (`Window > Package Manager`) - - Click the `+` button and select `Add package from git URL` - - Enter: `https://github.com/justinpbarnett/unity-mcp.git` +For alternative installation methods, see the [uv installation guide](https://docs.astral.sh/uv/getting-started/installation/). -2. **Set Up Python Environment** - - Navigate to the Python directory in your project: - - If installed as a package: `Library/PackageCache/com.justinpbarnett.unity-mcp/Python` - - If installed locally: `Assets/unity-mcp/Python` - - Install dependencies: - ```bash - uv venv - uv pip install -e . - ``` +**Important**: Do not proceed without installing uv. -### MCP Client Integration +### Step 3: Install the Unity Package -1. Open the Unity MCP window (`Window > Unity MCP`) -2. Click the "Auto Configure" button for your desired MCP client -3. Status indicator should show green and a "Configured" message +1. Open Unity and go to `Window > Package Manager`. +2. Click the `+` button and select `Add package from git URL`. +3. Enter: `https://github.com/justinpbarnett/unity-mcp.git` -Alternatively, manually configure your MCP client: - -1. Open the Unity MCP window (`Window > Unity MCP`) -2. Click the "Manually Configure" button for your desired MCP client -3. Copy the JSON code below to the config file - -```json -{ - "mcpServers": { - "unityMCP": { - "command": "uv", - "args": [ - "--directory", - "/path/to/your/unity-mcp/Python", - "run", - "server.py" - ] - } - } -} -``` - -Replace `/path/to/your/unity-mcp/Python` with the actual path to the Unity MCP Python directory. - -**⚠️ Only run one instance of the MCP server (either on Cursor or Claude Desktop), not both** - -4. **Start Claude Desktop or Cursor** - - Launch your preferred tool - - The Unity MCP Server will automatically start and connect - -## Usage - -Once configured, you can use the MCP Client to interact with Unity directly through their chat interface. +Once installed, the Unity MCP Package will be available in your Unity project. The server will start automatically when used with an MCP client like Claude Desktop or Cursor. ## Features @@ -121,7 +79,7 @@ Once configured, you can use the MCP Client to interact with Unity directly thro ## Contributing -I'd love your help to make the Unity MCP Server even better! Here's how to contribute: +I’d love your help to make the Unity MCP Server even better! Here’s how to contribute: 1. **Fork the Repository** Fork [github.com/justinpbarnett/unity-mcp](https://github.com/justinpbarnett/unity-mcp) to your GitHub account. @@ -132,7 +90,7 @@ I'd love your help to make the Unity MCP Server even better! Here's how to contr git checkout -b feature/your-feature-name ``` - OR + or ```bash git checkout -b bugfix/your-bugfix-name @@ -150,7 +108,7 @@ I'd love your help to make the Unity MCP Server even better! Here's how to contr ``` 5. **Submit a Pull Request** - Open a pull request to the `master` branch. Include a description of your changes and any relevant details. + Open a pull request to the `master` branch with a description of your changes. ## License @@ -158,21 +116,18 @@ This project is licensed under the **MIT License**. Feel free to use, modify, an ## Troubleshooting -Encountering issues? Here are some common fixes: +Encountering issues? Try these fixes: - **Unity Bridge Not Running** Ensure the Unity Editor is open and the MCP window is active. Restart Unity if needed. -- **Python Server Not Connected** - - - Verify the Python server is running (`python server.py` in the `Python` directory). - - Check `config.json` for correct port settings (default: `unity_port: 6400`, `mcp_port: 6500`). - - Ensure `uv` and dependencies are installed correctly. +- **Python Server Not Connected** + Verify that Python and uv are correctly installed and that the Unity MCP package is properly set up. - **Configuration Issues with Claude Desktop or Cursor** - Confirm the paths and settings in the configuration dialog match your tool's installation. + Ensure your MCP client is configured to communicate with the Unity MCP server. -For additional help, check the [issue tracker](https://github.com/justinpbarnett/unity-mcp/issues) or file a new issue. +For more help, visit the [issue tracker](https://github.com/justinpbarnett/unity-mcp/issues) or file a new issue. ## Contact @@ -182,6 +137,6 @@ Have questions or want to chat about the project? Reach out! ## Acknowledgments -A huge thanks to everyone who's supported this project's initial release. Special shoutout to Unity Technologies for having an excellent Editor API. +A huge thanks to everyone who’s supported this project’s initial release. Special shoutout to Unity Technologies for their excellent Editor API. Happy coding, and enjoy integrating LLMs with Unity! From 31a995043759b16c4a70fd9e3dda728e87d049ac Mon Sep 17 00:00:00 2001 From: Justin Barnett Date: Sat, 22 Mar 2025 18:22:11 -0400 Subject: [PATCH 5/6] removed some dependencies --- Python/pyproject.toml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Python/pyproject.toml b/Python/pyproject.toml index 423cf5f..5573640 100644 --- a/Python/pyproject.toml +++ b/Python/pyproject.toml @@ -4,12 +4,7 @@ version = "0.1.0" description = "Unity MCP Server: A Unity package for Unity Editor integration via the Model Context Protocol (MCP)." readme = "README.md" requires-python = ">=3.12" -dependencies = [ - "httpx>=0.27.2", - "mcp[cli]>=1.4.1", - "uvicorn>=0.29.0", - "fastapi>=0.111.0", -] +dependencies = ["httpx>=0.27.2", "mcp[cli]>=1.4.1"] [build-system] requires = ["setuptools>=64.0.0", "wheel"] From 642dbcbe31a3681426abee966511d56a823794fb Mon Sep 17 00:00:00 2001 From: Justin Barnett Date: Sat, 22 Mar 2025 18:22:46 -0400 Subject: [PATCH 6/6] uv.lock --- Python/uv.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Python/uv.lock b/Python/uv.lock index b858911..3046732 100644 --- a/Python/uv.lock +++ b/Python/uv.lock @@ -321,9 +321,9 @@ wheels = [ ] [[package]] -name = "unity" +name = "unity-mcp" version = "0.1.0" -source = { virtual = "." } +source = { editable = "." } dependencies = [ { name = "httpx" }, { name = "mcp", extra = ["cli"] }, @@ -331,7 +331,7 @@ dependencies = [ [package.metadata] requires-dist = [ - { name = "httpx", specifier = ">=0.28.1" }, + { name = "httpx", specifier = ">=0.27.2" }, { name = "mcp", extras = ["cli"], specifier = ">=1.4.1" }, ]