pr-mcp
v1.0.1
Published
AI-powered GitHub PR creation MCP server for Cursor, Claude Desktop, Windsurf, etc.
Downloads
192
Maintainers
Readme
PR MCP
AI-powered GitHub PR creation for Cursor, Claude Desktop, Windsurf, and other MCP-compatible editors.
Why MCP?
Unlike the CLI version where you run commands manually, the MCP server lets your AI IDE directly create PRs:
You: "Create a PR for my changes"
Cursor: [analyzes diff, generates description, creates PR]
✅ PR created: https://github.com/you/repo/pull/42No copy/paste. No switching windows. Just ask.
Quick Install
# Clone and install
git clone https://github.com/USER/pr-mcp.git
cd pr-mcp
npm install
# Or install globally
npm install -g pr-mcpSetup for Cursor
Add to your Cursor MCP config (~/.cursor/mcp.json or project .cursor/mcp.json):
{
"mcpServers": {
"pr-mcp": {
"command": "node",
"args": ["/path/to/pr-mcp/index.js"]
}
}
}Or if installed globally via npm:
{
"mcpServers": {
"pr-mcp": {
"command": "npx",
"args": ["pr-mcp"]
}
}
}Restart Cursor after adding the config.
Setup for Claude Desktop
Add to Claude Desktop config:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"pr-mcp": {
"command": "node",
"args": ["/path/to/pr-mcp/index.js"]
}
}
}Setup for Windsurf / Continue / Others
Most MCP-compatible editors use similar config. Add the server with:
- Command:
node(ornpx) - Args: path to
index.js(orpr-mcpif installed via npm)
Available Tools
| Tool | Description |
|------|-------------|
| analyze_changes | Analyze git diff, commits, changed files |
| generate_pr_description | Get context for AI to generate PR description |
| create_pr | Create the GitHub PR |
| preview_pr | Preview PR without creating |
| get_repo_config | Show .pr-mcp.json settings |
Usage Examples
Basic PR Creation
You: Create a PR for my changes
AI: I'll analyze your changes and create a PR.
[calls analyze_changes]
[calls create_pr with generated description]
✅ PR Created!
Title: [TK-1234] add user authentication
URL: https://github.com/you/repo/pull/42With Specific Options
You: Create a draft PR targeting main, add @alice as reviewer
AI: [calls create_pr with draft=true, target=main, reviewers=alice]
✅ Draft PR created...Preview First
You: Show me what the PR would look like
AI: [calls preview_pr]
## PR Preview
Title: [TK-1234] add user auth
Branch: feature/tk-1234-auth → develop
...Analyze Changes
You: What changes am I about to PR?
AI: [calls analyze_changes]
## Git Analysis
Commits: 3
- abc123 add login endpoint
- def456 add auth middleware
- ghi789 add tests
...Per-Repo Configuration (Optional)
Create .pr-mcp.json in your repo root:
{
"reviewers": ["alice", "bob"],
"targetBranch": "main",
"draft": false,
"customPrompt": "Focus on security implications",
"excludeFiles": ["package-lock.json"]
}The MCP server automatically reads this and applies:
- Default reviewers
- Default target branch
- Custom AI instructions
- Draft PR by default
Requirements
- Node.js >= 18
- GitHub CLI (
gh) installed and authenticated - Git repository with GitHub remote
How It Works
┌─────────────────┐
│ Your IDE │
│ (Cursor/Claude) │
└────────┬────────┘
│ MCP Protocol
▼
┌─────────────────┐
│ PR MCP Server │
│ (this tool) │
└────────┬────────┘
│ Git + GitHub CLI
▼
┌─────────────────┐
│ GitHub │
└─────────────────┘- You ask your AI to create a PR
- AI calls MCP tools to analyze changes
- AI generates description based on diff
- AI calls
create_prtool - Server uses
ghCLI to create PR - You get the PR URL
"Not in a git repository"
Make sure you have a file open from a git repository, or specify working_directory.
"gh: command not found"
Install GitHub CLI: https://cli.github.com/
Then authenticate: gh auth login
PR creation fails
Check:
# Is gh authenticated?
gh auth status
# Can you create PR manually?
gh pr create --helpLicense
MIT
