commit-to-pr-mcp
Automatically detects repository information and identifies git references such as commit hashes or branch names within local working directories to resolve them into pull requests.
Retrieves comprehensive GitHub pull request data, including titles, descriptions, labels, and review history, by using the GitHub CLI to resolve commit hashes or PR numbers.
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., "@commit-to-pr-mcpshow me the pull request details for commit 8f2a1b"
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.
commit-to-pr-mcp
An MCP (Model Context Protocol) server that enables AI agents to extract PR details from git commit hashes using the GitHub CLI.
Features
Commit to PR Resolution: Automatically extracts PR numbers from commit hashes, merge commits, and squash commits
Auto-Detection: Automatically detects GitHub repository from git working directory
Comprehensive PR Data: Retrieves full PR details including title, description, author, status, labels, and reviews
Flexible Input: Accepts commit hashes (full or short), branch names, or direct PR numbers
Type-Safe: Built with TypeScript and Zod for runtime validation
Related MCP server: GitHub MCP Server
Prerequisites
Node.js >= 18.0.0
GitHub CLI installed and authenticated (
gh auth login)An MCP-compatible client (Cursor, Claude Desktop, VS Code, etc.)
Installation
Getting Started
First, install the commit-to-pr-mcp server with your client.
Standard config works in most tools:
{
"mcpServers": {
"commit-to-pr": {
"command": "npx",
"args": [
"commit-to-pr-mcp@latest"
]
}
}
}Use the Claude Code CLI to add the server:
claude mcp add commit-to-pr npx commit-to-pr-mcp@latestAdd to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"commit-to-pr": {
"command": "npx",
"args": ["commit-to-pr-mcp@latest"]
}
}
}Click the button to install:
Or install manually:
Go to Cursor Settings β MCP β Add new MCP Server. Name to your liking, use command type with the command npx commit-to-pr-mcp@latest. You can also verify config or add command arguments via clicking Edit.
Project-Specific Configuration
Create .cursor/mcp.json in your project root:
{
"mcpServers": {
"commit-to-pr": {
"command": "npx",
"args": ["commit-to-pr-mcp@latest"]
}
}
}Follow the MCP install guide, use the standard config above.
Alternatively, install using the VS Code CLI:
code --add-mcp '{"name":"commit-to-pr","command":"npx","args":["commit-to-pr-mcp@latest"]}'Add via the Cline VS Code extension settings or by updating your cline_mcp_settings.json file:
{
"mcpServers": {
"commit-to-pr": {
"command": "npx",
"args": [
"commit-to-pr-mcp@latest"
]
}
}
}Follow the MCP Servers documentation. Use the standard config above.
Local Development
For local development and testing:
{
"mcpServers": {
"commit-to-pr": {
"command": "node",
"args": ["/absolute/path/to/commit-to-pr-mcp/dist/index.js"],
"env": {
"LOG_LEVEL": "debug"
}
}
}
}Verify Installation
After installation, verify commit-to-pr-mcp is working:
Restart your MCP client completely
Check connection status:
Cursor: Look for green dot in Settings β Tools & Integrations β MCP Tools
Claude Desktop: Check for "commit_to_pr" in available tools
VS Code: Verify in GitHub Copilot settings
Test with a simple query:
Get PR details for commit abc123
If you see the AI agent use the get_pr tool and return PR information, you're all set! π
Usage
The server provides a single tool: get_pr
Basic Example: Get PR from Commit Hash
{
"commit": "abc123def456",
"repo": "owner/repo" // Optional: auto-detected from git working directory
}Example: Get PR from Branch Name
{
"commit": "feature/new-feature",
"cwd": "/path/to/repo" // Optional: specify working directory for auto-detection
}Example: Get PR by Number Directly
{
"pr_number": 42,
"repo": "owner/repo" // Optional: auto-detected from git working directory
}Example: Auto-Detect Repository
When working in a git repository, you can omit the repo parameter:
{
"commit": "abc123"
// Repository is automatically detected from git remote
}Tool Parameters
get_pr
Get PR details by commit hash or PR number. Extracts PR number from git commits (merge commits, squash commits) and returns full PR details.
Parameters:
commit(optional): Git commit hash (full or short), branch name, or any git reference. Use this ORpr_number.pr_number(optional): PR number to look up directly. Use this ORcommit.repo(optional): GitHub repository inowner/repoformat. If not provided, auto-detects fromcwdor current working directory.cwd(optional): Working directory path to auto-detect the GitHub repository from git remote.
Note: Either commit or pr_number must be provided.
Response Format
The tool returns a structured response:
{
"number": 42,
"title": "Add new feature",
"body": "This PR adds a new feature...",
"state": "MERGED",
"url": "https://github.com/owner/repo/pull/42",
"author": "username",
"createdAt": "2025-01-15T10:30:00Z",
"mergedAt": "2025-01-16T14:20:00Z",
"baseRef": "main",
"headRef": "feature/new-feature",
"labels": ["enhancement", "ready-for-review"],
"reviews": [
{
"author": "reviewer1",
"state": "APPROVED",
"submittedAt": "2025-01-16T12:00:00Z"
},
{
"author": "reviewer2",
"state": "CHANGES_REQUESTED",
"submittedAt": "2025-01-16T13:00:00Z"
}
]
}Response Fields
number: PR numbertitle: PR titlebody: PR description/body textstate: PR state (OPEN,CLOSED,MERGED)url: GitHub URL to the PRauthor: PR author usernamecreatedAt: Creation timestamp (ISO 8601)mergedAt: Merge timestamp (ISO 8601),nullif not mergedbaseRef: Target branch nameheadRef: Source branch namelabels: Array of label namesreviews: Array of review objects withauthor,state, andsubmittedAt
How It Works
The server uses the GitHub CLI (gh) to:
Extract PR number from commits:
Searches PRs containing the commit hash
Parses merge commit messages (
Merge pull request #123)Parses squash commit messages (
(#123))
Retrieve PR details:
Fetches comprehensive PR information via
gh pr viewIncludes reviews, labels, and metadata
Auto-detect repository:
Reads
git remote get-url originfrom the working directoryExtracts
owner/repoformat from the remote URL
Development
Setup
npm install
npm run buildTesting
For local testing:
Build the project:
npm run buildConfigure your MCP client to use the local build (see Local Development section above)
Test with an MCP Inspector or client
Development Scripts
npm run build: Compile TypeScript to JavaScriptnpm run start: Run the compiled servernpm run dev: Run the server in development mode withtsx
Architecture
src/
βββ index.ts # Main server implementation
βββ Tool handlers # get_pr tool logic
βββ Git utilities # Repository detection
βββ GitHub CLI # PR extraction and detailsLicense
ISC
Contributing
Contributions welcome! Please read the contributing guidelines and submit a PR.
Related Projects
Available Tools
1 toolget_prA
Get PR details by commit hash or PR number. Extracts PR number from git commits (merge commits, squash commits) and returns full PR details including title, description, author, status, and reviews. Auto-detects repository from working directory.
| Name | Required | Description | Default |
|---|---|---|---|
| commit | No | Git commit hash (full or short), branch name, or any git reference. Use this OR pr_number. | |
| pr_number | No | PR number to look up directly. Use this OR commit. | |
| repo | No | GitHub repository in owner/repo format. If not provided, auto-detects from cwd. | |
| cwd | No | Working directory path to auto-detect the GitHub repository from git remote. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses key behavioral traits: it can extract PR numbers from git commits (merge/squash), auto-detects repositories from the working directory, and returns specific PR details. However, it omits information on error handling, rate limits, authentication needs, or what happens if inputs are invalid, leaving gaps in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the core purpose and efficiently covers key features in three sentences. It avoids redundancy, but could be slightly more concise by integrating the auto-detection note into the first sentence. Overall, it's well-structured with minimal waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 4 parameters with full schema coverage and no output schema, the description is moderately complete. It explains the tool's functionality and input options but lacks details on output format, error cases, or performance limits. For a tool with no annotations, this leaves room for improvement in guiding an AI agent effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description adds some context by mentioning 'auto-detects repository from working directory' and 'Extracts PR number from git commits', which clarifies the repo and commit parameters beyond the schema. However, it doesn't provide additional syntax or format details, so it meets but doesn't exceed expectations.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verbs ('Get PR details', 'Extracts PR number', 'returns full PR details') and resources ('by commit hash or PR number', 'from git commits', 'including title, description, author, status, and reviews'). It distinguishes itself by explaining its dual input capability and auto-detection feature, though no siblings exist for comparison.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage through phrases like 'Use this OR pr_number' and 'If not provided, auto-detects from cwd', which suggest when to use certain parameters. However, it lacks explicit guidance on when to choose this tool over alternatives (though none exist) or any prerequisites, making it adequate but not comprehensive.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly distinct as it is the only tool available.
The single tool name 'get_pr' follows a clear verb_noun pattern. With only one tool, naming consistency is inherently perfect as there are no other tools to compare against.
A single tool is too few for most practical server purposes, as it severely limits functionality and scope. While the tool is specific, the server's capability is minimal and likely insufficient for comprehensive workflows.
The server's domain appears to be PR-related operations, but with only a 'get' tool, there are significant gaps. It lacks create, update, delete, or other PR management functions, making the surface incomplete for typical PR workflows.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
A MCP server built for developers enabling Git based project management with project and personalβ¦
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.β¦
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that wraps around the GitHub CLI tool, allowing AI assistants to interact with GitHub repositories through commands for pull requests, issues, and repository operations.25MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI agents to directly manage GitHub repositories, including PRs, issues, and code search, using natural language.MIT
- FlicenseAqualityDmaintenanceA minimal MCP server that exposes a focused set of GitHub PR review tools to AI agents, enabling PR listing, detail retrieval, comment viewing, and thread management.5
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides tools for interacting with the GitHub API, enabling AI assistants to query repositories, pull requests, issues, commits, users, and more.467ISC
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/vltansky/commit-to-pr-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server