mcp-unity-dev

Development instructions for mcp-unity, the package that exposes Unity Editor capabilities to MCP tools.

In plain words
What is it for?
Use them when editing the package, adding Unity files, rebuilding the server, updating the Unity package, or verifying changes.
Why use it?
They document important setup details, Unity package update steps, build checks, and pitfalls when changing C# or TypeScript code.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/pakkio/mcp-unity/mcp-unity-dev
Any agent
npx skills add pakkio/mcp-unity --skill mcp-unity-dev
Clone the repo
git clone --depth 1 https://github.com/pakkio/mcp-unity

Made for: Claude Code, Codex.

Per session 123 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,242 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00123 $0.02242
Opus 5 $0.00062 $0.01121
Sonnet 5 $0.00025 $0.00448
Haiku 4.5 $0.00012 $0.00224

Measured 2d ago against content hash 48a304425733, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mcp-unity-dev scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/mcp-unity-dev/SKILL.md · 52 lines

How it starts

The opening of the file, as written. The whole thing — 52 lines — stays where its author put it; the contents beside it link to each section on GitHub.

mcp-unity development notes

Hard-won knowledge from actually using and extending mcp-unity in this repo. Read the section relevant to your task before you start, not after you hit the bug.

If you're modifying the mcp-unity package itself

The Unity project that actually runs this code (My project (1)) pulls it as a git package, not a local reference — editing files in this repo does nothing to the running Unity Editor until you:

  1. Edit the C# (Editor/Tools/*.cs, McpUnityServer.cs) and/or TypeScript (Server~/src/tools/*.ts, index.ts)
  2. New .cs files need a .meta file — Unity treats git packages as immutable and silently drops any asset without one (no error, the type just doesn't exist, giving a confusing CS0246 in an unrelated file). Generate a GUID (powershell -Command "[guid]::NewGuid().ToString('N')") and write the meta in the same format as a sibling file.
  3. cd Server~ && npm run build to catch TypeScript errors
  4. Commit (no AI co-author line — this user's preference), push to origin/main
  5. In Unity: Package Manager → In Project → MCP Unity → Update (or remove/re-add if no Update button). This triggers a domain reload.
  6. Verify via get_console_logs — check the PackageCache folder hash in any log line matches your new commit SHA, and confirm no compile errors before using the new tool.

Tool registration is two-sided and easy to half-do: a new tool needs a Unity McpToolBase subclass registered in McpUnityServer.cs RegisterTools(), and a Node registerXTool() in Server~/src/tools/*.ts registered in index.ts. Forgetting either side gives a confusing "tool not found" or silently does nothing.

Tool gotchas (don't rediscover these empirically)

  • reparent_gameobject does not reorder the Hierarchy. It changes parent only; Unity's SetParent is a no-op for sibling index when the parent is unchanged, and even a genuine temp-parent bounce doesn't reliably reorder. Use set_sibling_index instead (absolute siblingIndex, or insertAfterInstanceId/insertBeforeInstanceId relative to a sibling).
  • duplicate_gameobject on a nested child under a scaled/rotated parent used to corrupt the clone's transform. Fixed by instantiating with the parent specified directly (Instantiate(original, parent)) instead of parentless-then-reparent. If you ever see a duplicate land at a wildly wrong position/rotation/scale, this is the failure mode to suspect.
  • Component fields that reference other scene objects (a Transform, Rigidbody, or another Component) go through update_component's componentData using {"instanceId": N} or {"objectPath": "Parent/Child"}not {"path": ...}/{"guid": ...}, which are asset-only (AssetDatabase). If the target field type doesn't match the resolved object directly (e.g. field is Rigidbody but you passed the GameObject's ID), it falls back to GetComponent automatically. List<T>/array fields accept a JSON array of the same per-element shapes.
  • Collider-derived components (including WheelCollider) are read via SerializedObject, not reflection. They used to be fully skipped ("_skipped": "Detailed property serialization skipped for safety") because some of their reflected C# properties are native-backed getters that can crash the Editor. get_gameobject/get_gameobject resource now dump these via the same SerializedObject/SerializedProperty API update_component already trusts for writes, so radius, isTrigger, suspensionSpring, etc. read back correctly. Native-plugin components (Pathfinding/FMOD namespaces) are still fully skipped — that skip is unrelated and still necessary.
  • set_play_mode_status action:"play"/"stop" used to frequently return "Connection failed" or time out. Root cause: entering/exiting Play mode synchronously fires ExitingEditMode, which unconditionally closes the WebSocket (StopServer) — this could race the in-flight response, and separately, the Node bridge used to reject all pending requests on any transient WebSocket error event (not just a terminal disconnect), which fired on the same reset. Both are fixed: Unity defers the actual mode transition to the next editor tick (via EditorApplication.delayCall) so the response is queued to send first, and Node no longer rejects pending requests on a bare connection error — only on a genuinely terminal disconnect. The action should now resolve normally without a manual sleep-and-poll workaround.
  • Unity discards all runtime changes to existing scene objects when you exit Play mode (auto-revert to the edit-time saved state). If you need to inspect what happened during a Play session, query while still in Play mode — don't stop first.
  • GameObject lookup by instanceId/objectPath now goes through one shared resolver (Editor/Utils/GameObjectResolver.cs) used by every tool. It searches all loaded scenes and includes inactive objects, and a bare name that matches more than one object returns an ambiguous_reference_error listing every candidate instead of silently picking one. Previously, whether an inactive object or an object in a non-active loaded scene could be found at all depended on which specific tool you called (four independent, disagreeing implementations existed) — that's no longer the case.
  • Prefer batch_execute for any run of >2-3 related tool calls — it's dramatically faster than sequential calls and each op gets its own success/failure in the summary.

Read the full file on GitHub · 52 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 52 lines · 123 tokens per session scan A 48a304425733

Subscribe to this mod's changes

mcp-unity-dev is a skill published in the GitHub repository pakkio/mcp-unity (0 stars, last pushed 18d ago), licensed MIT. It adds 123 tokens to every session and 2,242 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

particles

Use this skill when creating particle effects in Phaser 4. Covers ParticleEmitter, emission zones, death zones, particle properties, textures, gravity wells, and particle movement. Triggers on: particles, emitter, particle effect, explosion, fire, smoke.

phaserjs/phaser · 53 tokens

web-games

Web browser game development principles. Framework selection, WebGPU, optimization, PWA.

vudovn/ag-kit · 20 tokens

develop-web-game

Use when Codex is building or iterating on a web game (HTML/JS) and needs a reliable development + testing loop: implement small changes, run a Playwright-based test script with short input bursts and intentional pauses, inspect screenshots/text, and review console errors with rendergametotext.

netease-youdao/LobsterAI · 64 tokens

gameobject-component-destroy

Destroy one or more Components from a target GameObject. Missing (null) components are skipped — they cannot be destroyed. Use 'gameobject-find' and 'gameobject-component-get' to identify the components first.

IvanMurzak/Unity-MCP · 49 tokens

ship-web-games

Package, deploy, and verify a playable Three.js or web game. Use for release builds, asset delivery, private/public deployment, production smoke tests, browser proof, release notes, rollback readiness, and cleanup of temporary QA resources.

MengTo/Skills · 50 tokens

unity

Compile, test, and drive Unity for this repo's C# packages (unity/core, jint, quickjs, clearscript) and the two Unity projects (tests/, kitchen-sink/). Use when a change touches C# under unity/, when Unity test results are needed, when a rendering snapshot has to be checked or regenerated, or when the app has to be…

ReactUnity/core · 108 tokens