github / github/github-mcp-server

Use GitHub-signed commits for repository file write tools

未关闭
#2,771 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
33k
派生
5k
平均合并
2 天 1 小时
30 天内合并 PR
52

描述

## Summary

Repository write tools such as `create_or_update_file` and `push_files` can create unsigned commits. In repositories that require verified commit signatures, the MCP-created pull request is then blocked with:

> Commits must have verified signatures.

## Reproduction

1. Use the MCP server against a repository with a ruleset/branch protection rule requiring signed commits.
2. Create a branch.
3. Use `create_or_update_file` or `push_files` to write a commit.
4. Open a pull request.

## Actual behavior

The commit can be reported by GitHub as `verification.verified=false` with `verification.reason=unsigned`, and the pull request cannot be merged while the signed-commit rule is active.

## Expected behavior

Repository write tools should use a GitHub API path that can produce GitHub-verified commits when supported by the authenticated actor, so MCP-generated pull requests can satisfy signed-commit requirements without clients managing GPG or SSH signing keys.

## Notes

I verified in an internal test repository that switching the file write to GraphQL `createCommitOnBranch` produced a commit with:

- `verification.verified=true`
- `verification.reason=valid`

The existing `delete_file` implementation already avoids the simpler REST contents deletion path because of commit signing behavior. The same issue can affect create/update and multi-file writes.

## Proposed fix

Use GraphQL `createCommitOnBranch` for `create_or_update_file` and `push_files`, keeping the existing tool inputs and response shape as much as possible.

贡献指南

打开贡献指南

调研方向

Start with the implementations of create_or_update_file and push_files, then compare them with the existing delete_file path and its use of GitHub APIs. Investigate GraphQL createCommitOnBranch and preserve the existing tool inputs and response shape. Done means writes produce GitHub-verified commits when supported and pull requests satisfy signed-commit requirements.

由索引模型根据 Issue 内容生成。

评估

技术栈
go, graphql
领域
api, backend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。