Skip to main content

GitHub Copilot CLI Integration

Complete guide for using Bob the Fixer with GitHub Copilot CLI.

Overview

GitHub Copilot CLI is an AI-powered terminal assistant that acts as your terminal's sidekick. It's an agent that understands your GitHub repositories, issues, and pull requests directly within your terminal.

Key Features:

  • Codebase exploration and file editing
  • Command execution with explicit user approval
  • GitHub context integration (issues, PRs)
  • MCP server support for custom tools

How it differs from other AI CLIs:

  • Uses GitHub authentication (not separate API keys)
  • Agent-based architecture with approval workflows
  • Included with Copilot Pro, Pro+, Business, and Enterprise plans

Prerequisites

  • Node.js 18+ and npm
  • GitHub account with Copilot subscription (Pro, Pro+, Business, or Enterprise)
  • Bob the Fixer installed
  • SonarQube running

Installation

Step 1: Install GitHub Copilot CLI

npm install -g @github/copilot

Step 2: Create Configuration Directory

mkdir -p ~/.copilot

Step 3: Configure Bob the Fixer

Option A: Run Bob the Fixer Installer

If GitHub Copilot is detected, the installer configures it automatically:

cd /path/to/bob-the-fixer
./install.sh

Option B: Manual Configuration

Create or edit ~/.copilot/mcp-config.json:

{
"mcpServers": {
"bob-the-fixer": {
"type": "local",
"command": "node",
"tools": ["*"],
"args": [
"/path/to/bob-the-fixer/packages/core/dist/universal-mcp-server.js"
],
"env": {
"SONAR_URL": "http://localhost:9000",
"SONAR_TOKEN": "your-token-here",
"LOG_LEVEL": "info",
"LOG_FILE_PATH": "./logs/mcp-server.log"
}
}
}
}
Important

Replace /path/to/bob-the-fixer with your actual installation path.

Authentication

GitHub Copilot CLI uses your GitHub credentials automatically. Unlike Claude or Gemini, you don't need to configure separate API keys.

Requirements:

  • Active GitHub account
  • Copilot subscription (Pro, Pro+, Business, or Enterprise)
  • GitHub CLI authenticated (gh auth login) or browser-based login

Configuration File

Location

~/.copilot/mcp-config.json

Structure

FieldTypeDescription
typestringMust be "local" for local MCP servers
commandstringThe command to run (node)
toolsarrayTool permissions (["*"] for all)
argsarrayArguments (path to MCP server)
envobjectEnvironment variables

Environment Variables

VariableRequiredDefaultDescription
SONAR_URLYes-SonarQube server URL
SONAR_TOKENYes-SonarQube authentication token
LOG_LEVELNoinfoLogging verbosity
LOG_FILE_PATHNo-Log file location
ENCRYPTION_KEYNo-Token encryption key

Adding to Existing Config

If you already have other MCP servers configured, use jq to merge:

MCP_SERVER_PATH="/path/to/bob-the-fixer/packages/core/dist/universal-mcp-server.js"
SONAR_TOKEN="your-token"

jq --arg path "$MCP_SERVER_PATH" \
--arg token "$SONAR_TOKEN" \
'.mcpServers["bob-the-fixer"] = {
"type": "local",
"command": "node",
"tools": ["*"],
"args": [$path],
"env": {
"SONAR_URL": "http://localhost:9000",
"SONAR_TOKEN": $token,
"LOG_LEVEL": "info"
}
}' ~/.copilot/mcp-config.json > /tmp/mcp-config.json

mv /tmp/mcp-config.json ~/.copilot/mcp-config.json

Verify Installation

Check the configuration exists:

cat ~/.copilot/mcp-config.json | jq '.mcpServers["bob-the-fixer"]'

Expected output:

{
"type": "local",
"command": "node",
"tools": ["*"],
"args": ["/path/to/bob-the-fixer/packages/core/dist/universal-mcp-server.js"],
"env": {
"SONAR_URL": "http://localhost:9000",
"SONAR_TOKEN": "squ_...",
"LOG_LEVEL": "info"
}
}

Usage

Starting Copilot CLI

GitHub Copilot CLI runs as an agent in your terminal. Refer to the official documentation for the latest invocation method.

Example Prompts

Once running, interact with code quality tools using natural language:

Scan this project for code issues
What security vulnerabilities exist in this codebase?
Fix the critical bugs found by SonarQube

Available Commands

TaskExample Prompt
First scan"Set up SonarQube and analyze this project"
View issues"Show me all critical issues"
Get details"Explain the SQL injection issue"
Fix issue"Fix the null pointer bug in user.ts"
Check quality"Did we pass the quality gate?"
Generate report"Create a quality summary report"

Approval Workflow

GitHub Copilot CLI requires explicit approval before:

  • Editing files
  • Executing commands
  • Making changes to your system

This provides an extra layer of safety when fixing code issues.

Available Tools

All 20 Bob the Fixer MCP tools are available:

  • Scanning: sonar_scan_project, sonar_auto_setup
  • Analysis: sonar_get_issue_details, sonar_analyze_patterns, sonar_get_security_hotspots, sonar_get_security_hotspot_details
  • Metrics: sonar_get_project_metrics, sonar_get_quality_gate, sonar_get_technical_debt, sonar_get_coverage_gaps
  • Duplication: sonar_get_duplication_summary, sonar_get_duplication_details
  • Reporting: sonar_generate_report
  • Management: sonar_project_discovery, sonar_config_manager, and more

Troubleshooting

"MCP server not responding"

  1. Check the config file exists:

    ls -la ~/.copilot/mcp-config.json
  2. Verify JSON is valid:

    cat ~/.copilot/mcp-config.json | jq .
  3. Check the MCP server file exists:

    ls -la /path/to/bob-the-fixer/packages/core/dist/universal-mcp-server.js
  4. If missing, rebuild:

    cd /path/to/bob-the-fixer
    npm run build

"SonarQube connection failed"

  1. Verify SonarQube is running:

    curl http://localhost:9000/api/system/status
  2. Check token is valid:

    curl -u "your-token:" http://localhost:9000/api/authentication/validate

"Config file not found"

Create the directory and initialize the file:

mkdir -p ~/.copilot
echo '{"mcpServers":{}}' > ~/.copilot/mcp-config.json

Then add the Bob the Fixer configuration.

"Invalid JSON syntax"

Validate and fix JSON:

# Check for errors
cat ~/.copilot/mcp-config.json | jq .

# Common issues:
# - Missing commas between entries
# - Trailing commas after last entry
# - Unescaped quotes in strings

Check Bob the Fixer Status

Use the built-in diagnostic:

Check if Bob the Fixer is properly configured

This runs sonar_diagnose_permissions to verify connectivity and permissions.

Removing Bob the Fixer

Using jq

jq 'del(.mcpServers["bob-the-fixer"])' ~/.copilot/mcp-config.json > /tmp/mcp-config.json
mv /tmp/mcp-config.json ~/.copilot/mcp-config.json

Manual

Edit ~/.copilot/mcp-config.json and remove the bob-the-fixer entry.

Using Uninstaller

cd /path/to/bob-the-fixer
./uninstall.sh

This automatically removes Bob the Fixer from all configured AI CLIs.

Supported Platforms

GitHub Copilot CLI supports:

  • macOS
  • Linux
  • Windows (via WSL)

Pricing

GitHub Copilot CLI is included with:

  • Copilot Pro
  • Copilot Pro+
  • Copilot Business
  • Copilot Enterprise

Each interaction uses your plan's request quota.

Next Steps