feat: Add peer review data persistence to database#16
Merged
Conversation
Adds a standalone MCP plugin that exposes PR Agent functionality as MCP tools for any MCP-compatible tool (Claude Code, etc.). Key features: - LLM-agnostic design: returns diff data for the calling LLM to analyze - No API keys required in plugin - uses host tool's LLM - Dashboard integration for tracking analysis metrics MCP Tools: - analyze_diff: Get diff ready for AI analysis - analyze_branch: Get current branch diff for analysis - get_dashboard_stats: Get dashboard metrics - get_recent_analyses: Get analysis history - save_analysis: Save results to dashboard Commands: - /pr-analyze: Analyze current branch - /pr-stats: Show dashboard statistics - /pr-recent: Show recent analyses Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…onfig - Detailed README with tool descriptions and usage examples - npm package configuration for publishing as pr-agent-mcp - Added bin entry for npx pr-agent-mcp usage Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- smithery.json for Smithery MCP marketplace - PUBLISHING.md with npm, Smithery, and mcp.run instructions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a production-ready MCP (Model Context Protocol) server that mirrors the CLI workflow exactly, enabling PR Agent to work with any MCP-compatible tool (Claude Code, Cursor, Windsurf, Cline, etc.). ## New Features - **MCP Server** (`src/mcp/server.ts`): Full implementation with two tools: - `analyze`: Mirrors `pr-agent analyze` CLI command exactly - `dashboard`: Starts web dashboard for analysis history - **Publishing Configuration**: - `server.json`: MCP Registry configuration - `smithery.json`: Smithery marketplace configuration - Updated `package.json` with mcpName and npm metadata - **Documentation**: - `docs/MCP-SERVER.md`: Comprehensive MCP server documentation - `src/mcp/README.md`: MCP-specific quick start guide - Publishing guides for npm, MCP Registry, and Smithery ## Technical Details - Uses same `.pragent.config.json` as CLI - Full feature parity: Jira peer review, arch-docs, risk detection, complexity scoring - Saves analysis to `pr-agent.db` for dashboard - Follows MCP security best practices (input validation, localhost binding) ## Breaking Changes - Removed old `pr-agent-plugin/` directory (replaced by integrated `src/mcp/`) Closes techdebtgpt#28 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- MCP server now uses the same PRAnalyzerAgent workflow as CLI - Added StubChatModel that triggers fallback paths in the agent - Added MCPChatModel for future use when Claude Code supports MCP sampling - PRAnalyzerAgent accepts optional chatModel for pass-through LLM access - Recommendations and risks are now properly stored in database - Dashboard "Most Requested Changes" section now populates correctly The StubChatModel always throws, which forces PRAnalyzerAgent to: 1. Run static analysis (semgrep, pattern matching) 2. Generate default recommendations via catch blocks The calling LLM (Claude Code, Cursor, etc.) provides AI insights after receiving the analysis response. Note: When Claude Code adds MCP sampling support (Issue #1785), StubChatModel can be replaced with MCPChatModel for true LLM pass-through. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Expand database schema with 12 new columns for peer review data: - peer_review_enabled, ticket_key, ticket_quality_score, ticket_quality_tier - ac_compliance_percentage, ac_requirements_met, ac_requirements_total - peer_review_verdict, peer_review_blockers, peer_review_warnings - implementation_completeness, quality_score - Add getJiraComplianceStats() function to aggregate peer review metrics - Update analyze.command.ts to save peer review results after analysis - Update MCP server to include peer_review_enabled flag in saved analyses The peer review data includes ticket quality ratings, acceptance criteria compliance, verdict (approve/request_changes/needs_discussion), and detailed blockers/warnings for dashboard visualization. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
dzdimov
approved these changes
Jan 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getJiraComplianceStats()function to aggregate peer review metrics for dashboardpeer_review_enabledflag in saved analysesNew Database Fields
peer_review_enabled- Flag indicating if peer review was runticket_key- Jira ticket key (e.g., TODO-1)ticket_quality_score- Overall ticket quality score (0-100)ticket_quality_tier- Quality tier (excellent/good/adequate/poor/insufficient)ac_compliance_percentage- Acceptance criteria compliance percentageac_requirements_met/ac_requirements_total- AC requirements countspeer_review_verdict- Verdict (approve/request_changes/needs_discussion)peer_review_blockers/peer_review_warnings- JSON arrays of issuesimplementation_completeness/quality_score- Additional metricsDashboard Integration
The
getJiraComplianceStats()function returns aggregated data for dashboard visualization:Test plan
getJiraComplianceStats()returns correct aggregated data🤖 Generated with Claude Code