G
GitHub
reference
devtools
Repository management, file operations, and GitHub API integration
GitHub MCP Server
Deprecation Notice: Development for this project has been moved to GitHub in the http://github.com/github/github-mcp-server repo.
MCP Server for the GitHub API, enabling file operations, repository management, search functionality, 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
- Advanced Search: Support for searching code, issues/PRs, and users
Tools
-
create_or_update_file
- Create or update a single file in a repository
- Inputs:
(string): Repository owner (username or organization)owner
(string): Repository namerepo
(string): Path where to create/update the filepath
(string): Content of the filecontent
(string): Commit messagemessage
(string): Branch to create/update the file inbranch
(optional string): SHA of file being replaced (for updates)sha
- Returns: File content and commit details
-
push_files
- Push multiple files in a single commit
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(string): Branch to push tobranch
(array): Files to push, each withfiles
andpath
content
(string): Commit messagemessage
- Returns: Updated branch reference
-
search_repositories
- Search for GitHub repositories
- Inputs:
(string): Search queryquery
(optional number): Page number for paginationpage
(optional number): Results per page (max 100)perPage
- Returns: Repository search results
-
create_repository
- Create a new GitHub repository
- Inputs:
(string): Repository namename
(optional string): Repository descriptiondescription
(optional boolean): Whether repo should be privateprivate
(optional boolean): Initialize with READMEautoInit
- Returns: Created repository details
-
get_file_contents
- Get contents of a file or directory
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(string): Path to file/directorypath
(optional string): Branch to get contents frombranch
- Returns: File/directory contents
-
create_issue
- Create a new issue
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(string): Issue titletitle
(optional string): Issue descriptionbody
(optional string[]): Usernames to assignassignees
(optional string[]): Labels to addlabels
(optional number): Milestone numbermilestone
- Returns: Created issue details
-
create_pull_request
- Create a new pull request
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(string): PR titletitle
(optional string): PR descriptionbody
(string): Branch containing changeshead
(string): Branch to merge intobase
(optional boolean): Create as draft PRdraft
(optional boolean): Allow maintainer editsmaintainer_can_modify
- Returns: Created pull request details
-
fork_repository
- Fork a repository
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(optional string): Organization to fork toorganization
- Returns: Forked repository details
-
create_branch
- Create a new branch
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(string): Name for new branchbranch
(optional string): Source branch (defaults to repo default)from_branch
- Returns: Created branch reference
-
list_issues
- List and filter repository issues
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(optional string): Filter by state ('open', 'closed', 'all')state
(optional string[]): Filter by labelslabels
(optional string): Sort by ('created', 'updated', 'comments')sort
(optional string): Sort direction ('asc', 'desc')direction
(optional string): Filter by date (ISO 8601 timestamp)since
(optional number): Page numberpage
(optional number): Results per pageper_page
- Returns: Array of issue details
-
update_issue
- Update an existing issue
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(number): Issue number to updateissue_number
(optional string): New titletitle
(optional string): New descriptionbody
(optional string): New state ('open' or 'closed')state
(optional string[]): New labelslabels
(optional string[]): New assigneesassignees
(optional number): New milestone numbermilestone
- Returns: Updated issue details
-
add_issue_comment
- Add a comment to an issue
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(number): Issue number to comment onissue_number
(string): Comment textbody
- Returns: Created comment details
-
search_code
- Search for code across GitHub repositories
- Inputs:
(string): Search query using GitHub code search syntaxq
(optional string): Sort field ('indexed' only)sort
(optional string): Sort order ('asc' or 'desc')order
(optional number): Results per page (max 100)per_page
(optional number): Page numberpage
- Returns: Code search results with repository context
-
search_issues
- Search for issues and pull requests
- Inputs:
(string): Search query using GitHub issues search syntaxq
(optional string): Sort field (comments, reactions, created, etc.)sort
(optional string): Sort order ('asc' or 'desc')order
(optional number): Results per page (max 100)per_page
(optional number): Page numberpage
- Returns: Issue and pull request search results
-
search_users
- Search for GitHub users
- Inputs:
(string): Search query using GitHub users search syntaxq
(optional string): Sort field (followers, repositories, joined)sort
(optional string): Sort order ('asc' or 'desc')order
(optional number): Results per page (max 100)per_page
(optional number): Page numberpage
- Returns: User search results
-
list_commits
- Gets commits of a branch in a repository
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(optional string): page numberpage
(optional string): number of record per pageper_page
(optional string): branch namesha
- Returns: List of commits
get_issue
- Gets the contents of an issue within a repository
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(number): Issue number to retrieveissue_number
- Returns: Github Issue object & details
get_pull_request
- Get details of a specific pull request
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(number): Pull request numberpull_number
- Returns: Pull request details including diff and review status
list_pull_requests
- List and filter repository pull requests
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(optional string): Filter by state ('open', 'closed', 'all')state
(optional string): Filter by head user/org and branchhead
(optional string): Filter by base branchbase
(optional string): Sort by ('created', 'updated', 'popularity', 'long-running')sort
(optional string): Sort direction ('asc', 'desc')direction
(optional number): Results per page (max 100)per_page
(optional number): Page numberpage
- Returns: Array of pull request details
create_pull_request_review
- Create a review on a pull request
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(number): Pull request numberpull_number
(string): Review comment textbody
(string): Review action ('APPROVE', 'REQUEST_CHANGES', 'COMMENT')event
(optional string): SHA of commit to reviewcommit_id
(optional array): Line-specific comments, each with:comments
(string): File pathpath
(number): Line position in diffposition
(string): Comment textbody
- Returns: Created review details
merge_pull_request
- Merge a pull request
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(number): Pull request numberpull_number
(optional string): Title for merge commitcommit_title
(optional string): Extra detail for merge commitcommit_message
(optional string): Merge method ('merge', 'squash', 'rebase')merge_method
- Returns: Merge result details
get_pull_request_files
- Get the list of files changed in a pull request
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(number): Pull request numberpull_number
- Returns: Array of changed files with patch and status details
get_pull_request_status
- Get the combined status of all status checks for a pull request
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(number): Pull request numberpull_number
- Returns: Combined status check results and individual check details
update_pull_request_branch
- Update a pull request branch with the latest changes from the base branch (equivalent to GitHub's "Update branch" button)
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(number): Pull request numberpull_number
(optional string): The expected SHA of the pull request's HEAD refexpected_head_sha
- Returns: Success message when branch is updated
get_pull_request_comments
- Get the review comments on a pull request
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(number): Pull request numberpull_number
- Returns: Array of pull request review comments with details like the comment text, author, and location in the diff
get_pull_request_reviews
- Get the reviews on a pull request
- Inputs:
(string): Repository ownerowner
(string): Repository namerepo
(number): Pull request numberpull_number
- Returns: Array of pull request reviews with details like the review state (APPROVED, CHANGES_REQUESTED, etc.), reviewer, and review body
Search Query Syntax
Code Search
: Search by programming languagelanguage:javascript
: Search in specific repositoryrepo:owner/name
: Search in specific pathpath:app/src
: Search by file extensionextension:js
- Example:
q: "import express" language:typescript path:src/
Issues Search
oris:issue
: Filter by typeis:pr
oris:open
: Filter by stateis:closed
: Search by labellabel:bug
: Search by authorauthor:username
- Example:
q: "memory leak" is:issue is:open label:bug
Users Search
ortype:user
: Filter by account typetype:org
: Filter by followersfollowers:>1000
: Search by locationlocation:London
- Example:
q: "fullstack developer" location:London followers:>100
For detailed search syntax, see GitHub's searching documentation.
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
scope ("Full control of private repositories")repo
- Alternatively, if working only with public repositories, select only the
scopepublic_repo
- 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
:Docker
{ "mcpServers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "mcp/github" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>" } } } }
NPX
{ "mcpServers": { "github": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-github" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>" } } } }
Build
Docker build:
docker build -t mcp/github -f src/github/Dockerfile .
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.
Related Servers
Adfin
official
The only platform you need to get paid - all payments in one place, invoicing and accounting reconciliations with [Adfin](https://www.adfin.com/).
View Details
APIMatic MCP
official
APIMatic MCP Server is used to validate OpenAPI specifications using [APIMatic](https://www.apimatic.io/). The server processes OpenAPI files and returns validation summaries by leveraging APIMatic’s API.
View DetailsAWS
official
Specialized MCP servers that bring AWS best practices directly to your development workflow.
View Details