GitHub MCP Bridge

GitHub MCP Bridge

A Model Context Protocol server that enables AI agents to securely access and interact with GitHub Enterprise data, providing access to enterprise users, organizations, emails, and license information.

Category
访问服务器

README

GitHub MCP Bridge 🌉

Python Version MCP Protocol GitHub API

A powerful Model Context Protocol (MCP) server that enables AI agents (like Claude, ChatGPT, and others) to securely access and interact with GitHub Enterprise data. This project provides a bridge between AI systems and GitHub's Enterprise features, allowing for access to enterprise users, organizations, emails, and license information.

GitHub MCP Bridge Diagram

🌟 Features

  • User Management: List all enterprise users and get detailed information
  • Organization Access: View all organizations and their details
  • Email Retrieval: Access user email information (requires admin privileges)
  • License Management: View and manage enterprise licenses, including consumed licenses
  • Dual Transport Support: Use stdio for direct integration or SSE for service deployment
  • Kubernetes Ready: Deploy in EKS, GKE, or any Kubernetes environment
  • n8n Integration: Create workflows with GitHub Enterprise data

📋 Prerequisites

  • Python 3.9+
  • GitHub Personal Access Token with appropriate scopes
  • GitHub Enterprise instance (optional, can use github.com API)

🚀 Quick Start

Installation

  1. Clone this repository:
git clone https://github.com/vipink1203/github-mcp-bridge.git
cd github-mcp-bridge
  1. Create a virtual environment and install dependencies:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
  1. Set up environment variables:
cp .env.example .env
# Edit .env file with your GitHub token, enterprise name, and other settings

Running the Server

Using the setup script:

chmod +x setup.sh
./setup.sh

Manual startup:

For stdio transport (direct integration with MCP clients):

export GITHUB_TOKEN=your_github_token
export GITHUB_ENTERPRISE_NAME=your_enterprise_name
export TRANSPORT=stdio
python main.py

For SSE transport (standalone service):

export GITHUB_TOKEN=your_github_token
export GITHUB_ENTERPRISE_NAME=your_enterprise_name
export TRANSPORT=sse
export PORT=8050
python main.py

🐳 Running with Docker and n8n

The most common use case for this MCP server is to run it alongside n8n in a containerized environment.

Option 1: Adding to Existing n8n Docker Compose Setup

If you already have n8n running with Docker Compose, add these lines to your existing docker-compose.yml file:

