Skip to content

MCP setup

BareCI’s MCP server is at https://api.bareci.com/mcp, over Streamable HTTP. Every tool is a route of the /v1 JSON API called with your own token, so every scope and organisation check applies unchanged.

Terminal window
bareci login

login signs in with a one-time code in the browser and stores an agent token for this machine. For an agent elsewhere, create a token with the scopes it needs (read, run, operate) and give it as BARECI_TOKEN. See Organisations, tokens and spend.

Most MCP clients take a server definition like this:

{
"mcpServers": {
"bareci": {
"type": "http",
"url": "https://api.bareci.com/mcp",
"headers": { "Authorization": "Bearer ${BARECI_TOKEN}" }
}
}
}

With Claude Code:

Terminal window
claude mcp add --transport http bareci https://api.bareci.com/mcp --header "Authorization: Bearer $BARECI_TOKEN"

Ask the agent to call whoami. It answers the token’s kind, scopes and the organisations it may act for.

  • Revision 2026-07-28: stateless, probe with server/discover.
  • The legacy initialize handshake for 2025-11-25, 2025-06-18 and 2025-03-26, so older clients connect too.
  • The dashboard’s session cookie is never accepted here; only bearer tokens.

Every tool result is structured and carries next: the next action in one sentence, usually with the tool and arguments that do it. Errors come back as tool errors with a hint. The server’s instructions give the usual loop:

  1. run_create to test the worktree on a BareCI machine, then run_logs until done.
  2. After pushing, ready answers whether the pull request may merge and names the fix for each reason it may not.
  3. findings lists every reviewer’s open findings; fix or dispute each, then finding_resolve.
  4. flows_run tests the pull request’s preview with the repository’s Flows.

The browser_* tools drive a real browser, so they run where the browser is: the local MCP server in the CLI, bareci mcp. It serves the browser tools itself and passes every other tool through to the hosted server with this machine’s token. The hosted /mcp does not list them.

bareci mcp speaks MCP over standard input and output. It uses the token from bareci login (or BARECI_TOKEN), and runs the browser through the Flows package’s bareci-flows-mcp. It looks for that next to bareci, then on PATH, then at BARECI_FLOWS_MCP. It runs a repository’s own copy from node_modules only with --project-flows, so a checkout cannot make it run a program of its choosing:

Terminal window
bun add -d @bareci/flows
bunx playwright install chromium
claude mcp add bareci -- bareci mcp --project-flows

Or, for clients that take a server definition:

{
"mcpServers": {
"bareci": { "command": "bareci", "args": ["mcp", "--project-flows"] }
}
}

The browser host gets no BareCI credentials, and its browsers stop when bareci mcp ends or is stopped. Signed out, only the browser tools work. Without the Flows package, tools/list leaves the browser tools out and calling one answers how to install it. BARECI_FLOWS_MCP names the browser host (bareci-flows-mcp) when it is not in node_modules/.bin or on PATH.

See the API reference for every tool’s arguments, answer, route and scope.