github-mcp

eh24905-wiz/github-mcp

3.2

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.

Tools
18
Resources
0
Prompts
0

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:

ToolDescription
get_authenticated_userGet the authenticated user's profile information
list_repositoriesList repositories for the authenticated user
get_repositoryGet details of a specific repository
create_repositoryCreate a new GitHub repository
list_branchesList branches in a repository
create_branchCreate a new branch
list_pull_requestsList pull requests in a repository
get_pull_requestGet details of a specific pull request
create_pull_requestCreate a new pull request
merge_pull_requestMerge a pull request
list_issuesList issues in a repository
get_issueGet details of a specific issue
create_issueCreate a new issue
update_issueUpdate an existing issue
list_commentsList comments on an issue or PR
add_commentAdd a comment to an issue or PR
search_repositoriesSearch for repositories on GitHub
search_issuesSearch 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:

VariableDescriptionRequired
GITHUB_TOKENGitHub Personal Access TokenYes

Creating a GitHub Token

  1. Go to GitHub Settings > Developer Settings > Personal Access Tokens
  2. Click "Generate new token (classic)" or "Fine-grained tokens"
  3. Select the required scopes:
    • repo - Full control of private repositories
    • read:user - Read user profile data
  4. 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, member
  • sort (optional): Sort by - created, updated, pushed, full_name
  • per_page (optional): Results per page (max 100)
create_repository

Create a new repository.

Parameters:

  • name (required): Repository name
  • description (optional): Repository description
  • private (optional): Whether the repository is private
  • auto_init (optional): Initialize with README

Pull Request Tools

create_pull_request

Create a new pull request.

Parameters:

  • owner (required): Repository owner
  • repo (required): Repository name
  • title (required): PR title
  • head (required): Branch containing changes
  • base (required): Branch to merge into
  • body (optional): PR description
  • draft (optional): Create as draft PR
merge_pull_request

Merge a pull request.

Parameters:

  • owner (required): Repository owner
  • repo (required): Repository name
  • pull_number (required): PR number
  • merge_method (optional): Merge method - merge, squash, rebase
  • commit_title (optional): Custom merge commit title

Issue Tools

create_issue

Create a new issue.

Parameters:

  • owner (required): Repository owner
  • repo (required): Repository name
  • title (required): Issue title
  • body (optional): Issue body/description
  • labels (optional): Array of labels to apply
  • assignees (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, updated
  • per_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, updated
  • per_page (optional): Results per page

Development

# Build
npm run build

# Run in development mode
npm run dev

License

MIT