mcp-unity  by CoderGamester

Unity plugin for AI-assisted development via Model Context Protocol

created 4 months ago
848 stars

Top 43.0% on sourcepulse

GitHubView on GitHub
Project Summary

This package integrates AI assistants with the Unity Editor via the Model Context Protocol (MCP), enabling AI agents to interact with and manipulate Unity projects. It targets game developers and AI engineers seeking to leverage AI for tasks like code generation, scene manipulation, and asset management within Unity.

How It Works

MCP Unity establishes a WebSocket connection between a Node.js server and the Unity Editor. The Node.js server acts as a bridge, translating AI agent commands into Unity Editor actions using the MCP specification. This allows AI models to execute Unity-specific operations like creating GameObjects, updating components, or running tests.

Quick Start & Requirements

  • Install: Add https://github.com/CoderGamester/mcp-unity.git via Unity Package Manager.
  • Prerequisites: Unity 2022.3+, Node.js 18+, npm 9+.
  • Setup: Install Unity package, Node.js, configure AI client (via Unity Editor or JSON), start server in Unity Editor.
  • Docs: MCP Unity

Highlighted Details

  • IDE Integration: Automatically adds Unity package cache to VSCode-like workspaces for improved AI code intelligence.
  • Tooling: Supports execute_menu_item, select_gameobject, update_component, add_package, run_tests, send_console_log, add_asset_to_scene.
  • Resource Discovery: Provides endpoints like unity://menu-items, unity://hierarchy, unity://gameobject/{id}, unity://logs, unity://packages, unity://assets, unity://tests/{testMode} for AI introspection.

Maintenance & Community

  • Support via GitHub Issues.
  • Discord: gamester7178
  • Contributions welcome via Pull Requests following Conventional Commits.

Licensing & Compatibility

  • MIT License.
  • Compatible with commercial and closed-source projects.

Limitations & Caveats

  • The run_tests tool may fail when "Reload Domain" is enabled in Play Mode settings; disabling it is a workaround.
  • AI client-to-MCP server timeout varies by IDE.
Health Check
Last commit

2 days ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
15
Star History
401 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.