Skip to content

Runtime MCP

Runtime MCP connects an agent to a running UnrealZoo world for structured scene inspection and task control: discover actors, inspect native scene state, capture views, move cameras and characters, invoke reflected Blueprint functions, and place supported assets. It is a runtime service in UnrealCV Dev For UnrealZoo, not an Unreal Editor automation server and not a replacement for Gym's observation/action loop.

Demonstrations

These examples illustrate upstream demonstrations, not guaranteed capabilities of every runtime build.

Complex-scene navigation

Complex-scene navigation
Complex-scene navigation
Screenshots (7)
First-person view: finding the sakura tree
First-person view: finding the sakura tree
Reaching the first sakura tree
Reaching the first sakura tree
Reaching the second sakura tree
Reaching the second sakura tree
Detached camera: front framing
Detached camera: front framing
Detached camera: left framing
Detached camera: left framing
Detached camera: right framing
Detached camera: right framing
Final character and sakura-tree capture
Final character and sakura-tree capture

Multi-direction scene captioning

Multi-direction scene captioning
Multi-direction scene captioning
Screenshots (6)
View: north
View: north
View: east
View: east
View: south
View: south
View: west
View: west
View: up
View: up
View: down
View: down

Character appearance control

Character appearance control
Character appearance control
Screenshots (10)
Character appearance 1
Character appearance 1
Character appearance 2
Character appearance 2
Character appearance 3
Character appearance 3
Character appearance 4
Character appearance 4
Character appearance 5
Character appearance 5
Character appearance 6
Character appearance 6
Character appearance 7
Character appearance 7
Character appearance 8
Character appearance 8
Character appearance 9
Character appearance 9
Character appearance 10
Character appearance 10

Scene generation and inspection

Scene generation and inspection
Scene generation and inspection
Screenshots (7)
Before generation: top-down view
Before generation: top-down view
After generation: top-down view
After generation: top-down view
Evaluation from positive X
Evaluation from positive X
Evaluation from negative X
Evaluation from negative X
Evaluation from positive Y
Evaluation from positive Y
Evaluation from negative Y
Evaluation from negative Y
Generated street-side rest point
Generated street-side rest point

Original scene-generation video

Availability and prerequisites

  • Use a supported UnrealZoo package with Runtime MCP enabled. The gym v3.1 README advertises Runtime MCP with the UE5.7 full package; this does not establish the transport or tools present in every downloadable patch. Follow Getting started for package selection, then verify the actual listener and capabilities below.
  • Run the package on a graphics-capable machine with a loaded world. Installing unrealcv or unrealzoo-gym alone does not install or start this service.
  • Use an MCP client supporting Streamable HTTP for current builds, or curl for the protocol checks below. No Python MCP package is required by the current documented connection workflow.
  • The public Runtime MCP repository contains reference material and examples, not the Unreal Engine C++ server. The server is distributed with supported environments and is not included in the open-source UnrealCV plugin. There is no public server build recipe or standalone server-start CLI in the inspected repository.

Transport depends on the build

The current public repository documents Streamable HTTP at http://127.0.0.1:29998/mcp. The hosted UnrealCV Runtime MCP page still describes an older UnrealCV-framed TCP service on the same port and a Python example client. These are different wire protocols. Do not send raw UnrealCV frames to an HTTP listener, or assume that HTTP configuration works on an older package. The current repository snapshot does not contain examples/runtime_mcp_client.py or skills/unrealcv-runtime-mcp; do not copy those older file-based instructions into a current checkout.

1. Start the environment and check the listener

Extract the supported package and start its executable normally. For example, the Windows executable layout recognized by the gym source is shown below; replace the package directory with the one you extracted:

& 'D:\path\to\package\Windows\UnrealZoo_UE5_7\Binaries\Win64\UnrealZoo_UE5_7.exe'

On other platforms, use the launcher supplied by the matching package rather than renaming a Windows executable. Load the intended map before discovery. This launches the environment, not a separate Python MCP server. Neither the public repository nor the inspected gym source supplies a universal Runtime MCP enable/port command-line switch; use an MCP-enabled build and its package instructions rather than inventing a flag.

