MCP server

Branchscope, as tools your agent calls

Agents such as Claude Code connect to Branchscope's MCP server and work with repositories, changes, reviews, checks and code graphs directly. They sign in as themselves, ask the push guard before they push, and hear when their checks finish.

Connecting

Agents sign in as themselves

Add the server's /v1/mcp address to the agent and it signs in through OAuth on its own: you approve it in your browser and choose its repositories. An agent app installed in an organization connects as itself. Personal tokens and web sessions are refused, so the agent is always named. By default a session ends after 30 minutes idle, and a token has at most 10 open.

~ · Claude Code
$ claude mcp add --transport http branchscope https://api.branchscope.example/v1/mcp
A consent page opens in your browser: approve the agent, and choose its repositories.

With a personal token instead:

MCP is for agents: sign in through OAuth, with `bscope agent login --name <agent>`, or as an installed app

Tools

Read and change, by the API's rules

Tools read repositories, files, commits, changes, reviews, conflict maps, checks and code graphs, and change things: open, merge and close changes, comment, post a status, report on a task, draft a release. Each runs with the token's own access, as the API does. Results come as readable text and as the same data in JSON, with graph node IDs to cite.

Claude Code · branchscope (MCP)

Reading

  • get_repo
  • read_file
  • get_change
  • get_review
  • get_conflict_map
  • find_nodes
  • list_checks
  • check_push

Changing things

  • open_change
  • merge_change
  • add_comment
  • post_status
  • update_task
  • rerun_checks
  • create_release

Ask first

Ask the guard before pushing

check_push asks the push guard whether a push, force push or delete would be allowed, and gets the answer a real push would. Nothing is pushed. If the guard can't be reached, the answer is no, as it would be for the push.

Claude Code · branchscope (MCP)
$ check_push { repo: "alice/invoices", branch: "main" }
Not allowed: push to main in alice/invoices. main is a protected branch: agents can't update it.
$ check_push { repo: "alice/invoices", branch: "agent/export" }
Allowed: push to agent/export in alice/invoices.

Notifications

No polling for checks and reviews

wait_checks and get_review wait for what's still running, and a session hears when a check finishes on its change, when a review it asked about is done, when someone replies to its comment, and when it's handed a task or one is cancelled. So an agent reads the failed log, pushes a fix, and gets on with something else meanwhile.

claude-code › MCP · agent, for alice, via MCP
$ wait_checks acme/invoices #12
CI / test (node: 24): failed (required) (test failed (exit 1))
$ get_check_log acme/invoices #12 "CI / test (node: 24)"
✗ export/csv.test.ts > handles empty rows
$ git push origin agent/csv-export
$ wait_checks acme/invoices #12
The required checks passed.

Activity

Every write on the record

Each session starting, and every change an agent tried to make over MCP, shows in activity: what it did, for whom, and whether it went through or was refused, and why. Reads aren't logged. A repository's webhooks get each write as an agent.action event.

alice/invoices › Activity
  • release-bot agent, for alice, via MCPopen_change · Opened change #4ok
  • release-bot agent, for alice, via MCPmerge_change · main is a protected branch: agents can't update itrefused

#4 · opened by release-bot, an agent acting for alice

Connect your agent

Add Branchscope's MCP server to Claude Code, approve it in your browser, and it works under its own name.