README.md
GitHub MCP Server
MCP Server for the GitHub API, enabling file operations, repository management, and more.
Features
- Automatic Branch Creation: When creating/updating files or pushing changes, branches are automatically created if they don't exist
- Comprehensive Error Handling: Clear error messages for common issues
- Git History Preservation: Operations maintain proper Git history without force pushing
- Batch Operations: Support for both single-file and multi-file operations
Tools
create_or_update_file
- Create or update a single file in a repository
- Inputs:
owner
(string): Repository owner (username or organization)repo
(string): Repository namepath
(string): Path where to create/update the filecontent
(string): Content of the filemessage
(string): Commit messagebranch
(string): Branch to create/update the file insha
(optional string): SHA of file being replaced (for updates)
- Returns: File content and commit details
push_files
- Push multiple files in a single commit
- Inputs:
owner
(string): Repository ownerrepo
(string): Repository namebranch
(string): Branch to push tofiles
(array): Files to push, each withpath
andcontent
message
(string): Commit message
- Returns: Updated branch reference
search_repositories
- Search for GitHub repositories
- Inputs:
query
(string): Search querypage
(optional number): Page number for paginationperPage
(optional number): Results per page (max 100)
- Returns: Repository search results
create_repository
- Create a new GitHub repository
- Inputs:
name
(string): Repository namedescription
(optional string): Repository descriptionprivate
(optional boolean): Whether repo should be privateautoInit
(optional boolean): Initialize with README
- Returns: Created repository details
get_file_contents
- Get contents of a file or directory
- Inputs:
owner
(string): Repository ownerrepo
(string): Repository namepath
(string): Path to file/directorybranch
(optional string): Branch to get contents from
- Returns: File/directory contents
create_issue
- Create a new issue
- Inputs:
owner
(string): Repository ownerrepo
(string): Repository nametitle
(string): Issue titlebody
(optional string): Issue descriptionassignees
(optional string[]): Usernames to assignlabels
(optional string[]): Labels to addmilestone
(optional number): Milestone number
- Returns: Created issue details
create_pull_request
- Create a new pull request
- Inputs:
owner
(string): Repository ownerrepo
(string): Repository nametitle
(string): PR titlebody
(optional string): PR descriptionhead
(string): Branch containing changesbase
(string): Branch to merge intodraft
(optional boolean): Create as draft PRmaintainer_can_modify
(optional boolean): Allow maintainer edits
- Returns: Created pull request details
fork_repository
- Fork a repository
- Inputs:
owner
(string): Repository ownerrepo
(string): Repository nameorganization
(optional string): Organization to fork to
- Returns: Forked repository details
create_branch
- Create a new branch
- Inputs:
owner
(string): Repository ownerrepo
(string): Repository namebranch
(string): Name for new branchfrom_branch
(optional string): Source branch (defaults to repo default)
- Returns: Created branch reference
Setup
Personal Access Token
Create a GitHub Personal Access Token with appropriate permissions:
- Go to Personal access tokens (in GitHub Settings > Developer settings)
- Select which repositories you'd like this token to have access to (Public, All, or Select)
- Create a token with the
repo
scope ("Full control of private repositories")- Alternatively, if working only with public repositories, select only the
public_repo
scope
- Alternatively, if working only with public repositories, select only the
- Copy the generated token
Usage with Claude Desktop
To use this with Claude Desktop, add the following to your claude_desktop_config.json
:
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}
License
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Github
MCP Server for the GitHub API, enabling file operations, repository management, and more.
Package Information
3851 stars
Updated 12/4/2024
Created 11/19/2024
MIT License
Organization
modelcontextprotocolContributors
jspahrsummers dsp-ant maheshmurag jackadamson ItsBarryZ GarvanD Skirano maledorak mikegehard elie executeautomation sergehuber anjor SkywaveTM Taylor4484 mishushakov ferrants Karthik-clearpoint kacperlukawski tb-peregrine p13rr0m fatwang2 zckly polRk varunneal sean-lynch salihergut rorylogue rishikavikondala ProRedCat