Get the FREE Ultimate OpenClaw Setup Guide →

mcp-github

MCP server for GitHub operations

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio nhevers-mcp-github python -m mcpgithub \
  --env GITHUB_TOKEN="ghp_..." \
  --env GITHUB_DEFAULT_OWNER="myorg"

How to use

This MCP server provides a set of tools to interact with GitHub repositories and code. It exposes operations for listing repositories, reading files, and performing common GitHub actions such as creating issues and pull requests, as well as searching code across repositories. Use the built-in MCP tools to compose requests that can be routed through the MCP framework, enabling automated workflows and integrations with other services. The included examples demonstrate how to call each available tool and what arguments are required.

Key capabilities include: list_repos to enumerate a user or organization’s repositories; get_file to fetch the contents of a file from a repository; create_issue to file issues with a title and body; search_code to query code across repositories with optional language filtering; and create_pr to open pull requests by specifying the head and base branches. All operations leverage the GitHub API via the mcpgithub client, authenticated with the provided token.

How to install

Prerequisites:

  • Python 3.8+ installed on your system
  • Git installed (optional for cloning the repository)
  • Access to the MCP framework where this server will run

Installation steps:

  1. Install dependencies from the repository:
pip install -r requirements.txt
  1. Ensure you have a GitHub personal access token with the necessary scopes (repo, read:user, etc.). Store it securely and set environment variables as described in the README.
  2. Run the MCP server configuration (see mcp_config above) or start the GitHub MCP server module directly for local development:
# If you’re using the MCP framework, ensure your environment is set and then run the server via your MCP runner.
  1. Verify the server is reachable and the tools are listed in the MCP interface, then begin executing the provided MCP tool JSON payloads (list_repos, get_file, create_issue, search_code, create_pr).

Additional notes

Environment variables:

  • GITHUB_TOKEN: GitHub personal access token with required scopes
  • GITHUB_DEFAULT_OWNER: Default owner/org for operations that require ownership context Common issues:
  • Ensure the GITHUB_TOKEN has sufficient scopes for the requested operations (read/write as needed).
  • If requests fail due to rate limits, consider using a token with higher privileges or adding appropriate caching.
  • When using get_file, provide an accurate path relative to the repository root. For create_pr and create_issue, ensure the target repository, branches, and titles are correct. Configuration tips:
  • You can override GITHUB_DEFAULT_OWNER per request if you need to operate on a different owner for a particular call.
  • Keep your Python environment isolated to avoid conflicts with other MCP components.

Related MCP Servers

Sponsor this space

Reach thousands of developers