Inspect the runtime log. The older documented readiness marker is Runtime MCP server listening on port 29998; it confirms a listener, not which transport is implemented. For a current HTTP build, verify the endpoint using the initialization request in the next section. Do not confuse this service with the ordinary UnrealCV command socket: changing [UnrealCV.Core] Port in unrealcv.ini does not document or prove a Runtime MCP port change.

Keep one intended environment on the endpoint. With an agent in a container or on another machine, 127.0.0.1 refers to the agent's own host/network namespace, not automatically the simulator. Prefer a trusted tunnel or equivalent private connectivity; do not expose the listener publicly.

2. Configure a current HTTP MCP client

The public repository supplies this configuration for clients accepting .mcp.json-style settings. Merge it with the client's existing settings rather than overwriting unrelated servers:

{
  "mcpServers": {
    "unrealcv": {
      "type": "http",
      "url": "http://127.0.0.1:29998/mcp",
      "disabled": false
    }
  }
}

For Codex, the upstream example uses ~/.codex/config.toml:

[mcp_servers.unrealcv]
url = "http://127.0.0.1:29998/mcp"
enabled = true

Configuration-file location and permission prompts depend on the client. This is a direct HTTP connection: there is no documented pip install command, stdio launch command, or local bridge to insert into this configuration.

Verify the protocol without an agent

The current repository advertises JSON-RPC 2.0 over Streamable HTTP, protocol versions 2025-11-25, 2025-06-18, 2025-03-26, and 2024-11-05, JSON responses, SSE message events, and the Mcp-Session-Id / Mcp-Protocol-Version headers. The following Bash example requests one advertised version:

curl -i -N http://127.0.0.1:29998/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"unrealzoo-check","version":"1.0"}}}'

Read the negotiated protocolVersion in the response. If the server returns Mcp-Session-Id, retain that value for subsequent requests. Complete initialization, then list the tools (replace SESSION_ID with that returned value; omit its header if the server did not issue one):

curl -i -N http://127.0.0.1:29998/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -H 'Mcp-Protocol-Version: 2025-03-26' \
  -H 'Mcp-Session-Id: SESSION_ID' \
  -d '{"jsonrpc":"2.0","method":"notifications/initialized"}'

curl -i -N http://127.0.0.1:29998/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -H 'Mcp-Protocol-Version: 2025-03-26' \
  -H 'Mcp-Session-Id: SESSION_ID' \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'

Use the negotiated version in the header if it differs. With SSE, read the JSON-RPC payload in the event data; a streaming connection may stay open. A normal MCP client manages initialization and session headers for you. These are protocol request examples, not captured responses from a tested UnrealZoo session.

3. Discover first, then inspect

Run tools/list after every environment/build change. Inspect each tool's inputSchema, required fields and limits; the connected runtime is authoritative, not a screenshot, Python method, or static tool count. Client interfaces may normalize displayed names (for example, dots to underscores); use the exact server-provided name in raw tools/call requests.

A small inspection workflow is:

  1. Call scene.overview with a bounded radius and actor count. Radius and world-space positions are in centimeters.
  2. Select an exact runtime actor name from the result. Call scene.inspect_actor to inspect its transform, bounds, tags and components. Never substitute an asset path for a runtime actor name.
  3. Use perception.snapshot when available for native line-of-sight, nearby-object and navigation information. Native state is not equivalent to what an image-only agent could observe.
  4. Only then request a small scene.capture_view if visual evidence is needed. Check the returned capture metadata and path rather than assuming an image was delivered inline.

For example, send this tools/call payload using the same HTTP headers and session as above (or enter the name and arguments in your MCP client):

{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"scene.overview","arguments":{"radius":2500,"max_actors":20}}}

After replacing ACTOR_FROM_OVERVIEW with a returned actor name:

{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"scene.inspect_actor","arguments":{"actor":"ACTOR_FROM_OVERVIEW"}}}

If the live capture schema supports these arguments:

{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"scene.capture_view","arguments":{"camera_id":0,"source":"mqrc","width":640,"height":360}}}

The public reference describes mvrc as the main viewport backbuffer and mqrc as an independently configurable renderer that may need warmup. Captures are saved as PNG files on the runtime machine in its temporary directory, with path, dimensions, renderer, MIME type and byte count in the result. A remote client cannot assume that returned path exists locally; arrange trusted file access separately. Keep image requests small and obey the live schema's limits.

4. Extend to task control safely

The tool reference describes these workflows; availability remains build-dependent:

