eh24905-wiz/github-mcp
If you are the rightful owner of github-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A Model Context Protocol (MCP) server for GitHub integration, enabling AI assistants to interact with GitHub repositories, pull requests, issues, and more.
GitHub MCP Server
A Model Context Protocol (MCP) server for GitHub integration, providing AI assistants with the ability to interact with GitHub repositories, pull requests, issues, and more.
Features
This MCP server provides the following tools:
| Tool | Description |
|---|---|
get_authenticated_user | Get the authenticated user's profile information |
list_repositories | List repositories for the authenticated user |
get_repository | Get details of a specific repository |
create_repository | Create a new GitHub repository |
list_branches | List branches in a repository |
create_branch | Create a new branch |
list_pull_requests | List pull requests in a repository |
get_pull_request | Get details of a specific pull request |
create_pull_request | Create a new pull request |
merge_pull_request | Merge a pull request |
list_issues | List issues in a repository |
get_issue | Get details of a specific issue |
create_issue | Create a new issue |
update_issue | Update an existing issue |
list_comments | List comments on an issue or PR |
add_comment | Add a comment to an issue or PR |
search_repositories | Search for repositories on GitHub |
search_issues | Search for issues and PRs |
Prerequisites
- Node.js >= 18.0.0
- npm or yarn
- GitHub Personal Access Token with appropriate scopes
Installation
# Clone the repository
git clone <repository-url>
cd github-mcp
# Install dependencies
npm install
# Build the project
npm run build
Configuration
Environment Variables
Create a .env file or set the following environment variable:
| Variable | Description | Required |
|---|---|---|
GITHUB_TOKEN | GitHub Personal Access Token | Yes |
Creating a GitHub Token
- Go to GitHub Settings > Developer Settings > Personal Access Tokens
- Click "Generate new token (classic)" or "Fine-grained tokens"
- Select the required scopes:
repo- Full control of private repositoriesread:user- Read user profile data
- Copy the generated token
Usage
MCP Client Configuration
Add to your MCP client configuration (e.g., Claude Desktop):
{
"mcpServers": {
"github": {
"command": "node",
"args": ["/path/to/github-mcp/dist/index.js"],
"env": {
"GITHUB_TOKEN": "your-github-token"
}
}
}
}
Running Directly
GITHUB_TOKEN=your-token npm start
API Reference
Repository Tools
list_repositories
List repositories for the authenticated user.
Parameters:
type(optional): Filter by type -all,owner,public,private,membersort(optional): Sort by -created,updated,pushed,full_nameper_page(optional): Results per page (max 100)
create_repository
Create a new repository.
Parameters:
name(required): Repository namedescription(optional): Repository descriptionprivate(optional): Whether the repository is privateauto_init(optional): Initialize with README
Pull Request Tools
create_pull_request
Create a new pull request.
Parameters:
owner(required): Repository ownerrepo(required): Repository nametitle(required): PR titlehead(required): Branch containing changesbase(required): Branch to merge intobody(optional): PR descriptiondraft(optional): Create as draft PR
merge_pull_request
Merge a pull request.
Parameters:
owner(required): Repository ownerrepo(required): Repository namepull_number(required): PR numbermerge_method(optional): Merge method -merge,squash,rebasecommit_title(optional): Custom merge commit title
Issue Tools
create_issue
Create a new issue.
Parameters:
owner(required): Repository ownerrepo(required): Repository nametitle(required): Issue titlebody(optional): Issue body/descriptionlabels(optional): Array of labels to applyassignees(optional): Array of users to assign
Search Tools
search_repositories
Search for repositories.
Parameters:
query(required): Search query (e.g., "language:typescript stars:>100")sort(optional): Sort by -stars,forks,updatedper_page(optional): Results per page
search_issues
Search for issues and PRs.
Parameters:
query(required): Search query (e.g., "is:issue is:open label:bug")sort(optional): Sort by -comments,reactions,created,updatedper_page(optional): Results per page
Development
# Build
npm run build
# Run in development mode
npm run dev
License
MIT