services:
  # ... your existing n8n service and other services
  
  github-mcp:
    image: ghcr.io/vipink1203/github-mcp-bridge:latest
    # Or build from local source:
    # build:
    #   context: ./github-mcp-bridge
    #   dockerfile: Dockerfile
    container_name: github-mcp-bridge
    environment:
      - GITHUB_TOKEN=${GITHUB_TOKEN}
      - GITHUB_ENTERPRISE_URL=${GITHUB_ENTERPRISE_URL:-https://api.github.com}
      - GITHUB_ENTERPRISE_NAME=${GITHUB_ENTERPRISE_NAME}
      - TRANSPORT=sse
      - PORT=8050
      - HOST=0.0.0.0
    ports:
      - "8050:8050"
    restart: unless-stopped
    networks:
      - n8n-network  # Use your existing n8n network

Make sure to add your GitHub token to your .env file:

GITHUB_TOKEN=your_github_token_here
GITHUB_ENTERPRISE_NAME=your_enterprise_name

Option 2: Using docker-compose.override.yml

If you don't want to modify your original n8n docker-compose.yml:

  1. Create a docker-compose.override.yml in the same directory as your existing n8n docker-compose.yml:
version: '3'

services:
  # Add MCP settings to n8n
  n8n:
    environment:
      - N8N_COMMUNITY_PACKAGES=n8n-nodes-mcp
      - N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
      
  # Add GitHub MCP service
  github-mcp:
    image: ghcr.io/vipink1203/github-mcp-bridge:latest
    container_name: github-mcp-bridge
    environment:
      - GITHUB_TOKEN=${GITHUB_TOKEN}
      - GITHUB_ENTERPRISE_NAME=${GITHUB_ENTERPRISE_NAME}
      - TRANSPORT=sse
      - PORT=8050
    ports:
      - "8050:8050"
    restart: unless-stopped
    # This will use the same network as your n8n service
  1. Update your .env file to include the GitHub token:
GITHUB_TOKEN=your_github_token_here
GITHUB_ENTERPRISE_NAME=your_enterprise_name
  1. Run your Docker Compose as usual:
docker-compose up -d

Option 3: Starting from Scratch

If you don't have n8n set up yet, here's a complete docker-compose.yml with both n8n and GitHub MCP:

version: '3'

services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - N8N_COMMUNITY_PACKAGES=n8n-nodes-mcp
      - N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
    volumes:
      - ~/.n8n:/home/node/.n8n
    networks:
      - n8n-network

  github-mcp:
    image: ghcr.io/vipink1203/github-mcp-bridge:latest
    container_name: github-mcp-bridge
    environment:
      - GITHUB_TOKEN=${GITHUB_TOKEN}
      - GITHUB_ENTERPRISE_URL=${GITHUB_ENTERPRISE_URL:-https://api.github.com}
      - GITHUB_ENTERPRISE_NAME=${GITHUB_ENTERPRISE_NAME}
      - TRANSPORT=sse
      - PORT=8050
      - HOST=0.0.0.0
    ports:
      - "8050:8050"
    restart: unless-stopped
    networks:
      - n8n-network

networks:
  n8n-network:
    driver: bridge

Configuring n8n to Use the GitHub MCP

  1. Make sure the n8n-nodes-mcp package is enabled in your n8n environment:
environment:
  - N8N_COMMUNITY_PACKAGES=n8n-nodes-mcp
  - N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
  1. In the n8n web interface, add a new MCP credential:
    • Go to Settings > Credentials > New Credentials

    • Select MCP Client API

    • Configure with:

      • Name: GitHub MCP
      • Transport Type: Server-Sent Events (SSE)
      • Server URL: http://github-mcp:8050/sse

      Note: Use the container name (github-mcp) instead of localhost since they're in the same Docker network

Troubleshooting

If you have issues connecting from n8n to the GitHub MCP service:

  1. Network Connectivity: Ensure both containers are on the same network:
docker network inspect n8n-network
  1. DNS Resolution: Verify n8n can resolve the GitHub MCP service by name:
docker exec -it n8n ping github-mcp
  1. Check Logs: Look for errors in the GitHub MCP container:
docker logs github-mcp-bridge
  1. Port Access: Verify the service is listening on the correct port:
docker exec -it n8n curl http://github-mcp:8050/health
  1. Environment Variables: Make sure all required variables are set correctly.

🛠️ MCP Tools & Resources

Available Tools

Tool Description
list_enterprise_users Get all users in the GitHub Enterprise instance
get_user_info Get detailed information for a specific user
list_user_organizations Get all organizations a user belongs to
list_enterprise_organizations Get all organizations in the enterprise
get_user_emails Get email addresses for a user
list_enterprise_licenses Get all licenses in the GitHub Enterprise instance
get_license_info Get detailed information for a specific license
list_consumed_licenses Get all consumed licenses with detailed user information

Available Resources

Resource Description
github://users/{dummy} List of all GitHub Enterprise users
github://organizations/{dummy} List of all GitHub Enterprise organizations
github://user/{username} Information about a specific user
github://user/{username}/organizations Organizations for a specific user
github://licenses/{dummy} List of all GitHub Enterprise licenses
github://consumed-licenses/{dummy} List of all consumed licenses with user details

🔌 Client Configuration

Claude Desktop / Windsurf

Setting up Claude Desktop Configuration

The Claude Desktop settings file is located at:

  • On macOS: ~/Library/Application Support/Claude Desktop/settings.json
  • On Windows: %APPDATA%\Claude Desktop\settings.json
  • On Linux: ~/.config/Claude Desktop/settings.json

You can use any name for your MCP server (not just "github"). Here's an example using "github-ent" as the server name:

{
  "mcpServers": {
    "github-ent": {
      "command": "/path/to/your/venv/python",
      "args": ["/path/to/github-mcp-bridge/main.py"],
      "env": {
        "GITHUB_TOKEN": "your_github_token",
        "GITHUB_ENTERPRISE_NAME": "your_enterprise_name",
        "TRANSPORT": "stdio"
      }
    }
  }
}

Make sure to replace:

  • /path/to/your/venv/python with the full path to the Python executable in your virtual environment
  • /path/to/github-mcp-bridge/main.py with the full path to the main.py file
  • your_github_token with your GitHub Personal Access Token
  • your_enterprise_name with your GitHub Enterprise name

After editing the settings file, restart Claude Desktop for the changes to take effect.

Testing the Integration

You can test the integration by asking Claude: "Can you list the GitHub Enterprise users using the github-ent MCP tool?"

SSE Configuration

If you prefer to run the MCP server as a standalone service, you can configure Claude Desktop to use the SSE transport:

{
  "mcpServers": {
    "github-ent": {
      "transport": "sse",
      "url": "http://localhost:8050/sse"
    }
  }
}

In this case, you'll need to start the server separately before using it with Claude Desktop:

export GITHUB_TOKEN=your_github_token
export GITHUB_ENTERPRISE_NAME=your_enterprise_name
export TRANSPORT=sse
export PORT=8050
python main.py

🌐 Enterprise Deployment

Kubernetes / EKS

For more advanced EKS deployment options:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: github-mcp
  namespace: n8n
spec:
  replicas: 1
  selector:
    matchLabels:
      app: github-mcp
  template:
    metadata:
      labels:
        app: github-mcp
    spec:
      containers:
      - name: github-mcp
        image: ghcr.io/vipink1203/github-mcp-bridge:latest
        env:
        - name: GITHUB_TOKEN
          valueFrom:
            secretKeyRef:
              name: github-mcp-secrets
              key: github-token
        - name: GITHUB_ENTERPRISE_NAME
          valueFrom:
            secretKeyRef:
              name: github-mcp-secrets
              key: enterprise-name
        - name: TRANSPORT
          value: "sse"
        ports:
        - containerPort: 8050

For a complete EKS deployment guide, see the wiki.

📊 Example Use Cases

  • Enterprise User Management: Automate user onboarding and offboarding
  • License Monitoring: Get alerts when licenses are close to expiration
  • License Consumption Analysis: Track which users are consuming licenses across different organizations
  • Organization Analysis: Analyze organization structures and relationships
  • User Access Auditing: Track user permissions and access levels
  • AI-powered GitHub Insights: Let AI analyze your enterprise GitHub data

🔒 Security Considerations

  • Store your GitHub token securely
  • Use appropriate scopes for your GitHub token
  • For production, consider using AWS Secrets Manager or similar
  • Implement network policies in Kubernetes deployments

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgements


<p align="center">Built with ❤️ for AI and GitHub integration</p>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选