npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cheffromspace/github-pr-assistant

v0.1.1

Published

GitHub PR review assistant using Anthropic Claude and MCP

Downloads

13

Readme

GitHub PR Assistant

An AI-powered GitHub PR reviewer using Anthropic Claude and Model Context Protocol (MCP). This tool helps automate code reviews by analyzing pull requests and providing detailed, actionable feedback.

Features

  • Automatically reviews GitHub pull requests using Claude AI
  • Provides detailed code review feedback with security, performance, and maintainability insights
  • Interactive tools to fetch files, add comments, and approve/request changes on PRs
  • Can be used as a library in your Node.js applications or as a standalone CLI tool
  • Supports customizable review focus areas and Claude model selection

Prerequisites

Before installing this tool, you'll need:

  1. Anthropic API Key: Get one from Anthropic Console
  2. GitHub Access Token: Create a token with repo scope from GitHub Settings

Installation

Global Installation (recommended for CLI usage)

npm install -g @cheffromspace/github-pr-assistant

Local Installation (for use in a project)

npm install @cheffromspace/github-pr-assistant

Configuration

You can configure the tool using environment variables or command-line options:

Required Configuration

  • Anthropic API Key: Set via ANTHROPIC_API_KEY environment variable or --anthropic-key option
  • GitHub Access Token: Set via GITHUB_ACCESS_TOKEN environment variable or --github-token option

Optional Configuration

  • Claude Model: Defaults to claude-3-7-sonnet-latest, can be customized via --model option
  • Max Tokens: Response length limit, defaults to 4000, can be adjusted via --max-tokens option

Usage

Command Line Interface

# Set environment variables (recommended approach)
export ANTHROPIC_API_KEY=your-anthropic-api-key
export GITHUB_ACCESS_TOKEN=your-github-token

# Run a PR review
gh-ai-pr-review review --owner your-org --repo your-repo --pr 123

# Use a specific Claude model
gh-ai-pr-review review --owner your-org --repo your-repo --pr 123 --model claude-3-opus-20240229

# Adjust token limit for longer responses
gh-ai-pr-review review --owner your-org --repo your-repo --pr 123 --max-tokens 8000

# Provide credentials via command line (not recommended for shared environments)
gh-ai-pr-review review --owner your-org --repo your-repo --pr 123 \
  --anthropic-key sk-ant-api-key \
  --github-token github-pat-token

As a Node.js Library

import { PRReviewClient } from '@cheffromspace/github-pr-assistant';

// Create client with configuration
const client = new PRReviewClient({
  anthropicApiKey: 'your-anthropic-api-key', // Or use process.env.ANTHROPIC_API_KEY
  githubToken: 'your-github-token',          // Or use process.env.GITHUB_ACCESS_TOKEN
  model: 'claude-3-opus-20240229',           // Optional, defaults to sonnet
  maxTokens: 8000                            // Optional, defaults to 4000
});

// Method 1: Review a PR by providing repo details (client will fetch PR data)
const review = await client.reviewPR({
  owner: 'your-org',
  repo: 'your-repo',
  number: 123
});

// Method 2: Review a PR with pre-fetched data
const review = await client.reviewPR({
  // Full PR data object
  title: 'Fix authentication bug',
  body: 'This PR addresses the authentication issue...',
  user: { login: 'developer' },
  // ... other PR details
});

// Access the review results
console.log(review.content);  // The review text
console.log(review.toolUses); // Actions taken by Claude during review

API Reference

PRReviewClient

The main client class for interacting with the PR review system.

Constructor

new PRReviewClient(config?: ClientConfig)

Parameters:

  • config (optional): Configuration object with:
    • anthropicApiKey: Anthropic API key (string)
    • githubToken: GitHub API token (string)
    • model: Claude model to use (string, default: 'claude-3-7-sonnet-latest')
    • maxTokens: Maximum tokens for response (number, default: 4000)

Methods

fetchPRData(owner: string, repo: string, prNumber: number): Promise<PRData>

Fetches complete pull request data from GitHub.

Parameters:

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

Returns: Complete PR data object

reviewPR(prData: PRDataWithPrompt | { owner: string, repo: string, number: number }): Promise<ReviewResult>

Performs a review of the provided PR data.

Parameters:

  • prData: Either complete PR data object OR repository identifiers to fetch the PR

Returns: Review result with content and tool uses

interface ReviewResult {
  content: string;        // The review text
  toolUses?: Array<{      // Actions performed during review
    name: string;         // Tool name (e.g., 'add_comment', 'approve')
    input: any;           // Input provided to the tool
    output: any;          // Tool execution result
  }>;
}

Available Tools

The PR Assistant uses the following tools to interact with GitHub:

  1. get_file: Fetches file contents from the repository
  2. add_comment: Posts a comment on the PR with review feedback
  3. approve: Approves the PR if it meets quality standards
  4. request_change: Requests changes when significant issues are found

Integration Ideas

  • CI/CD Pipeline: Run automated reviews on all PRs
  • GitHub Actions: Trigger reviews when PRs are opened or updated
  • Pre-merge Checks: Require AI review before merging
  • Developer Workflow: Get quick feedback before requesting human review

Troubleshooting

Common Issues

  • Authentication Errors: Ensure both API keys are valid and have appropriate permissions
  • Rate Limit Errors: GitHub or Anthropic API rate limits may be exceeded
  • Model Availability: Ensure the selected Claude model is available in your account

Debug Mode

For detailed logging:

# Set DEBUG environment variable
export DEBUG=gh-ai-pr-assistant:*

# Run the command
gh-ai-pr-review review --owner your-org --repo your-repo --pr 123

License

MIT