MCP ExplorerExplorer

GitHub MCP Server

@modelcontextprotocolon 2 months ago
52364 MIT
HostedFreeOfficial
Dev Tools
#github#code#repository#git
MCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.

Overview

What is GitHub MCP Server

The GitHub MCP Server is a middleware component that facilitates interactions with the GitHub API, enabling users to perform various file operations, manage repositories, and execute advanced search functionalities seamlessly. It is designed to enhance productivity by automating common tasks associated with GitHub repositories.

Use cases

This server can be used for a variety of tasks including creating or updating files in repositories, managing branches, searching for repositories, issues, and users, as well as creating and managing pull requests and issues. It is particularly useful for developers and teams looking to integrate GitHub functionalities into their workflows or applications.

How to use

To use the GitHub MCP Server, users must create a GitHub Personal Access Token with appropriate permissions. This token is then configured within the server setup, either using Docker or NPX commands. After installation, users can invoke various API functionalities through defined commands, allowing for streamlined interactions with GitHub repositories.

Key features

Key features of the GitHub MCP Server include automatic branch creation for file operations, comprehensive error handling, preservation of Git history, support for batch operations, and advanced search capabilities across repositories, code, issues, pull requests, and users.

Where to use

The GitHub MCP Server is ideal for use in development environments, CI/CD pipelines, or any application where GitHub integration is required. It is particularly beneficial for teams working on collaborative projects, enabling them to manage their codebase and issues more efficiently.

Content

GitHub MCP Server

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

Search Query Syntax

Code Search

  • language:javascript: Search by programming language
  • repo:owner/name: Search in specific repository
  • path:app/src: Search in specific path
  • extension:js: Search by file extension
  • Example: q: "import express" language:typescript path:src/

Issues Search

  • is:issue or is:pr: Filter by type
  • is:open or is:closed: Filter by state
  • label:bug: Search by label
  • author:username: Search by author
  • Example: q: "memory leak" is:issue is:open label:bug

Users Search

  • type:user or type:org: Filter by account type
  • followers:>1000: Filter by followers
  • location:London: Search by location
  • 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 repo scope (“Full control of private repositories”)
    • Alternatively, if working only with public repositories, select only the public_repo scope
  • Copy the generated token

Installation

Local

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-github"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_ACCESS_TOKEN"
      }
    }
  }
}

Remote

{
  "mcpServers": {
    "github": {
      "type": "streamable-http",
      "url": "https://router.mcpso.cc/mcp/github"
    }
  }
}

Tools

create_or_update_file
Create or update a single file in a GitHub repository
search_repositories
Search for GitHub repositories
create_repository
Create a new GitHub repository in your account
get_file_contents
Get the contents of a file or directory from a GitHub repository
push_files
Push multiple files to a GitHub repository in a single commit
create_issue
Create a new issue in a GitHub repository
create_pull_request
Create a new pull request in a GitHub repository
fork_repository
Fork a GitHub repository to your account or specified organization
create_branch
Create a new branch in a GitHub repository
list_commits
Get list of commits of a branch in a GitHub repository
list_issues
List issues in a GitHub repository with filtering options
update_issue
Update an existing issue in a GitHub repository
add_issue_comment
Add a comment to an existing issue
search_code
Search for code across GitHub repositories
search_issues
Search for issues and pull requests across GitHub repositories
search_users
Search for users on GitHub
get_issue
Get details of a specific issue in a GitHub repository.
get_pull_request
Get details of a specific pull request
list_pull_requests
List and filter repository pull requests
create_pull_request_review
Create a review on a pull request
merge_pull_request
Merge a pull request
get_pull_request_files
Get the list of files changed in a pull request
get_pull_request_status
Get the combined status of all status checks for a pull request
update_pull_request_branch
Update a pull request branch with the latest changes from the base branch
get_pull_request_comments
Get the review comments on a pull request
get_pull_request_reviews
Get the reviews on a pull request

MCP Server Configuration

This MCP server is hosted, and you can test tools online for free after connecting.

Required Environment Variables

Personal Access Token for GitHub to authenticate API requests

To execute tools on this server, you must first configure environment variables and connect to the server.

Comments

Recommend MCP Servers

View All MCP Servers