Add GitHub Copilot CLI support#641
Conversation
Reviewer's GuideAdds GitHub Copilot CLI as a first-class, auto-configured MCP client by introducing a dedicated JSON-file configurator and updating the documentation/prerequisite lists to include it alongside other supported MCP clients. Class diagram for new CopilotCliConfigurator JSON-file clientclassDiagram
class JsonFileMcpConfigurator {
<<abstract>>
- McpClient client
+ JsonFileMcpConfigurator(McpClient client)
+ IList~string~ GetInstallationSteps()
}
class CopilotCliConfigurator {
+ CopilotCliConfigurator()
+ IList~string~ GetInstallationSteps()
}
class McpClient {
+ string name
+ string windowsConfigPath
+ string macConfigPath
+ string linuxConfigPath
}
JsonFileMcpConfigurator <|-- CopilotCliConfigurator
McpClient o-- JsonFileMcpConfigurator
CopilotCliConfigurator --> McpClient : config
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
📝 WalkthroughWalkthroughThis PR adds GitHub Copilot CLI as a new supported MCP client. A new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
CopilotCliConfigurator, consider factoring the sharedPath.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".copilot", "mcp-config.json")expression into a local variable or helper to avoid repeating the same path logic for each OS field. - Double-check whether GitHub Copilot CLI uses the same
~/.copilot/mcp-config.jsonpath on native Windows as on Unix-like systems; if it differs (e.g., uses%APPDATA%), you may want to set a Windows-specific path instead of reusing the user-profile path for all three platforms.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `CopilotCliConfigurator`, consider factoring the shared `Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".copilot", "mcp-config.json")` expression into a local variable or helper to avoid repeating the same path logic for each OS field.
- Double-check whether GitHub Copilot CLI uses the same `~/.copilot/mcp-config.json` path on native Windows as on Unix-like systems; if it differs (e.g., uses `%APPDATA%`), you may want to set a Windows-specific path instead of reusing the user-profile path for all three platforms.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@MCPForUnity/Editor/Clients/Configurators/CopilotCliConfigurator.cs`:
- Around line 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.
| 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" |
There was a problem hiding this comment.
🧩 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 (andmcp-config.jsonmoves 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.
|
Thank you @GeekTrainer ! If you're on Discord/LinkedIn/Twitter - send me your profile so we'll tag you in release notes! |
Description
Add GitHub Copilot CLI as a supported MCP client with auto-configuration support.
Type of Change
Changes Made
Testing/Screenshots/Recordings
Configurator follows the same pattern as existing JSON-file configurators (Cursor, VSCode, etc.)
Documentation Updates
tools/UPDATE_DOCS.mdRelated Issues
N/A
Additional Notes
Config path sourced from official GitHub documentation: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-copilot-cli
Summary by Sourcery
Add GitHub Copilot CLI as a supported MCP client with JSON-file auto-configuration and update docs to list it as a recommended client.
New Features:
Documentation:
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.