Skip to main content
Glama

setup_unity_bridge

Install or update Unity MCP bridge scripts to enable Claude to interact with Unity projects, even when Unity server is not running.

Instructions

Install/update Unity MCP bridge scripts to a Unity project (works even if Unity server is not running)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the Unity project
forceUpdateNoForce update even if scripts are up to date

Implementation Reference

  • Handler for 'setup_unity_bridge' tool in executeTool method. Validates input, calls UnityBridgeDeployService.deployScripts, and returns success/error message.
    case 'setup_unity_bridge': { const { projectPath, forceUpdate } = args; if (!projectPath) { throw new Error('projectPath is required'); } try { await this.deployService.deployScripts({ projectPath, forceUpdate }); return { content: [{ type: 'text', text: `Unity MCP bridge scripts installed successfully to:\n${projectPath}/Assets/Editor/MCP/\n\nPlease restart Unity Editor or open Window > Unity MCP Server to start the server.` }] }; } catch (error: any) { throw new Error(`Failed to install scripts: ${error.message}`); } }
  • Registration of the tool in getTools() array, defining name, description, and input schema.
    { name: 'setup_unity_bridge', description: 'Install/update Unity MCP bridge scripts to a Unity project (works even if Unity server is not running)', inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'Path to the Unity project' }, forceUpdate: { type: 'boolean', description: 'Force update even if scripts are up to date', default: false } }, required: ['projectPath'] } },
  • Input schema definition for the tool parameters: projectPath (required string), forceUpdate (optional boolean).
    inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'Path to the Unity project' }, forceUpdate: { type: 'boolean', description: 'Force update even if scripts are up to date', default: false } }, required: ['projectPath'] }
  • Core helper method that validates the Unity project, creates necessary directories, and deploys the MCP bridge scripts (UnityHttpServer.cs and UnityMCPServerWindow.cs) with version checking and meta file generation.
    async deployScripts(options: DeploymentOptions): Promise<void> { const { projectPath, forceUpdate = false } = options; // Validate Unity project const projectValidation = await this.validateUnityProject(projectPath); if (!projectValidation.isValid) { throw new Error(`Invalid Unity project: ${projectValidation.error}`); } // Create Editor/MCP directory if it doesn't exist const editorMCPPath = path.join(projectPath, 'Assets', 'Editor', 'MCP'); await fs.mkdir(editorMCPPath, { recursive: true }); // Deploy each script for (const script of this.SCRIPTS) { await this.deployScript(projectPath, script, forceUpdate); } this.logger.info('Unity MCP scripts deployed successfully'); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zabaglione/mcp-server-unity'

If you have feedback or need assistance with the MCP directory API, please join our Discord server