Skip to main content

MCP server for GitHub operations โ€” 73 tools for repos, PRs, issues, actions, releases, search, and more

Project description

๐Ÿ™ GitHub MCP Server

MCP server for GitHub operations โ€” 73 tools for repos, PRs, issues, actions, releases, search, and more.

A comprehensive Model Context Protocol (MCP) server that exposes the full GitHub REST API as AI-ready tools. Connect your AI assistant (Cursor, Claude Desktop, or any MCP client) to manage GitHub through natural language.

Author: Pawan Gunjkar (pawangunjkar@gmail.com)


๐Ÿ“ฅ Install

Option 1: PyPI / uvx (Recommended)

No clone required โ€” install and run directly:

uvx pawangunjkar-github-mcp

Cursor / Claude Desktop โ€” add to .cursor/mcp.json or claude_desktop_config.json:

{
  "mcpServers": {
    "github": {
      "command": "uvx",
      "args": ["pawangunjkar-github-mcp"],
      "env": {
        "GITHUB_TOKEN": "ghp_your-token-here",
        "GITHUB_PROTOCOL": "ssh"
      }
    }
  }
}

Option 2: Smithery

npx -y @smithery/cli install github-mcp --client cursor

Or browse smithery.ai and search for github-mcp.

Option 3: Clone from GitHub

git clone https://github.com/Pawangunjkar/github-mcp.git
cd github-mcp
uv sync
uv run server.py

See PUBLISHING.md for PyPI, Smithery, and directory submission steps.


โœจ Features

  • ๐Ÿ”Œ 73 tools across 12 categories โ€” full GitHub API coverage
  • ๐Ÿ” PAT authentication โ€” Personal Access Token with Bearer auth
  • ๐Ÿ”„ SSH + HTTPS โ€” supports both clone/push protocols
  • ๐Ÿ“„ Auto-pagination โ€” transparently handles paginated API responses
  • โšก Rate limit aware โ€” tracks and warns on low rate limits
  • ๐Ÿ’พ Credential caching โ€” auto-connect from env vars or cached credentials
  • ๐Ÿข GitHub Enterprise โ€” configurable API URL for GHE servers
  • ๐ŸŽฏ Zero configuration โ€” just set env vars and run

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.10+
  • uv package manager
  • GitHub account with a Personal Access Token

1. Clone & Install

cd github-mcp
uv sync

2. Configure Credentials

Option A: Environment Variables (Recommended)

cp .env.example .env

# Set your GitHub PAT
GITHUB_TOKEN=ghp_your-personal-access-token
GITHUB_PROTOCOL=ssh    # or 'https'

Option B: Connect via chat

github_connect(token="ghp_xxxxxxxxxxxx", protocol="ssh")

3. Generate a Personal Access Token

  1. Go to GitHub โ†’ Settings โ†’ Developer settings โ†’ Personal access tokens
  2. Click "Generate new token" (classic)
  3. Select scopes: repo, workflow, read:org, gist, notifications, delete_repo
  4. Click Generate and copy the token

4. Run the Server

# For Cursor / Claude Desktop (stdio transport)
uv run server.py

# For testing with MCP Inspector
uv run mcp dev server.py

๐Ÿ› ๏ธ Tool Reference (73 Tools)

Category 1: Connection & Authentication (4 tools)

Tool Description
github_connect Connect with Personal Access Token
github_disconnect Disconnect current session
github_status Show connection status, user info, rate limits
github_save_credentials Save credentials to disk cache

Category 2: Repository Management (10 tools)

Tool Description
github_list_repos List repos for authenticated user or any user/org
github_get_repo Get detailed repo info (stars, forks, languages)
github_create_repo Create a new repository
github_delete_repo Delete a repository permanently
github_fork_repo Fork a repository
github_update_repo Update repo settings (description, visibility)
github_list_topics Get repo topics/tags
github_update_topics Set repo topics/tags
github_list_languages Get language breakdown
github_list_contributors List repo contributors

Category 3: Branch & Tag Management (8 tools)

