github-mcp

github-mcp

Provides 39 tools to manage GitHub repositories, branches, issues, PRs, workflows, and more via the GitHub CLI, enabling natural language interaction with GitHub.

Category
Visit Server

README

šŸ™ GitHub MCP Server

License: MIT Python 3.10+ MCP Tools

A Model Context Protocol (MCP) server that wraps the GitHub CLI (gh) to provide 39 tools across 12 categories — manage repos, branches, issues, PRs, workflows, collaborators, and more, directly from Claude Desktop or Claude Code.

šŸš€ Features

  • Repository Management — Create, clone, list, view, and delete repos
  • Git Operations — Add, commit, push, pull, init + push in one command
  • Branch Management — Create, list, switch, and delete branches
  • Forking — Fork repos and sync forks with upstream
  • Issues — Create, list, and comment on issues
  • Pull Requests — Create, list, comment, merge, review, and diff PRs
  • Collaborators — List and add collaborators to repos
  • File Operations — Read and create/update files via the GitHub API
  • Workflows — List, trigger, and inspect GitHub Actions workflow runs
  • Releases — Create and list releases
  • Gists — Create gists from content
  • Search — Search repositories across GitHub
  • Security — Path sandboxing, input validation, read-only mode, audit logging
  • Remote Access — SSE transport with OAuth 2.0 authentication via ngrok tunnel

šŸ“¦ Prerequisites

1. Install GitHub CLI

# macOS
brew install gh

# Ubuntu/Debian
sudo apt install gh

# Windows
winget install GitHub.cli

2. Authenticate

gh auth login
gh auth status   # Verify you're logged in

3. Python 3.10+

python --version  # Must be 3.10 or higher

šŸ”§ Installation

# Clone the repository
git clone https://github.com/prateekaryann/github-mcp.git
cd github-mcp

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

šŸ”Œ Usage — Local (stdio)

This is the simplest setup. Claude Desktop or Claude Code launches the server as a subprocess.

Claude Desktop

Add to your claude_desktop_config.json:

OS Config path
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json
Linux ~/.config/claude/claude_desktop_config.json
{
  "mcpServers": {
    "github": {
      "command": "python",
      "args": ["/path/to/github-mcp/server.py"],
      "cwd": "/path/to/github-mcp"
    }
  }
}

Restart Claude Desktop after adding the configuration.

Claude Code

claude mcp add github -- python /path/to/github-mcp/server.py

🌐 Usage — Remote (SSE + OAuth)

For remote access, the server runs an SSE endpoint with OAuth 2.0 authentication, exposed via an ngrok tunnel.

Step 1: Start an ngrok tunnel

ngrok http 8080
# Note the HTTPS forwarding URL, e.g. https://abc123.ngrok-free.app

Or use the included helper scripts:

# Linux/macOS
./tunnel.sh

# Windows (PowerShell)
.\tunnel.ps1

Step 2: Start the server in SSE mode

export MCP_TRANSPORT=sse
export MCP_PORT=8080
export MCP_SERVER_URL=https://abc123.ngrok-free.app  # Your ngrok URL
python server.py

Step 3: Connect from Claude Desktop

{
  "mcpServers": {
    "github-remote": {
      "url": "https://abc123.ngrok-free.app/sse"
    }
  }
}

The OAuth flow will prompt you to authorize when you first connect.

šŸ› ļø Tools Reference

Auth (3)

Tool Description
auth_status Check GitHub CLI authentication status
whoami Get currently authenticated username
switch_account Switch between GitHub accounts

Repos (5)

Tool Description
create_repo Create a new GitHub repository
list_repos List repositories for a user/org
repo_view View repository details
clone_repo Clone a repository locally
delete_repo Delete a repository (requires confirm=True)

Git (4)

Tool Description
git_status Get status of a local repository
git_add_commit_push Add, commit, and push in one command
git_init_and_push Initialize local dir, create GitHub repo, and push
git_pull Pull latest changes from remote

Branches (4)

Tool Description
create_branch Create a new branch
list_branches List branches in a repository
switch_branch Switch to a different branch
delete_branch Delete a branch

Forks (2)

Tool Description
fork_repo Fork a repository
sync_fork Sync a fork with its upstream repository

Issues (3)

Tool Description
create_issue Create a new issue
list_issues List repository issues
comment_on_issue Add a comment to an issue

Pull Requests (6)

Tool Description
create_pr Create a pull request
list_prs List pull requests
comment_on_pr Add a comment to a PR
merge_pr Merge a pull request
review_pr Submit a review on a PR
pr_diff View the diff of a pull request

Collaborators (2)

Tool Description
list_collaborators List collaborators on a repository
add_collaborator Add a collaborator to a repository

File Operations (2)

Tool Description
get_file_contents Get the contents of a file from a repository
create_or_update_file Create or update a file in a repository

Gists (1)

Tool Description
create_gist Create a GitHub gist

Workflows (4)

Tool Description
list_workflows List GitHub Actions workflows for a repo
run_workflow Trigger a workflow dispatch event
list_workflow_runs List recent workflow runs
view_workflow_run View details of a specific workflow run

Search (1)

Tool Description
search_repos Search GitHub repositories

Releases (2)

Tool Description
create_release Create a new GitHub release
list_releases List releases for a repository

šŸ”’ Security

Path Sandboxing

All local file operations are restricted to the WORK_DIR directory (default: ~/projects). Any path outside this directory is rejected, preventing unauthorized filesystem access.

Input Validation

Repository names, usernames, branch names, and file paths are validated against strict regex patterns to prevent injection attacks.

Read-Only Mode

Set READ_ONLY=true to restrict the server to safe, non-destructive operations only (list, view, search). All write operations will be blocked.

Audit Logging

Every tool invocation is logged with parameters to mcp_audit.log (configurable via LOG_FILE), providing a full audit trail of all operations.

OAuth 2.0 (Remote Mode)

When running in SSE mode, the server requires OAuth 2.0 authentication with configurable scopes (read, write). Client registration and token revocation are supported.

Dangerous Operation Confirmation

Destructive operations like delete_repo require an explicit confirm=True parameter to prevent accidental data loss.

āš™ļø Configuration

Variable Description Default
WORK_DIR Base directory for git operations (path sandbox root) ~/projects
READ_ONLY Block all write operations when true false
LOG_FILE Path to the audit log file mcp_audit.log
MCP_TRANSPORT Transport mode: stdio or sse stdio
MCP_PORT Port for SSE server 8080
MCP_SERVER_URL Public URL for OAuth issuer (ngrok URL) http://localhost:8080

šŸ—ļø Architecture

github-mcp/
ā”œā”€ā”€ server.py           # Main MCP server — all 39 tools
ā”œā”€ā”€ oauth_provider.py   # In-memory OAuth 2.0 provider (SSE mode)
ā”œā”€ā”€ requirements.txt    # mcp[cli], uvicorn, starlette
ā”œā”€ā”€ tunnel.sh           # ngrok tunnel helper (Linux/macOS)
ā”œā”€ā”€ tunnel.ps1          # ngrok tunnel helper (Windows)
ā”œā”€ā”€ README.md
ā”œā”€ā”€ LICENSE
└── .claude/
    └── CLAUDE.md       # Claude Code project instructions

šŸ“ License

MIT License — See LICENSE for details.

šŸ‘¤ Author

Prateek Aryan — @prateekaryann


Built for seamless GitHub integration with Claude.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured