home / mcp / pygithub mcp server

PyGithub MCP Server

Provides a Python-based MCP server to interact with GitHub via PyGithub, enabling issue, comment, and label management.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "astromined-pygithub-mcp-server": {
      "command": "/path/to/repo/.venv/bin/python",
      "args": [
        "-m",
        "pygithub_mcp_server"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your-token-here"
      }
    }
  }
}

You can run a Python-based MCP server that uses PyGithub to interact with GitHub, giving you modular tools to manage issues, comments, labels, and more from an AI assistant. This guide shows you how to install, configure, and start the PyGithub MCP Server and how to use it with an MCP client.

How to use

You will run a local MCP server that exposes GitHub operations through modular tools. Enable and disable tool groups as needed, supply authentication, and interact with issues, comments, labels, and milestones via the MCP client. The server handles optional parameters gracefully, constructs proper GitHub API calls, and paginates results where applicable.

How to install

# Step 1: Create and activate a virtual environment
uv venv
source .venv/bin/activate

# Step 2: Install the MCP package in editable mode
uv pip install -e .

Configuration

Configure the MCP server to run locally using Python in a virtual environment. Provide the Python interpreter path, the module to execute, and any required environment variables such as your GitHub access token.

{
  "mcpServers": {
    "github": {
      "command": "/path/to/repo/.venv/bin/python",
      "args": ["-m", "pygithub_mcp_server"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your-token-here"
      }
    }
  }
}

Security and configuration notes

You can enable or disable tool groups to minimize exposed functionality. Use a separate configuration file or environment variables to toggle groups like issues, repositories, pull_requests, and search.

Troubleshooting

If the server fails to start, verify the Python path in the MCP settings, ensure all dependencies are installed in the virtual environment, and check that the GitHub access token is valid and has the required permissions.

Notes on development and testing

During development, you can test MCP tools with the MCP Inspector to experiment with available tools, try real GitHub repositories, and verify success and error cases.

Available tools

issues

Issue management tools to create, read, update, list, and close issues, including handling assignees and milestones.

comments

Comment tools to add, list, update, and delete comments on issues and pull requests.

labels

Label management tools to add or remove labels from issues, including handling multiple labels in a single operation.

milestones

Milestone handling for assigning and managing milestones on issues.