mcp-unity: Cursor rule for Windsurf

.windsurfrules

windsurfrules is a cursor rule for Windsurf from CoderGamester/mcp-unity. It costs 2,865 tokens per session, scanned B, original, MIT.

Repository rules for a Unity project with a C# editor package and a Node.js/TypeScript server connected through WebSockets. They explain how the parts communicate using the Model Context Protocol, a standard way for AI clients to call tools and read resources.

In plain words
What is it for?
Use them when modifying the Unity editor side, the server, or the JSON messages exchanged between them.
Why use it?
They keep code changes aligned with the project's structure, supported versions, communication method, and message format.

Cursor rule for Windsurf

Written for Windsurf: a Windsurf rule.

This is CoderGamester/mcp-unity's own configuration. It tells Windsurf how to work on mcp-unity itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything mcp-unity configures →

About the project

MCP Unity is a bridge between the Unity Editor and AI coding assistants through the Model Context Protocol, allowing agents to query and manipulate Unity scenes and GameObjects. Unity developers use it with assistants such as Cursor, Windsurf, Claude Code, Codex, and Copilot, and the catalogue entries provide instructions for working with it.

CoderGamester/mcp-unity · 2,012 stars · on GitHub

Reuse

Borrowing it

Nothing to install: this file belongs to CoderGamester/mcp-unity. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/CoderGamester/mcp-unity/main/.windsurfrules
Clone the repo
git clone --depth 1 https://github.com/CoderGamester/mcp-unity

Made for: Windsurf.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for windsurfrules

README.md
[![agentmods](https://agentmods.dev/badge/rules/codergamester/mcp-unity/windsurfrules/github.svg)](https://agentmods.dev/rules/codergamester/mcp-unity/windsurfrules)
Your own site
<a href="https://agentmods.dev/rules/codergamester/mcp-unity/windsurfrules"><img src="https://agentmods.dev/badge/rules/codergamester/mcp-unity/windsurfrules/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for windsurfrules

Your own site · 80×15
<a href="https://agentmods.dev/rules/codergamester/mcp-unity/windsurfrules"><img src="https://agentmods.dev/badge/rules/codergamester/mcp-unity/windsurfrules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,865 This file is loaded in full into every session.
When invoked 2,865 The same file — it is already loaded in full.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.02865 $0.02865
Opus 5.5 $0.01146 $0.01146
Sonnet 5.5 $0.00573 $0.00573
Haiku 4.5 $0.00286 $0.00286

Measured 26d ago against content hash 4467be258dce, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

windsurfrules scanned grade B with 1 finding 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 26d 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.

Unrestricted tool accessmediumExcessive agency

A wildcard tool grant or "run any command" leaves no least-privilege boundary at all.

* **Security/Safety**: Be cautious with tools that modify files or execute arbitrary code. Currently, the scope is within Unity, but general caution is advised.
.windsurfrules · 142 lines

How it starts

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

1. Project Structure

  • The project consists of two main parts:
    • Editor/ (Unity C#/Editor Package): A C# Unity Editor package that exposes Unity Editor functionality via a WebSocket bridge.
    • Server/ (Node.js/TypeScript): A Node.js server implementing the Model Context Protocol (MCP), using the official TypeScript SDK.

2. Communication & Protocol

  • Primary Protocol: Model Context Protocol (MCP).
  • Transport Layer: WebSockets.
    • Node.js server (Server/) acts as a WebSocket client to the WebSocket server running within the Unity Editor (Editor/).
  • Message Format: JSON. MCP defines the structure for tool/resource calls.
    • Node.js tools typically send a request like: { method: "csharp_tool_name", params: { ... } } to Unity via mcpUnity.sendRequest().
    • Unity C# tools receive this, execute, and return a JObject response.
  • Response Format: JSON. MCP defines the structure for tool/resource responses.
    • Unity C# tools return a JObject response.
    • Node.js tools receive this and return a JObject response.
  • Error Handling: MCP defines a standard error format.
    • Unity C# tools return an error object if an exception occurs.
    • Node.js tools receive this and return an error object.

Communication Flow:

  • Request: AI LLM Assistant -> Node.js MCP Server -> WebSocket Bridge -> Unity Editor Package -> Unity Editor API
  • Response: Unity Editor Package -> WebSocket Bridge -> Node.js MCP Server -> AI LLM Assistant

3. Minimum Supported Versions

  • Unity: 2022.3 or newer
  • Node.js: 18.0.0 or newer

4. Key Components

Unity Editor Package (Editor/)

  • UnityBridge/:
    • McpUnityServer.cs: Singleton. The central nervous system on the Unity side. Initializes WebSocket server, registers tools/resources, and dispatches incoming requests to appropriate handlers.
      • LLM Assistant Note: When adding new tools/resources, they must be registered here in RegisterTools() or RegisterResources(). Pay attention to how existing tools are instantiated (currently direct new Tool()).
    • McpUnitySocketHandler.cs: Handles individual WebSocket client connections, message parsing, and routing requests to McpUnityServer for tool/resource execution.
    • McpUnityEditorWindow.cs: // TODO: Complete
  • Tools/: Contains C# classes inheriting from McpToolBase. Each class implements a specific action that can be triggered in Unity.
    • LLM Assistant Note: New tools should follow the McpToolBase pattern: define Name (matching Node.js tool name), Description, IsAsync, and override Execute() or ExecuteAsync(). Use Undo.RecordObject for actions that modify the scene or assets.
  • Resources/: Contains C# classes inheriting from McpResourceBase (assumption, or similar base). These provide read-only access to Unity Editor state.
    • LLM Assistant Note: New resources should follow the McpResourceBase pattern: define Name (matching Node.js resource name), Description, and override Fetch() or FetchAsync()
  • Services/: Contains classes providing specific functionalities, often designed for dependency injection.
    • Example: TestRunnerService.cs, ConsoleLogsService.cs.
    • LLM Assistant Note: Prefer dependency injection for new services. If a tool needs a complex piece of logic, consider abstracting it into a service.
  • Utils/: Utility classes for common tasks like logging (McpLogger.cs), settings management (McpUnitySettings.cs), GameObject creation (GameObjectHierarchyCreator.cs)

Read the full file on GitHub · 142 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. 26d ago First seen · 142 lines · 2,865 tokens per session scan B 4467be258dce

Subscribe to this mod's changes

windsurfrules is a cursor rule published in the GitHub repository CoderGamester/mcp-unity (2,012 stars, last pushed 26d ago), licensed MIT. It adds 2,865 tokens to every session, about $0.0115 per session on Opus 5.5. A static security scan graded it B with 1 finding (unrestricted tool access). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-12.

Related

windsurfrules compared with cursor rules from other repositories

windsurfrules next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
windsurfrulesCoderGamester/mcp-unityCursor rule2.0k26d agoMITB2,865Windsurf
cfx-lua-conventionsTMHSDigital/CFX-Developer-ToolsCursor rule51mo agononeA0Cursor
cfx-javascript-conventionsTMHSDigital/CFX-Developer-ToolsCursor rule51mo agononeA0Cursor
cfx-csharp-conventionsTMHSDigital/CFX-Developer-ToolsCursor rule51mo agononeA0Cursor
ponytailDietrichGebert/ponytailCursor rule185k8d agoMITA604Cursor
angular-20angular/angularCursor rule101kyesterdayMITA0Cursor
dev-standardapache/supersetCursor rule75ktodayApache-2.0A1,147Cursor