Labsco
YushengAuggie logo

Phabricator

โ˜… 7

from YushengAuggie

Interact with Phabricator for task management and code review workflows.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

Phabricator MCP Server

A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact intelligently with Phabricator for advanced task management and code review workflows.

โœจ Features

๐Ÿ”‘ Personal Authentication

  • Per-User Authentication: Configure your personal Phabricator API token in your MCP client
  • User Attribution: Comments and reviews appear under YOUR name instead of a shared service account
  • Flexible Configuration: Supports both personal tokens and shared environment variables
  • Standard MCP Integration: Follows MCP ecosystem best practices for authentication

๐ŸŽฏ Core Task Management

  • Task Operations: View task details, read comments, add comments, subscribe users to tasks
  • Rich Formatting: Well-structured output with task metadata, status, priority, and full comment threads

๐Ÿ” Advanced Code Review

  • Differential Management: View revisions, read comments, approve/reject code changes
  • Intelligent Review Feedback: Analyze comments with surrounding code context for actionable insights
  • Inline Comments: Add targeted feedback to specific lines in code reviews
  • Code Context Analysis: Correlate review comments with actual code changes and locations

๐Ÿš€ Server Architecture

  • HTTP/SSE Transport: FastMCP-based server for reliable production use (default on port 8932)
  • stdio Transport: Legacy support for direct MCP client integration
  • Comprehensive API: 11 specialized tools for complete Phabricator workflow automation

๐Ÿง  Smart Review Analysis

  • Comment-Code Correlation: Intelligently link review feedback to specific code locations
  • Contextual Code Display: Show surrounding code lines for better understanding
  • Action Item Generation: Categorize feedback into actionable to-do items
  • Priority Classification: Organize comments by Issues โ†’ Suggestions โ†’ Nits โ†’ Other

๐Ÿ›  Available Tools

Task Management (3 tools)

  • get-task - Get comprehensive task details with comments
  • add-task-comment - Add comments to tasks
  • subscribe-to-task - Subscribe users to task notifications

Code Review (8 tools)

  • get-differential - Get basic differential revision details
  • get-differential-detailed - Get comprehensive review with code changes
  • get-review-feedback - : Get intelligent review analysis with code context
  • add-differential-comment - Add general comments to reviews
  • add-inline-comment - : Add targeted inline comments to specific code lines
  • accept-differential - Accept/approve differential revisions
  • request-changes-differential - Request changes with optional feedback
  • subscribe-to-differential - Subscribe users to review notifications

๐Ÿงช Development & Testing

Install Development Dependencies

# Install with dev dependencies
pip install -e ".[dev]"

# Or with uv (faster)
uv pip install -e ".[dev]"

Run Tests

# Run all tests with our test runner
python run_tests.py

# Run specific test suites
python -m pytest src/tests/test_tool_completeness.py -v
python -m pytest src/tests/test_tool_integration.py -v

# Run with coverage
python -m pytest --cov=src --cov-report=html

Code Quality

# Format code
black src/
ruff check src/ --fix

# Type checking
mypy src/

# Run all quality checks
black src/ && ruff check src/ && mypy src/ && python run_tests.py

Testing Features

  • Tool Completeness: Validates all 11 tools are properly configured
  • Integration Testing: Tests all tools with realistic mock data
  • Error Handling: Validates graceful failure modes
  • Argument Validation: Ensures correct required/optional parameters
  • Mock Phabricator: No API calls needed for testing

๐ŸŽฏ Advanced Features

Intelligent Review Feedback Analysis

The get-review-feedback tool provides advanced analysis:

# Returns structured feedback with:
{
    "revision": {...},              # Revision metadata
    "review_feedback": [            # Enhanced comment analysis
        {
            "comment": "Fix this issue",
            "author": "reviewer-phid",
            "type": "inline",
            "code_context": {
                "file": "src/example.py",
                "target_line": 42,
                "hunk_info": "@@ -40,7 +40,7 @@",
                "lines": [           # Surrounding code context
                    {"line_number": 40, "content": "def example():", "is_target": False},
                    {"line_number": 41, "content": "    # TODO: fix this", "is_target": False},
                    {"line_number": 42, "content": "    return broken_code", "is_target": True},
                    {"line_number": 43, "content": "    # end function", "is_target": False},
                ]
            },
            "primary_file": "src/example.py",
            "primary_line": 42
        }
    ],
    "summary": "Analysis summary with actionable insights",
    "total_comments": 5,
    "comments_with_context": 3
}

Smart Comment-Code Correlation

  • Keyword Extraction: Identifies variable names, function names in comments
  • Code Location Mapping: Links comments to specific files and line numbers
  • Context Enrichment: Shows surrounding code for better understanding
  • Priority Classification: Organizes feedback by importance

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

# Fork and clone the repository
git clone https://github.com/your-username/phabricator-mcp-server.git
cd phabricator-mcp-server

# Create feature branch
git checkout -b feature/amazing-feature

# Make changes and test
python run_tests.py

# Commit and push
git commit -m 'feat: add amazing feature'
git push origin feature/amazing-feature

# Open a Pull Request

Development Guidelines

  • Follow existing code style (black + ruff)
  • Add tests for new features
  • Update documentation as needed
  • Ensure all quality checks pass

๐Ÿ“„ License

MIT License - see LICENSE file for details.