Provides tools for interacting with the GitHub API, enabling management of repositories, branches, issues, pull requests, files, and releases. Features include creating and listing repositories, managing branches, creating and tracking issues, handling pull request lifecycles, updating repository files, and creating tagged releases.
GitHub MCP Server
A Model Context Protocol (MCP) server that provides tools for interacting with the GitHub API. This server allows LLM agents manage GitHub repositories, issues, pull requests, branches, files, and releases through a standardized interface.
Table of Contents
Overview
github-mcp-server implements the Model Context Protocol (MCP), enabling standardized communication between LLMs and external systems through:
Clients: Claude Desktop, IDEs, and other MCP-compatible clients
Servers: Tools and resources for project management and collaboration
LLM Agents: AI models that leverage the ability to perform GitHub operations programmatically.
It acts as a bridge between AI models and the GitHub API, offering a set of well-defined tools that follow consistent patterns and handle authentication, validation, error handling, and rate limiting.
Key capabilities:
GitHub API Integration: Secure and seamless integration with GitHub's REST API
Comprehensive GitHub Features: Complete management of repos, branches, issues, PRs, and more
Atomic Feature Architecture: Well-organized modular code structure for maintainability
Input Validation: Robust validation with Zod schemas for all operations
Error Handling: Consistent error categorization and reporting
Rate Limiting: Built-in GitHub API rate limit handling
Performance Focus: Optimized operations and response formatting
Architecture & Components
Core system architecture:
Core Components:
MCP Protocol Layer: Handles communication with AI assistants
Validation Layer: Ensures data integrity through schema validation
GitHub Service: Core integration with GitHub REST API
Rate Limiter: Prevents API rate limit exhaustion
Feature Modules: Domain-specific GitHub operations
Error Handling: Comprehensive error handling and logging system
Features
Repository Management
Create, List, Get: Create new repositories, list user repositories, and get detailed repository information
Validation & Configuration: Validate repository settings and manage configuration options
Branch Management
Create, Delete, List: Complete branch lifecycle management with secure validation
Protected Branch Support: Filtering and operations for protected branches
Issue Management
Create & List: Create detailed issues with labels and list issues with filtering options
Status Tracking: Filter by issue state (open, closed, all)
Pull Request Management
Create, Update, Merge, List: Full pull request lifecycle management
Review & Comment Integration: Add reviews and comments to pull requests
Merge Options: Support for different merge strategies (merge, squash, rebase)
File Management
Create & Update Files: Add and modify repository content with commit messages
Base64 Encoding Support: Handle both text and binary file content
Release Management
Create Releases: Create tagged releases with customizable options
Draft & Prerelease Support: Support for draft and prerelease workflows
Installation
Prerequisites
Node.js (v16 or newer)
A GitHub personal access token with appropriate permissions
Setup
Clone the repository:
git clone https://github.com/cyanheads/github-mcp-server.git cd github-mcp-serverInstall dependencies:
npm installCreate a
.env
file in the project root with your GitHub token:GITHUB_TOKEN=your_github_personal_access_token LOG_LEVEL=info SERVER_NAME=github-mcp-serverBuild the project:
npm run buildStart the server:
node build/index.js
Configuration
The server can be configured through environment variables:
Environment Variable | Description | Default |
| GitHub personal access token (required) | - |
| Logging level (debug, info, warn, error, fatal) | info |
| MCP server name | github-mcp-server |
| MCP server version | 0.1.0 |
| Timeout for API calls in milliseconds | 10000 |
| Whether rate limiting is enabled | true |
| Minimum remaining requests before throttling | 100 |
| Time buffer to add to rate limit reset time | 5000 |
MCP Client Settings
Add to your MCP client settings:
Project Structure
This project follows an atomic feature-oriented architecture pattern:
Each feature domain is split into:
Resources: Read operations that don't modify data
Modifications: Write operations that create, update, or delete data
Each operation is contained in its own directory with:
Operation implementation file
Type definitions file
Export index file
Tools
GitHub MCP Server provides a comprehensive suite of tools for interacting with GitHub:
Repository Management Tools
Tool | Description |
| Get detailed information about a specific repository Parameters:
,
|
| List repositories for the authenticated user Parameters:
(optional),
(optional) |
| Create a new GitHub repository Parameters:
,
(optional),
(optional) |
Branch Management Tools
Tool | Description |
| List branches in a repository Parameters:
,
,
(optional),
(optional) |
| Create a new branch Parameters:
,
,
,
|
| Delete a branch Parameters:
,
,
|
Issue Management Tools
Tool | Description |
| Create a new issue in a repository Parameters:
,
,
,
(optional),
(optional) |
| List issues in a repository Parameters:
,
,
(optional),
(optional) |
Pull Request Management Tools
Tool | Description |
| Create a new pull request Parameters:
,
,
,
,
,
(optional) |
| Merge a pull request Parameters:
,
,
,
(optional),
(optional),
(optional) |
| Update an existing pull request Parameters:
,
,
,
(optional),
(optional),
(optional),
(optional),
(optional) |
| List pull requests in a repository Parameters:
,
,
(optional),
(optional),
(optional),
(optional),
(optional) |
File Management Tools
Tool | Description |
| Create or update a file in a repository Parameters:
,
,
,
,
,
(optional),
(optional) |
Release Management Tools
Tool | Description |
| Create a new release Parameters:
,
,
,
(optional),
(optional),
(optional),
(optional) |
Development
Project Structure
The project follows strict naming conventions and directory structure:
File naming:
action.entity.type.ts
(e.g.,create.repository.operation.ts
)Each module has a clearly defined purpose
Types are co-located with their implementation
All exports are centralized through index files
Scripts
npm run build
- Build the projectnpm run watch
- Watch for changes and rebuildnpm run inspector
- Run the MCP inspector toolnpm run clean
- Clean build artifactsnpm run rebuild
- Clean and rebuild the projectnpm run tree
- Generate a directory tree representation
Error Handling
The server implements a comprehensive error handling strategy:
Standardized Error Objects: Consistent error format with categorization
Input Validation: Pre-validation using Zod schemas
Rate Limiting Protection: Automatic handling of GitHub API rate limits
Error Categories:
Network errors (connectivity issues)
Authentication errors (token problems)
Validation errors (invalid input)
GitHub API errors (API-specific issues)
System errors (unexpected failures)
Detailed Logging: Structured logging for all operations and errors
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature
)Commit your changes (
git commit -m 'Add some amazing feature'
)Push to the branch (
git push origin feature/amazing-feature
)Open a Pull Request
License
This server cannot be installed
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.
A Model Context Protocol server that enables LLM agents to manage GitHub repositories, issues, pull requests, branches, files, and releases through a standardized interface.
Related MCP Servers
- AsecurityFlicenseAqualityA Model Context Protocol server that enables AI models to interact with GitHub's API, allowing for repository creation and management with descriptions, topics, and website URLs through natural language commands.Last updated -
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants to perform GitHub operations including repository management, file operations, issue tracking, and pull request creation.Last updated -1
- -securityFlicense-qualityModel Context Protocol server that enables interaction with GitHub repositories, issues, pull requests, and search functionality through natural language.Last updated -1
- AsecurityAlicenseAqualityA Model Context Protocol server that enables LLMs to interact with Git repositories, providing tools to read, search, and manipulate Git repositories through commands like status, diff, commit, and branch management.Last updated -12MIT License