Tool Description
github_list_branches List all branches
github_get_branch Get branch details and protection status
github_create_branch Create a new branch from a ref
github_delete_branch Delete a branch
github_protect_branch Set branch protection rules
github_list_tags List all tags
github_create_tag Create a lightweight or annotated tag
github_compare_branches Compare two branches (ahead/behind, diff)

Category 4: File & Content Operations (6 tools)

Tool Description
github_get_file Get file content (auto-decodes base64)
github_create_file Create a new file via commit
github_update_file Update a file via commit
github_delete_file Delete a file via commit
github_get_tree Get directory tree listing
github_get_clone_url Get SSH or HTTPS clone URL

Category 5: Pull Requests (10 tools)

Tool Description
github_list_prs List pull requests (open, closed, all)
github_get_pr Get PR details (diff stats, reviews, status)
github_create_pr Create a new pull request
github_update_pr Update PR title, body, base branch
github_merge_pr Merge a PR (merge, squash, or rebase)
github_close_pr Close a PR without merging
github_list_pr_files List files changed in a PR
github_list_pr_reviews List reviews on a PR
github_request_reviewers Request reviewers for a PR
github_create_pr_comment Add a comment on a PR

Category 6: Issues (8 tools)

Tool Description
github_list_issues List issues with filters (state, labels, assignee)
github_get_issue Get issue details
github_create_issue Create a new issue
github_update_issue Update issue title, body, labels, assignees
github_close_issue Close an issue
github_create_issue_comment Add a comment on an issue
github_list_issue_comments List comments on an issue
github_add_labels Add labels to an issue/PR

Category 7: Actions & Workflows (7 tools)

Tool Description
github_list_workflows List all workflows in a repo
github_trigger_workflow Trigger a workflow dispatch event
github_list_workflow_runs List workflow runs
github_get_workflow_run Get details of a specific run
github_get_run_logs Get workflow run logs
github_cancel_workflow_run Cancel a running workflow
github_rerun_workflow Re-run a workflow

Category 8: Releases (5 tools)

Tool Description
github_list_releases List all releases
github_get_release Get release details and assets
github_create_release Create a release (with auto-generated notes)
github_delete_release Delete a release
github_get_latest_release Get the latest release

Category 9: Users & Organizations (5 tools)

Tool Description
github_get_user Get user profile info
github_list_user_repos List repos for a specific user
github_get_org Get organization info
github_list_org_repos List repos for an organization
github_list_org_members List organization members

Category 10: Search (4 tools)

Tool Description
github_search_repos Search repositories (with qualifiers)
github_search_code Search code across GitHub
github_search_issues Search issues and PRs
github_search_users Search users and organizations

Category 11: Gists (4 tools)

Tool Description
github_list_gists List gists
github_create_gist Create a new gist
github_get_gist Get gist content and details
github_delete_gist Delete a gist

Category 12: Webhooks & Notifications (2 tools)

Tool Description
github_list_notifications List unread notifications
github_mark_notifications_read Mark notifications as read

๐Ÿ”— SSH vs HTTPS Support

The server supports both protocols. Set your preference via:

  • Environment variable: GITHUB_PROTOCOL=ssh (or https)
  • Connection parameter: github_connect(token="...", protocol="ssh")
Feature SSH HTTPS
Clone URL git@github.com:user/repo.git https://github.com/user/repo.git
Auth SSH key on machine PAT or credential helper
Default โœ… Preferred Fallback

Tools like github_create_repo, github_fork_repo, and github_get_clone_url return URLs in both formats.


โš™๏ธ Configuration

Environment Variables

Variable Required Default Description
GITHUB_TOKEN Yes โ€” Personal Access Token
GITHUB_API_URL No https://api.github.com API URL (change for GitHub Enterprise)
GITHUB_PROTOCOL No ssh Preferred clone protocol (ssh or https)
GITHUB_TIMEOUT No 30 Request timeout in seconds
GITHUB_MCP_CACHE_DIR No ~/.github-mcp-cache Credential cache directory

Cursor Integration

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "github": {
      "command": "uvx",
      "args": ["pawangunjkar-github-mcp"],
      "env": {
        "GITHUB_TOKEN": "ghp_your-token-here",
        "GITHUB_PROTOCOL": "ssh"
      }
    }
  }
}

