copilot-mcp
Provides the autonomous agent with Git operations to clone repositories, create feature branches, commit changes, and push branches.
Enables the autonomous agent to clone GitHub repositories, push feature branches, and open pull requests.
Exposes GitHub Copilot AI models as tools for chat, code completion, explanation, bug fixing, review, test generation, model listing, and autonomous coding agent workflows via the Copilot Chat Completions API.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
copilot-mcp
An MCP (Model Context Protocol) server that exposes GitHub Copilot AI โ including Claude Sonnet, GPT-5, Gemini, and all other Copilot models โ as tools for any MCP client.
Works with Codex CLI, Claude Code, Gemini CLI, and any other MCP-compatible agent.
What it does
๐ฌ Chat with any Copilot model (Claude Sonnet 4.6, GPT-5.4, Gemini 2.5 Pro, etc.)
โ๏ธ Complete code from a prompt
๐ Explain code snippets
๐ง Fix bugs
๐ Review code for bugs, security, and performance issues
๐งช Generate unit tests
๐ค Agent mode โ spin up an autonomous coding agent that can read/write files, run shell commands, and open Pull Requests on GitHub โ all in a multi-turn loop
Related MCP server: GitHub Copilot MCP Server
Prerequisites
Python 3.10+
A GitHub account with Copilot subscription (Individual, Business, or Enterprise)
ghCLI authenticated (gh auth login) or aGITHUB_TOKENenv var
Installation
pip install git+https://github.com/elastics-ai/copilot-mcpOr clone and install locally:
git clone https://github.com/elastics-ai/copilot-mcp
cd copilot-mcp
pip install -e .Verify it works:
copilot-mcp --help # should print nothing and exit (it's an MCP stdio server)
python -c "import copilot_mcp; print('OK')"Authentication
The server uses your existing gh CLI session โ no extra setup needed:
gh auth login # one-time setupOr set an environment variable:
export GITHUB_TOKEN=ghp_your_token_hereClient configuration
Codex CLI
Add to ~/.codex/config.toml:
[mcp_servers.copilot]
command = "copilot-mcp"
startup_timeout_sec = 15Claude Code
claude mcp add github-copilot copilot-mcpOr add to ~/.claude.json manually:
{
"mcpServers": {
"github-copilot": {
"command": "copilot-mcp"
}
}
}Gemini CLI
Add to ~/.gemini/settings.json:
{
"mcpServers": {
"github-copilot": {
"command": "copilot-mcp"
}
}
}Note: All three clients use the same
copilot-mcpcommand โ no path needed afterpip install.
Tools
Tool | Description |
| General coding chat โ questions, architecture, debugging |
| Code generation / completion |
| Explain a code snippet |
| Identify and fix bugs |
| Code review (bugs, security, performance) |
| Generate unit tests |
| List all available Copilot models |
| Autonomous coding agent loop (see below) |
Every tool accepts an optional model parameter. Default is claude-sonnet-4.6.
Changing the default model
COPILOT_MODEL=gpt-5.4 codex
COPILOT_MODEL=claude-opus-4.6 claudeAvailable models
Run copilot_list_models from any client, or check programmatically:
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"copilot_list_models","arguments":{}}}' \
| copilot-mcpNotable models: claude-sonnet-4.6, claude-opus-4.6, gpt-5.4, gpt-5.3-codex, gemini-2.5-pro, gpt-4o-2024-11-20
Agent mode (copilot_agent)
The copilot_agent tool spins up a fully autonomous coding agent. You give it a task; it loops until done.
Agent tools
The agent has access to: read_file, write_file, bash, list_files, git_clone, git_checkout_branch, git_commit_all, git_push, create_pull_request
Example tasks
"Add input validation to the POST /orders endpoint in elastics-ai/my-service and open a PR"
"Fix all TypeScript errors in src/ and write tests for the changed files"
"Refactor the database connection module to use a connection pool"GitHub PR workflow
When given a task involving a remote repo, the agent autonomously:
git_clonethe repositoryExplores with
list_files/read_filegit_checkout_branchโ creates a feature branch (e.g.copilot/add-validation)Makes changes with
write_fileRuns tests/linters with
bashgit_commit_allwith a descriptive messagegit_pushthe feature branchcreate_pull_requestโ opens a PR with title and descriptionReturns a summary with the PR URL
Safety guardrails
โ Never pushes to
mainormasterโ blocked at the tool levelโ Never approves or merges PRs โ only opens them
โ Always creates a feature branch before committing
โ Max 20 agent iterations by default (configurable)
Usage examples
Codex CLI
Ask Copilot to review src/auth.ts for security issues
Use copilot_agent to add rate limiting to elastics-ai/api-service and open a PRClaude Code
Use the copilot_chat tool to explain how the order matching algorithm worksDirect (for testing)
import asyncio, sys
sys.path.insert(0, '.')
from copilot_mcp.server import call_tool
async def test():
r = await call_tool("copilot_chat", {"message": "What is a deadlock?"})
print(r.content[0].text)
asyncio.run(test())Configuration reference
Env var | Default | Description |
|
| Default model for all tools |
| (from gh CLI) | GitHub PAT โ falls back to |
| (from gh CLI) | Alternative GitHub token env var |
How it works
The server calls https://api.githubcopilot.com/chat/completions directly using your GitHub token โ the same API that powers Copilot in VS Code. No token exchange or proxy is needed.
Key implementation note: The Copilot API proxy drops tool_calls from Claude model responses when tool_choice: "auto". The agent loop works around this by using tool_choice: "required" with a task_complete sentinel tool.
License
MIT ยฉ Elastics
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
This server cannot be deployed
Maintenance
Related MCP Connectors
GitHub Copilot MCP: code, repo, PR, workflow tools for AI assistants.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Connect MCP clients to 2,000+ AI models without managing provider API keys.
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.โฆ
Related MCP Servers
- AlicenseBqualityDmaintenanceIntegrates 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.42MIT
- AlicenseNot gradedqualityDmaintenanceIntegrates GitHub Copilot CLI with MCP clients to offer various coding assistance tools including asking questions, explaining code, suggesting commands, debugging, refactoring, generating tests, and reviewing code.32 npm8MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to fetch GitHub pull request diffs and metadata, and post review comments directly through the MCP protocol.1MIT
- AlicenseBqualityCmaintenanceEnables automated pull request review, security vulnerability analysis, and code quality improvement suggestions through any MCP client.37 npmMIT