agentleFS
AlexeyPerovAlexeyPerov/Unity-Open-MCP/mcp-server/AGENTS.md

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…

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
  1. Very specific:

    Keep production internal modules statically resolvable.

    line 14
  2. Very specific:

    No deps beyond @modelcontextprotocol/sdk without strong justification.

    line 17
  3. Very specific:

    Keep InstanceLock / authToken aligned with the bridge.

    line 65
  4. Very specific:

    No persistent disk caches in offline/compressible paths.

    line 69

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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/sdk without strong justification.

Tool definitions

  1. Define in src/tools/{name}.ts, export from index.ts, add to the right domain/tool array, and ensure that array is in ALL_TOOLS.
  2. Names: unity_open_mcp_* or unity_senses_*.
  3. Each tool: name, description, inputSchema, handler.
  4. Schema changes → same-task bridge C# handler update (args by key name), then node scripts/generate-batch-schemas.mjs for nested preflight constraints.
  5. Legacy typed tools → bridge KnownTools (+ read/mutate set) + DispatchTool case (registration).
  6. Domains → end-to-end checklist.

Routing

  • tool-router.ts: live / batch / offline / local.
  • Local handlers may use an optional read-only GET /tools probe; it must fail open so offline Unity never makes the tool unusable.
  • capabilities, generate_skill, manage_tools are local-only.
  • bridge_status, restart_editor, and resource_pressure are local-only operator surfaces that act on the OS process (instance lock + /ping; process kill; fd-count probe), not the bridge. Like read_compile_errors they 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.md and docs/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.
  • ListTools filters via filterVisibleTools; meta-tools use ALWAYS_VISIBLE_TOOLS. Visibility changes emit tools/list_changed.
  • Compiled-state available from LiveClient.listBridgeTools() (null offline).

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 projectPath for classifyInstance → bridge_compile_failed on stale heartbeat + live PID.
  • Keep InstanceLock / authToken aligned 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

  1. npm run typecheck and npm test.
  2. Tool contracts → owning page linked from docs/api/mcp-tools.md.
  3. Capability changes → build-capabilities.test.ts.

Agent skill sync

This package owns skill sync with tool/capability/routing changes.

SurfaceRole
skills/unity-open-mcp/SKILL.mdRoot agent playbook
skills/extensions/<domain>/SKILL.mdDomain playbook
Pages under docs/api/mcp-tools.mdHuman/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).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.