GitHub PR Helper MCP server

Integrates with GitHub repositories through the GitHub CLI to enable pull request creation and line-specific PR comments, streamlining code review workflows directly from conversations.
Back to servers
Setup instructions
Provider
Chiaote Ni
Release date
Mar 14, 2025
Language
TypeScript

The GitHub PR Helper is an MCP (Model Context Protocol) service that automates GitHub Pull Request creation and code review using the GitHub CLI. It eliminates the need to manually handle authentication and permissions issues when working with GitHub repositories.

Prerequisites

Installing GitHub CLI

Before using this service, you need to install GitHub CLI:

  • macOS:

    brew install gh
    
  • Windows:

    winget install --id GitHub.cli
    
  • Linux: Refer to the official GitHub CLI documentation

Authenticating with GitHub

Log in to GitHub CLI:

gh auth login

Follow the prompts to complete the login process. This will automatically handle authentication without manual token management.

Installation

Install dependencies:

npm install

Optionally configure environment variables in a .env file:

  • PORT: Server port (defaults to 3000)

Starting the Service

HTTP Service

For development mode:

npm run dev

For production mode:

npm start

MCP Service

To run as an MCP service:

npm run mcp

API Endpoints

HTTP API

Create a GitHub Pull Request:

POST /api/github/pr

Request body:

{
  "repoPath": "Local Git repository path",
  "title": "PR title",
  "description": "PR description",
  "ticketNumber": "Ticket number",
  "baseBranch": "Target branch"
}

Add a comment to a PR:

POST /api/github/pr/comment

Request body:

{
  "repoPath": "Local Git repository path",
  "baseBranch": "Base branch for comparison",
  "filePath": "File path",
  "lineNumber": 10,
  "comment": "Comment content"
}

MCP Tools

create_pull_request: Creates a GitHub Pull Request

Parameters:

  • repoPath: Local Git repository path
  • title: PR title
  • description: PR description
  • ticketNumber: Ticket number
  • baseBranch: Target branch

add_pr_comment: Adds a comment to a PR

Parameters:

  • repoPath: Local Git repository path
  • baseBranch: Base branch for comparison
  • filePath: File path
  • lineNumber: Line number
  • comment: Comment content

Integrating with AI Assistants

Installing to VSCode (Roo Code)

  1. Locate the Roo Code MCP settings file:

    /Users/aaron/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
    
  2. Add the following configuration to the mcpServers object:

    "github-pr-helper": {
      "command": "node",
      "args": ["/path/to/app-github-pr-helper/src/mcp-server.js"],
      "disabled": false,
      "alwaysAllow": []
    }
    
  3. Restart VSCode

Installing to Claude (Anthropic)

  1. Locate the Claude settings file:

    /Users/aaron/Library/Application Support/Claude/claude_desktop_config.json
    
  2. Add the same configuration to the mcpServers object as described above

  3. Restart Claude

Installing to Other AI Assistants

Similar configuration applies to other AI assistants that support MCP. Locate their configuration files and add the server configuration with the appropriate path to the MCP server script.

Usage Examples

To create a GitHub PR using an AI assistant:

Please use the create_pull_request tool to create a GitHub Pull Request.
Parameters:
{
  "repoPath": "/path/to/your/repo",
  "title": "Implement new feature",
  "description": "This PR implements the new feature, including...",
  "ticketNumber": "JIRA-123",
  "baseBranch": "main"
}

To add a comment to a PR:

Please use the add_pr_comment tool to add a comment to the PR.
Parameters:
{
  "repoPath": "/path/to/your/repo",
  "baseBranch": "main",
  "filePath": "src/index.js",
  "lineNumber": 42,
  "comment": "This could be written more concisely"
}

Important Notes

Before using this tool, ensure that:

  • You've logged in with gh auth login
  • You've created and switched to the branch you want to submit as a PR
  • You've committed all changes
  • You've pushed the branch to the remote repository

If you encounter permission issues, check your login status with:

gh auth status

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-pr-helper" '{"command":"node","args":["/Users/aaron/CascadeProjects/app-github-pr-helper/src/mcp-server.js"],"disabled":false,"alwaysAllow":[]}'

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-pr-helper": {
            "command": "node",
            "args": [
                "/Users/aaron/CascadeProjects/app-github-pr-helper/src/mcp-server.js"
            ],
            "disabled": false,
            "alwaysAllow": []
        }
    }
}

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-pr-helper": {
            "command": "node",
            "args": [
                "/Users/aaron/CascadeProjects/app-github-pr-helper/src/mcp-server.js"
            ],
            "disabled": false,
            "alwaysAllow": []
        }
    }
}

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