Skip to main content
Glama

Unity MCP Efficient

CI GitHub Release Python 3.10+ License: MIT

A small compatibility layer that lets AI clients use MCP for Unity without loading its full tool surface into every prompt.

The model sees six stable tools and discovers the required Unity operation on demand. The facade then compacts routine output, preserves full results for bounded retrieval, and batches related work without forcing every intermediate response into the conversation.

Measured against MCP for Unity v10.1.0, the model-visible schema fell from 23,280 estimated tokens to 915, while 377 indexed Unity operations remained reachable. The reproducible benchmark measures context footprint, not API billing.

IMPORTANT

This project does not replace the Unity package or its Python server. MCP for Unity remains the backend. Register the facade, not the upstream server, with the AI client. Exposing both tool surfaces removes most of the context savings.

Measured context reduction

On 2026-08-24, the scripts in benchmarks/ produced these results against MCP for Unity v10.1.0 (c14de1e6).

Measurement

Upstream surface

Efficient facade

Reduction

Model-visible tools

48

6

87.50%

Serialized tool schemas

93,119 chars

3,657 chars

96.07%

Approximate schema tokens¹

23,280

915

96.07%

Synthetic 250-object hierarchy²

628,110 chars

875 chars

99.86%

Approximate hierarchy tokens¹

157,028

219

99.86%

Action argument surface

5,566 fields

1,798 fields

67.70%

The dynamic catalog indexed 377 Unity operations. A small deterministic English/Russian search suite returned the expected operation at rank 1 for all 15 cases and within the top 3 for all 15 cases. The release candidate passes 35 facade tests. A live smoke test made no project changes and verified the six-tool surface, editor.refresh at rank 1, editor state, and a two-step scene inspection batch against an open Unity Editor.

¹ Token counts use a transparent four-characters-per-token estimate. They describe context footprint, not API billing. Actual tokenization varies by model and payload.

² The hierarchy benchmark models a noisy response containing 250 objects, 300 vertex indices per object, and the same data in text and structured payloads. This stress case does not promise the same reduction for every scene. See BENCHMARKS.md for the method and raw values.

Related MCP server: Agent Bridge for Unity

What the six tools do

Tool

Purpose

search_capabilities

Finds the best Unity operations from a short English or Russian task phrase. Full schemas are optional.

call_operation

Executes one exact operation and returns a bounded preview plus a recoverable result handle.

batch_operations

Runs up to 50 bounded call, select, assert, poll, foreach, and emit steps in one model round trip.

inspect_unity

Reads project, editor, scene, console, or selected-object state with revision-aware suppression.

get_result

Pages, filters, searches, or selects data already produced without repeating Unity work.

get_viewport

Returns one bounded Scene or Game view image without duplicating it in structured JSON.

The model still reaches the 377 indexed operations behind the facade. Those operations no longer occupy the prompt all at once.

Problems handled at the boundary

Common failure mode

What the facade changes

The client sends dozens of large tool schemas before useful work begins

A six-tool surface with on-demand operation discovery

Manager tools expose one large union of arguments for every action

Action-specific schemas; 67.70% fewer argument fields in the measured catalog

Scene, console, test, and asset responses flood the conversation

Unity-aware post-processing, strict output budgets, pagination, and result handles

A FastMCP or Pydantic Root object fails JSON serialization

Recursive JSON normalization before preview construction

Unity completes a mutation but disconnects during domain reload

Raw result persistence, explicit retry metadata, and no automatic mutation replay

A test run starts but its large envelope hides or loses job_id

A compact asynchronous receipt designed for polling

The upstream response nests success: false under transport-level success

Outer ok reflects the nested Unity result

Repeating a timed-out mutation may duplicate work

Stable request_id receipts suppress exact retries

Multi-object work burns one model turn per operation

Bounded sequential workflows and conservative parallel batches for reads

stale_status or is_changing causes open-ended polling

Delayed, revision-aware checks with a clear stopping rule

Architecture

Codex or another MCP client
        |
        | sees 6 tools
        v
Unity MCP Efficient (stdio by default)
        |-- capability search over the live upstream catalog
        |-- compact Unity-specific post-processing
        |-- bounded workflow runtime
        |-- local SQLite result and request receipts
        |
        | HTTP, default http://127.0.0.1:8080/mcp
        v
MCP for Unity server
        |
        v
Unity Editor package

A skill alone cannot hide tool schemas that an MCP client has already loaded. That is why this repository contains both pieces:

  • the facade enforces the smaller API and compact responses;

  • the skill teaches Codex how to search, batch, recover, and verify efficiently.

Install

1. Start MCP for Unity in HTTP mode

Install CoplayDev/MCP for Unity using its upstream instructions. In Unity, open Window → MCP for Unity, select the local HTTP transport, and start the server.

The upstream default endpoint is:

http://127.0.0.1:8080/mcp

If your project uses another port, pass it through UNITY_MCP_BACKEND_URL below.

2. Register the facade in Codex

Install uv when needed, then run:

codex mcp add unity-efficient \
  --env UNITY_MCP_BACKEND_URL=http://127.0.0.1:8080/mcp \
  -- uvx --from git+https://github.com/Vangardo/unity-mcp-efficient.git@v0.2.0 unity-mcp-efficient

