The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the FunseaAI Unity MCP listing page.
The Most Advanced MCP Server for Unity Editor
中文 | English
💖 If 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:
💡 Before 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:
Or add the scoped registry manually in Packages/manifest.json:
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:<port>/); 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 <project> with this project's entry name and <port> with its port -- the MCP Server window shows both:
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.
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.
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.
Written as a delimited managed block into every DeepSeek Harness profile's ~/.dsh/profiles/<profile>/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.
Written to the workspace-local .agents/mcp_config.json with mcpServers entries using serverUrl for Funplay's Streamable HTTP endpoint. This keeps the server out of unrelated workspaces. Use a current Antigravity version supporting workspace MCP configuration, then reload its MCP servers.
The workspace root is the nearest ancestor containing .git (including a worktree's .git file), or the Unity project directory when it is outside Git. Open that directory as the Antigravity workspace. Configure + Skills places .agents/mcp_config.json, .agents/skills/, and the managed AGENTS.md block at this same root, including when the Unity project is nested inside a repository. Other clients retain their existing instruction locations and share the block when paths coincide.
Existing Funplay entries in ~/.gemini/config/mcp_config.json or the older ~/.gemini/antigravity/mcp_config.json are reported in the panel and left unchanged. Review them after configuring each workspace; the one-click action does not fall back to global configuration. Multiple Unity projects in the same repository share a workspace: their MCP entries remain separately named, while Project Skills refuses to replace another project's managed workspace guidance.
Use the same JSON structure as Cursor unless your local Windsurf version requires a different MCP config format.
Open your AI client and try a few safe requests first:
get_scene_info and tell me what scene is open."unity://project/context and summarize the current editor state."execute_code to return the active scene name."If those work, the MCP server, resources, and primary execution tool are connected correctly.
Open your AI client and try: "Create a 3D platformer level with 5 floating platforms"
funplay-love-town), so configuring several projects no longer overwrites one shared funplay entry. Two projects that share a product name would resolve to the same entry name; the second one configured appends a project hash automatically, so nothing is overwritten and no setting has to be turned on.UserSettings/FunplayMcpSettings.json.core: 40 focused tools for structured inspection/editing, UI audits and authoring, recoverable Editor preparation, shared task status, visual evidence, input and logs. Short MCP tasks can complete in one response; get_task supports bounded waits and state-change revisions. execute_code remains a project-specific fallback. full retains all 180 tools, including legacy status/compile/Play APIs, configuration, preview management and specialized diagnostics. Custom exposure lists are preserved; get_tool_capabilities distinguishes implementation from exposure.execute_code safety checks and the stricter filesystem guard are enabled by default from Funplay > MCP Settings. The guard blocks obvious destructive snippets, broad System.IO writes, raw file streams, and absolute/user/system/traversal paths, but it is not a complete sandbox. Clients may still override the default per call with the optional safety_checks argument.Funplay > Check for Updates can refresh Git installs in place or download and import the latest unitypackage automatically.execute_code First — Optimized around one in-memory C# execution tool for rich editor/runtime orchestration. See execute_code: In-Memory C# Execution below for details.execute_code now has persistent default-on safety toggles, including a stricter filesystem guard for clients that do not expose per-call arguments clearlycore exposes 40 focused tools; full exposes all 180 built-in toolsinstanceId Chaining — Tools return {success, message, data} JSON with stable instanceId fields so agents can chain by_id calls reliably instead of re-resolving by nameIFunplayCommand for execute_code — New snippet template with auto-Undo (ctx.RegisterObjectCreation/Modification/DestroyObject), structured logs (ctx.Log/LogWarning/LogError), and a tracked changelog returned to the agentunitypackagecore and fullunity-mcp-workflow and unity-ui-composition guidanceexecute_code safety defaults and enable verbose plugin debug logging when troubleshooting MCP connections or tool executionexecute_code: In-Memory C# Executionexecute_code is the heart of Funplay MCP for Unity. It lets an AI write a C# snippet, compile it through a Roslyn-first in-memory flow, and run it on the editor thread — the agent gets the full Unity Editor and runtime API surface without writing any project files to disk.
.cs files are written under Assets/, no domain reload is triggered, no project state is touched beyond what the snippet itself does.request_recompile.IFunplayCommand and use the injected ExecutionContext so every created / modified / destroyed object participates in editor Undo, and the changelog is returned to the agent.The response carries { logs, created, modified, destroyed, returnValue }, so the agent can verify exactly what changed without re-querying the scene.
The legacy template (public static string Run()) is still supported — useful for one-off inspection snippets where structured tracking is overkill.
When to reach for execute_code vs a specialized tool — execute_code shines for multi-step orchestration, novel reads, and situations where chaining 5–10 narrow tool calls would be noisier than one snippet. For single-field component edits, simple selection changes, or anything covered by an existing tool, prefer the dedicated tool — it is cheaper for the LLM to call and easier to verify.
The table below compares this repository with the publicly documented behavior of Coplay's open-source unity-mcp repository on GitHub.
| Area | Funplay MCP for Unity | Coplay unity-mcp |
|---|---|---|
| Unity-side architecture | Embedded Unity Editor package with built-in HTTP MCP server | Unity bridge plus local Python MCP server |
| Extra local prerequisites | Unity package only for core workflows | Unity + Python 3.10+ + uv according to the public quick start |
| Primary workflow style | execute_code first, then focused helper tools | Broad manage_* tool families exposed through the bridge |
| Default tool exposure | Compact core profile with optional full expansion | Public docs emphasize a broad always-available tool surface |
| Built-in context model | Project resources, resource templates, workflow prompts, interaction history | Public README emphasizes tool families and bridge/server workflow |
| Play mode validation | Built-in play mode control, screenshots, logs, and input simulation in the package | Public README emphasizes broad Unity management and automation tools |
| Positioning | Lightweight, direct, MIT-licensed Unity MCP server for AI-driven editor control | Full-featured Unity bridge maintained by Coplay with Python-backed server setup |
Source for Coplay column: CoplayDev/unity-mcp
The table below compares this repository with Unity Technologies' official com.unity.ai.assistant package (v2.7.0-pre.2 as of 2026-05).
| Area | Funplay MCP for Unity | Unity AI Assistant |
|---|---|---|
| Minimum Unity version | 2022.3 | 6000.3 (Unity 6 only) |
| License | MIT, open source | Unity Terms of Service, proprietary |
| Deployment | Local HTTP MCP server in Editor, no cloud | Editor + native Relay subprocess + Unity Cloud backend |
| Billing | Free, user brings their own AI client | Credits-based (Unity Dashboard) |
| Tool exposure | 180 tools across 42 modules, core (40) / full profiles | ~15 MCP tools (mostly Manage* families) |
| Generic escape hatch | execute_code — Roslyn-first in-memory compile, IFunplayCommand + Undo, no sandbox (client-side approval) | RunCommand — namespace blacklist sandbox |
| Play mode validation | Full loop: enter / simulate input / capture / read logs / exit | Enter/Exit only; no input simulation |
| Asset generators | Not built-in (compose external APIs via execute_code) | Native Image / Mesh / PBR / Sound / Animation generators |
| Primary client model | BYO any MCP client (Claude Code / Cursor / Kimi / LM Studio / Codex / VS Code) | Built-in chat window + ACP for Claude/Gemini via Gateway |
| Offline-capable | Yes for tool calls (inference depends on chosen client) | No (inference requires Unity Cloud) |
For a long-form comparison of the two approaches see Funplay Unity MCP vs Unity AI Assistant detailed comparison (Chinese).
The current open-source package exposes four high-value capability layers:
full, 40 focused tools in coreexecute_code for rich editor/runtime orchestrationedit_prefab_safely, verify_compilation, enter_play_and_recover, wire_serialized_references, create_playable_prototype. Projects can add their own through mcp-prompts/*.md files in the project root.Project prompt files use a small, dependency-free front-matter format followed by the workflow body:
Names and argument names must match [a-z][a-z0-9_-]{0,63}. Required, unknown, and non-string arguments are rejected by prompts/get; omitted optional placeholders become empty strings. Definitions are cached when the MCP server starts, so restart the server or trigger a Unity domain reload after changing a prompt file.
Version 0.6.9 includes 180 tool functions across 42 modules, with 40 high-frequency tools exposed by default.
| Category | Tools |
|---|---|
| GameObject | create_primitive, create_game_object, delete_game_object, find_game_objects, get_game_object_info, set_transform, duplicate_game_object, rename_game_object, set_parent, add_component, set_tag_and_layer, set_active |
| Hierarchy | get_hierarchy |
| Components | get_component_properties, list_components, set_component_property, set_component_properties |
| Component Batch | copy_component, paste_component_values, add_component_to_many |
| Scripts | create_script, edit_script, patch_script |
| Assets | create_material, assign_material, find_assets, delete_asset, rename_asset, copy_asset |
| Asset Import | get_asset_import_settings, set_asset_import_settings |
| References | find_references, find_broken_references |
| Mesh | get_mesh_info |
| Materials | get_material_properties, set_material_property |
| Files | read_file, write_file, search_files, list_directory, exists |
| Scene | get_scene_info, list_scenes, load_scene_additive, unload_scene, list_dirty_scenes, save_all_scenes, save_scene, open_scene, create_new_scene, enter_play_mode, exit_play_mode, set_time_scale, get_time_scale |
| Physics | physics_raycast, physics_overlap, physics2d_overlap_point |
| Particles | particle_control |
| Lighting | get_lighting_settings, set_lighting_settings, bake_lightmaps |
| Timeline | director_evaluate |
| Prefabs | create_prefab, instantiate_prefab, unpack_prefab, open_prefab_stage, save_prefab_stage, close_prefab_stage, set_prefab_property, set_prefab_properties |
| ScriptableObject | create_scriptable_object, get_scriptable_object, set_scriptable_object_properties |
| UI | create_canvas, create_button, create_text, create_image, raycast_at_point, get_ui_defaults, configure_ui_defaults, create_project_ui |
| UI Audit | audit_ui, get_ui_audit, cancel_ui_audit |
| UI Preview | start_ui_preview_session, get_ui_preview_session, end_ui_preview_session |
| Inspection | find_project_types, inspect_ui_sprites, get_tool_capabilities |
| Visual Inspection | get_visual_coordinates, get_object_screen_bounds |
| Animation | create_animation_clip, create_animator_controller, assign_animator, get_animator_state, set_animator_parameter, play_animator_state |
| Camera | get_camera_properties, set_camera_projection, set_camera_settings, set_camera_culling_mask |
| Screenshot | capture_game_view, capture_simulator_view, capture_scene_view, capture_multiview, capture_editor_window |
| Video | record_game_view, mark_recording, extract_recording_frames, get_recording_frame |
| Script Execution | execute_code, get_execute_code_history, replay_execute_code, clear_execute_code_history |
| Input Simulation | simulate_key_press, simulate_key_combo, simulate_mouse_click, simulate_mouse_drag, simulate_ui_scroll |
| Performance | get_performance_snapshot, analyze_scene_complexity |
| Profiler | profiler_start, profiler_stop, profiler_status, get_frame_timing, get_counters, get_object_memory, get_top_memory_objects, memory_take_snapshot, memory_list_snapshots, memory_compare_snapshots, frame_debugger_enable, frame_debugger_disable, frame_debugger_get_events |
| Memory Snapshot | memory_take_full_snapshot, memory_list_full_snapshots, memory_open_snapshot_in_profiler, memory_query_top_objects, memory_query_references |
| Packages | install_package, remove_package, list_packages |
| Compilation | wait_for_compilation, request_recompile, get_compilation_errors, get_reload_recovery_status |
| Editor Operations | prepare_editor, get_editor_operation, list_editor_operations, cancel_editor_operation |
| Tasks | get_task (shared read-only status and bounded waits) |
| Testing | run_tests, get_test_job, cancel_test_run |
| Editor State | get_editor_state, get_selection, set_selection, get_prefab_stage, get_active_tool, set_active_tool, get_windows, get_tags, add_tag, remove_tag, get_layers, add_layer, get_build_settings |
| Project Settings | get_project_settings |
| Undo | undo, redo, get_undo_state |
| Menu Items | execute_menu_item, validate_menu_item |
| Visual Feedback | select_object, focus_on_object, ping_asset, log_message, show_dialog, get_console_logs |
📊 See PROFILER_TOOLS.md for the full Profiler tool reference, implementation notes, known limitations, and test report.
See Reliable UI workflows for end-to-end preparation, read-only audits, structured queries, project TMP/prefab/input defaults, capture-coordinate mapping, recording markers/keyframes, and recoverable preview sessions. Both built-in Project Skills include these workflows; use Project Skills to update existing installations. These tools and skill updates are included starting with v0.6.9.
Use record_game_view (included in core) to review UI animations, transitions, and multi-step interactions in a short silent MP4. It uses Unity's built-in MediaEncoder; no Recorder package or external encoder is required.
record_game_view with {"action":"start","duration_seconds":10,"fps":15,"max_dimension":1280}. Keep its recording_id.{"action":"status","recording_id":"<id>"}. To end early, use action:"stop", then poll until finalization finishes.ready:true, read the returned path as a local video file. Video bytes are not embedded in the MCP response; remote clients need separate access to the Unity machine's files.Clips receive unique filenames under <UnityProject>/Library/FunplayMcp/Recordings/ and are retained until you remove them. Start accepts 1–120 seconds, 1–60 target FPS, and a maximum dimension of 128–1920 pixels; it preserves the aspect ratio without upscaling and uses even encoding dimensions. State includes actual frame count, elapsed time, stop reason, file size, and errors. Pass the recording ID when polling/stopping to avoid accidentally controlling a newer clip.
Currently supports graphics-enabled macOS and Windows Editors in Play Mode, with no audio track. It captures the rendered Game View, including overlay UI, without re-rendering scene cameras. Keep the Game tab rendering and do not resize it during capture: hiding/closing the tab or changing its render resolution stops recording with an error instead of silently capturing stale or stretched frames. Exiting Play Mode finalizes the clip; a script/domain reload finalizes it early and preserves an interrupted receipt in the editor session. Only consume a file with ready:true. Slow frames keep their real timestamps, but recording adds overhead: this is visual evidence, not frame-accurate performance profiling.
Create your own tools with simple attribute annotations:
Methods are automatically discovered, converted to snake_case (spawn_enemies), and exposed via MCP with JSON Schema definitions.
Newtonsoft.JsonContributions are welcome! Please read the Contributing Guide before submitting a PR.
MIT — Free to use, modify, distribute, and integrate into commercial or open-source projects.