MCP ExplorerExplorer

Github Pr Mcp

@shaileshahujaon 9 months ago
3 MIT
FreeCommunity
AI Systems
MCP server that fetches GitHub Pull Request comments

Overview

What is Github Pr Mcp

github-pr-mcp is a Model Context Protocol (MCP) server designed to fetch comments from GitHub Pull Requests using a personal access token.

Use cases

Use cases for github-pr-mcp include automating the retrieval of comments for code reviews, integrating with CI/CD pipelines, and enhancing developer tools that require access to PR discussions.

How to use

To use github-pr-mcp, install it via Smithery or manually by cloning the repository, installing dependencies, and setting up a .env file with your GitHub token. Build the project and run the server to access the ‘get_pr_comments’ tool.

Key features

Key features include fetching PR comments with file paths and line ranges, using the GitHub API via Octokit, implementing MCP server with StdioServerTransport, and returning comments in a structured JSON format.

Where to use

github-pr-mcp can be used in software development environments where GitHub is utilized for version control and collaboration, particularly in projects that involve pull requests.

Content

GitHub PR Comments MCP Server

smithery badge

This is a Model Context Protocol (MCP) server that fetches GitHub Pull Request comments using a GitHub personal access token.

Features

  • Fetches PR comments with file paths, line ranges, and replies
  • Uses GitHub API via Octokit
  • Implements MCP server with StdioServerTransport
  • Returns comments in a structured JSON format

Installation

Installing via Smithery

To install github-pr-mcp for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install github-pr-mcp --client claude

Installing Manually

  1. Clone the repository

  2. Install dependencies:

    npm install
    
  3. Create a .env file with your GitHub token:

    GITHUB_TOKEN=your_github_token_here
    

Usage

  1. Build the project:

    npm run build
    
  2. Run the server:

    npm start
    

    Or directly with a GitHub token:

    node dist/server.js your_github_token_here
    
  3. The server exposes a tool called get_pr_comments that accepts the following parameters:

    • owner: Repository owner (username or organization)
    • repo: Repository name
    • pull_number: Pull request number

Integration with Cursor

To integrate with Cursor, use the following command in Cursor’s MCP server configuration:

node /path/to/dist/server.js your_github_token_here

Replace /path/to with the actual path to your project, and your_github_token_here with your GitHub personal access token.

Testing

A test client is included to verify the server functionality:

  1. Build the project:

    npm run build
    
  2. Run the test client:

    npm test
    

The test client will start the server, connect to it, and call the get_pr_comments tool with sample parameters.

Response Format

The server returns comments in the following format:

{
  "comments": [
    {
      "id": 123456789,
      "path": "src/example.js",
      "body": "This is a comment on a specific line",
      "line": 42,
      "start_line": 40,
      "user": {
        "login": "username"
      },
      "created_at": "2023-01-01T00:00:00Z",
      "replies": [
        {
          "id": 987654321,
          "body": "This is a reply to the comment",
          "user": {
            "login": "another-username"
          },
          "created_at": "2023-01-02T00:00:00Z"
        }
      ]
    }
  ]
}

Development

To run the server in development mode:

npm run dev

License

ISC

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers