- Code Review
Code Review
Tools
-
CodeReview: Runs git diff between branch and base branch. Returns the diff along with instructions to review and fix issues.
-
CodeReviewWithGithubUrl: Fetches diff from a GitHub PR URL. Returns the diff along with instructions to review and fix issues.
-
AddPRSummaryComment: Adds a summary comment to a GitHub PR.
-
AddPRLineComment: Adds multiple comments to specific lines in a GitHub PR. Supports commenting on specific changed lines in the PR diff.
Prerequisites
- Node.js (v18 or above recommended)
- Git installed on your system
- For GitHub PR review, you must provide either:
- a
GITHUB_TOKENenvironment variable (to use the GitHub RESTful API), or - have the GitHub CLI (
gh) installed and authenticated
- a
- (Optional) Notion API token for guideline integration
Environment Variables Description:
GITHUB_TOKEN: GitHub personal access token for API access. Optional - falls back to GitHub CLI if not provided.NOTION_API_KEY: Required for fetching review guidelines from Notion.NOTION_CODE_REVIEW_GUIDELINE_CODE_BLOCK_URL: Notion URL containing code review guidelines. Must point to a Notion</> Codeblock and requires validNOTION_API_KEYto function. Falls back to default guidelines if not configured or API key is missing.NOTION_STYLE_GUIDELINE_CODE_BLOCK_URL: Notion URL containing style guidelines. Must point to a Notion</> Codeblock and requires validNOTION_API_KEYto function. Falls back to default guidelines if not configured or API key is missing.IGNORE_PATTERNS: Optional comma-separated glob patterns for files to exclude from review.
CI Integration for Automated Code Review
You can automate code review in your CI pipeline by triggering an n8n webhook, which will call this project's MCP tool to perform the review and return results or leave comments on your PR.
For a step-by-step guide and recommended workflow diagram, see: CI Integration with n8n and MCP Tool
Server Config
{
"mcpServers": {
"code-review": {
"command": "npx",
"args": [
"-y",
"code-review-mcp-server"
],
"env": {
"GITHUB_TOKEN": "github_token",
"NOTION_API_KEY": "notion_api_key",
"NOTION_CODE_REVIEW_GUIDELINE_CODE_BLOCK_URL": "notion_code_block_url_here",
"NOTION_STYLE_GUIDELINE_CODE_BLOCK_URL": "notion_code_block_url_here",
"IGNORE_PATTERNS": "pattern1,pattern2,pattern3"
}
}
}
}