Github-mcp-server
MCP server enabling AI assistants to interact with GitHub
An open-source Model Context Protocol (MCP) server that enables AI assistants to interact with GitHub through natural language. Automate repository management, issue tracking, pull requests, branch operations, and file management. 1. Get a GitHub Personal Access Token: - Go to https://github.com/settings/tokens - Generate new token (classic) - Select scopes: repo, user, delete_repo The server will start and wait for MCP protocol messages from AI assistants.
Summary extracted from the README.
GitHub MCP Server
An open-source Model Context Protocol (MCP) server that enables AI assistants to interact with GitHub through natural language. Automate repository management, issue tracking, pull requests, branch operations, and file management.
π Features
15 Powerful Tools
Repository Management (3 tools):
list_repositories- List all repositoriesget_repository- Get detailed repository infocreate_repository- Create new repository
Issue Management (4 tools):
list_issues- List issues in repositoryget_issue- Get issue detailscreate_issue- Create new issueclose_issue- Close issue with optional comment
Pull Request Management (4 tools):
list_pull_requests- List pull requestsget_pull_request- Get PR detailscreate_pull_request- Create new PRmerge_pull_request- Merge a PR
Branch Management (2 tools):
list_branches- List all branchescreate_branch- Create new branch
File Operations (2 tools):
get_file_contents- Read file from repositorycreate_or_update_file- Create or update file
π Quick Start
Installation
git clone https://github.com/afrah123456/github-mcp-server.git
cd github-mcp-server
pip install -r requirements.txt
Configuration
-
Get a GitHub Personal Access Token:
- Go to https://github.com/settings/tokens
- Generate new token (classic)
- Select scopes:
repo,user,delete_repo
-
Create
.envfile:
cp .env.example .env
- Add your token to
.env:
GITHUB_TOKEN=your_github_token_here
GITHUB_USERNAME=your_username
Run the Server
python run_server.py
The server will start and wait for MCP protocol messages from AI assistants.
π‘ Usage Examples
With AI Assistants (Claude, ChatGPT, etc.):
User: "List all my GitHub repositories"
AI β GitHub MCP Server β Returns list
User: "Create issue: Fix login bug"
AI β GitHub MCP Server β Creates issue
User: "Show me all open PRs in my repo"
AI β GitHub MCP Server β Lists PRs
User: "Create branch 'feature-dark-mode' from main"
AI β GitHub MCP Server β Creates branch
π§ͺ Testing
# Run all tests
pytest tests/ -v
# Test connection
python test_connection.py
# Test all features
python test_mvp.py
Test Results:
- β 6/6 tests passing
- β 100% success rate
- β All 15 tools functional
π Project Structure
github-mcp-server/
βββ src/github_mcp/
β βββ server.py # Main MCP server
β βββ github_client.py # GitHub API client
β βββ config.py # Configuration
βββ tests/
β βββ test_github_client.py
βββ examples/
β βββ basic_usage.md
βββ run_server.py
βββ requirements.txt
βββ README.md
π οΈ Tech Stack
- Python 3.11+
- PyGithub - GitHub API client
- MCP SDK - Model Context Protocol
- OAuth - Secure authentication
- pytest - Testing framework
π€ Contributing
Contributions welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
- Improve documentation
π€ Author
Afrah Fathima S
- GitHub: @afrah123456
- LinkedIn: [https://www.linkedin.com/in/afrah-fathima-b98090241/]
π Acknowledgments
Built using the Model Context Protocol specification and PyGithub library.
π Stats
- Tools: 15
- Test Coverage: 100%
- Language: Python
- Status: β Production Ready
Star this repo if you find it useful! β