Unity-Open-MCP / mcp-server
AGENTS.md15 starsChanged 5 months agoMITView on GitHub
Rules for mcp-server/ — stdio MCP server (unity-open-mcp). Root AGENTS.md also applies. Owns tool schemas, session visibility, routing, offline reads, capabilities mirroring, and agent skill sync. Bridge owns C# registration, transport, gate execution, and the port formula — packages/bridge/AGENTS.md. - TypeScript ESM. Source src/ → dist/. Node 18+. - Keep production internal modules statically resolvable; no dynamic import() for ordinary wiring. Allowed: test isolation, justified Node built-ins, documented exceptional lazy-loading. - No deps beyond @modelcontextprotocol/sdk without strong justification. 1. Define…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- demo/AGENTS.mdAGENTS.md
- hub/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- skills/AGENTS.mdAGENTS.md
- animationSkill
- audioSkill
- cinemachineSkill
- constraintsSkill
- input-simulationSkill
- inputsystemSkill
- lightingSkill
- memoryprofilerSkill
- navigationSkill
- particlesystemSkill
- probuilderSkill
- shadergraphSkill
- splinesSkill
- spriteatlasSkill
- terrainSkill
- textureSkill
- tilemapSkill
- timelineSkill
- uiSkill
- vfxSkill
- unity-open-mcpSkill
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Keep production internal modules statically resolvable.
- Very specific: line 17
No deps beyond @modelcontextprotocol/sdk without strong justification.
- Very specific: line 65
Keep InstanceLock / authToken aligned with the bridge.
- Very specific: line 69
No persistent disk caches in offline/compressible paths.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MCP server rules
Scope
Rules for mcp-server/ — stdio MCP server (unity-open-mcp). Root
AGENTS.md also applies. Owns tool schemas, session visibility, routing,
offline reads, capabilities mirroring, and agent skill sync. Bridge owns C#
registration, transport, gate execution, and the port formula —
packages/bridge/AGENTS.md.
Package shape
- TypeScript ESM. Source
src/→dist/. Node 18+. - Keep production internal modules statically resolvable; no dynamic
import()for ordinary wiring. Allowed: test isolation, justified Node built-ins, documented exceptional lazy-loading. - No deps beyond
@modelcontextprotocol/sdkwithout strong justification.
Tool definitions
- Define in
src/tools/{name}.ts, export fromindex.ts, add to the right domain/tool array, and ensure that array is inALL_TOOLS. - Names:
unity_open_mcp_*orunity_senses_*. - Each tool:
name,description,inputSchema, handler. - Schema changes → same-task bridge C# handler update (args by key name),
then
node scripts/generate-batch-schemas.mjsfor nested preflight constraints. - Legacy typed tools → bridge
KnownTools(+ read/mutate set) +DispatchToolcase (registration). - Domains → end-to-end checklist.
Routing
tool-router.ts: live / batch / offline / local.- Local handlers may use an optional read-only
GET /toolsprobe; it must fail open so offline Unity never makes the tool unusable. capabilities,generate_skill,manage_toolsare local-only.bridge_status,restart_editor, andresource_pressureare local-only operator surfaces that act on the OS process (instance lock + /ping; process kill; fd-count probe), not the bridge. Likeread_compile_errorsthey stay reachable when the bridge is down — by design, since the bridge is the thing that dies in the failure modes they recover from.- New route types update
docs/architecture.mdanddocs/api/routing-lifecycle.md.
Tool-group session visibility
- Catalog:
src/capabilities/tool-groups.ts. Session state:tool-session-state.ts(ephemeral). Bridge does not see activate/deactivate. ListToolsfilters viafilterVisibleTools; meta-tools useALWAYS_VISIBLE_TOOLS. Visibility changes emittools/list_changed.- Compiled-state
availablefromLiveClient.listBridgeTools()(nulloffline).
Instance discovery
- Order in
instance-discovery.ts: env override → live lock → shared deterministic port. - Bridge owns the three-way port contract. Hashing/normalization/range/fallback changes update C#, this TS mirror, Hub Rust, and all three fixtures together.
- MCP is read-only on locks. Preserve
projectPathforclassifyInstance→bridge_compile_failedon stale heartbeat + live PID. - Keep
InstanceLock/authTokenaligned with the bridge.
Offline reads and capabilities
- No persistent disk caches in offline/compressible paths. Only allowed cache:
session
AssetModelCache(LRU 8). src/capabilities/mirrors verify — see catalog sync.
Verification
npm run typecheckandnpm test.- Tool contracts → owning page linked from
docs/api/mcp-tools.md. - Capability changes →
build-capabilities.test.ts.
Agent skill sync
This package owns skill sync with tool/capability/routing changes.
| Surface | Role |
skills/unity-open-mcp/SKILL.md | Root agent playbook |
skills/extensions/<domain>/SKILL.md | Domain playbook |
Pages under docs/api/mcp-tools.md | Human/contributor reference |
Same task: always update the owning API page; update the root skill when
workflow/routing guidance changes; update the domain skill for domain
behavior; pure schema tweaks need only the API doc. Keep skills lean; no
full API tables or client-install JSON (paths:
skills/client-paths.json).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

