An MCP (Model Context Protocol) server that wraps the GitHub Copilot CLI (gh copilot), enabling AI assistants to interact with GitHub Copilot through a standardized interface.
- Command Suggestions: Get shell, git, and GitHub CLI command suggestions from natural language
- Command Explanations: Understand what complex commands do
- Shell Aliases: Generate convenience aliases for your shell
- Configuration: View and manage Copilot CLI settings
- Dual Transport Support: Both STDIO (local) and SSE (network) transports
- Python 3.10+
- GitHub CLI (
gh) installed: https://cli.github.com/ - GitHub Copilot extension for gh:
gh extension install github/gh-copilot
- GitHub Copilot subscription (Individual, Business, or Enterprise)
cd /home/ward/MCP/copilot_mcp_server
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtpip install -e .For local MCP client connections:
python server.pyFor network-accessible MCP server:
python server_sse.pyOr with custom host/port:
MCP_SERVER_HOST=0.0.0.0 MCP_SERVER_PORT=8602 python server_sse.pyGet a command suggestion from GitHub Copilot based on natural language.
Parameters:
prompt(required): Natural language description of what you want to dotarget: Target type -'shell'(default),'gh', or'git'
Examples:
copilot_suggest(prompt="Install git", target="shell")
copilot_suggest(prompt="Create pull request", target="gh")
copilot_suggest(prompt="Undo the most recent local commits", target="git")Convenience wrapper for shell command suggestions.
Parameters:
prompt(required): Natural language description
Examples:
- "Kill processes holding onto deleted files"
- "Convert SVG to PNG and resize"
Convenience wrapper for git command suggestions.
Parameters:
prompt(required): Natural language description
Examples:
- "Undo the most recent local commits"
- "Clean up local branches"
Convenience wrapper for GitHub CLI command suggestions.
Parameters:
prompt(required): Natural language description
Examples:
- "Create pull request"
- "List pull requests waiting for my review"
Get an explanation of a command from GitHub Copilot.
Parameters:
command(required): The command to explain
Examples:
copilot_explain(command="du -sh | sort -h")
copilot_explain(command="git log --oneline --graph --decorate --all")Get the GitHub Copilot CLI version information.
Get help information.
Parameters:
command: Optional command to get help for ('suggest', 'explain', 'config', 'alias')
Get GitHub Copilot CLI configuration.
Parameters:
key: Optional specific config key (empty shows all)
Generate shell aliases for convenience commands.
Parameters:
shell: Shell type -'bash','zsh','fish', or'powershell'
Add to your MCP settings:
{
"mcpServers": {
"copilot": {
"command": "python",
"args": ["/home/ward/MCP/copilot_mcp_server/server.py"]
}
}
}{
"mcpServers": {
"copilot-remote": {
"url": "http://localhost:8602/sse"
}
}
}| Variable | Default | Description |
|---|---|---|
MCP_SERVER_HOST |
0.0.0.0 |
SSE server bind address |
MCP_SERVER_PORT |
8602 |
SSE server port |
copilot_suggest_shell(prompt="Find all files larger than 100MB")copilot_explain(command="find . -name '*.log' -mtime +30 -delete")copilot_suggest_git(prompt="Squash last 3 commits into one")copilot_suggest_gh(prompt="List all open issues assigned to me")Create /etc/systemd/user/copilot-mcp.service:
[Unit]
Description=GitHub Copilot MCP Server
After=network.target
[Service]
Type=simple
WorkingDirectory=/home/ward/MCP/copilot_mcp_server
ExecStart=/home/ward/MCP/copilot_mcp_server/venv/bin/python server_sse.py
Restart=always
RestartSec=5
Environment=MCP_SERVER_PORT=8602
[Install]
WantedBy=default.targetEnable and start:
systemctl --user enable copilot-mcp
systemctl --user start copilot-mcpMIT License
- Claude Code MCP Server - Similar MCP wrapper for Claude Code CLI
- Gemini CLI MCP Server - Similar MCP wrapper for Gemini CLI