coderabbitai-mcp
Version:
MCP server for interacting with CodeRabbit AI reviews on GitHub pull requests. Enables LLMs to analyze, implement, and resolve CodeRabbit suggestions programmatically.
95 lines • 3.4 kB
TypeScript
import { GitHubReview, GitHubComment, GitHubUser } from './types.js';
export interface GitHubPullRequest {
id: number;
number: number;
title: string;
body: string;
state: 'open' | 'closed';
user: GitHubUser;
html_url: string;
created_at: string;
updated_at: string;
}
export interface GitHubAPIError extends Error {
status?: number;
response?: any;
}
/**
* Direct GitHub API client for CodeRabbit MCP server
* Uses GitHub REST API v4 with Personal Access Token authentication
*/
export declare class GitHubClient {
private token;
private baseUrl;
constructor(token?: string, baseUrl?: string);
/**
* Make an authenticated request to the GitHub API
*/
private makeRequest;
/**
* Get all reviews for a pull request
*/
getPullRequestReviews(owner: string, repo: string, pullNumber: number): Promise<GitHubReview[]>;
/**
* Get all comments for a pull request (review comments)
*/
getPullRequestComments(owner: string, repo: string, pullNumber: number): Promise<GitHubComment[]>;
/**
* Get a specific pull request
*/
getPullRequest(owner: string, repo: string, pullNumber: number): Promise<GitHubPullRequest>;
/**
* List pull requests for a repository
*/
listPullRequests(owner: string, repo: string, options?: {
state?: 'open' | 'closed' | 'all';
sort?: 'created' | 'updated' | 'popularity';
direction?: 'asc' | 'desc';
perPage?: number;
page?: number;
}): Promise<GitHubPullRequest[]>;
/**
* Add a comment to an issue (including pull requests)
*/
addIssueComment(owner: string, repo: string, issueNumber: number, body: string): Promise<any>;
/**
* Get a specific comment by ID
*/
getComment(owner: string, repo: string, commentId: number): Promise<GitHubComment>;
/**
* React to a comment (add reaction)
*/
addReactionToComment(owner: string, repo: string, commentId: number, reaction: '+1' | '-1' | 'laugh' | 'confused' | 'heart' | 'hooray' | 'rocket' | 'eyes'): Promise<any>;
/**
* Resolve a pull request review conversation
* This marks the conversation thread as resolved
*
* Note: GitHub's REST API doesn't support direct conversation resolution.
* This method uses a fallback approach with reactions to indicate resolution.
*/
resolveReviewConversation(owner: string, repo: string, commentId: number): Promise<any>;
/**
* Unresolve a pull request review conversation
*
* Note: GitHub's REST API doesn't support direct conversation resolution.
* This method uses a fallback approach with reactions to indicate unresolving.
*/
unresolveReviewConversation(owner: string, repo: string, commentId: number): Promise<any>;
/**
* Search for a comment across multiple pull requests
* This is a helper method since GitHub doesn't provide direct comment search
*/
findCommentInRecentPRs(owner: string, repo: string, commentId: number, maxPRs?: number): Promise<{
comment: GitHubComment;
pr: GitHubPullRequest;
} | null>;
/**
* Check if the token has required permissions
*/
validateToken(): Promise<{
valid: boolean;
scopes: string[];
user: string;
}>;
}
//# sourceMappingURL=github-client.d.ts.map