website/docs/architecture/transports.md
MCP for Unity supports two transports between the MCP client and the Python server. The choice affects multi-agent capability, configuration shape, and a few subtle behaviors around instance routing.
| If you want… | Use |
|---|---|
| Multiple MCP clients sharing one Unity instance | HTTP |
| Multiple Unity instances driven from one client | either |
| Lowest setup friction | stdio (Claude Desktop default) |
| Remote-hosted server (cloud, Docker) | HTTP |
| Marketplace distribution that can't ship Python | HTTP (remote URL) |
Architecture: one Python process, one shared WebSocket hub at /hub/plugin, multiple MCP clients can connect concurrently. Each client gets a client_id and session-keyed state.
Endpoint: http://localhost:8080/mcp
MCP client config:
{
"mcpServers": {
"unityMCP": { "url": "http://localhost:8080/mcp" }
}
}
What you gain:
What you give up:
set_active_instance (HTTP enforces Name@hash)Architecture: the MCP client spawns a dedicated Python process via stdio, communicating over stdin/stdout. The Python process talks to Unity over a legacy TCP bridge.
MCP client config (macOS/Linux):
{
"mcpServers": {
"unityMCP": {
"command": "uvx",
"args": ["--from", "mcpforunityserver", "mcp-for-unity", "--transport", "stdio"]
}
}
}
What you gain:
set_active_instance(instance="6401")What you give up:
client_id in middleware. Two clients can hold different active instances concurrently against the same Unity Editor pool.See Multi-Instance Routing for the routing API.
In the Unity Editor: Window → MCP for Unity → Settings, pick HTTP or stdio, click Configure All Detected Clients. The configurator rewrites each client's MCP config to match.
Claude Desktop is the exception — it's always written as stdio regardless of your selection, because it doesn't support HTTP.
By default, HTTP binds to loopback (127.0.0.1 / ::1). Binding to all interfaces (0.0.0.0 / ::) requires explicit opt-in: Advanced Settings → Allow LAN Bind (HTTP Local).
Remote endpoints require https://. To allow plaintext http:// for a remote URL, opt in via Allow Insecure Remote HTTP. Both guards are fail-closed: if you don't flip the switch, the server refuses the unsafe configuration.
Server/src/transport/ (plugin hub, websocket transport, legacy stdio bridge)MCPForUnity/Editor/Services/ (transport clients, server management, stdio bridge host)