On PowerShell, use the same command on one line:

codex mcp add unity-efficient --env UNITY_MCP_BACKEND_URL=http://127.0.0.1:8080/mcp -- uvx --from git+https://github.com/Vangardo/unity-mcp-efficient.git@v0.2.0 unity-mcp-efficient

Remove or disable any direct MCP for Unity entry from the same Codex client. Keep the upstream HTTP server running, but do not register its 48-tool surface with the model.

3. Install the Codex skill

The easiest route is to ask Codex:

$skill-installer Install the skill from https://github.com/Vangardo/unity-mcp-efficient/tree/v0.2.0/skills/unity-mcp-efficient

For a manual user-level install, clone the repository and copy skills/unity-mcp-efficient to:

$HOME/.agents/skills/unity-mcp-efficient

Codex detects skill changes automatically. Restart it if the skill does not appear.

Other MCP clients

Use this stdio configuration shape:

{
  "mcpServers": {
    "unity-efficient": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/Vangardo/unity-mcp-efficient.git@v0.2.0",
        "unity-mcp-efficient"
      ],
      "env": {
        "UNITY_MCP_BACKEND_URL": "http://127.0.0.1:8080/mcp"
      }
    }
  }
}

Install the packaged skill when the client supports the Agent Skills format. The facade works without it, but the skill improves tool selection and recovery behavior.

  1. Inspect low-detail Unity state once.

  2. Search with one concrete task phrase.

  3. Request the selected schema when its arguments are unclear.

  4. Batch known dependent work sequentially. Parallelize independent reads, never Unity mutations.

  5. Keep compact output and expand stored results by path or page.

  6. Verify the semantic result, not every raw intermediate object.

This loop is already encoded in skills/unity-mcp-efficient/SKILL.md.

Configuration

Variable

Default

Meaning

UNITY_MCP_BACKEND_URL

http://127.0.0.1:8080/mcp

Upstream MCP for Unity HTTP endpoint

UNITY_MCP_OPERATION_TIMEOUT

60

Per-operation timeout in seconds

UNITY_MCP_RESULT_DB

OS user cache directory

SQLite result store path; use memory for process-local storage

UNITY_MCP_EFFICIENT_TRANSPORT

stdio

Facade transport: stdio, http, or sse

Keep the default stdio transport unless you have a reason to expose the facade over a network. Read SECURITY.md before using HTTP or SSE.

Development and verification

git clone https://github.com/Vangardo/unity-mcp-efficient.git
cd unity-mcp-efficient
uv sync --extra dev
uv run pytest -q

With the upstream HTTP server running:

uv run python benchmarks/evaluate_facade.py
uv run python benchmarks/measure_surface.py
uv run python benchmarks/live_smoke.py

evaluate_facade.py and measure_surface.py read the live upstream catalog. live_smoke.py makes no mutations, but it requires an open and connected Unity Editor.

Known boundaries

  • Compact output is intentionally lossy. The untouched raw result remains available through get_result for a bounded time.

  • The facade does not make arbitrary Unity mutations safe. Permissions and review still belong to the MCP client and user.

  • Parallel mode is conservative. Unity may serialize editor work internally.

  • A discoverable optional capability, such as Roslyn support, may still be absent from a particular Unity project.

  • Scene and Game view capture may omit IMGUI or editor overlays.

  • Compatibility tests use MCP for Unity v10.1.0. The catalog is dynamic; benchmark later upstream releases before claiming support.

Design lineage

We took the progressive-disclosure idea from work on Vangardo/mcp_hub, a broader MCP gateway that routes a large integration catalog through a small search-and-call surface. Unity MCP Efficient applies that context discipline to Unity, then adds Unity-specific compaction, revision checks, mutation recovery, screenshots, and bounded local workflows.

If you need this pattern for Slack, Teamwork, Telegram, calendar, memory, automation, or cross-service agents, see MCP Hub.

The Unity compatibility backend is CoplayDev/MCP for Unity, distributed under the MIT License. This repository is an independent project and does not include its source code. See NOTICE.md and THIRD_PARTY_NOTICES.md.

Project documents

License and trademarks

The original code in this repository is available under the MIT License.

Unity is a trademark or registered trademark of Unity Technologies or its affiliates in the United States and elsewhere. This project is not affiliated with or endorsed by Unity Technologies or CoplayDev. Other names and brands belong to their respective owners.

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Unity Editor MCP SDK that exposes Unity Editor capabilities as MCP tools, enabling AI assistants like Claude Code to drive Unity Editor workflows through prefab inspection, asset manipulation, and preview rendering.
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Allows MCP clients like Claude Desktop or Cursor to perform Unity Editor actions, including asset management, scene modification, and game mechanic testing.
    22
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents (like Claude Code, Cursor) to directly operate Unity scenes via MCP protocol, with tools for scene hierarchy, object creation/deletion, and transform modification.
    16
    ISC

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Vangardo/unity-mcp-efficient'

If you have feedback or need assistance with the MCP directory API, please join our Discord server