unity-mcp icon indicating copy to clipboard operation
unity-mcp copied to clipboard

MCP Bridge connection failed - "Could not connect to Unity" error

Open jae1jeong opened this issue 10 months ago • 4 comments

Environment

  • MCP for Unity Version: 9.0.3
  • Unity Version: 6000.3.3f1
  • OS: macOS (Darwin 25.1.0)
  • MCP Client: Claude Code (claude-opus-4-5-20251101)
  • Python Version: 3.12.7

MCP Server Configuration

Server Path: /Users/jeongjaewon/Library/Application Support/UnityMCP/UnityMcpServer/src

Claude Code MCP Config: "UnityMCP": { "type": "stdio", "command": "uv", "args": [ "--directory", "/Users/jeongjaewon/Library/Application Support/UnityMCP/UnityMcpServer/src", "run", "server.py" ] }

Issue Description

When calling Unity MCP tools from Claude Code, the connection fails with an error message. The Unity Editor is running and the MCP for Unity window shows the server is started, but Claude Code cannot establish a connection to Unity.

Error Message {"success": false, "message": "Python error managing scene: Could not connect to Unity. Ensure the Unity Editor and MCP Bridge are running."}

Steps to Reproduce

  1. Open Unity Editor
  2. Open Window → MCP for Unity
  3. Click "Start Server"
  4. Call MCP tools from Claude Code (e.g., manage_scene, manage_editor)
  5. Connection fails with the error above

What I Tried

  • Restarted Unity Editor
  • Restarted MCP Bridge server
  • Confirmed using latest version (9.0.3)
  • Checked that MCP for Unity window shows "Running" status

Expected Behavior

MCP tools called from Claude Code should successfully connect to Unity Editor and execute commands.

Actual Behavior

All MCP tool calls fail with "Could not connect to Unity" error, even when Unity Editor is running and MCP Bridge server is started.

Additional Information

  • MCP for Unity window status: (Running/Stopped)
  • Transport Type: (HTTP/Stdio)
  • Port: 8080
Image Image

jae1jeong avatar Jan 14 '26 14:01 jae1jeong

I can't reproduce this the way you describe it (on Mac with MCP v 9.03). It you may have claude code trying to talk to the wrong version of the mcp server -- your config set up stdio:

"UnityMCP": { "type": "stdio", "command": "uv", "args": [ "--directory", "/Users/jeongjaewon/Library/Application Support/UnityMCP/UnityMcpServer/src", "run", "server.py" ] }

...but your screenshots and console logs show it's trying to connect to HTTP.

I'd recommend doing /mcp in claude code, and making sure the one you want (http or stdio) is selected, and the other disabled or removed.

dsarno avatar Jan 14 '26 18:01 dsarno

maybe you need to update claude code

whatevertogo avatar Jan 14 '26 22:01 whatevertogo

I did update it this AM. Again, I think it has to do with your clajude code being confused about whether it's using stdio or http to talk to the mcp server.

dsarno avatar Jan 14 '26 23:01 dsarno

got it. I changed transport http to stdio and it worked, thanks

jae1jeong avatar Jan 15 '26 06:01 jae1jeong