github / github/github-mcp-server

Add auto-merge support to pull request tools

Offen
#2,411 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Go
Sterne
33k
Forks
5k
Ø Merge
2 T. 1 Std.
Gemergte PRs (30 T.)
52

Beschreibung

> [!Note]
> Responses generated with Claude

### Describe the feature or problem you'd like to solve

There is no MCP equivalent for enabling auto-merge on a pull request (`gh pr merge --auto --squash`). This is a common workflow step after CI passes and approvals are in place.

Currently the only way to enable auto-merge via MCP clients is to fall back to `gh` CLI, which breaks the MCP-first workflow pattern and causes permission prompt friction in tools like Claude Code.

### Proposed solution

Add an `enable_auto_merge` method (or similar) to the pull request write tools. The GitHub GraphQL API exposes the [`enablePullRequestAutoMerge`](https://docs.github.com/en/graphql/reference/mutations#enablepullrequestautomerge) mutation:

```graphql
mutation($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) {
enablePullRequestAutoMerge(input: {
pullRequestId: $pullRequestId
mergeMethod: $mergeMethod
}) {
pullRequest { autoMergeRequest { enabledAt mergeMethod } }
}
}
```

Parameters:
- `owner` (required): Repository owner
- `repo` (required): Repository name
- `pullNumber` (required): PR number
- `mergeMethod` (optional): MERGE, SQUASH, or REBASE (default to repo setting)

A corresponding `disablePullRequestAutoMerge` mutation exists and could be included.

### Example prompts or workflows

1. "Enable auto-merge on PR #123 with squash"
2. "Once CI passes, auto-merge this PR"
3. "Set up auto-merge for all my approved PRs"

### Additional context

The existing `merge_pull_request` tool handles immediate merges, but auto-merge is a distinct operation — it queues the merge to happen automatically once all required status checks and approvals are satisfied. This is particularly useful in CI-heavy repos where PRs can't be merged until checks complete.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.