The Most Advanced MCP Server for Unity Editor with execute_code, prompts/resources, input simulation, screenshots, and play mode automation.
The Most Advanced MCP Server for Unity Editor with execute_code, prompts/resources, input simulation, screenshots, and play mode automation.
Funplay MCP for Unity
The Most Advanced MCP Server for Unity Editor
中文 | EnglishIf you find this project useful, please consider giving it a Star. It helps more Unity developers discover it and supports ongoing development.
Funplay MCP for Unity is an MIT-licensed Unity Editor MCP server that lets AI assistants like Claude Code, Cursor, Kimi Code, LM Studio, Windsurf, Codex, and VS Code Copilot operate directly inside your running Unity project.
Describe your game in one sentence — your AI assistant builds it in Unity through Funplay MCP for Unity's built-in tools for scene creation, script generation, runtime validation, input simulation, performance analysis, and editor automation.
"Build a snake game with a 10x10 grid, food spawning, score UI, and game-over screen"
Your AI assistant handles it through Funplay MCP for Unity: creates the scene, generates all scripts, sets up the UI, and configures the game logic — all from a single prompt.
16-second demo — AI generates a 3D model and integrates it into the scene end-to-end. Watch HD MP4.
If you just want to get connected fast, do these three things:
Funplay > MCP ServerIn Unity, go to Window → Package Manager → + → Add package from git URL:
https://github.com/FunplayAI/funplay-unity-mcp.gitBefore you clone or install, a quick ⭐ on GitHub would be greatly appreciated.
If you want Unity Package Manager to show registry-backed package version history and allow version selection, install from OpenUPM instead of Git.
Using the OpenUPM CLI:
openupm add com.gamebooom.unity.mcpOr add the scoped registry manually in Packages/manifest.json:
{
"scopedRegistries": [
{
"name": "OpenUPM",
"url": "https://package.openupm.com",
"scopes": [
"com.gamebooom"
]
}
],
"dependencies": {
"com.gamebooom.unity.mcp": "0.6.9"
}
}If you installed from a Git URL before, remove the Git dependency first, then install from OpenUPM. Git-installed packages only show the resolved Git version in Unity and do not get the registry-backed Version History list.
Menu: Funplay → MCP Server to start the server.
A new project gets its own port, derived from the project path, so two editors opened on different projects never fight over one port. The MCP Server window shows the exact URL (http://127.0.0.1:/); the one-click configuration writes that URL for you. Type a port in Server Port to pin a fixed one (CI, a firewall rule) and Use Per-Project Port to derive one instead.
Upgrading from an earlier version changes nothing: the project keeps the port it was already using, recorded as a pin, so existing client configs keep working. Click Use Per-Project Port when you want that project to run beside another editor. See Running Several Unity Projects at Once for the full setup guide.
If the window reports a fallback port, do not use a client entry that still targets the occupied stable port; it could reach the process that owns that port. One-click configuration stays blocked until you click Use Per-Project Port or Pin Current Port and the server finishes restarting.
Direct in-process HTTP is the default transport. If you need stronger connection continuity across Unity script recompiles or Play Mode domain reloads, enable Experimental Broker Mode in the MCP Server window. It runs a tiny local broker with Unity's bundled Mono, keeps the same 127.0.0.1 port for MCP clients, and requires no client config change.
Open Funplay → Tool Exposure if you want to edit the exact tools exposed by core or full.
Open Funplay → MCP Settings if you need to adjust execute_code safety defaults or plugin debug logging.
Use the built-in One-Click MCP Configuration in the Funplay > MCP Server window first.
Select your target client, click Configure, and the package writes the recommended MCP config entry for you.
For Claude Code, Cursor, Codex, OpenCode, and DeepSeek Harness, click Configure + Skills to also install both built-in project skills.
If you want project-specific AI guidance for the current Unity project, open Funplay → Project Skills to choose supported platforms and install the built-in unity-mcp-workflow and unity-ui-composition skills. The UI skill covers responsive portrait and landscape uGUI work.
If you prefer to edit config files manually, use the examples below as fallback references. Replace with this project's entry name and with its port -- the MCP Server window shows both:
Claude Code / Claude Desktop
{
"mcpServers": {
"funplay-": {
"type": "http",
"url": "http://127.0.0.1:/"
}
}
}Cursor
{
"mcpServers": {
"funplay-": {
"url": "http://127.0.0.1:/"
}
}
}LM Studio
LM Studio's mcp.json location can vary by version and platform. Prefer Program > Install > Edit mcp.json in LM Studio. Funplay's one-click Configure button opens LM Studio's lmstudio://add_mcp link and only updates an existing config file if one is already present, instead of creating a guessed path.
{
"mcpServers": {
"funplay-": {
"url": "http://127.0.0.1:/"
}
}
}VS Code
{
"servers": {
"funplay-": {
"type": "http",
"url": "http://127.0.0.1:/"
}
}
}Trae
{
"mcpServers": {
"funplay-": {
"url": "http://127.0.0.1:/"
}
}
}Kiro
{
"mcpServers": {
"funplay-": {
"type": "http",
"url": "http://127.0.0.1:/"
}
}
}Kimi / Kimi Code
Current Kimi Code releases load project-level MCP servers from .kimi-code/mcp.json (official MCP documentation). Funplay's one-click Configure target writes there so the current Unity server is only visible to Kimi sessions started in this project. If the machine only has the legacy Kimi CLI data directory, it writes the compatible user-level ~/.kimi/mcp.json instead. Start a new Kimi session from the Unity project root after configuring; on first use, review the loopback URL and trust the workspace. The generated project file contains this machine's local port, so normally keep it uncommitted unless the team deliberately shares one pinned port.
{
"mcpServers": {
"funplay-": {
"url": "http://127.0.0.1:/"
}
}
}Codex
[mcp_servers.funplay-]
url = "http://127.0.0.1:/"OpenCode
Written to the repository's own .opencode/opencode.json (not the global config), so only OpenCode sessions started inside this repo see this editor's tools.
{
"mcp": {
"funplay-": {
"type": "remote",
"url": "http://127.0.0.1:/",
"enabled": true
}
}
}DeepSeek Harness
Written as a delimited managed block into every DeepSeek Harness profile's ~/.dsh/profiles//cordis.patch.yml, because DSH composes its plugins per launch through --profile and exposes no single active profile to target from outside. Anything outside the block is preserved on reconfigure, and deleting the block by hand uninstalls the entry.
…json { "mcpServers": { "funplay-": { "serverUrl": "http://127.0.0.1:/" } } }
…csharp using UnityEngine; using UnityEditor; using Funplay.Editor.Tools.Helpers; using Funplay.Editor.Tools.Scripting;
public class CommandScript : IFunplayCommand { public void Execute(ExecutionContext ctx) { var go = GameObject.CreatePrimitive(PrimitiveType.Cube); ctx.RegisterObjectCreation(go); // auto-Undo + tracked ctx.Log("Created {0}", go.name); ctx.ReturnValue = GameObjectSerializer.Describe(go, includeComponents: false); } }
…Open activity {activity_key} with theme {theme_id}, then validate its runtime state.
…csharp using System.ComponentModel;
[ToolProvider("MyTools")] public static class MyCustomTools { [Description("Spawns enemies at random positions in the scene")] public static string SpawnEnemies( [ToolParam("Number of enemies to spawn", Required = true)] int count, [ToolParam("Prefab path in Assets")] string prefabPath) { // Your implementation here return $"Spawned {count} enemies"; } }
Methods are automatically discovered, converted to snake_case (`spawn_enemies`), and exposed via MCP with JSON Schema definitions.
## Architecture
MCP Server (HTTP JSON-RPC 2.0) └─ MCPRequestHandler (protocol handling) └─ MCPExecutionBridge └─ FunctionInvokerController (reflection-based invocation) └─ Tool Functions (180 built-in tools across 42 modules)
External AI Client → HTTP Request → MCPRequestHandler → MCPExecutionBridge → FunctionInvokerController → tool method
## Requirements
- Unity 2022.3 or later
- .NET / Mono with `Newtonsoft.Json`
## Contributing
Contributions are welcome! Please read the [Contributing Guide](CONTRIBUTING.md) before submitting a PR.
## License
[MIT](LICENSE) — Free to use, modify, distribute, and integrate into commercial or open-source projects.No open issues yet, or sync has not completed.