Goal Discovery and action Verification / limitation
Camera composition Inspect components; use camera.get_pose, camera.look_at or camera.frame_bounds. Query pose and capture again. Camera changes affect subsequent observations.
Follow a character camera.follow_actor requires an exact actor and case-sensitive camera_component. It changes the view target, not possession or movement control. FPS Camera / TPS Camera are tested SmartLocomotion names, not universal defaults.
Navigate a character Inspect the actor/controller; use character.ensure_ai_controller, character.nav_area and character.navigate only after approval. Requires a valid NavMesh, navigation area, AIController and reachable goal. Setting the sampling area does not build a NavMesh. Check character.movement_state for actual displacement, not just a successful call.
Change appearance Discover the exact function and parameters using blueprint.inspect_api, then use blueprint.call. set_app(NewParam) is an upstream character example, not an API guaranteed on arbitrary actors. Query/inspect and capture the result.
Generate a scene Search assets, inspect bounds, raycast ground and check the region before spawn.from_asset. Use supported settling/overlap options from the schema, then spawn.validate_placement. Record generated actor names; rollback only approved targets.

For a reproducible pattern, the upstream scene-generation example publishes tool schemas, requests, responses and a manifest. Its asset paths and coordinates belong to that demonstration; discover suitable assets and geometry in your own map instead of replaying it blindly.

Raw UnrealCV commands

Prefer structured tools. For functionality not wrapped by a dedicated tool, discover the connected command dispatcher using unrealcv.list_cmd, then unrealcv.describe_command with the exact command/template before unrealcv.exec:

{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"unrealcv.exec","arguments":{"command":"vget /unrealcv/status"}}}

This status query is an inspection example, not a blanket approval for arbitrary commands. See the open-source command reference and the separate development command reference. A command's presence in a Python API or development document does not prove support in your binary.

Permissions and trust boundary

Treat the endpoint as a control interface to the simulator, not a read-only knowledge service. The public connection examples do not establish authentication, TLS, per-tool authorization, or a safety sandbox. Local binding alone is not a permission system.

  • Start with inspection tools and bounded queries. Capturing views writes files; asset information queries can load assets. Do not equate “inspection” with zero resource use.
  • Require explicit task-level approval before moving cameras/actors, spawning, changing physics/controllers, invoking Blueprint functions, or executing mutating raw commands. Seek separate confirmation for destruction, broad changes or cleanup outside the task's generated actors.
  • Reflected functions and raw command strings can cross the intended tool-level safety boundary. Do not auto-approve them based only on a friendly tool name or an untrusted scene/asset label.
  • Record calls, arguments and generated actor names. Read back the affected pose/state or placement after changes. Coordinate with Gym users: concurrent camera, movement or world edits can invalidate observations and experiments.

Troubleshooting and support checks

Symptom Check / next step
Connection refused / timeout Confirm the intended environment is running, a world is loaded, and the listener is enabled. Check host/network namespace, firewall and port conflicts. Installing a client does not create a listener.
HTTP request fails or produces non-HTTP data Check whether this is the older framed-TCP build. Port 29998 alone does not identify the protocol. Match the package's transport; do not assume an HTTP bridge exists.
HTTP error or lost session Inspect the actual HTTP/RPC error, negotiated protocol version, endpoint path and session headers. Reinitialize after a runtime restart; do not reuse an old session blindly.
Unknown tool / invalid arguments Refresh tools/list; use exact names and required schema fields. A static reference or normalized client label can differ from the live server.
Actor, asset or Blueprint function not found Rediscover in the current world. Distinguish runtime actor names, full asset object paths, component names and reflected parameter names.
Movement call succeeds but actor stays still Check character.movement_state, controller, physics, NavMesh and goal reachability. Following a camera does not possess the actor.
Capture missing / wrong view Check camera ID, renderer support, warmup, returned runtime-side path and dimensions. Do not assume the remote path is locally accessible.

An HTTP success status is not proof that a tool succeeded: inspect the JSON-RPC error or tool result (including isError where supplied), then verify the relevant runtime state. Exact error strings and supported tools cannot be guaranteed from the closed server implementation.

References

References: Runtime MCP repository, its tool reference, the gym feature announcement, and the older hosted UnrealCV guide. Verify tool execution, navigation, and capture capabilities in the target runtime.