📱 GitHub MCP Server

Enterprise GitHub Integration

Seamless integration with GitHub Enterprise for repository browsing, issue tracking, and code analysis with AI-powered insights.

GitHub Enterprise Features

Comprehensive GitHub integration for enterprise development teams

📂 Repository Management

  • Browse repositories and file structures
  • Search across codebases and commits
  • Access repository metadata and statistics
  • View branch and tag information

🐛 Issue Tracking

  • Query issues and pull requests
  • Access issue comments and discussions
  • Track issue status and assignments
  • View project boards and milestones

👥 Team Collaboration

  • View team members and permissions
  • Access organization information
  • Review code review comments
  • Track contributor statistics

📊 Analytics & Insights

  • Repository activity and trends
  • Code quality metrics
  • Deployment and release tracking
  • Security vulnerability reports

Step-by-Step Setup

Follow these steps to connect to your GitHub Enterprise

Step 1: Install the GitHub MCP Server

Install the GitHub MCP server on your development machine:

# Install the GitHub MCP server
npm install -g @mcp/github-server

# Verify installation
mcp --version

Step 2: Create a GitHub Personal Access Token

You need a token to access your company's GitHub:

  1. Go to your GitHub Enterprise (e.g., https://github.company.com)
  2. Click your profile picture → Settings
  3. In the left sidebar, click "Developer settings"
  4. Click "Personal access tokens" → "Tokens (classic)"
  5. Click "Generate new token (classic)"
  6. Select these scopes:
    • repo (for repository access)
    • read:org (for organization data)
    • read:user (for user information)
    • read:project (for project boards)
  7. Click "Generate token" and copy the token (starts with ghp_)

Step 3: Configure Your GitHub Connection

Set up the connection using your token:

# Replace these with your actual values
export GITHUB_TOKEN="ghp_your_actual_token_here"
export GITHUB_URL="https://github.company.com"
export GITHUB_ORG="your-company-org"

# Configure the MCP server
mcp config github \
  --token $GITHUB_TOKEN \
  --url $GITHUB_URL \
  --organization $GITHUB_ORG \
  --readonly

Step 4: Test Your Connection

Verify everything is working:

# Test the connection
mcp test github

# Verify authentication
mcp auth verify github

# If successful, you should see:
# ✅ GitHub connection successful
# ✅ Organization access verified

Usage Examples

Leverage GitHub data through Copilot and MCP integration

Method 1: Ask GitHub Copilot (Recommended)

In your IDE with GitHub Copilot, you can ask natural language questions:

Example questions you can ask Copilot:

  • "What are the most recent pull requests in the main repository?"
  • "Show me open issues assigned to my team"
  • "What repositories have been most active this month?"
  • "Find code examples of authentication implementation"
  • "List all repositories using Node.js in our organization"
  • "What are the security vulnerabilities in our codebase?"

Copilot will automatically search your GitHub repositories and provide answers!

Method 2: Direct MCP Commands

You can also query GitHub directly from your terminal:

List repositories:

mcp query github "repositories in organization company-org"

Find specific issues:

mcp query github "open issues labeled 'bug' in repository 'main-app'"

Search for code patterns:

mcp query github "search code 'function authenticate' in organization"

Get pull request details:

mcp query github "pull requests merged last week in repository 'api-service'"

Advanced Queries

# Repository analytics mcp query github " repository statistics for 'main-app' including: - commit frequency by author - pull request merge time - issue resolution time - code review participation " # Security and compliance mcp query github " security scan results for repositories with: - dependency vulnerabilities - secret scanning alerts - code scanning findings - branch protection status "

Enterprise Integration Patterns

Best practices for GitHub Enterprise MCP integration

🔐 Security Configuration

  • Use service accounts with minimal permissions
  • Implement token rotation policies
  • Enable audit logging for all API calls
  • Configure IP allowlisting for API access

⚡ Performance Optimization

  • Implement intelligent caching strategies
  • Use GraphQL API for efficient queries
  • Configure rate limit handling
  • Optimize for large organization data

📊 Monitoring & Alerts

  • Track API rate limit usage
  • Monitor authentication failures
  • Alert on repository access patterns
  • Generate compliance reports

Troubleshooting

Common issues and solutions for GitHub MCP integration

🔑 Authentication Issues

Problem: 401 Unauthorized errors

# Verify token validity curl -H "Authorization: token $GITHUB_TOKEN" \ https://github.company.com/api/v3/user # Check token scopes mcp auth scope github --token $GITHUB_TOKEN

🚦 Rate Limiting

Problem: API rate limits exceeded

# Check current rate limits mcp status github --rate-limits # Configure rate limit handling mcp config github --rate-limit-strategy exponential-backoff