Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions MCPForUnity/Editor/Clients/Configurators/CopilotCliConfigurator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.IO;
using MCPForUnity.Editor.Models;

namespace MCPForUnity.Editor.Clients.Configurators
{
public class CopilotCliConfigurator : JsonFileMcpConfigurator
{
public CopilotCliConfigurator() : base(new McpClient
{
name = "GitHub Copilot CLI",
windowsConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".copilot", "mcp-config.json"),
macConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".copilot", "mcp-config.json"),
linuxConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".copilot", "mcp-config.json")
})
{ }

public override IList<string> GetInstallationSteps() => new List<string>
{
"Install GitHub Copilot CLI (https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli)",
"Open or create mcp-config.json at the path above",
"Paste the configuration JSON (or use /mcp add in the CLI)",
"Restart your Copilot CLI session"
Comment on lines +10 to +24
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

GitHub Copilot CLI mcp-config.json configuration path location documentation

💡 Result:

GitHub Copilot CLI stores MCP server definitions in mcp-config.json in your Copilot config directory:

  • Default location: ~/.copilot/mcp-config.json (macOS/Linux; Windows typically via WSL uses the same ~/.copilot/ path) [1]
  • If you set XDG_CONFIG_HOME: the config directory moves under that location (and mcp-config.json moves with it) [1]

Official documentation: GitHub Docs “Using GitHub Copilot CLI” → “Add an MCP server” notes both the filename and default directory, and the XDG_CONFIG_HOME override [1].

Sources
[1] GitHub Docs — “Using GitHub Copilot CLI” (section “Add an MCP server”) (docs.github.com)

Citations:


Consider handling XDG_CONFIG_HOME for Linux users.

The path ~/.copilot/mcp-config.json is correct per official GitHub Copilot CLI documentation. However, on Linux, users with XDG_CONFIG_HOME set should have the config read from $XDG_CONFIG_HOME/copilot/mcp-config.json instead. The current implementation ignores this environment variable, which may prevent auto-configuration for users with custom config directories.

🤖 Prompt for AI Agents
In `@MCPForUnity/Editor/Clients/Configurators/CopilotCliConfigurator.cs` around
lines 10 - 24, The linuxConfigPath currently hardcodes
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".copilot", "mcp-config.json"); update CopilotCliConfigurator (the McpClient
initializer) to check Environment.GetEnvironmentVariable("XDG_CONFIG_HOME") and,
if non-empty, use Path.Combine(xdg, "copilot", "mcp-config.json") as
linuxConfigPath; otherwise fall back to the existing
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".copilot", "mcp-config.json") behavior so Linux honors XDG_CONFIG_HOME while
keeping windowsConfigPath and macConfigPath unchanged.

};
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

* **Unity 2021.3 LTS+** — [Download Unity](https://unity.com/download)
* **Python 3.10+** and **uv** — [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
* **An MCP Client** — [Claude Desktop](https://claude.ai/download) | [Cursor](https://www.cursor.com/en/downloads) | [VS Code Copilot](https://code.visualstudio.com/docs/copilot/overview) | [Windsurf](https://windsurf.com)
* **An MCP Client** — [Claude Desktop](https://claude.ai/download) | [Cursor](https://www.cursor.com/en/downloads) | [VS Code Copilot](https://code.visualstudio.com/docs/copilot/overview) | [GitHub Copilot CLI](https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli) | [Windsurf](https://windsurf.com)

### 1. Install the Unity Package

Expand Down
3 changes: 2 additions & 1 deletion docs/guides/MCP_CLIENT_CONFIGURATORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This guide explains how MCP client configurators work in this repo and how to ad

It covers:

- **Typical JSON-file clients** (Cursor, VSCode GitHub Copilot, VSCode Insiders, Windsurf, Kiro, Trae, Antigravity, etc.).
- **Typical JSON-file clients** (Cursor, VSCode GitHub Copilot, VSCode Insiders, GitHub Copilot CLI, Windsurf, Kiro, Trae, Antigravity, etc.).
- **Special clients** like **Claude CLI** and **Codex** that require custom logic.
- **How to add a new configurator class** so it shows up automatically in the MCP for Unity window.

Expand Down Expand Up @@ -91,6 +91,7 @@ Most MCP clients use a JSON config file that defines one or more MCP servers. Ex
- **Cursor** – `JsonFileMcpConfigurator` (global `~/.cursor/mcp.json`).
- **VSCode GitHub Copilot** – `JsonFileMcpConfigurator` with `IsVsCodeLayout = true`.
- **VSCode Insiders GitHub Copilot** – `JsonFileMcpConfigurator` with `IsVsCodeLayout = true` and Insider-specific `Code - Insiders/User/mcp.json` paths.
- **GitHub Copilot CLI** – `JsonFileMcpConfigurator` with standard HTTP transport.
- **Windsurf** – `JsonFileMcpConfigurator` with Windsurf-specific flags (`HttpUrlProperty = "serverUrl"`, `DefaultUnityFields["disabled"] = false`, etc.).
- **Kiro**, **Trae**, **Antigravity (Gemini)** – JSON configs with project-specific paths and flags.

Expand Down
2 changes: 1 addition & 1 deletion docs/i18n/README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

* **Unity 2021.3 LTS+** — [下载 Unity](https://unity.com/download)
* **Python 3.10+** 和 **uv** — [安装 uv](https://docs.astral.sh/uv/getting-started/installation/)
* **一个 MCP 客户端** — [Claude Desktop](https://claude.ai/download) | [Cursor](https://www.cursor.com/en/downloads) | [VS Code Copilot](https://code.visualstudio.com/docs/copilot/overview) | [Windsurf](https://windsurf.com)
* **一个 MCP 客户端** — [Claude Desktop](https://claude.ai/download) | [Cursor](https://www.cursor.com/en/downloads) | [VS Code Copilot](https://code.visualstudio.com/docs/copilot/overview) | [GitHub Copilot CLI](https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli) | [Windsurf](https://windsurf.com)

### 1. 安装 Unity 包

Expand Down