Chapter 6 of 15 7 min beginner

Connect VS Code Copilot

Agent mode and tool approval

Verified against a working setup on 2026-08-10

VS Code supports MCP through Copilot's agent mode. If you already have Copilot, this is the least additional software of any option — and it puts Unity tools next to the C# editing you were doing anyway.

Where the config lives

ScopeFileNote
User (Windows)%APPDATA%\Code\User\mcp.jsonApplies to every workspace.
User (macOS)~/Library/Application Support/Code/User/mcp.jsonSame file, different home.
Workspace.vscode/mcp.jsonCommitted with the project.
VS Code uses servers as the top-level key, not mcpServers. Copying a Claude or Cursor config across without changing that key is a very easy mistake — and it fails silently.

The config

json
{
  "servers": {
    "unity-mcp": {
      "type": "stdio",
      "command": "C:\\Users\\you\\.unity\\relay\\relay_win.exe",
      "args": ["--mcp"]
    }
  }
}

Turning it on

  1. 1
    Write mcp.json

    Use the user-level path for a setup that follows you across projects.

  2. 2
    Open the Chat view and pick Agent

    The mode dropdown sits at the top of the chat panel. Ask and Edit modes cannot call tools.

  3. 3
    Open the tools picker

    The tools icon lists every MCP tool available. Your Unity tools should be there and ticked.

  4. 4
    Open your Unity project

    As always, the Editor must be running.

  5. 5
    Verify

    Ask for something only the live project knows.

    text
    What compile errors are in my Unity console right now?

Tool approval

VS Code asks before running a tool and offers to remember your choice. That prompt is a real safety boundary, so it is worth being deliberate about what you make permanent.

Tool kindApprovalWhy
Read console, read sceneAlways allowNo side effects, and this is most of the value.
Search and inspect assetsAlways allowRead-only.
Create or edit scriptsAllow per sessionRecoverable, but only if git is clean.
Modify scenes or GameObjectsAsk every timeHardest thing to review after the fact.
Delete anythingAsk every timeObvious.
Run menu itemsAsk every timeA menu item can do literally anything.
Copilot has a "always allow for this workspace" option. Applying it to scene-editing tools means the agent can restructure your hierarchy with no prompt at all. Keep write tools on ask.

Why this one is convenient for Unity

The obvious benefit: VS Code is already many people's C# editor for Unity, so the model can read your scripts through the workspace and your scene through MCP at the same time. That combination catches a class of bug — script expects a component the scene does not have — that neither source alone would reveal.

What to take away

  • VS Code uses servers, not mcpServers.
  • User config lives at %APPDATA%\Code\User\mcp.json.
  • Only Agent mode can call tools.
  • Always-allow reads; keep scene and delete tools on ask.
  • Workspace files plus MCP scene access catches script/scene mismatches.