diff --git a/MCPForUnity/UnityMcpServer~/src/server.py b/MCPForUnity/UnityMcpServer~/src/server.py index 62911a63..11053ac8 100644 --- a/MCPForUnity/UnityMcpServer~/src/server.py +++ b/MCPForUnity/UnityMcpServer~/src/server.py @@ -157,7 +157,26 @@ def _emit_startup(): # Initialize MCP server mcp = FastMCP( name="mcp-for-unity-server", - lifespan=server_lifespan + lifespan=server_lifespan, + instructions=""" +This server provides tools to interact with the Unity Game Engine Editor.\n\n +Available tools:\n +- `manage_editor`: Controls editor state and queries info.\n +- `execute_menu_item`: Executes, lists and checks for the existence of Unity Editor menu items.\n +- `read_console`: Reads or clears Unity console messages, with filtering options.\n +- `manage_scene`: Manages scenes.\n +- `manage_gameobject`: Manages GameObjects in the scene.\n +- `manage_script`: Manages C# script files.\n +- `manage_asset`: Manages prefabs and assets.\n +- `manage_shader`: Manages shaders.\n\n +- Tips:\n +- Create prefabs for reusable GameObjects.\n +- Always include a camera and main light in your scenes.\n +- Unless specified otherwise, paths are relative to the project's `Assets/` folder.\n +- After creating or modifying scripts with `manage_script`, allow Unity to recompile; use `read_console` to check for compile errors.\n +- Use `execute_menu_item` for interacting with Unity systems and third party tools like a user would.\n + +""" ) # Register all tools @@ -167,28 +186,6 @@ def _emit_startup(): register_all_resources(mcp) -@mcp.prompt() -def asset_creation_strategy() -> str: - """Guide for discovering and using MCP for Unity tools effectively.""" - return ( - "Available MCP for Unity Server Tools:\n\n" - "- `manage_editor`: Controls editor state and queries info.\n" - "- `execute_menu_item`: Executes, lists and checks for the existence of Unity Editor menu items.\n" - "- `read_console`: Reads or clears Unity console messages, with filtering options.\n" - "- `manage_scene`: Manages scenes.\n" - "- `manage_gameobject`: Manages GameObjects in the scene.\n" - "- `manage_script`: Manages C# script files.\n" - "- `manage_asset`: Manages prefabs and assets.\n" - "- `manage_shader`: Manages shaders.\n\n" - "Tips:\n" - "- Create prefabs for reusable GameObjects.\n" - "- Always include a camera and main light in your scenes.\n" - "- Unless specified otherwise, paths are relative to the project's `Assets/` folder.\n" - "- After creating or modifying scripts with `manage_script`, allow Unity to recompile; use `read_console` to check for compile errors.\n" - "- Use `execute_menu_item` for interacting with Unity systems and third party tools like a user would.\n" - ) - - def main(): """Entry point for uvx and console scripts.""" mcp.run(transport='stdio') diff --git a/README.md b/README.md index 8f6f8aa2..c13d043c 100644 --- a/README.md +++ b/README.md @@ -162,18 +162,17 @@ If Auto-Setup fails or you use a different client: **Claude Code** If you're using Claude Code, you can register the MCP server using the below commands: -🚨**make sure to run these from your Unity project's home directory**🚨 **macOS:** ```bash -claude mcp add UnityMCP -- uv --directory /Users/USERNAME/Library/AppSupport/UnityMCP/UnityMcpServer/src run server.py +claude mcp add --scope user UnityMCP -- uv --directory /Users/USERNAME/Library/AppSupport/UnityMCP/UnityMcpServer/src run server.py ``` **Windows:** ```bash -claude mcp add UnityMCP -- "C:/Users/USERNAME/AppData/Local/Microsoft/WinGet/Links/uv.exe" --directory "C:/Users/USERNAME/AppData/Local/UnityMCP/UnityMcpServer/src" run server.py +claude mcp add --scope user UnityMCP -- "C:/Users/USERNAME/AppData/Local/Microsoft/WinGet/Links/uv.exe" --directory "C:/Users/USERNAME/AppData/Local/UnityMCP/UnityMcpServer/src" run server.py ``` **VSCode (all OS)**