The PyGithub MCP Server enables AI assistants to programmatically interact with GitHub via a structured API. With this server, you can:
Repository Operations:
Create, fork, and search repositories
Get repository details and file contents
Manage files (create/update/delete)
Push multiple files in a single commit
Create and manage branches
List repository commits
Issue Management:
Create, update, list, and delete issues
Add, list, update, and remove issue comments
Manage issue labels, assignees, and milestones
Filter issues by state, labels, and date
Advanced Features:
Support for paginated results
Modular and configurable architecture
Allows interaction with the GitHub API through PyGithub. Provides tools for managing issues, repositories, and pull requests, including creating and updating issues, managing comments, handling labels, assignees, and milestones.
PyGithub MCP Server
A Model Context Protocol server that provides tools for interacting with the GitHub API through PyGithub. This server enables AI assistants to perform GitHub operations like managing issues, repositories, and pull requests.
Features
Modular Tool Architecture:
Configurable tool groups that can be enabled/disabled
Domain-specific organization (issues, repositories, etc.)
Flexible configuration via file or environment variables
Clear separation of concerns with modular design
Easy extension with consistent patterns
Complete GitHub Issue Management:
Create and update issues
Get issue details and list repository issues
Add, list, update, and delete comments
Manage issue labels
Handle assignees and milestones
Smart Parameter Handling:
Dynamic kwargs building for optional parameters
Proper type conversion for GitHub objects
Validation for all input parameters
Clear error messages for invalid inputs
Robust Implementation:
Object-oriented GitHub API interactions via PyGithub
Centralized GitHub client management
Proper error handling and rate limiting
Clean API abstraction through MCP tools
Comprehensive pagination support
Detailed logging for debugging
Documentation
Comprehensive guides are available in the docs/guides directory:
error-handling.md: Error types, handling patterns, and best practices
security.md: Authentication, access control, and content security
tool-reference.md: Detailed tool documentation with examples
See these guides for detailed information about using the PyGithub MCP Server.
Usage Examples
Issue Operations
Creating an Issue
Getting Issue Details
Updating an Issue
Comment Operations
Adding a Comment
Listing Comments
Updating a Comment
Label Operations
Adding Labels
Removing a Label
All operations handle optional parameters intelligently:
Only includes provided parameters in API calls
Converts primitive types to GitHub objects (e.g., milestone number to Milestone object)
Provides clear error messages for invalid parameters
Handles pagination automatically where applicable
Installation
Create and activate a virtual environment:
Install dependencies:
Configuration
Basic Configuration
Add the server to your MCP settings (e.g., claude_desktop_config.json
or cline_mcp_settings.json
):
Tool Group Configuration
The server supports selectively enabling or disabling tool groups through configuration. You can configure this in two ways:
1. Configuration File
Create a JSON configuration file (e.g., pygithub_mcp_config.json
):
Then specify this file in your environment:
2. Environment Variables
Alternatively, use environment variables to configure tool groups:
By default, only the issues
tool group is enabled. See README.config.md
for more detailed configuration options.
Development
Testing
The project includes a comprehensive test suite:
Note: Many tests are currently failing and under investigation. This is a known issue being actively worked on.
Testing with MCP Inspector
Test MCP tools during development using the MCP Inspector:
Use the MCP Inspector's Web UI to:
Experiment with available tools
Test with real GitHub repositories
Verify success and error cases
Document working payloads
Project Structure
Troubleshooting
Server fails to start:
Verify venv Python path in MCP settings
Ensure all requirements are installed in venv
Check GITHUB_PERSONAL_ACCESS_TOKEN is set and valid
Build errors:
Use --no-build-isolation flag with uv build
Ensure Python 3.10+ is being used
Verify all dependencies are installed
GitHub API errors:
Check token permissions and validity
Review pygithub_mcp_server.log for detailed error traces
Verify rate limits haven't been exceeded
Dependencies
Python 3.10+
MCP Python SDK
Pydantic
PyGithub
UV package manager
License
MIT
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
Enables AI assistants to interact with GitHub through the PyGithub library, providing tools for managing issues, repositories, pull requests, and other GitHub operations with intelligent parameter handling and error management.
Related Resources
Related MCP Servers
- -securityFlicense-qualityEnables interaction with GitHub through the GitHub API, supporting file operations, repository management, advanced search, and issue tracking with comprehensive error handling and automatic branch creation.Last updated -3,2641
- -securityAlicense-qualityEnables interaction with GitHub repositories through the GitHub API, allowing file operations, repository management, issue tracking, and code search through natural language commands.Last updated -3322MIT License
- -securityFlicense-qualityA set of tools allowing AI assistants to interact directly with GitHub, enabling automation of tasks like fetching user profiles, creating repositories, and managing pull requests.Last updated -
- -securityAlicense-qualityTransforms any GitHub repository into a documentation hub for AI assistants, enabling access to up-to-date documentation and code to eliminate hallucinations. Supports repository-specific and dynamic endpoints with smart search capabilities.Last updated -Apache 2.0