Home / Servers / GitHub API / repos_update_branch_protection

Update branch protection

An MCP tool from the GitHub API server, hosted on mcp.hjlabs.in.

Update branch protection Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise… [PUT /repos/{owner}/{repo}/branches/{branch}/protection]

Name on the gateway: github_api__repos_update_branch_protection · may change things.

Parameters

NameTypeDescription
owner requiredstringThe account owner of the repository. The name is not case…
repo requiredstringThe name of the repository without the .git extension. The…
branch requiredstringThe name of the branch. Cannot contain wildcard…
required_status_checks requiredobjectRequire status checks to pass before merging. Set to null to disable.
enforce_admins requiredbooleanEnforce all configured restrictions for administrators. Set to true to enforce…
required_pull_request_reviews requiredobjectRequire at least one approving review on a pull request, before merging. Set…
restrictions requiredobjectRestrict who can push to the protected branch. User, app, and team…
required_linear_historybooleanEnforces a linear commit Git history, which prevents anyone from pushing merge…
allow_force_pushesbooleanPermits force pushes to the protected branch by anyone with write access to…
allow_deletionsbooleanAllows deletion of the protected branch by anyone with write access to the…
block_creationsbooleanIf set to true, the restrictions branch protection settings which limits who…
required_conversation_resolutionbooleanRequires all conversations on code to be resolved before a pull request can be…
lock_branchbooleanWhether to set the branch as read-only. If this is true, users will not be…
allow_fork_syncingbooleanWhether users can pull changes from upstream when the branch is locked. Set to…

How to call it

Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:

call_tool arguments
{
  "name": "github_api__repos_update_branch_protection",
  "arguments": {
    "owner": "…",
    "repo": "…",
    "branch": "…",
    "required_status_checks": "…",
    "enforce_admins": true,
    "required_pull_request_reviews": "…",
    "restrictions": "…"
  }
}

Or connect the GitHub API server directly, which lists 1,221 tools including this one:

Run in your terminal
claude mcp add --transport http hj-github-api https://mcp.hjlabs.in/mcp/github-api \
  --header "Authorization: Bearer YOUR_API_KEY"

Try asking

Use the update branch protection tool with owner set to ….

More from GitHub API