GithubMCP

GithubMCP

Connects AI assistants to GitHub repositories, pull requests, issues, commits, and code search while enabling repository visibility controls, CI/CD monitoring, sandboxed local filesystem access, and code quality/security analysis.

Category
访问服务器

README

<div align="center">

GithubMCP

A Production-Grade Personal Developer Assistant MCP Server

License: MIT Python: 3.11+ Managed by: uv MCP Compatible Code style: ruff Type checked with: mypy

Seamlessly connect AI models (Claude, Cursor, etc.) to your GitHub workflows, CI/CD pipelines, local workspace context, and code analysis tools.

</div>


Overview

GithubMCP is a Model Context Protocol (MCP) server designed for developers. It bridges AI assistants directly with your development environment, enabling them to:

  • Inspect GitHub repositories, pull requests, issues, commits, and code across public and private repositories.
  • Manage repository privacy & visibility (public/private) directly through conversation.
  • Monitor CI/CD workflow runs and parse failed GitHub Actions build steps.
  • Inspect local filesystem workspaces safely within user-defined allowed paths.
  • Analyze code quality, calculate complexity metrics, find TODOs, and detect potential security smells (hardcoded secrets).

Supports both STDIO (Claude Desktop, Cursor) and SSE (Server-Sent Events for web clients) transport modes.


Tool Suite Reference

GithubMCP provides 13 specialized tools:

Category Tool Name Description
GitHub search_repos Search public & private user/org repositories with language & sort filters.
GitHub inspect_pr Fetch PR details, changed files, addition/deletion stats, and review comments.
GitHub inspect_issue Inspect issue state, assignees, linked PRs, labels, and recent comments.
GitHub search_code Search code patterns across repositories with extension filters.
GitHub recent_commits Fetch recent commit history with diff statistics and authors.
GitHub update_repo_visibility Change repository visibility between private and public.
CI/CD check_ci_status Monitor GitHub Actions status (success/failure/in-progress) and failed step logs.
Filesystem read_file Read local file contents safely with MIME type detection and size validation.
Filesystem list_directory List directory tree structure with file sizes, mtime, and glob filters.
Filesystem search_local_files Asynchronously grep files for regex/patterns with surrounding line context.
Filesystem get_project_context Detect project tech stack (Node, Python, Rust, Go, Docker) & dev commands.
Analysis generate_change_summary Compare git refs and categorize commits into Features, Fixes, Breaking Changes, etc.
Analysis analyze_code_quality Compute lines of code, complexity estimate, TODO comments, and secret smells.

Quick Start

1. Prerequisites

  • Python 3.11+
  • uv (Fast Python package manager)

Install uv (if not already installed):

# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

2. Clone & Setup

git clone https://github.com/Dhananjayrbiraris/github-mcp.git
cd github-mcp

# Install dependencies and sync virtual environment
uv sync

3. Environment Configuration

Copy the template .env.example to .env:

cp .env.example .env

Edit .env with your GitHub Personal Access Token:

# GitHub Personal Access Token (Classic PAT with 'repo', 'workflow', 'read:user' scopes)
GITHUB_TOKEN=ghp_your_github_token_here

# Default GitHub Username (Optional)
GITHUB_USERNAME=your_username

# Sandboxed directories allowed for local filesystem operations
ALLOWED_PATHS=["~/projects", "~/workspace", "."]

# Max file size limit in MB for reading files
MAX_FILE_SIZE_MB=10

# Default Transport mode: "stdio" or "sse"
TRANSPORT=stdio

Generating your GitHub Token: Go to GitHub Settings -> Developer Settings -> Personal access tokens (classic) and generate a token with repo, workflow, and read:user scopes.


Client Setup Guides

A. Claude Desktop

1. Open the Claude Desktop configuration file:

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

2. Add the github-mcp server:

{
  "mcpServers": {
    "github-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/github-mcp",
        "run",
        "python",
        "-m",
        "github_mcp.main",
        "--transport",
        "stdio"
      ],
      "env": {
        "GITHUB_TOKEN": "ghp_your_personal_access_token_here"
      }
    }
  }
}

(On Windows, use backslashes e.g. C:\\Users\\yourname\\path\\to\\github-mcp or forward slashes).

3. Restart Claude Desktop

Open Claude Desktop — click the Tools icon at the bottom right of the prompt box to view all connected GithubMCP tools.


B. Cursor IDE

In Cursor:

  1. Navigate to Cursor Settings -> Features -> MCP.
  2. Click + Add New MCP Server.
  3. Fill in:
    • Name: github-mcp
    • Type: command
    • Command: uv --directory /path/to/github-mcp run python -m github_mcp.main --transport stdio

C. Server-Sent Events (SSE) Mode / Web Clients

To run the MCP server over HTTP / Server-Sent Events:

uv run python -m github_mcp.main --transport sse --host 0.0.0.0 --port 8000

SSE endpoint will be available at: http://localhost:8000/sse


Security & Sandboxing

  1. Path Sandboxing: Local filesystem tools (read_file, list_directory, search_local_files, get_project_context) strictly enforce path traversal validation against ALLOWED_PATHS. Accessing paths outside the allowlist will raise a SecurityError.
  2. Secret Management: Tokens and credentials are never logged or exposed.
  3. Rate Limit Resilience: Automatic exponential backoff retries on GitHub API rate limit throttling.

Development & Testing

Run the full testing and quality check suite:

# Run pytest unit tests
uv run pytest

# Run linter
uv run ruff check .

# Check code formatting
uv run ruff format --check .

# Run strict type checking
uv run mypy src/

Repository Structure

github-mcp/
├── .github/workflows/ci.yml # GitHub Actions CI workflow
├── src/github_mcp/
│   ├── __init__.py
│   ├── main.py              # Server entrypoint & MCP tool registrations
│   ├── config.py            # Pydantic Settings model
│   ├── github_tools.py      # GitHub API integrations & visibility controls
│   ├── file_tools.py        # Sandboxed local filesystem operations
│   ├── ci_tools.py          # GitHub Actions CI/CD monitoring
│   ├── analysis_tools.py    # Diff categorization & code quality analyzer
│   └── utils.py             # Path safety, error handling, rate limiting
├── tests/
│   ├── conftest.py          # Pytest fixtures and mocks
│   ├── test_github.py       # GitHub tools unit tests
│   ├── test_files.py        # Filesystem tools unit tests
│   └── test_ci.py           # CI status tools unit tests
├── docs/
│   ├── architecture.md      # System architecture & data flow
│   └── tools_reference.md   # Complete API schemas for all 13 tools
├── pyproject.toml           # Project dependencies & tool configurations
├── .env.example             # Environment variable template
├── CONTRIBUTING.md          # Open-source contribution guidelines
├── SECURITY.md              # Security policy & vulnerability reporting
└── LICENSE                  # MIT License

License

This project is licensed under the MIT License — free for personal and commercial use.


<div align="center"> Built using the <a href="https://modelcontextprotocol.io/">Model Context Protocol</a> and <a href="https://github.com/astral-sh/uv">UV</a>. </div>

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选