GitHub Plus MCP server

Integrates with GitHub's API to streamline repository management, code operations, and issue tracking for developers and teams.
Back to servers
Setup instructions
Provider
PhialsBasement
Release date
Feb 05, 2025
Language
TypeScript
Stats
4 stars

The GitHub MCP Server Plus provides a powerful interface to the GitHub API, allowing you to perform file operations, manage repositories, search through GitHub, and more through the Model Context Protocol (MCP).

Installation

You need to obtain a GitHub Personal Access Token (PAT) before using this server.

Getting a GitHub Personal Access Token

  1. Go to Personal access tokens in GitHub Settings > Developer settings
  2. Select which repositories you want the token to access (Public, All, or Select)
  3. Create a token with the repo scope for full control of repositories
    • For public repositories only, you can select just the public_repo scope
  4. Copy the generated token for use in configuration

Setting Up with Claude Desktop

Add the GitHub MCP server to your Claude Desktop configuration by updating your claude_desktop_config.json file.

Using Docker

{
  "mcpServers": {
    "github": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "GITHUB_PERSONAL_ACCESS_TOKEN",
        "mcp/github"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
      }
    }
  }
}

Using NPX

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

Usage

The GitHub MCP Server offers numerous tools for interacting with GitHub. Here are examples of common operations:

Managing Files

Creating or Updating a File

// Create or update a single file
{
  "owner": "username",
  "repo": "repository-name",
  "path": "path/to/file.js",
  "content": "console.log('Hello World');",
  "message": "Add hello world script",
  "branch": "main"
}

Pushing Multiple Files

// Push multiple files in a single commit
{
  "owner": "username",
  "repo": "repository-name",
  "branch": "feature-branch",
  "files": [
    {
      "path": "src/index.js",
      "content": "console.log('App starting...');"
    },
    {
      "path": "README.md",
      "content": "# My Project\nThis is a sample project."
    }
  ],
  "message": "Add initial files"
}

Repository Operations

Creating a Repository

{
  "name": "new-project",
  "description": "A new project repository",
  "private": true,
  "autoInit": true
}

Forking a Repository

{
  "owner": "original-owner",
  "repo": "original-repo"
}

Branch Management

Creating a Branch

{
  "owner": "username",
  "repo": "repository-name",
  "branch": "new-feature",
  "from_branch": "main"
}

Issues and Pull Requests

Creating an Issue

{
  "owner": "username",
  "repo": "repository-name",
  "title": "Bug: Application crashes on startup",
  "body": "When running the app, it crashes immediately with the following error...",
  "labels": ["bug", "priority-high"],
  "assignees": ["developer-username"]
}

Creating a Pull Request

{
  "owner": "username",
  "repo": "repository-name",
  "title": "Add login feature",
  "body": "This PR implements the login functionality as described in issue #42",
  "head": "feature-login",
  "base": "main",
  "draft": false
}

Searching GitHub

Searching Code

{
  "q": "import express language:typescript path:src/",
  "sort": "indexed",
  "order": "desc",
  "per_page": 20
}

Searching Issues and PRs

{
  "q": "memory leak is:issue is:open label:bug",
  "sort": "created",
  "order": "desc",
  "per_page": 10
}

Searching Users

{
  "q": "fullstack developer location:London followers:>100",
  "sort": "followers",
  "order": "desc",
  "per_page": 25
}

Advanced Search Syntax

Code Search Options

  • language:javascript - Filter by programming language
  • repo:owner/name - Search in specific repository
  • path:app/src - Search in specific path
  • extension:js - Search by file extension

Issues Search Options

  • 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

Users Search Options

  • type:user or type:org - Filter by account type
  • followers:>1000 - Filter by followers
  • location:London - Search by location

For complete search syntax documentation, refer to GitHub's searching documentation.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "github" '{"command":"npx","args":["-y","@modelcontextprotocol/server-github"],"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"<YOUR_TOKEN>"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later