PyGithub GitHub Integration
STDIOA server providing tools for interacting with GitHub API through PyGithub.
A server providing tools for interacting with GitHub API through PyGithub.
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.
Modular Tool Architecture:
Complete GitHub Issue Management:
Smart Parameter Handling:
Robust Implementation:
Comprehensive guides are available in the docs/guides directory:
See these guides for detailed information about using the PyGithub MCP Server.
{ "owner": "username", "repo": "repository", "title": "Issue Title", "body": "Issue description", "assignees": ["username1", "username2"], "labels": ["bug", "help wanted"], "milestone": 1 }
{ "owner": "username", "repo": "repository", "issue_number": 1 }
{ "owner": "username", "repo": "repository", "issue_number": 1, "title": "Updated Title", "body": "Updated description", "state": "closed", "labels": ["bug", "wontfix"] }
{ "owner": "username", "repo": "repository", "issue_number": 1, "body": "This is a comment" }
{ "owner": "username", "repo": "repository", "issue_number": 1, "per_page": 10 }
{ "owner": "username", "repo": "repository", "issue_number": 1, "comment_id": 123456789, "body": "Updated comment text" }
{ "owner": "username", "repo": "repository", "issue_number": 1, "labels": ["enhancement", "help wanted"] }
{ "owner": "username", "repo": "repository", "issue_number": 1, "label": "enhancement" }
All operations handle optional parameters intelligently:
uv venv source .venv/bin/activate
uv pip install -e .
Add the server to your MCP settings (e.g., claude_desktop_config.json
or cline_mcp_settings.json
):
{ "mcpServers": { "github": { "command": "/path/to/repo/.venv/bin/python", "args": ["-m", "pygithub_mcp_server"], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "your-token-here" } } } }
The server supports selectively enabling or disabling tool groups through configuration. You can configure this in two ways:
Create a JSON configuration file (e.g., pygithub_mcp_config.json
):
{ "tool_groups": { "issues": {"enabled": true}, "repositories": {"enabled": true}, "pull_requests": {"enabled": false}, "discussions": {"enabled": false}, "search": {"enabled": true} } }
Then specify this file in your environment:
export PYGITHUB_MCP_CONFIG=/path/to/pygithub_mcp_config.json
Alternatively, use environment variables to configure tool groups:
export PYGITHUB_ENABLE_ISSUES=true export PYGITHUB_ENABLE_REPOSITORIES=true export PYGITHUB_ENABLE_PULL_REQUESTS=false
By default, only the issues
tool group is enabled. See README.config.md
for more detailed configuration options.
The project includes a comprehensive test suite:
# Run all tests pytest # Run tests with coverage report pytest --cov # Run specific test file pytest tests/test_operations/test_issues.py # Run tests matching a pattern pytest -k "test_create_issue"
Note: Many tests are currently failing and under investigation. This is a known issue being actively worked on.
Test MCP tools during development using the MCP Inspector:
source .venv/bin/activate # Ensure venv is activated npx @modelcontextprotocol/inspector -e GITHUB_PERSONAL_ACCESS_TOKEN=your-token-here uv run pygithub-mcp-server
Use the MCP Inspector's Web UI to:
tests/
├── unit/ # Fast tests without external dependencies
│ ├── config/ # Configuration tests
│ ├── tools/ # Tool registration tests
│ └── ... # Other unit tests
└── integration/ # Tests with real GitHub API
├── issues/ # Issue tools tests
└── ... # Other integration tests
src/
└── pygithub_mcp_server/
├── __init__.py
├── __main__.py
├── server.py # Server factory (create_server)
├── version.py
├── config/ # Configuration system
│ ├── __init__.py
│ └── settings.py # Configuration management
├── tools/ # Modular tool system
│ ├── __init__.py # Tool registration framework
│ └── issues/ # Issue tools
│ ├── __init__.py
│ └── tools.py # Issue tool implementations
├── client/ # GitHub client functionality
│ ├── __init__.py
│ ├── client.py # Core GitHub client
│ └── rate_limit.py # Rate limit handling
├── converters/ # Data transformation
│ ├── __init__.py
│ ├── parameters.py # Parameter formatting
│ ├── responses.py # Response formatting
│ ├── common/ # Common converters
│ ├── issues/ # Issue-related converters
│ ├── repositories/ # Repository converters
│ └── users/ # User-related converters
├── errors/ # Error handling
│ ├── __init__.py
│ └── exceptions.py # Custom exceptions
├── operations/ # GitHub operations
│ ├── __init__.py
│ └── issues.py
├── schemas/ # Data models
│ ├── __init__.py
│ ├── base.py
│ ├── issues.py
│ └── ...
└── utils/ # General utilities
├── __init__.py
└── environment.py # Environment utilities
Server fails to start:
Build errors:
GitHub API errors:
MIT