Enhanced PR Comments Resolver MCP Server
Fetches GitHub pull request comments, applies fixes directly to workspace files, and provides tools for resolving, embedding, and managing PR comments programmatically.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Enhanced PR Comments Resolver MCP ServerApply PR #42 comments to my workspace files."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🚀 Enhanced PR Comments Resolver - MCP Server v2.1
A comprehensive Model Context Protocol (MCP) server that not only fetches GitHub PR comments but also intelligently applies and fixes them directly in your workspace files. This enhanced version includes smart pattern recognition, similar comment linking, and automated issue resolution capabilities optimized for Cursor IDE.
✨ Enhanced Features
🔍 Comprehensive Comment Processing
Fetches all types of PR comments (issue, review, and general comments)
Intelligent comment analysis and categorization
Priority-based comment filtering (High/Medium/Low priority)
Actionable vs non-actionable comment detection
🧠 Smart pattern recognition across similar comments
🔗 Comment linking for consistent fixes across files
🎯 Direct File Modification & Intelligent Fixing
Apply comments directly to files in your current workspace
🤖 Automatic issue resolution based on comment content
🌐 "Apply everywhere" support for project-wide changes
Intelligent workspace detection (Git repos, package.json, pyproject.toml, etc.)
Safe file operations with optional automatic backups
Batch processing of multiple comments
Dry-run mode for testing changes
🔧 Smart fixes for: imports, naming, types, formatting, removal, and more
🧠 Enhanced Prompt Generation
Cursor IDE optimized prompts with enhanced formatting
Multiple format types: Cursor, JSON, Markdown, Structured
Context-aware suggestions with file path resolution
Intelligent action categorization (Bug Fix, Refactor, Style, etc.)
Enhanced code context with syntax highlighting
📝 Comment Embedding
Embed PR comments as hidden comments directly in source files
Track applied suggestions with metadata
Reference original comment URLs and authors
Maintain audit trail of changes
🔧 Workspace Intelligence
Automatic workspace root detection
Project structure analysis
Language detection and file type support
Intelligent file path resolution
Related MCP server: GitHub Code Review Assistant
🛠 Installation
Clone or download this repository
Install dependencies using uv (recommended):
cd pr-comments-resolver uv syncOr using pip:
pip install -r requirements.txtSet up GitHub token (see GitHub Token Setup section)
🔐 GitHub Token Setup
Why You Need a GitHub Token
Higher Rate Limits: 5,000 requests/hour vs 60 requests/hour
Private Repository Access: Access private repos with proper permissions
Better Error Handling: More detailed API responses
Getting a GitHub Token
Go to GitHub Settings > Developer settings > Personal access tokens
Click "Generate new token (classic)"
Select scopes:
public_repo(andrepofor private repositories)Copy the token immediately
Setting Up the Token
Method 1: Environment Variable (Recommended)
export GITHUB_TOKEN="your_token_here"Method 2: MCP Client Configuration
For Cursor (add to your MCP settings):
{
"mcpServers": {
"pr-comments-resolver": {
"command": "python",
"args": ["/path/to/pr-comments-resolver/main.py"],
"env": {
"GITHUB_TOKEN": "your_token_here"
}
}
}
}🚀 Quick Start
⚡ ONE-CLICK WORKFLOW (RECOMMENDED) ✨ NEW!
# Complete everything in one go - no redundant API calls!
complete_pr_workflow("https://github.com/owner/repo/pull/123", dry_run=True)
# Apply everything after preview
complete_pr_workflow("https://github.com/owner/repo/pull/123", dry_run=False)This unified tool:
📁 Sets up workspace automatically
📥 Fetches PR comments (with smart caching)
📝 Embeds comments in files
🔧 Intelligently fixes all issues
🔗 Links similar patterns across files
🌐 Applies "everywhere" comments to all PR files
🔧 INDIVIDUAL TOOLS (If you need granular control)
Step 1: Embed PR Comments
# In Cursor IDE, use the MCP tool to embed comments in files
resolve_pr_comments("https://github.com/owner/repo/pull/123", dry_run=True)Step 2: Intelligent Fix & Check
# Automatically check and fix issues mentioned in comments
check_and_fix_applied_comments("https://github.com/owner/repo/pull/123", dry_run=True)
# Apply the fixes
check_and_fix_applied_comments("https://github.com/owner/repo/pull/123", dry_run=False)Step 3: Focus on Specific Files
# Check and fix comments for a specific file
check_specific_file_comments("https://github.com/owner/repo/pull/123", "src/components/Button.tsx", dry_run=False)What You Get
The system will automatically:
🎯 Embed comments at the right locations in your code
🔗 Detect similar patterns across multiple comments
🧠 Apply fixes intelligently based on comment content
🌐 Handle "everywhere" comments across all PR files
🔄 Link related comments for consistent fixes
Example embedded comment:
/**
* PR Comment from @reviewer: you can use theme token here
* Comment ID: 123456
* Line: ~42
*/
const color = '#ff0000'; // ← This will be automatically fixed!After running check_and_fix_applied_comments:
const color = theme.colors.primary; // ← Automatically fixed!🎮 Usage
Running the MCP Server
python main.pyAvailable Tools
🔍 Core Functionality
detect_workspace
Automatically detect and analyze your current workspace.
{
"tool": "detect_workspace",
"arguments": {}
}set_workspace_path
Set a custom workspace path for file operations.
{
"tool": "set_workspace_path",
"arguments": {
"workspace_path": "/path/to/your/project"
}
}fetch_pr_comments_tool
Fetch all comments from a GitHub PR with enhanced processing.
{
"tool": "fetch_pr_comments_tool",
"arguments": {
"pr_url": "https://github.com/owner/repo/pull/123"
}
}complete_pr_workflow 🚀 NEW! (RECOMMENDED)
Complete PR comment resolution workflow in one step with smart caching.
{
"tool": "complete_pr_workflow",
"arguments": {
"pr_url": "https://github.com/owner/repo/pull/123",
"workspace_path": "/optional/custom/path",
"dry_run": true
}
}What it does:
📁 Sets up workspace (auto-detected or custom)
📥 Fetches PR comments (with 5min smart caching)
📝 Embeds comments in files at correct locations
🔧 Intelligently fixes all detected issues
🔗 Links similar comments for consistent fixes
🌐 Applies "everywhere" comments across all PR files
resolve_pr_comments ✨ NEW!
Embed PR comments directly in your source files at specific locations.
{
"tool": "resolve_pr_comments",
"arguments": {
"pr_url": "https://github.com/owner/repo/pull/123",
"dry_run": true
}
}check_and_fix_applied_comments ✨ NEW!
Intelligently check and fix issues mentioned in PR comments after they're applied.
{
"tool": "check_and_fix_applied_comments",
"arguments": {
"pr_url": "https://github.com/owner/repo/pull/123",
"dry_run": true
}
}Features:
🔗 Links similar comments across files
🌐 Applies "everywhere" comments to all PR files
🧠 Intelligent pattern recognition and fixing
🎯 Handles imports, naming, types, formatting, and more
check_specific_file_comments ✨ NEW!
Check and fix comments for a specific file.
{
"tool": "check_specific_file_comments",
"arguments": {
"pr_url": "https://github.com/owner/repo/pull/123",
"file_path": "src/components/Button.tsx",
"dry_run": true
}
}🛠️ Utility Tools
clear_pr_cache ✨ NEW!
Clear cached PR comments data to force fresh API calls.
{
"tool": "clear_pr_cache",
"arguments": {
"pr_url": "https://github.com/owner/repo/pull/123"
}
}Cache Features:
📋 Smart caching with 5-minute TTL
🗑️ Clear specific PR cache or all cached data
⚡ Eliminates redundant API calls within the same session
🔄 Automatic cache invalidation
🎯 Enhanced Prompt Generation
generate_cursor_prompt
Generate optimized prompts for Cursor IDE with intelligent formatting.
{
"tool": "generate_cursor_prompt",
"arguments": {
"pr_url": "https://github.com/owner/repo/pull/123",
"format_type": "cursor"
}
}Format Types:
"cursor"- Optimized for Cursor IDE with enhanced formatting"json"- Structured JSON format for automated processing"markdown"- Clean markdown format for documentation"structured"- Advanced structured format with metadata
🔧 Direct File Modification
apply_pr_comments
Apply all actionable PR comments directly to your workspace files.
{
"tool": "apply_pr_comments",
"arguments": {
"pr_url": "https://github.com/owner/repo/pull/123",
"dry_run": true
}
}apply_single_comment
Apply a specific comment to a file.
{
"tool": "apply_single_comment",
"arguments": {
"pr_url": "https://github.com/owner/repo/pull/123",
"comment_id": "987654321",
"dry_run": false
}
}📝 Comment Integration
embed_comments_in_files
Embed PR comments as hidden comments directly in source files.
{
"tool": "embed_comments_in_files",
"arguments": {
"pr_url": "https://github.com/owner/repo/pull/123"
}
}get_file_context
Get enhanced context around specific lines in files.
{
"tool": "get_file_context",
"arguments": {
"file_path": "src/main.py",
"line_number": 42,
"context_lines": 10
}
}🎯 Intelligent Comment Processing
Comment Categorization
The server automatically categorizes comments by:
Priority Levels: 🔴 HIGH, 🟡 MEDIUM, 🟢 LOW, ⚪ REVIEW
Action Types: 🐛 BUG_FIX, 🔧 REFACTOR, ➕ ADD_FEATURE, ➖ REMOVE, 🎨 STYLE, ⚡ OPTIMIZE, 💭 DISCUSS
Supported Actions
Variable/function renaming
Import statement additions
Typo corrections
Docstring additions
Type hint improvements
Code removal/cleanup
Style formatting
📊 Example Workflows
1. Quick PR Review Analysis
# 1. Detect workspace
detect_workspace()
# 2. Generate Cursor-optimized prompt
generate_cursor_prompt("https://github.com/owner/repo/pull/123", "cursor")
# 3. Review the generated prompt in Cursor2. Apply Comments to Workspace
# 1. Test changes with dry run
apply_pr_comments("https://github.com/owner/repo/pull/123", dry_run=true)
# 2. Apply actual changes
apply_pr_comments("https://github.com/owner/repo/pull/123", dry_run=false)
# 3. Embed comments for reference
embed_comments_in_files("https://github.com/owner/repo/pull/123")3. Selective Comment Application
# 1. Fetch all comments
fetch_pr_comments_tool("https://github.com/owner/repo/pull/123")
# 2. Apply specific high-priority comment
apply_single_comment("https://github.com/owner/repo/pull/123", "comment_id", false)🔒 Safety Features
File Safety
Automatic Backups: Creates timestamped backups before modifications
Dry Run Mode: Test changes without modifying files
Error Recovery: Graceful handling of file operation errors
Encoding Detection: Handles multiple file encodings safely
Change Validation
Syntax Preservation: Maintains code syntax and structure
Incremental Changes: Makes focused, atomic modifications
Change Tracking: Adds metadata comments for audit trails
Rollback Support: Easy restoration from backups
🎨 Enhanced Cursor Integration
The generated prompts are specifically optimized for Cursor IDE with:
Visual Hierarchy: Enhanced formatting with emojis and structure
Code Context: Syntax-highlighted code blocks with line numbers
Action Guidance: Step-by-step implementation instructions
Priority Indicators: Clear visual priority and action type indicators
File Navigation: Direct file paths and line number references
📈 Response Format
All tools return comprehensive JSON responses with:
{
"success": true,
"workspace_path": "/path/to/workspace",
"pr_info": {
"owner": "username",
"repo": "repository",
"pr_number": 123,
"url": "https://github.com/username/repository/pull/123"
},
"results": {
"total_comments": 15,
"actionable_comments": 8,
"successful": 6,
"failed": 0,
"skipped": 2
},
"details": [...]
}🛠 Development
Project Structure
pr-comments-resolver/
├── main.py # Enhanced MCP server with all tools
├── modules/
│ ├── __init__.py # Module initialization
│ ├── prompt_generator.py # Enhanced prompt generation
│ └── file_manager.py # Workspace and file operations
├── pyproject.toml # Dependencies and project config
├── README.md # This file
└── uv.lock # Dependency lock fileDependencies
httpx- Async HTTP client for GitHub APImcp[cli]- Model Context Protocol frameworkaiofiles- Async file operationspathlib2- Enhanced path handling (Python < 3.11)
Development Setup
# Install development dependencies
uv sync --dev
# Run linting
black .
flake8 .
mypy .
# Run tests
pytest🔄 Migration from v1.0
If you're upgrading from the basic version:
Backup your current setup
Update dependencies:
uv syncNew tools available: All file modification and prompt generation tools
Enhanced responses: More detailed JSON responses with workspace context
Workspace detection: Automatic detection replaces manual path setting
🤝 Contributing
Fork the repository
Create a feature branch
Make your changes with tests
Ensure code quality (black, flake8, mypy)
Submit a pull request
📄 License
This project is open source. Please check the license file for details.
🆘 Troubleshooting
Common Issues
Workspace not detected
# Manually set workspace path
set_workspace_path("/path/to/your/project")File not found errors
Ensure you're running from the correct directory
Check file paths are relative to workspace root
Verify files exist in the detected workspace
Permission errors
Ensure write permissions in workspace directory
Check GitHub token has appropriate repository permissions
Rate limiting
Set up GitHub token for higher limits
Implement delays between batch operations
Debug Mode
Enable detailed logging by setting environment variable:
export LOG_LEVEL=DEBUG
python main.py🚀 What's New in v2.0
✅ Direct file modification with intelligent change application
✅ Enhanced Cursor prompts with visual formatting and context
✅ Workspace intelligence with automatic detection
✅ Comment embedding in source files for reference
✅ Batch processing with progress tracking
✅ Safety features including backups and dry-run mode
✅ Modular architecture for easier maintenance
✅ Comprehensive error handling and validation
✅ Multiple prompt formats for different use cases
✅ Enhanced metadata and tracking capabilities
Transform your PR review workflow with intelligent automation! 🎉
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/abhinandanmishra1/pr-comments-resolver-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server