📇 ☁️ - Connect an IDE or AI assistant to GitHub Copilot CLI for code analysis, review and batch processing
Copilot MCP Tool
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**Copilot MCP Tool** is an open‑source Model Context Protocol (MCP) server that connects your IDE or AI assistant (Claude, Cursor, etc.) to **GitHub Copilot CLI**. It enables non‑interactive automation, safe tool execution with permissions, and large‑scale code analysis via @ file references. Built for reliability and speed, it streams progress updates, and integrates cleanly with standard MCP clients for code review, refactoring, documentation, and CI automation.
- **Primary**: Ask GitHub Copilot CLI questions from your MCP client, with comprehensive tool management
- **Advanced**: Batch processing, code review, and brainstorming capabilities
TLDR: + GitHub Copilot CLI
**Goal**: Use GitHub Copilot CLI directly from your MCP-enabled editor to analyze and edit code efficiently.
Prerequisites
Before using this tool, ensure you have:
1. **Node.js** (v18.0.0 or higher)
2. **GitHub Copilot CLI** - Required
One-Line Setup
Verify Installation
Type /mcp inside Claude Code to verify the Copilot MCP is active.
---
Alternative: Import from Claude Desktop
If you already have it configured in Claude Desktop:
1. Add to your Claude Desktop config:
2. Import to Claude Code:
Configuration
Register the MCP server with your MCP client:
For NPX Usage (Recommended)
Add this configuration to your Claude Desktop config file:
For Global Installation
If you installed globally, use this configuration instead:
**Configuration File Locations:**
- **Claude Desktop**:
- **macOS**: ~/Library/Application Support/Claude/claude_desktop_config.json
- **Windows**: %APPDATA%\Claude\claude_desktop_config.json
- **Linux**: ~/.config/claude/claude_desktop_config.json
After updating the configuration, restart your terminal session.
Environment Variables
Configure default behavior with environment variables:
COPILOT_MODEL - Default AI Model
**Method 1: In MCP Configuration (Recommended)**
Add the env field to your MCP server configuration:
**Method 2: System Environment Variable**
**Available models**:
- claude-sonnet-4.5 - Default, best for code generation
- claude-sonnet-4 - Faster version
- gpt-5 - OpenAI GPT-5
**Priority**: model parameter > COPILOT_MODEL env > Copilot CLI default (claude-sonnet-4.5)
**Override in requests**:
COPILOT_MCP_CWD - Working Directory
**Purpose**: Sets the working directory for Copilot CLI command execution. This is especially important when the MCP server starts from a different directory than your project (e.g., from home directory in IDE integrations).
**Method 1: In MCP Configuration (Recommended for IDE)**
**Method 2: System Environment Variable**
**Resolution Priority**:
1. workingDir parameter in request (highest)
2. COPILOT_MCP_CWD env variable
3. PWD or INIT_CWD env variables
4. Auto-inferred from @path in prompt
5. process.cwd() (lowest)
**Override in requests**:
**For IntelliJ IDEA / IDE Users**: If Copilot CLI cannot find your project files, set COPILOT_MCP_CWD in your MCP server configuration to point to your project directory.
See Getting Started Guide for full configuration details.
Example Workflow
- **Natural language**: "use copilot to explain index.html", "understand this repo with @src", "look for vulnerabilities and suggest fixes"
- **Claude Code**: Type /copilot to access the MCP server tools.
Usage Examples
GitHub Copilot CLI
With File References (using @ syntax)
- ask copilot to analyze @src/main.ts and explain what it does
- use copilot to summarize @. the current directory
- analyze @package.json and list dependencies using copilot
General Questions (without files)
- ask copilot to explain div centering