Github-mcp-server

afrah123456/Github-mcp-server Checked 6 hours ago

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 repositories
  • get_repository - Get detailed repository info
  • create_repository - Create new repository

Issue Management (4 tools):

  • list_issues - List issues in repository
  • get_issue - Get issue details
  • create_issue - Create new issue
  • close_issue - Close issue with optional comment

Pull Request Management (4 tools):

  • list_pull_requests - List pull requests
  • get_pull_request - Get PR details
  • create_pull_request - Create new PR
  • merge_pull_request - Merge a PR

Branch Management (2 tools):

  • list_branches - List all branches
  • create_branch - Create new branch

File Operations (2 tools):

  • get_file_contents - Read file from repository
  • create_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

  1. Get a GitHub Personal Access Token:

  2. Create .env file:

cp .env.example .env
  1. 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! ⭐