Skip to content

x0cipher/unreal-mcp

Repository files navigation

๐ŸŽฎ UnrealMCP

Build games by talking to your editor.

UnrealMCP plugs Unreal Engine 5 into any LLM agent โ€” Claude, Cursor, Copilot โ€” through the Model Context Protocol. Describe what you want; watch it appear in the viewport.

License: MIT Unreal Engine 5.7 Python 3.10+ MCP Status: v0.1 PRs Welcome


You: "Spawn a row of glowing cubes and point a camera at them."

Agent: โ€ฆcalls execute_python, runs unreal API, returns the captured log.

Editor: the cubes are there.

That's the whole idea. An agent gets a small set of MCP tools wired straight into a running Unreal Editor, so natural language turns into real edits โ€” actors, assets, materials, Blueprints โ€” with the engine's own output flowing back so the agent can see what it did and fix its own mistakes.

โœจ Why this exists

Making games is hard, and the learning curve keeps a lot of good ideas trapped in people's heads. UnrealMCP is a bet that the gap between "I can picture it" and "it exists in the engine" should be a conversation. It's also a great way to learn Unreal โ€” you can watch the agent work and read every API call it makes.

๐Ÿง  How it works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   MCP / stdio   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   TCP :55557   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Claude /   โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚  Python MCP server โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚  UnrealMCP plugin    โ”‚
โ”‚  Cursor /   โ”‚                 โ”‚     (server/)      โ”‚                โ”‚  (in Unreal Editor)  โ”‚
โ”‚  Copilot    โ”‚ โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚                    โ”‚ โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚  runs on game thread โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    tool calls   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   JSON cmds     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • Plugin (MCPProject/Plugins/UnrealMCP) โ€” a UEditorSubsystem starts a TCP server on 127.0.0.1:55557 from an FRunnable worker thread. Requests are JSON { "type": <command>, "params": {โ€ฆ} }; each command is marshalled onto the game thread and answered with { "status": "success" | "error", โ€ฆ }.
  • Server (server/) โ€” a FastMCP server (stdio transport) exposing MCP tools that forward to the plugin.

The headliner tool, execute_python, runs code in the editor's Python scope (the full unreal module) and returns captured logs and any exception trace โ€” so the agent always knows what actually happened. It's the universal escape hatch while higher-level tools grow up around it.

Tools

Tool What it does
ping Health check โ€” returns pong.
execute_python Run arbitrary Python in the editor; returns logs + errors.
spawn_actor Spawn an actor (any unreal class) with location/rotation/scale/label; static meshes get a mesh.
list_actors List level actors (label, class, location), with optional name filter.
set_actor_transform Move / rotate / scale the actor(s) with a given label.
delete_actor Delete the actor(s) with a given label.

The actor tools are thin wrappers over execute_python โ€” no plugin rebuild needed to add more, so the surface grows fast.

๐Ÿš€ Quickstart

Requirements: Unreal Engine 5.7 (other 5.x likely work with minor tweaks), a C++ toolchain UnrealBuildTool can use (Visual Studio 2022 or VS Build Tools 2022 with the MSVC v143 toolchain + a Windows 10/11 SDK), Python 3.10+, and an MCP-capable client (Claude Desktop / Claude Code, Cursor, โ€ฆ).

1 โ€” Build the plugin

& "C:\Program Files\Epic Games\UE_5.7\Engine\Build\BatchFiles\Build.bat" `
  MCPProjectEditor Win64 Development `
  -Project="<repo>\MCPProject\MCPProject.uproject" -WaitMutex

Open MCPProject/MCPProject.uproject. The plugin auto-starts its server on load โ€” look for MCP server listening on 127.0.0.1:55557 in the Output Log.

2 โ€” Set up the MCP server

cd server
python -m venv .venv
.venv/Scripts/python -m pip install -r requirements.txt   # Windows

3 โ€” Connect your agent

See docs/connecting-agents.md for Claude Desktop / Claude Code / Cursor. Minimal Claude Desktop entry:

{
  "mcpServers": {
    "unreal-mcp": {
      "command": "<repo>/server/.venv/Scripts/python.exe",
      "args": ["<repo>/server/unreal_mcp_server.py"]
    }
  }
}

๐Ÿ•น๏ธ Try it

With the editor open and the agent connected, ask:

"Use the unreal-mcp ping tool." โ†’ returns pong.

"Spawn a cube at the origin." โ†’ the agent calls execute_python:

import unreal
sub = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
sub.spawn_actor_from_class(unreal.StaticMeshActor, unreal.Vector(0, 0, 0))

No agent handy? Run the bundled round-trip smoke test (editor open):

cd server && .venv/Scripts/python test_roundtrip.py

๐Ÿ—‚๏ธ Repository layout

Path What
MCPProject/ UE5 host project used to develop & test the plugin
MCPProject/Plugins/UnrealMCP/ The plugin โ€” drop into any UE project to use it
server/ The Python MCP server
docs/ Connection + usage docs

๐Ÿ—บ๏ธ Roadmap

  • End-to-end pipeline: ping + execute_python with log/error feedback
  • Actor commands โ€” spawn_actor / list_actors / set_actor_transform / delete_actor
  • More native coverage โ€” assets, materials, Blueprints, Niagaraโ€ฆ
  • Blueprint graph authoring (K2Node creation + pin wiring)
  • A real grounding loop โ€” viewport screenshots + structured error feedback
  • Packaging / runtime agent support

See the Releases for what's shipped.

๐Ÿ”’ Security

UnrealMCP lets an agent run arbitrary Python inside your editor. The bridge binds to loopback only and runs only while the editor is open โ€” but there's no auth on the local socket yet. Read SECURITY.md before you wire up anything you don't fully trust.

๐Ÿค Contributing

This is young and there's a lot of surface to cover โ€” new commands, docs, bug reports, or just trying it and telling us what broke. Start with CONTRIBUTING.md; agents and humans alike should skim AGENTS.md for how the bridge is built.

๐Ÿ“œ License

MIT ยฉ x0cipher

About

Drive Unreal Engine 5 from LLM agents (Claude, Cursor, Copilot) via the Model Context Protocol.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors