Skip to main content

mcp-github-cli

MCP server that provides focused GraphQL and REST API tools for interacting with GitHub. This server offers a streamlined set of powerful tools that leverage GitHub's APIs to provide rich data and functionality.

Usage

uvx mcp-github-cli

Will run from PyPI. This can be used in goose or claude.

Prerequisites

  1. Install the GitHub CLI (gh) if not already installed:

    • macOS: brew install gh
    • Linux: sudo apt install gh
    • Windows: winget install GitHub.cli
  2. Authenticate with GitHub:

    gh auth login
    

Test

uv run python main.py --test

This will run a comprehensive test suite that verifies:

  • Authentication status with GitHub
  • User information retrieval (gh_get_me)
  • GraphQL query functionality (viewer info)
  • REST API repository search
  • GraphQL repository information retrieval
  • REST API branch listing

The test output provides a good demonstration of the capabilities of the different tools.

Usage from source

Running from CLI (Goose, or to try it)

uv --directory /path/to/mcp-github-cli run python main.py

Features

This MCP server focuses on providing powerful, focused tools that leverage GitHub's GraphQL and REST APIs:

User Information

  • gh_get_me(): Get detailed information about the authenticated user

GraphQL Tools

GraphQL tools provide rich, nested data in a single request:

  • gh_graphql_repo_info(owner_repo): Get comprehensive repository information
  • gh_graphql_user_profile(username): Get detailed user profile data
  • gh_graphql_pull_requests(owner_repo, limit, state): Get pull requests with reviewers and status
  • gh_graphql_issues(owner_repo, limit, state, labels): Get issues with comments and labels
  • gh_graphql_repo_contributors(owner_repo, limit): Get repository contributors and their commits
  • gh_custom_graphql(query, variables): Execute a custom GraphQL query

REST API Tools

REST tools provide specific functionality for common operations:

  • gh_rest_search_repos(query, limit): Search for repositories
  • gh_rest_repo_contents(owner_repo, path, ref): Get repository contents
  • gh_rest_create_issue(owner_repo, title, body, labels): Create an issue
  • gh_rest_create_pr(owner_repo, title, body, head, base, draft): Create a pull request
  • gh_rest_branches(owner_repo): List repository branches
  • gh_rest_commits(owner_repo, branch, limit): List repository commits
  • gh_rest_api(endpoint, method, data, query_params): Execute a custom REST API request

Examples

Here are examples of using these tools:

User Information

# Get authenticated user information
gh_get_me()

GraphQL Examples

# Get repository information
gh_graphql_repo_info("block/goose")

# Get user profile
gh_graphql_user_profile("octocat")

# Get open pull requests
gh_graphql_pull_requests("block/goose", 5, "OPEN")

# Get issues with specific labels
gh_graphql_issues("block/goose", 10, "OPEN", ["bug", "help wanted"])

# Custom GraphQL query
gh_custom_graphql("""
query {
  viewer {
    login
    name
  }
}
""")

REST API Examples

# Search for repositories
gh_rest_search_repos("language:python stars:>1000", 5)

# Get file contents
gh_rest_repo_contents("block/goose", "README.md")

# Create an issue
gh_rest_create_issue("your-username/your-repo", "Bug report", "There's a bug", ["bug"])

# List branches
gh_rest_branches("block/goose")

# Custom REST API request
gh_rest_api("repos/block/goose", "GET", query_params={"sort": "updated"})

Building and Publishing

  1. Update version in pyproject.toml:
[project]
version = "x.y.z"  # Update this
  1. Build the package:
# Clean previous builds
rm -rf dist/*

# Or build in a clean environment using uv
uv venv .venv
source .venv/bin/activate
uv pip install build
python -m build
  1. Publish to PyPI:
# Install twine if needed
uv pip install twine

# Upload to PyPI
python -m twine upload dist/*

License

MIT

Metadata

Release files for mcp-github-cli 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-github-cli 0.2.0
File Size Uploaded Provenance Actions
mcp_github_cli-0.2.0.tar.gz 7.8 kB Without provenance Details for mcp_github_cli-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-github-cli 0.2.0
File Interpreter ABI Platform Actions
mcp_github_cli-0.2.0-py3-none-any.whl Python 3 none any Details for mcp_github_cli-0.2.0-py3-none-any.whl

Total release size: 16.1 kB

Release files / mcp_github_cli-0.2.0.tar.gz

Download URL mcp_github_cli-0.2.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
295bdc3367e4ecadcab2f01e0f8701254b9626e3b322e5fcd80fd3c676fecfea
BLAKE2b-256 checksum
How to use checksums
00dbb3862afa1c1c1673358610e58a6cf7cc2d0eed8bc0107b264c9e5ddb2d0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / mcp_github_cli-0.2.0-py3-none-any.whl

Download URL mcp_github_cli-0.2.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4687bf45d641efdc3aeb4ee49b37b4f379f61225162787785cb8873dd45f2257
BLAKE2b-256 checksum
How to use checksums
235108136b0a09d244af84e751691e2e133b225a5a9ae4ecebde511fb62fd275
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Security for mcp-github-cli 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page