You signed in with another tab or window. Reload
to refresh your session. You signed out in another tab or window. Reload
to refresh your session. You switched accounts on another tab or window. Reload
to refresh your session. Dismiss alert
cyanheads / github-mcp-server Public
A Model Context Protocol (MCP) server built in TypeScript that integrates with GitHub's API, enabling AI assistants to manage repositories, issues, pull requests, and code while providing a structured interface for LLM agents to perform GitHub operations.
2 stars
1 fork
Branches
Tags
Activity
Notifications
You must be signed in to change notification settings
main
Go to file
Code
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- |
| Latest commit
-------------
History
-------
7 Commits
| | |
| .github/workflows | | .github/workflows | | |
| docs | | docs | | |
| scripts | | scripts | | |
| src | | src | | |
| .env.example | | .env.example | | |
| .gitignore | | .gitignore | | |
| LICENSE | | LICENSE | | |
| README.md | | README.md | | |
| package-lock.json | | package-lock.json | | |
| package.json | | package.json | | |
| tsconfig.json | | tsconfig.json | | |
| View all files | | |
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.
github-mcp-server implements the Model Context Protocol (MCP), enabling standardized communication between LLMs and external systems through:
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:
Core system architecture:
Click to expand Mermaid diagram
Loading
flowchart TB
subgraph API["API Layer"]
direction LR
MCP["MCP Protocol"]
Val["Validation"]
Rate["Rate Limiting"]
MCP --> Val --> Rate
end
subgraph Features\["Feature Modules"\]
direction LR
Repo\["Repository Management"\]
Branch\["Branch Management"\]
Issue\["Issue Management"\]
PR\["Pull Request Management"\]
File\["File Management"\]
Release\["Release Management"\]
Repo <--> Branch
Repo <--> Issue
Repo <--> PR
Repo <--> File
Branch <--> PR
end
subgraph Services\["Services Layer"\]
direction LR
GitHub\["GitHub Service"\]
Mapper\["Response Mapper"\]
RateLimiter\["Rate Limiter"\]
GitHub <--> RateLimiter
GitHub <--> Mapper
end
Rate --> Repo
Rate --> Branch
Rate --> Issue
Rate --> PR
Rate --> File
Rate --> Release
Repo --> GitHub
Branch --> GitHub
Issue --> GitHub
PR --> GitHub
File --> GitHub
Release --> GitHub
classDef layer fill:#2d3748,stroke:#4299e1,stroke-width:3px,rx:5,color:#fff
classDef component fill:#1a202c,stroke:#a0aec0,stroke-width:2px,rx:3,color:#fff
classDef api fill:#3182ce,stroke:#90cdf4,stroke-width:2px,rx:3,color:#fff
classDef features fill:#319795,stroke:#81e6d9,stroke-width:2px,rx:3,color:#fff
classDef services fill:#2f855a,stroke:#9ae6b4,stroke-width:2px,rx:3,color:#fff
class API,Features,Services layer
class MCP,Val,Rate api
class Repo,Branch,Issue,PR,File,Release features
class GitHub,Mapper,RateLimiter services
Core Components:
Clone the repository:
shell
git clone https://github.com/cyanheads/github-mcp-server.git
cd github-mcp-server
Install dependencies:
shell
npm install
Create 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-server
Build the project:
shell
npm run build
Start the server:
shell
node build/index.js
The server can be configured through environment variables:
Environment Variable | Description | Default |
---|---|---|
GITHUB_TOKEN |
GitHub personal access token (required) | - |
LOG_LEVEL |
Logging level (debug, info, warn, error, fatal) | info |
SERVER_NAME |
MCP server name | github-mcp-server |
SERVER_VERSION |
MCP server version | 0.1.0 |
API_TIMEOUT_MS |
Timeout for API calls in milliseconds | 10000 |
RATE_LIMITING_ENABLED |
Whether rate limiting is enabled | true |
RATE_LIMITING_MIN_REMAINING |
Minimum remaining requests before throttling | 100 |
RATE_LIMITING_RESET_BUFFER_MS |
Time buffer to add to rate limit reset time | 5000 |
Add to your MCP client settings:
{
"mcpServers": {
"github": {
"command": "node",
"args": ["/path/to/github-mcp-server/build/index.js"],
"env": {
"GITHUB_TOKEN": "your_github_personal_access_token",
"LOG_LEVEL": "info",
"SERVER_NAME": "github-mcp-server"
}
}
}
}
This project follows an atomic feature-oriented architecture pattern:
/src
/configuration // Application configuration
/dependencyInjection // Tool registry and DI container
/features // Feature modules organized by domain
/repositoryManagement
/resources // Read operations
/modifications // Write operations
/branchManagement
/issueManagement
/pullRequestManagement
/fileManagement
/releaseManagement
/services // External service integrations
/githubAccess // GitHub API client and utilities
/types // Core type definitions
/utilities // Helper functions and utilities
Each feature domain is split into:
Each operation is contained in its own directory with:
GitHub MCP Server provides a comprehensive suite of tools for interacting with GitHub:
Tool | Description |
---|---|
get_repository |
Get detailed information about a specific repository Parameters: owner , repo |
list_repositories |
List repositories for the authenticated user Parameters: type (optional), sort (optional) |
create_repository |
Create a new GitHub repository Parameters: name , description (optional), private (optional) |
Tool | Description |
---|---|
list_branches |
List branches in a repository Parameters: owner , repo , protected (optional), per_page (optional) |
create_branch |
Create a new branch Parameters: owner , repo , branch , sha |
delete_branch |
Delete a branch Parameters: owner , repo , branch |
Tool | Description |
---|---|
create_issue |
Create a new issue in a repository Parameters: owner , repo , title , body (optional), labels (optional) |
list_issues |
List issues in a repository Parameters: owner , repo , state (optional), labels (optional) |
Tool | Description |
---|---|
create_pull_request |
Create a new pull request Parameters: owner , repo , title , head , base , body (optional) |
merge_pull_request |
Merge a pull request Parameters: owner , repo , pull_number , commit_title (optional), commit_message (optional), merge_method (optional) |
update_pull_request |
Update an existing pull request Parameters: owner , repo , pull_number , title (optional), body (optional), state (optional), base (optional), maintainer_can_modify (optional) |
list_pull_requests |
List pull requests in a repository Parameters: owner , repo , state (optional), head (optional), base (optional), sort (optional), direction (optional) |
Tool | Description |
---|---|
update_file |
Create or update a file in a repository Parameters: owner , repo , path , message , content , sha (optional), branch (optional) |
Tool | Description |
---|---|
create_release |
Create a new release Parameters: owner , repo , tag_name , name (optional), body (optional), draft (optional), prerelease (optional) |
The project follows strict naming conventions and directory structure:
action.entity.type.ts
(e.g., create.repository.operation.ts
)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 representationThe server implements a comprehensive error handling strategy:
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)Built with the Model Context Protocol
A Model Context Protocol (MCP) server built in TypeScript that integrates with GitHub's API, enabling AI assistants to manage repositories, issues, pull requests, and code while providing a structured interface for LLM agents to perform GitHub operations.
github
typescript
version-control
mcp
ai-assistant
llm
llm-agent
model-context-protocol
modelcontextprotocol
No packages published
You can’t perform that action at this time.