MCP for Unity Server is a Python library that provides the server-side implementation for the Model Context Protocol (MCP), enabling seamless integration and communication with Unity clients. It facilitates real-time data exchange and command execution between Python applications and the Unity Editor. The current version is 9.6.6, and it sees regular updates, often with significant architectural changes between major versions.
pip install mcpforunityserverVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize and start an MCP server, setting up basic connection and disconnection event handlers. The server listens on port 25001 and remains active indefinitely.
Review the latest documentation or source code for `Server` and `UnityClient` constructors. Update parameter names and types. Remove any reliance on `message_id` from message processing logic.
Migrate all existing synchronous callback functions to `async def` functions. Ensure that any calls to these callbacks are properly `await`ed where applicable.
Update import statements from `from mcpforunityserver import MyType` to `from mcpforunityserver.types import MyType` for all affected symbols.