A Python package that bridges MCP (Model Context Protocol) over STDIO to a Unity TCP Server.
This bridge enables MCP client to communicate with the UnityCodeMcpServer running inside Unity Editor via TCP. The bridge:
- Receives MCP messages via STDIO
- Forwards them to the Unity TCP Server
- Returns responses back via STDIO
- Python 3.10+ - Required for the bridge
- uv - Fast Python package manager (install uv)
- Unity Editor - With UnityCodeMcpServer running (auto-starts when Unity opens)
Windows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | shNo installation needed! uv runs the package directly:
uv run --directory /path/to/STDIO~ unity-code-mcp-stdiopip install -e /path/to/STDIO~
unity-code-mcp-stdio| Argument | Default | Description |
|---|---|---|
--retry-time |
2 |
Seconds between connection retries |
--retry-count |
5 |
Maximum number of connection retries |
Note: The host is hardcoded to
localhostand the port is read automatically fromUnityCodeMcpServerSettings.assetinside the Unity project.
# Basic usage (from STDIO directory)
uv run unity-code-mcp-stdio
# Run from any directory using --directory
uv run --directory "C:/path/to/STDIO~" unity-code-mcp-stdio
# With retry configuration
uv run --directory "C:/path/to/STDIO~" unity-code-mcp-stdio --retry-time 3 --retry-count 10{
"mcpServers": {
"unity": {
"command": "uv",
"args": [
"run",
"--directory",
"C:/Users/YOUR_USERNAME/path/to/Assets/Plugins/UnityCodeMcpServer/Editor/STDIO~",
"unity-code-mcp-stdio"
]
}
}
}Note: Replace
C:/Users/YOUR_USERNAME/path/to/...with the actual path to your Unity project's STDIO folder. The port is read automatically fromUnityCodeMcpServerSettings.assetinside the Unity project.
┌─────────────────┐ TCP ┌─────────────────┐ STDIO ┌─────────────────┐
│ │ │ │ │ │
│ Unity Editor │ ◄────────────► │ STDIO Bridge │ ◄────────────► │ MCP Client │
│ │ │ │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
- MCP Client → Bridge (STDIO): MCP Client sends JSON-RPC 2.0 messages via stdin
- Bridge → Unity (TCP): Bridge forwards messages to Unity Tcp Server
- Unity → Bridge (TCP): Unity Tcp Server responds back to Bridge
- Bridge → MCP Client (STDIO): Bridge writes response to stdout
cd /path/to/STDIO
uv run --extra dev pytest tests/Windows Note: If you encounter "Failed to canonicalize script path" errors with
uv run, use the venv Python directly as shown below.
# Use the venv Python directly (avoids uv script canonicalization issues):
.\.venv\Scripts\python.exe -m pytest tests/ -v
# Sync dependencies including dev extras
uv sync --extra dev
# Alternative: pip install
uv pip install -e ".[dev]"Postman supports MCP (Model Context Protocol) natively, including STDIO transport. You can use Postman to test and debug the STDIO Bridge.
- Postman Desktop App (v11.35+) - Download here
- Unity Editor running with UnityCodeMcpServer active
-
Open Postman and create or select a workspace
-
Create a new MCP request:
- Click New → MCP
- Select STDIO as the transport type
-
Configure the STDIO command:
uv run --directory "C:/Users/YOUR_USERNAME/path/to/Assets/Plugins/UnityCodeMcpServer/Editor/STDIO" unity-code-mcp-stdioTip: You can also paste JSON configuration directly:
{ "command": "uv", "args": [ "run", "--directory", "C:/Users/YOUR_USERNAME/path/to/Assets/Plugins/UnityCodeMcpServer/Editor/STDIO~", "unity-code-mcp-stdio" ] } -
Click "Connect" - Postman will connect and discover available tools, prompts, and resources
For more details, see the official Postman documentation:
MIT