mcp-pr-companion
The server generates compact, agent-ready JSON payloads from Pull Request diffs, optimized for AI PR description generation.
Generate PR payloads (
generate_pr_payload): Extract diffs, commits, and AST categorizations from a Bitbucket PR URL or local Git branch comparison into a ~1-2KB schema.Manage manifests and cache: Retrieve PR manifests (
get_pr_manifest), check sync status (get_pr_sync_status), and refresh data from Bitbucket (refresh_pr_data) with deterministic revision caching.Analyze file changes (
get_pr_file_changes): Obtain per-file AST highlights, risk tags, and hunk statistics.Optimize for AI: Reduce token usage by up to 90%, employ async batch syncing with concurrency and backoff.
Ensure security: Scoped API tokens, sensitive data redaction, and write-safety mechanisms.
Fetches pull request metadata, commit history, and diffs from Bitbucket Cloud to generate a compact JSON summary for AI-powered PR description generation.
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., "@mcp-pr-companionGenerate PR payload for https://bitbucket.org/workspace/repo/pull-requests/123"
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.
π mcp-pr-companion
mcp-pr-companion is a dual-interface local pre-processing system (supporting Bitbucket Cloud REST API v2 & local Git diffs) designed to convert Pull Requests into compact, Adaptive AI Context Packs optimized for AI Coding Assistants and AI Agents.
π 1. Features Overview
Adaptive AI Context Strategy:
Dynamically tailors context pack structures based on PR size and risk level across 4 modes:
skim,standard,inspect_priority_files, anddeep_review.Automatically generates an explicit Read Strategy section guiding AI agents on required next files, optional next files, and skipped categories to optimize token efficiency (70% - 95% token savings).
Moves full file lists into
files.md, keepingcontext.mdultra-compact (0.5 β 1KB for comment-only PRs).
Schema v4 & Atomic Revision Storage:
Multi-revision storage engine featuring atomic write staging to prevent partial writes.
Manages active revision pointers via
current.json(context_path,files_summary_path,actions_path,manifest_path,ai_reading_mode).
MCP Server & Dual-Interface Architecture:
Local MCP Server over stdio: Exposes MCP tools (
get_pr_context_pack,get_pr_file_context,search_pr_files,get_pr_manifest,get_pr_sync_status,refresh_pr_data) for direct integration with AI IDEs and Agents.Terminal UI (
npm run cmd): Interactive TUI for token configuration, PR link registry management, cache warming, and log inspection.One-Command Auto Sync (
npm run mcp-pr-companion): Automated sequential discovery, filtering, and context pack generation for all OPEN pull requests owned by the user.
AST Analyzer & Secret Redacting Security:
Classifies change kinds (
comment_only,functional_logic,public_api,database_schema,auth_security,configuration, etc.).Extracts source code AST symbols (functions, methods, HTTP routes).
Automatically scans and redacts tokens/passwords via
Redactor(ATBB****abcd).Enforces account identity locking (
author.uuid) to prevent cross-account PR data leakage.
Related MCP server: MCP Merge Request Summarizer
π οΈ 2. Available Commands
Command | Description |
| Launches the interactive Terminal UI (TUI) to configure API tokens, manage PR link registry, warm local cache, and inspect sync logs. |
| Launches the Terminal UI using compiled JavaScript assets in |
| Runs the One-Command Auto Runner: Authenticates session, discovers all OPEN pull requests for the active user, and syncs/generates context packs automatically. |
| Runs the One-Command Auto Runner using compiled JavaScript assets in |
| Starts the Local MCP Server in production mode over stdio transport for AI Agent connections. |
| Starts the MCP Server in development mode with |
| Compiles TypeScript source files ( |
| Runs the complete Automated Test Suite (Unit tests, Schema Contract validation, Referential Integrity, Aggregate validation, 9 Golden Scenarios, Atomic Write Rollback, and Orchestration tests). |
| Initializes local environment, directory structures, and default configuration templates. |
| Verifies required Node.js package dependencies. |
| Automatically installs missing Node.js dependencies. |
| Performs pre-flight environment checks (Node.js version, Git CLI availability). |
| CLI runner for generating single PR payloads. |
π 3. Feature Workflow
The diagram below illustrates the end-to-end pipeline from PR request to Adaptive AI Context Pack generation and MCP serving:
flowchart TD
A[PR Sync Request / MCP Tool Call] --> B{Request Source}
B -- Terminal UI / CLI --> C[Bitbucket API / Local Git]
B -- MCP Server Tool Call --> C
C --> D[Authenticate & Filter Author UUID]
D --> E[Fetch Diffs, Commits & Metadata]
E --> F[AST Analyzer & Risk Analyzer]
F --> G[Classify Change Kind & Risk Tags]
G --> H[ContextModeClassifier]
H -->|Evaluate File Count & Risk Level| I{Select Context Mode}
I -- total_files <= 3 & comment_only --> J[Mode: skim]
I -- standard logic changes --> K[Mode: standard]
I -- public_api / database_schema --> L[Mode: inspect_priority_files]
I -- overall_risk high/critical or files > 30 --> M[Mode: deep_review]
J --> N[Generate Read Strategy & Markdown Context]
K --> N
L --> N
M --> N
N --> O[Atomic Revision Writer]
O --> P[Persist Staging Directory Atomically]
P --> P1[context.md - Adaptive Pack]
P --> P2[files.md - Full File Index]
P --> P3[files/file_XXXX.md - File Details]
P --> P4[manifest.json & current.json]
P1 & P2 & P3 --> Q[Serve MCP Client / AI Agent]π Runtime Directory & Context Output Layout
Generated context packs are structured as follows:
ai-context/{company}/{app}/{feature}/{repo}_{PR-ID}/
βββ context.md # Primary AI Entrypoint (Adaptive Markdown Context Pack)
βββ files.md # Complete Changed Files Index & Categorization Table
βββ actions.md # Tool Action Summary & Coverage Metadata
βββ current.json # Pointer to Active Revision & Reading Mode
βββ manifest.json # Structured Metadata Manifest (v4 Schema)
βββ files/ # Per-file AI Detail Markdown Files
β βββ file_0001.md
β βββ file_0002.md
βββ revisions/ # Revision History Subdirectory
βββ rev_xxxx_yyyy/Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Related MCP Servers
- Flicense-qualityDmaintenanceA lightweight tool that uses Mistral AI running locally to generate structured GitHub pull request descriptions from git diffs.
- Alicense-qualityDmaintenanceAutomatically generates comprehensive merge request summaries from git logs, analyzing commit history and categorizing changes into structured descriptions. Provides tools to analyze git repositories, compare branches, and create detailed summaries with change categorization, impact analysis, and review time estimates.1MIT
- Flicense-qualityFmaintenanceIntelligent PR boundary detection and recommendation system that analyzes git changes to generate atomic, logically-grouped pull request suggestions with titles, descriptions, and rationale.
- AlicenseBqualityDmaintenanceEnables AI assistants to read Bitbucket Cloud pull requests and diffs through natural conversation.229MIT
Related MCP Connectors
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.β¦
Screens public GitHub repos and PRs to generate risk maps, findings, and merge-readiness signals.
Provide your AI coding tools with token-efficient access to up-to-date technical documentation forβ¦
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/Ninh-Duong/mcp-pr-companion'
If you have feedback or need assistance with the MCP directory API, please join our Discord server