Copilot MCP Server
Integrates GitHub Copilot with MCP-compatible tools to provide AI-powered code assistance, including chat, code explanation, and reviews. It leverages existing GitHub CLI authentication to support multiple models like GPT-4o and Claude 3.5 Sonnet.
README
Copilot MCP Server
A Model Context Protocol (MCP) server that integrates with GitHub Copilot to provide AI-powered code assistance directly to Claude Code and other MCP-compatible tools.
Features
- Chat with Copilot: Get general programming assistance using GitHub Copilot's AI models
- Code Explanation: Detailed explanations of code snippets
- Code Suggestions: Generate code based on natural language descriptions
- Code Review: Get feedback and improvement suggestions for your code
- Multiple AI Models: Support for GPT-4o, Claude 3.5 Sonnet, and Gemini 2.0 Flash
- Rate Limiting: Built-in rate limiting to respect API limits
- Automatic Authentication: Works with your existing GitHub Copilot CLI setup
Installation
Option 1: Using npx (Recommended)
npx @willianpaiva/copilot-mcp-server
Option 2: Manual Installation
- Clone this repository:
git clone https://github.com/WillianPaiva/copilot-mcp.git
cd copilot-mcp
- Install dependencies:
npm install
- Build the project:
npm run build
Configuration
No Configuration Needed!
The server works out of the box with your existing GitHub Copilot authentication.
Optional Configuration
Only needed for special use cases. Create a .env file:
cp .env.example .env
Optional settings:
# Only if you want to override the detected organization
GITHUB_ORG=your_organization_name
# Optional debugging
LOG_LEVEL=info
DEBUG=false
MAX_REQUESTS_PER_MINUTE=60
Setup Requirements
Prerequisites:
- GitHub Copilot Subscription: You need an active GitHub Copilot subscription
- GitHub Copilot CLI Installed: Install and authenticate GitHub Copilot CLI:
# Install GitHub CLI first brew install gh # or your preferred method # Install GitHub Copilot CLI extension gh extension install github/gh-copilot # Authenticate (this will save tokens to ~/.config/github-copilot/) gh auth login
Authentication
Automatic Authentication (Recommended)
The MCP server automatically detects your GitHub Copilot authentication from:
~/.config/github-copilot/hosts.json~/.config/github-copilot/apps.json
No manual configuration needed if you have GitHub Copilot CLI installed and authenticated!
Troubleshooting Authentication
If automatic detection fails, ensure you have GitHub Copilot CLI properly installed and authenticated:
gh extension install github/gh-copilot
gh auth login
Usage
With Claude Code
Add the following to your Claude Code MCP configuration:
Option 1: Using npx (Recommended)
{
"mcpServers": {
"copilot": {
"command": "npx",
"args": ["-y", "@willianpaiva/copilot-mcp-server"]
}
}
}
Option 2: Manual Installation
{
"mcpServers": {
"copilot": {
"command": "node",
"args": ["/path/to/your/copilot-mcp/build/index.js"]
}
}
}
That's it! No tokens or environment variables needed - the server automatically uses your existing GitHub Copilot authentication.
Available Tools
copilot_chat
General programming assistance and questions.
// Example usage in Claude Code
copilot_chat({
message: "How do I implement a binary search algorithm?",
model: "gpt-4o",
context: "I'm working on a JavaScript project"
})
copilot_explain
Get detailed explanations of code.
copilot_explain({
code: "function fibonacci(n) { return n <= 1 ? n : fibonacci(n-1) + fibonacci(n-2); }",
language: "javascript"
})
copilot_suggest
Generate code from natural language descriptions.
copilot_suggest({
prompt: "Create a React component for a user profile card",
language: "javascript",
maxSuggestions: 3
})
copilot_review
Get code review and improvement suggestions.
copilot_review({
code: "your code here",
language: "python",
reviewType: "security"
})
Available Resources
copilot://models
List of available AI models and their capabilities.
copilot://usage
Current usage statistics and rate limiting information.
Development
Run in Development Mode
npm run dev
Build
npm run build
Lint
npm run lint
Test
npm test
Rate Limiting
The server implements rate limiting to respect GitHub's API limits:
- Default: 60 requests per minute
- Configurable via
MAX_REQUESTS_PER_MINUTEenvironment variable - Automatic reset every minute
Error Handling
The server includes comprehensive error handling for:
- Authentication failures
- Rate limit exceeded
- Network issues
- Invalid requests
- API unavailability
Troubleshooting
Common Issues
-
Authentication Failed
- Ensure GitHub Copilot CLI is installed:
gh extension install github/gh-copilot - Make sure you're authenticated:
gh auth login - Verify you have access to GitHub Copilot
- Ensure GitHub Copilot CLI is installed:
-
Rate Limit Exceeded
- Wait for the rate limit to reset (1 minute)
- Consider reducing the frequency of requests
-
API Not Available
- Verify you have access to GitHub Copilot
- Check GitHub's status page for outages
Debug Mode
Enable debug mode for verbose logging:
DEBUG=true
LOG_LEVEL=debug
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details.
Security
- The server uses your existing GitHub Copilot authentication
- No tokens are stored or transmitted by this application
- Authentication files are read-only from GitHub CLI's standard locations
- Follow GitHub's security best practices for your main GitHub authentication
Support
For issues and questions:
- Check the troubleshooting section
- Search existing GitHub issues
- Create a new issue with detailed information
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。