Alternative (from source):

{
  "mcpServers": {
    "github": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/github-mcp", "server.py"],
      "env": {
        "GITHUB_TOKEN": "ghp_your-token-here",
        "GITHUB_PROTOCOL": "ssh"
      }
    }
  }
}

Claude Desktop Integration

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "github": {
      "command": "uvx",
      "args": ["pawangunjkar-github-mcp"],
      "env": {
        "GITHUB_TOKEN": "ghp_your-token-here",
        "GITHUB_PROTOCOL": "ssh"
      }
    }
  }
}

๐Ÿ’ก Example Usage

Repository Management

"List all my repos sorted by recent activity"
โ†’ github_list_repos(sort="updated")

"Show me the details of the linux-ssh-mcp repo"
โ†’ github_get_repo(owner="Pawangunjkar", repo="linux-ssh-mcp")

"Fork the fastapi repo to my account"
โ†’ github_fork_repo(owner="tiangolo", repo="fastapi")

Pull Requests & Code Review

"Create a PR from feature-branch to main"
โ†’ github_create_pr(owner="me", repo="my-app", title="Add login feature", head="feature-branch", base="main")

"Show me the files changed in PR #42"
โ†’ github_list_pr_files(owner="me", repo="my-app", pr_number=42)

"Merge PR #42 with squash"
โ†’ github_merge_pr(owner="me", repo="my-app", pr_number=42, merge_method="squash")

GitHub Actions

"Trigger the deploy workflow on main branch"
โ†’ github_trigger_workflow(owner="me", repo="my-app", workflow_id="deploy.yml", ref="main")

"Show recent workflow runs"
โ†’ github_list_workflow_runs(owner="me", repo="my-app")

"Cancel the running workflow"
โ†’ github_cancel_workflow_run(owner="me", repo="my-app", run_id=12345)

Search

"Find popular Python MCP servers on GitHub"
โ†’ github_search_repos(query="mcp server language:python stars:>10")

"Search for FastMCP usage in code"
โ†’ github_search_code(query="FastMCP language:python")

๐Ÿ“ Project Structure

github-mcp/
โ”œโ”€โ”€ server.py              # Main MCP server โ€” 73 tool definitions
โ”œโ”€โ”€ github_client.py       # GitHub REST API client (HTTP, auth, pagination)
โ”œโ”€โ”€ credential_store.py    # Credential caching (env vars, memory, file)
โ”œโ”€โ”€ pyproject.toml         # Project metadata & dependencies
โ”œโ”€โ”€ .env.example           # Example environment variables
โ”œโ”€โ”€ .gitignore             # Python gitignore
โ”œโ”€โ”€ LICENSE                # MIT license
โ””โ”€โ”€ README.md              # This file

๐Ÿ”’ Security Notes

  • PAT tokens are stored in ~/.github-mcp-cache/credentials.json with restrictive file permissions (600)
  • Never commit .env files or tokens to version control
  • Use fine-grained tokens when possible for minimum required access
  • The server tracks rate limits and warns when running low

๐Ÿ“„ License

MIT License โ€” see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pawangunjkar_github_mcp-1.0.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pawangunjkar_github_mcp-1.0.0-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file pawangunjkar_github_mcp-1.0.0.tar.gz.

File metadata

  • Download URL: pawangunjkar_github_mcp-1.0.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.5

File hashes

Hashes for pawangunjkar_github_mcp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 92fbf25f3ada87fbe9081f810c783d0b8ffe54a5a30a754e41befe061350aa45
MD5 b293464d4cecc7cec206fc302048d989
BLAKE2b-256 dfd2f107c35858edb5b81c4cd52e32ba48d4f30897aed3007c168ae73046a844

See more details on using hashes here.

File details

Details for the file pawangunjkar_github_mcp-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pawangunjkar_github_mcp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 225510fdf11707e2c944aa8d8ec01fcd4ec4edd586bfe89b12d3a318a91dda62
MD5 c01b61ea218666c055a50dc6d94bb88e
BLAKE2b-256 ebe0a0f07a05151fca179a35655e41240b39ce0b5b496f96fc70a07a51aba933

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page