@teolin/code-review-agent
v3.0.1
Published
MCP server for automated code reviews with GitHub PR and Jira integration
Maintainers
Readme
Code Review MCP Server
Automated code review server that integrates GitHub PRs with Jira tickets for comprehensive code review automation.
Features
- 🔄 GitHub PR Integration: Fetches PR diffs and metadata
- 🎫 Jira Integration: Retrieves requirements and acceptance criteria via Atlassian CLI
- 🧪 Test Execution: Pulls branch locally and runs tests
- 🔍 Lint Checking: Runs linting to ensure code quality
- 💬 AI-Powered Analysis: Generates review comments with file:line references
- 📝 Formatted Output: Clean markdown report with all findings
Prerequisites
- GitHub CLI:
ghcommand must be available and authenticated - Atlassian CLI:
aclicommand must be available and authenticated - Node.js: Version >=25.2.1 required
Installation
Option 1: Install from npm (Recommended)
npm install -g code-review-mcp-serverOption 2: Install locally
npm install code-review-mcp-serverOption 3: Use with npx (no installation)
npx -y code-review-mcp-serverSetup
1. Install Dependencies
npm install2. Authenticate Required Services
# GitHub CLI
gh auth login
# Atlassian CLI
acli auth login --url https://your-domain.atlassian.netUsage
In Claude Code
# Review a specific PR (from any repository)
code_review pr_name: "123" working_directory: "/path/to/your/repo"
# Or use the tool directly:
/mcp code_review {"pr_name": "123", "working_directory": "/path/to/your/repo"}Example Output
# Code Review: 123
## 🎫 Jira Ticket: PAB-2197
**Summary:** Implement user authentication with JWT
**Status:** In Progress
**Description:** Add JWT-based authentication system
**Acceptance Criteria:** Users should be able to login and receive tokens
## 🧪 Test Results
**Status:** ✅ PASSED
## 🔍 Lint Results
**Status:** ✅ PASSED
## 💬 Review Comments
• **src/auth.js:45** → Remove console.log before merging
• **src/types.js:12** → Avoid "any" type, be more specific
• **src/handler.js:89** → Consider error handling for async operationHow It Works
- PR Analysis: Extracts PR diff and metadata from GitHub
- Jira Integration: Finds associated Jira ticket (from branch name/PR title/body)
- Requirements Fetch: Gets ticket details via Atlassian CLI
- Branch Testing: Checks out PR branch and runs
npm run test - Code Quality: Runs
npm run lintfor style compliance - Smart Analysis: Scans code changes for common issues:
- Console.log statements
- TODO/FIXME comments
- TypeScript
anyusage - Security concerns
- Missing error handling
- Report Generation: Formats findings into actionable review
Supported Patterns
- Branch naming:
feat/PAB-123-description,fix/ABC-456 - PR titles:
[PAB-123] Add feature - PR descriptions: References to Jira tickets
Configuration
The server automatically detects:
- GitHub repository context
- Node.js project structure
- Available npm scripts (
test,lint) - Jira ticket references
Testing
To test the MCP server:
npm testIntegration with Claude Code
Claude Code supports three scopes for MCP server configuration:
- User scope (
~/.claude.json): Available across all projects - Local scope (
~/.claude.json): Project-specific, private to you (default) - Project scope (
.mcp.jsonin project root): Team-shared, committed to git
Quick Setup with CLI (Recommended)
# User scope (available in all projects)
claude mcp add codereview --scope user
# Project scope (shared with team via git)
claude mcp add codereview --scope projectManual Configuration
Using npx (Recommended - no installation needed)
Add to .mcp.json (project scope) or ~/.claude.json (user scope):
{
"mcpServers": {
"codereview": {
"type": "stdio",
"command": "npx",
"args": ["-y", "code-review-mcp-server"]
}
}
}Using global installation
{
"mcpServers": {
"codereview": {
"type": "stdio",
"command": "codereview-mcp"
}
}
}Using local installation
{
"mcpServers": {
"codereview": {
"type": "stdio",
"command": "node",
"args": [
"./node_modules/code-review-mcp-server/src/index.js"
]
}
}
}Troubleshooting
- GitHub auth: Run
gh auth status - Atlassian auth: Run
acli auth list - MCP connection: Check Claude Code logs with
/logs - Permissions: Ensure server has access to repositories
Publishing
Using GitHub Actions (Recommended)
This package uses GitHub Actions for automated publishing. To publish a new version:
- Go to GitHub Actions → "Publish @teolin/code-review-agent" → Run workflow
- The workflow will automatically:
- Install dependencies
- Run the
prepublishOnlyscript to make the bin executable - Publish to npm with public access
Manual Publishing
Prerequisites
- You need an npm account: https://www.npmjs.com/signup
- Login to npm:
npm login
Publishing Steps
Test the package locally (optional but recommended):
# Test that it runs node src/index.js --help # Or test with a PR number (requires gh and acli to be authenticated) node src/index.jsPublish to npm:
npm publishThis will:
- Run the
prepublishOnlyscript to make the bin executable - Only include files specified in the
filesfield - Publish to npm with public access (configured in
publishConfig)
- Run the
Verify the package:
# Test with npx (no installation) npx -y @teolin/code-review-agent # Or install globally and test npm install -g @teolin/code-review-agent codereview-mcp
Updating the Package
Update the version in
package.json:npm version patch # for bug fixes (2.0.2 -> 2.0.3) npm version minor # for new features (2.0.2 -> 2.1.0) npm version major # for breaking changes (2.0.2 -> 3.0.0)Publish the new version:
npm publish
Checking Published Package
View your package on npm:
- https://www.npmjs.com/package/@teolin/code-review-agent
Check what files will be included before publishing:
npm pack --dry-runTroubleshooting
"You do not have permission to publish"
- Make sure you're logged in:
npm whoami - For scoped packages (@teolin/...), ensure you have access to the @teolin organization or use your own scope
"Package name already exists"
- The package name might be taken. Check: https://www.npmjs.com/package/@teolin/code-review-agent
- If needed, change the name in package.json
Files missing after installation
- Check the
filesfield in package.json - Use
npm pack --dry-runto preview what will be included
Requirements
- Node.js >=25.2.1
- GitHub CLI (
gh) authenticated - Atlassian CLI (
acli) authenticated - Published on npm: code-review-mcp-server
Extending
The server can be extended to support:
- Different CI/CD systems
- Additional code quality tools
- Custom review rules
- Multiple Jira instances
- Slack/Teams notifications
