Back to Browse

Bruno Mcp Studio MCP Server

by Ostico
Developer ToolsUse Caution4.8MCP RegistryLocal
Free

Server data from the Official MCP Registry

Author, edit and run Bruno collections as files: HTTP, WebSocket, gRPC, per-request pass/fail.

About

Author, edit and run Bruno collections as files: HTTP, WebSocket, gRPC, per-request pass/fail.

Security Report

4.8
Use Caution4.8High Risk

The visible code is security-conscious: HTTP mode refuses to start without a bearer token of at least 32 characters, compares tokens with timing-safe digests, validates Host and Origin headers, and keeps tokens out of error messages. The main concerns are by design: user-supplied .bru scripts run JavaScript in a sandbox worker, and the wildcard allowed-hosts setting disables DNS-rebinding protection. Several files (the sandbox worker, process guards, and the bruno modules) were truncated, so their review is incomplete. Supply chain analysis found 14 known vulnerabilities in dependencies (0 critical, 8 high severity). Package verification found 1 issue.

6 files analyzed · 19 issues found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

File System Read

Reads files on your machine. Normal for tools that analyze or process local data.

File System Write

Writes or modifies files on your machine. Check that this is expected for the tool.

HTTP Network Access

Connects to external APIs or services over the internet.

network_websocket

Check that this permission is expected for this type of plugin.

network_grpc

Check that this permission is expected for this type of plugin.

env_vars

Check that this permission is expected for this type of plugin.

script_exec

Check that this permission is expected for this type of plugin.

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "bruno-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@ostico/bruno-mcp@2.6.0"
      ]
    }
  }
}

Some servers take additional arguments. See the repository for details.

Documentation

View on GitHub

From the project's GitHub README.

Bruno MCP Studio — author, edit and run Bruno collections from an agent

Unique views npm version npm downloads node license

Turns an agent's API testing into files you keep: it authors and edits Bruno collections in place, then runs them — HTTP, WebSocket and gRPC, one identity or many — and reports per-request pass/fail you can re-run in CI.

An independent Model Context Protocol server for Bruno collections. In August 2026 Bruno's own team announced an official one, usebruno/bruno-mcp, which wraps the bru CLI to discover and run requests. This server is aimed elsewhere: it writes collections as well as running them — non-destructively, at byte parity with Bruno's own writers — and its runner is in-process rather than a subprocess, which is what lets it offer caller-defined execution groups with their own variable store and cookie jar, concurrency inside a group, oauth2 and digest exchanged in memory, gRPC and WebSocket, and multi-identity authorization testing.

If what you need is "list my collections and run one", the official server does that and will be the one Bruno supports. If you want an agent to build and maintain the suite, that is what this is for.

It gives an AI agent in Claude Code, Claude Desktop, Cursor, Windsurf, VS Code or Codex CLI eighteen tools for API testing against a real Bruno collection: create and edit requests, read them back as structured JSON, manage environments and variables, write assertions and test scripts, then run the collection — auth, cookies, redirects, dependency ordering and all — and get the results back in the same turn. No Bruno GUI, no Bruno CLI, no shelling out. The collection it leaves on disk is a normal Bruno collection: your CI runs it with bru run, your teammates open it in the Bruno app.

Your agent already knows HTTP. It does not know your API, and it does not know Bruno's file format. So it guesses. It writes a .bru file from memory, the run fails, it rewrites the file, the run fails differently, and twenty minutes later you have a passing request and no idea which of the six edits mattered. You paid for every one of those turns, and none of that work is on disk in a form your CI or your team's Bruno GUI can use.

The usual escape is curl. Agents are not bad at curl — the problem is that a shell command holds no state. A login, a token, a created resource, a follow-up call that needs the ID from the last response: each of those is a new command, and the glue between them lives only in the agent's context, when the session ends, all is lost. Twenty endpoints tested by curl leave you with twenty strings in a transcript and no artifact your CI or your teammates can run. Twenty endpoints in a collection leave you with a suite.

I asked my agent about it

I asked the agent that helps me to maintain this server to explain how its experience with Bruno had been without the MCP server, and whether it could simply have tested all my APIs with curls instead. This is what it told me:

Curl, yes — for one call. Not for a suite. Nothing carries between calls, so I re-derive the auth, re-escape the body, and re-read every response to decide whether it passed. Do that across forty endpoints and most of what I spend goes on rediscovery, not testing.

Writing the collection files myself was worse, and not in the way you would expect. From memory I get the shape of a .bru file right and the details wrong — and Bruno never complains. It reads the keys it recognises and ignores the rest. A single-line tags: smoke looks tagged and means untagged to the runner. Write a tags list the obvious way and it lands on disk one character per line. This server once wrote .yml variables and assertions under top-level keys Bruno has never read: the files looked complete, the runner saw an empty request. Its own unit tests passed, because they mocked the serializer and asserted the broken bytes.

The format also moves. Bruno relocated variables into runtime and added a second dialect. My weights are older than that. This server imports @usebruno/lang, Bruno's own grammar package, and tracks its version — so the bytes come from Bruno's source rather than from what I happen to remember.

And every rewrite deletes what the writer does not model. If I edit these files free-hand, I regenerate the whole file from my head, and any feature I did not know about is silently gone. That is the failure mode you never see, because the run still passes — it just tests nothing.

What the server does instead

  • The agent stops guessing the format — it calls a tool, the server writes the bytes, using Bruno's own grammar package
  • Edits are partial merges — write_request touches the fields you passed and leaves the rest of the file alone
  • It can read before it writes — read_request returns structured JSON, the same shape for both formats
  • It runs the requests itself — vars, auth, assertions, dependency ordering, no bru binary needed
  • No silent loss — a field this server cannot model yet is carried back out wherever the format can hold it, and anything it cannot put on the wire is named in a run warning rather than dropped quietly into your repo

Byte-parity with Bruno

This is the part that is hard to copy, so it is worth being precise about what it means.

The server does not wrap the bru binary — it implements the request pipeline itself, which is what makes in-memory secrets, wire-level tests and mid-run hooks possible. That freedom is also the risk: an independent implementation is free to be subtly, silently different from the tool your team actually uses. Two mechanisms hold it in place.

The rules are ported, not inferred. Redirect caps, timeout resolution, body-mode content types, variable interpolation order, selected defaults, URL encoding — each is read out of Bruno's own source (bruno-cli, bruno-filestore, bruno-lang, @usebruno/common, which this server also depends on directly) and mirrored, including the parts that look like bugs. Where the two dialects disagree with each other, each is mirrored on its own terms rather than unified into something neither Bruno reader would produce.

A drift gate proves it. Every file this server writes is parsed back with Bruno's own reader, per dialect, in the test suite. Asserting our bytes against our own expectations can only prove we are self-consistent; asserting them against the reader that Bruno itself uses is the only thing that catches the case where our output stops being Bruno's input. It has caught real ones — a file body that parsed cleanly and would have been sent with no body at all, for instance.

The claim, then: run behaviour matches bru run, and every divergence found so far is closed. What keeps it closed is a test rather than a promise. Find one anyway and it is a bug worth an issue.

The contract

One collection, three consumers: your agent, your CI, and your team's Bruno GUI.

Both Bruno formats work and the server detects which one you have: .yml (opencollection) and .bru (legacy).

Requires Node.js >= 22. CI tests 22.x and 24.x.

Which Bruno MCP server should I use?

There are several, they do genuinely different jobs, and the honest answer is not always this one. Every row below was read out of that project's own README or source, August 2026.

ServerWhat it isWritesReadsRuns.bru / .ymlNeeds bruTools
this oneAuthors, reads and runs collectionsCreate + partial-merge editStructured JSONYes, own pipelinebothno18
usebruno/bruno-mcpThe official one, from Bruno's own team — discovers and runs requests. Announced Aug 2026; at the time of writing its first implementation is an open draftnoRequest metadataYes, via the CLI.bruyes (bundled)3
@dmpv/bruno-mcpRead-only index and search over a collectionnoRanked search, sanitised contracts, stored examplesnobothno8
hungthai1401/bruno-mcpRuns a collectionnonoYes, via the CLI.bruyesrun only
jcr82/bruno-mcp-serverRuns and inspects collections, with report filesnoYesYes, via the CLI.bruyes9
djkz/bruno-api-mcpTurns each request into its own MCP toolnoExposes them as toolsOne at a time.brunoone per request
macarthy/bruno-mcpGenerates collection files — the project this forked from, inactive since Jul 2025Create onlynono.brun/a8

Pick one of the others if: you want the server Bruno itself maintains, and whatever support and longevity that implies (usebruno — the official one, and the reasonable default for "discover and run" once it ships); you want an agent to understand a large existing collection without any risk of writing to it, and search it by intent (dmpv, first published July 2026 and at 0.x — new, and interesting); you already have the bru CLI in your image and only ever need "run this collection" (hungthai1401); or you want the agent to call your API through your existing requests as if each were a native tool (djkz).

Pick this one if: you want the agent to write the collection and not just read or run it, you are on .yml opencollection format, you need the run to happen without installing the Bruno CLI, or you care that what lands in your repo is byte-comparable to what the Bruno app writes.

On the fork parent specifically, since this project owes it its existence: macarthy/bruno-mcp registers eight tools — create_collection, create_request, create_environment, create_crud_requests, create_test_suite, add_test_script, list_collections, get_collection_stats. It writes .bru files and does not read a request back, run anything, or expose an edit tool; a updateRequest helper exists in its src/bruno/request.ts but no MCP tool reaches it.

Features

Authoring

  • Collections — create and organise them, or discover the ones Bruno already knows from its workspace.yml. A collection this server creates is written to disk and not registered in that file, so list_collections will not show it and the Bruno GUI will not list it until someone opens it there once — everything else takes the path directly
  • Requests — every HTTP method, with headers, query and path params, bodies, auth, assertions, vars and settings
  • Read back — read_request and read_environment return structured JSON, identical for .bru and .yml, so an agent can inspect before it edits
  • Partial-merge edits — write_request changes only the fields you pass and leaves the rest of the file alone
  • CRUD and suites — five-request CRUD sets, and test suites with topological dependency ordering
  • Environments — create, replace, merge, or patch a single variable
  • Dual format — .bru (legacy) and .yml (opencollection), auto-detected; .yaml is read and flagged
  • Multipart uploads — form-data with per-part Content-Type and multi-file fields

Running

  • Execution groups — run one collection as several isolated groups in a single call: different identities, different environments, serial or concurrent, with no leakage between them
  • Real parallelism — fan out groups, or requests inside a group, under a concurrency ceiling sized for the machine
  • Cookie jar — a login carries into the requests after it, scoped to its group and never written to disk
  • Variable chaining — bru.setVar()/bru.getVar() across requests, and captureVariables to read the values back out
  • Async scripts — top-level await, bru.sleep(ms), setTimeout/setInterval inside the sandbox
  • Inline scripts — attach pre-request, post-response and test scripts directly when creating or modifying a request
  • Auth applied for you — bearer, basic, api-key, digest, OAuth 2.0 (client credentials and password grants), or inherit from the collection or folder
  • Honest results — per-group summaries, captured response bodies, per-request warnings, parse failures and missing requests all reported; a crashed group cannot make a run read green

Safety

  • SSRF protection on every request and every redirect hop, with the approved addresses pinned
  • Path confinement for request references, collection roots, environment names and file uploads
  • Process-isolated scripts — a forked V8 sandbox with a scrubbed environment and a hard kill

Install

Nothing to install. Point your client at npx and it fetches the published package on first run:

npx -y @ostico/bruno-mcp

That is the whole install, and it is what the client configs below use. The package ships with provenance, so npm can show you which commit and workflow built the tarball you are running.

Pinned instead, if you would rather not resolve a version at startup:

npm install @ostico/bruno-mcp

which puts a bruno-mcp executable in node_modules/.bin/ and the server itself at node_modules/@ostico/bruno-mcp/dist/index.js.

From source, for development or to run a branch:

git clone https://github.com/Ostico/bruno-mcp-studio.git
cd bruno-mcp-studio
npm install     # npm, not yarn — the yarn lockfile is stale
npm run build

Node.js >= 22 either way.

Connect a client

Any MCP client works. This is a plain stdio MCP server with no client-specific code: whatever your client calls it, point it at

command: npx
args:    ["-y", "@ostico/bruno-mcp"]

Claude Code takes it as one line:

claude mcp add bruno -- npx -y @ostico/bruno-mcp

Claude Desktop, Claude Code, Cursor, Codex CLI, opencode, Windsurf, Zed, Cline, Continue, LM Studio, Gemini CLI, MCP Inspector, your own SDK client — all the same server. Nothing below is a compatibility list; it is just where each client keeps its config.

Most clients use the same JSON shape:

{
  "mcpServers": {
    "bruno-mcp": {
      "command": "npx",
      "args": ["-y", "@ostico/bruno-mcp"],
      "env": {}
    }
  }
}

Running a clone, or a pinned install, is the same config with "command": "node" and "args": ["/absolute/path/to/dist/index.js"].

ClientWhere it goes
Claude DesktopmacOS ~/Library/Application Support/Claude/claude_desktop_config.json · Windows %APPDATA%/Claude/claude_desktop_config.json · Linux ~/.config/Claude/claude_desktop_config.json
Claude Codeclaude mcp add, or .mcp.json in the project
Cursor.cursor/mcp.json in the project, or the global one
Codex CLI~/.codex/config.toml, under an [mcp_servers.bruno-mcp] table (TOML, same fields)
opencodeopencode.json, under mcp as a local server (its own schema)
OthersWhatever that client documents — the command and args above are all it needs

Config schemas are the client's, not this server's, and they move. If a client's format differs from the JSON above, follow the client's docs; only command and args matter here.

See INTEGRATION.md for worked examples, Docker, and troubleshooting.

Running over HTTP

By default the server speaks stdio, one process per client. Over HTTP one process serves several clients at once: for example a single server on a host that every container on that host talks to, instead of a copy inside each container with the collections mounted into it. HTTP mode is opt-in, needs a bearer token, and binds to loopback unless told otherwise.

export BRUNO_MCP_AUTH_TOKEN="$(openssl rand -hex 32)"
npx -y @ostico/bruno-mcp --transport http
# Bruno MCP Server listening on http://127.0.0.1:8781/mcp (auth: bearer, 1 token)
SettingFlagEnvironmentDefault
Transport--transport stdio|httpBRUNO_MCP_TRANSPORTstdio
Bind address--hostBRUNO_MCP_HOST127.0.0.1
Port (0 picks a free one)--portBRUNO_MCP_PORT8781
Bearer token(s)noneBRUNO_MCP_AUTH_TOKEN, comma-separated for rotationrequired
Token file--auth-token-fileBRUNO_MCP_AUTH_TOKEN_FILEnone
Extra allowed hosts--allowed-hosts a,bBRUNO_MCP_ALLOWED_HOSTSnone
Session idle timeoutnoneBRUNO_MCP_SESSION_IDLE_MS1800000 (30 min)

A flag wins over its environment variable. Each token must be at least 32 characters. There is no --auth-token flag on purpose: a token on the command line shows up in ps and in shell history. A token file is read once at startup and may hold one token per line. Without any token the server refuses to start; there is no unauthenticated HTTP mode.

localhost, 127.0.0.1, [::1] and the bind address are always accepted in the Host header. Add the name your clients use, for example --allowed-hosts host.docker.internal for Docker containers on the same machine. * turns the check off and logs a warning. On Docker Desktop and Colima, host.docker.internal reaches a server bound to the host's loopback. On Linux it is the bridge gateway, so bind to that address with --host (for example 172.17.0.1), never to 0.0.0.0 on a machine others can reach.

BRUNO_MCP_TRANSPORT selects the mode for every server that inherits it, so export it only where an HTTP server is meant to start, not in a shell profile that stdio clients also read. Under stdio, arguments the server does not recognise are ignored, as before, with a warning on stderr; under HTTP they are an error.

GET /healthz answers 200 OK with no token, for readiness checks. It reveals nothing else. bruno-mcp --help prints the options.

Each client gets its own MCP session. Sessions end when the client closes them, after the idle timeout, or when the server stops; a client whose session expired starts a new one. At most 64 sessions are open at once.

The bearer token

The server reads its tokens once, at startup, from BRUNO_MCP_AUTH_TOKEN, from a token file, or from both. Each token is at least 32 characters of visible ASCII with no spaces; openssl rand -hex 32 makes a suitable one. A token file is the safer choice for anything long-lived, because it keeps the token out of the environment of every process the shell starts:

umask 077
openssl rand -hex 32 > ~/.config/bruno-mcp.token     # one token per line
bruno-mcp --transport http --auth-token-file ~/.config/bruno-mcp.token

Check that it works. The first call has no token and gets 401; the second gets 200 and starts a session:

TOKEN="$(cat ~/.config/bruno-mcp.token)"
curl -s -o /dev/null -w '%{http_code}\n' -X POST http://127.0.0.1:8781/mcp
curl -s -o /dev/null -w '%{http_code}\n' -X POST http://127.0.0.1:8781/mcp \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'

Every client sends the same token in an Authorization: Bearer <token> header. With Claude Code, one command adds the server:

claude mcp add --transport http bruno http://127.0.0.1:8781/mcp \
  --header "Authorization: Bearer $(cat ~/.config/bruno-mcp.token)"

That writes the token into Claude Code's config. To keep it out of a config file you commit, reference an environment variable instead: Claude Code expands ${NAME} in an .mcp.json from the environment of the client, not of the server. In this example the client's variable is called BRUNO_MCP_TOKEN, and it must hold the same value the server was started with:

{
  "mcpServers": {
    "bruno-mcp": {
      "type": "http",
      "url": "http://host.docker.internal:8781/mcp",
      "headers": { "Authorization": "Bearer ${BRUNO_MCP_TOKEN}" }
    }
  }
}

To change the token, start the server with both tokens (comma-separated in BRUNO_MCP_AUTH_TOKEN, or one per line in the file), move each client to the new one, then restart the server with the new token alone. Tokens are read only at startup, so each change of the list needs a restart, which ends open sessions; clients start new ones on their next call. A missing or wrong token gets 401 with WWW-Authenticate: Bearer, and the token is never written to the server's log or echoed in a response.

Quick start

// 1. create a collection
{ "name": "my-api", "outputPath": "./collections", "baseUrl": "https://api.example.com" }

// 2. add a request with a test
{ "collectionPath": "./collections/my-api", "name": "Get Users", "method": "GET",
  "url": "{{baseUrl}}/users",
  "scripts": { "tests": "test(\"ok\", function() { expect(res.getStatus()).to.equal(200); });" } }

// 3. run it
{ "collectionPath": "./collections/my-api" }

Tools

18 tools. File paths are absolute, or relative to the collection.

ToolWhat it does
create_collectionNew collection. format: "yaml" (default) or "bru". Also registers it in the workspace, so list_collections and the Bruno app can see it — registerInWorkspace: false to skip that, workspacePath to pick the file
list_collectionsFind collections from Bruno's workspace.yml
get_collection_statsCounts by method, folders, environments, request list with URLs — filterable by folder, method, nameContains, or includeRequests: false for counts only
write_requestWrite a request: method, url, headers, query, body, auth, scripts, settings. kind: "websocket" or kind: "grpc" for those transports. Pass collectionPath and name to create one, filePath to edit one — an edit is a partial merge, and filename renames the file
move_requestMove or copy a request to another folder or collection
read_requestRead one request back as JSON, same shape for .bru and .yml
list_requestsEvery request file in the collection, as absolute paths
delete_requestDelete one or more request files. Needs confirm: true
add_test_scriptAttach a script to an existing request (appends by default)
remove_scriptRemove one script, keep the request
create_environmentNew environment file. Refuses to overwrite unless overwrite: true
read_environmentVariables with their disabled/secret flags. Omit name to list environments
update_environmentReplace or merge an environment's variables
set_environment_variableAdd or change one variable
remove_environment_variableDelete one variable
run_collectionExecute requests, run their tests, return results

Reading before writing

read_request returns method, url, headers, query and path params, body, auth mode, scripts, assertions, vars, settings and docs — identical shape for both formats, so the on-disk format stays invisible. Its notes array names anything the file declares that the runner will not act on.

Use it before an edit to see the current state, and after a write to confirm what was written.

read_environment returns each variable with its value. Secrets come back by name only — Bruno stores no value for a secret in either format, so there is none to return.

Writing requests

write_request creates when you pass collectionPath and name, and edits when you pass filePath. An edit merges: fields you omit are left alone.

Notable options:

  • body.type — json, text, xml, sparql, graphql, form-urlencoded, form-data, file, binary, none
  • body.type: "form-data" — multipart uploads, per-part contentType, multi-file fields
  • auth.type — bearer, basic, api-key, digest, oauth2, inherit, none
  • scripts — inline pre-request, post-response, tests (no separate add_test_script call needed)
  • settings.timeout — script and request timeout in ms

name and filename are independent, as they are in Bruno itself: name changes the request's name inside the file and filename moves the file, so pass both to keep them in step. A filename is a basename in the request's own folder, its extension is optional and must match the collection's format if given, and a name already taken by another file is refused. The path it moved to comes back in the response — use it as filePath from then on.

write_request replaces a script of the same type by default, so repeating a call is idempotent. Pass scriptMode: "append" to concatenate. add_test_script appends by default, being an add.

In .yml collections post-response and tests share Bruno's single after-response slot, so replacing either overwrites both.

Moving requests

move_request relocates a request file — into another folder, or into another collection with targetCollectionPath. Pass copy: true to duplicate it instead.

The bytes are moved verbatim, never parsed and rewritten, so nothing a request declares can be lost on the way. Two consequences follow from that. The file keeps its name, so a copy needs a different folder or collection; renaming is write_request. And seq arrives unchanged, so the request can land next to a sibling claiming the same number — that is reported rather than repaired, because renumbering means rewriting the file. Bruno breaks such a tie by filename, so the order is defined either way.

A missing target folder is created, and reported: a folder with no settings file carries no folder-level auth, headers or scripts.

Running

{
  "collectionPath": "./collections/my-api",
  "environment": "dev",
  "requests": ["auth/login.bru", "users"]
}
ParameterMeaning
collectionPathCollection, or a subfolder of one
requestsOrdered list of request files and/or directories. Omit to run everything. [] runs nothing
groupsRun the collection as several isolated groups — see below. Cannot be combined with requests
environmentEnvironment name, loaded from environments/<name>.yml
collectionRootThe collection collectionPath belongs to, when running a subfolder. Must be that path or an ancestor
variables{name: value} for this run only. Never written to disk — the correct way to pass a secret
captureVariablesNames of bru.setVar variables whose values you want back
parallelRun the groups concurrently. Default false
maxConcurrencyCeiling on requests in flight. Omit to derive one from the machine; 0 lifts it
bailStop at the first failure instead of running the rest. Default false
cookieJarKeep cookies across the run so a login carries forward. Default true
includeResponseBodyInclude response bodies. Default true
maxResponseBodyBytesTruncate bodies past this size. Default 10240
reportAlso write the run to disk — see Report files

A directory in requests expands to the requests under it, ordered by seq within each folder, subfolders first, ties broken by filename. Duplicates are honoured: naming a request twice runs it twice.

By default nothing stops a run early. A request that fails, a file that will not parse, a name that matches nothing — each is reported and the run continues.

Stopping at the first failure

bail: true stops the run at the first request that fails or whose tests fail. Twenty-three requests behind a login that stopped working is twenty-three failures for one cause, and the cause is the least visible of them.

{
  "collectionPath": "./collections/my-api",
  "bail": true
}

Everything the run did not reach comes back in place, marked skipped: true with skipReason: "bail", carrying the method and URL it would have sent. Those requests are counted in summary.skipped and in neither passed nor failed, so passed + failed still equals total and a truncated run cannot read as a shorter one that went green. The run itself gains a bail object:

{
  "bail": {
    "reason": "test failure",
    "at": "Login",
    "path": "/collections/my-api/auth/login.bru",
    "group": 0,
    "skipped": 22
  }
}

reason is either request failure (nothing came back) or test failure (it came back and a check failed). Later groups are skipped whole.

Nothing cancels a request already in flight. With parallel, or with a group of its own that runs concurrently, the requests that had already started still finish and are reported normally — the run says so in warnings rather than leaving you to infer it from the count.

Execution groups

A group is an isolated run inside one call. It owns its request list, environment, variables, parallel flag, variable store, cookie jar and OAuth2 tokens. Nothing crosses from one group to another, in either direction, at any parallel setting.

The same requests as two users, with no chance of one login's token or session cookie reaching the other:

{
  "collectionPath": "./collections/my-api",
  "parallel": true,
  "groups": [
    { "name": "alice", "requests": ["auth/login.bru", "orders"], "variables": { "user": "alice" } },
    { "name": "bob",   "requests": ["auth/login.bru", "orders"], "variables": { "user": "bob" } }
  ]
}

parallel: true runs the two groups against each other. Each group's own requests stay serial, which is what you want when orders depends on the login before it.

One suite against two environments:

{
  "groups": [
    { "name": "staging",    "requests": ["smoke"], "environment": "staging" },
    { "name": "production", "requests": ["smoke"], "environment": "production" }
  ]
}

Group fields: name, requests, environment, variables, parallel, startAfter, data, dataFile.

docs/execution-groups.md covers the whole model: what a group owns, the two parallel flags and their defaults, ordering, iterations over data rows, the concurrency ceiling, and what a failure looks like at each level.

  • Omit requests to run the whole collection under that group's identity. An empty [] runs nothing.
  • environment replaces the run-level one; variables merge over the run-level ones, group winning.
  • Set parallel on a group to run its own requests concurrently. They share that group's store, so they can genuinely contend on a bru.setVar — the point when reproducing a race. Give maxConcurrency at least as many slots as racers, or the cap serialises them quietly.
  • startAfter: { group, requestsCompleted } holds a group until another has got that far — a listener connected before a trigger fires, without a bru.sleep tuned to that day's latency. Needs run-level parallel; a request that failed still counts as a position reached; cycles and gates that could never open are refused before anything runs.

Results

Results are group-shaped. There is no top-level results array, not even when you passed no groups — that case is one group, and flattening it would make every caller check which way they had called.

{
  "summary": { "total": 4, "passed": 3, "failed": 1, "duration_ms": 1250 },
  "groups": [
    {
      "name": "alice",
      "index": 0,
      "summary": { "total": 2, "passed": 2, "failed": 0, "duration_ms": 620 },
      "results": [
        {
          "name": "Get Users",
          "method": "GET",
          "url": "https://api.example.com/users",
          "status": 200,
          "duration_ms": 312,
          "tests": [{ "description": "ok", "status": "pass" }],
          "response_body": "[{\"id\":1}]",
          "response_content_type": "application/json",
          "response_body_truncated": false,
          "response_headers": {
            "content-type": "application/json",
            "strict-transport-security": "max-age=31536000",
            "set-cookie": ["session=[redacted]; HttpOnly; Secure; SameSite=Lax"]
          }
        }
      ],
      "capturedVariableNames": ["authToken"]
    }
  ]
}

Each group carries its own summary, results, missingRequests, capturedVariableNames, capturedVariables and warnings. The top-level summary covers the whole run.

response_headers needs no flag and no test script. Credential-named values are masked, and set-cookie is a list — one entry per cookie, because a comma-joined one cannot be split back — whose entries keep every attribute with only the cookie value withheld. Checking HttpOnly, Secure, SameSite or Strict-Transport-Security is therefore a single call. includeResponseBody: false does not suppress them: that flag is about a body's size.

A WebSocket result carries response_headers as well, holding the handshake response — the 101 is the only place a session cookie or an agreed sec-websocket-protocol appears for that transport, since frames have no headers. A gRPC result reports its metadata under its own grpc detail instead.

A group that could not start at all reports error instead of results and counts as one failure — otherwise a run with a dead group would read green.

Run-level fields: parseErrors and parseFailures name files that could not be parsed, warnings collects anything else worth seeing.

Scripts

Scripts run in a V8 context inside a forked process (see Security). Both kinds are async functions, so top-level await works.

Tests and post-response get test(), expect(), res and bru:

APINotes
test(name, fn)Wraps assertions. Required for one to be reported
expect(v)Chai-style: .to.equal, .include/.contain, .match, .have.property/.lengthOf/.keys, .be.above/.below/.least/.most/.oneOf, .throw, and .to.not.* for any of them
res.getStatus() res.getStatusText()
res.getHeader(name) res.getHeaders()Header lookup is case-insensitive
res.getSetCookies()Cookies the response set
res.getBody()Already parsed when the media type's subtype is json or ends +json
res.getResponseTime()ms
res(path, ...fns)Bruno's query language over the body: res("data.pets..name") descends to every name, [0] indexes, [?] filters or maps with a callback. Also valid as an assertion's left-hand side, where the syntax could not appear bare
bru.setVar(name, v) bru.getVar(name)Pass values to later requests as {{name}}
bru.sleep(ms)Also setTimeout/setInterval and their clear*
atob(s) btoa(s)base64, in both script kinds. Enough to read a JWT payload without a second request

Pre-request scripts get req and bru instead — there is no response yet. Mutating req changes what is sent: req.getUrl(), req.setUrl(), req.getMethod(), req.getHeader(), req.setHeader(), req.getHeaders(), req.getBody(), req.setBody().

Two things that catch people out

Wrap assertions in test(). A bare passing expect() is never recorded, so the run reports "tests": [] while the request counts as passed — green with nothing asserted. The runner spots this and says so in that result's warnings. A bare failing assertion is not silent: it throws and is reported as a script error.

test("status is 200", function() {          // ✅ recorded
  expect(res.getStatus()).to.equal(200);
});

expect(res.getStatus()).to.equal(200);      // ❌ runs, passes, reported nowhere

Do not JSON.parse(res.getBody()). It is already an object whenever the media type's subtype is json or carries the +json suffix — application/json, text/json, application/vnd.api+json — so parsing again throws SyntaxError: "[object Object]" is not valid JSON. Read fields directly. If an endpoint may return either, branch: typeof b === "string" ? JSON.parse(b) : b.

Reading a claim out of a token needs no second request. atob and btoa are both present, under the names Bruno's own sandbox uses, so the usual base64url dance works:

test("the token is for the user we logged in as", function() {
  const payload = res.getBody().token.split(".")[1];
  const claims = JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/")));
  expect(claims.uid).to.equal(bru.getVar("expectedUid"));
});

Buffer is not available. It is a host class with affordances a sandbox should not hand out, and a faithful stand-in would be a fake whose gaps you would find one at a time; a bare reference throws Buffer is not defined, which is reported as a script error rather than silently misbehaving.

Sleeping counts against the script timeout — settings.timeout, 5000 ms when unset. await bru.sleep(10000) under the default reports a timeout instead of waiting.

Environments and variables

An environment is environments/<name>.yml in the collection:

name: dev
variables:
  - name: baseUrl
    value: https://api-dev.example.com
  - name: apiKey
    value: dev-key-123
  - name: skipped
    value: whatever
    disabled: true

The tools take variables as a flat object ({"baseUrl": "..."}) and write that array for you.

{{name}} is substituted into urls, headers, bodies and auth. Disabled variables are skipped; unresolved ones are left as written and named in the run's warnings.

Precedence, lowest first: environment file → run variables → a request's own vars → bru.setVar during the run. This matches Bruno's --env-var behaviour.

A variable may be built out of others: base_url: "https://{{host}}/{{stage}}" resolves the way it does under bru run, using Bruno's own interpolate. One exception, deliberate: a value captured from a response — by bru.setVar or a post-response vars block — is inserted as text and never scanned again, so a response echoing key={{api_key}} cannot make the next request send your key.

Generators. {{$guid}}, {{$timestamp}}, {{$randomEmail}} and the rest of Bruno's ~120 dynamic variables work in urls, headers, query params, bodies and auth. They are not variables: nothing declares them, each occurrence produces its own value, and none is reported as unresolved. A keyword no generator answers to — {{$gid}} — is left as written and named in the warnings, so a typo still surfaces. In a JSON body or a GraphQL variables block the generated value is escaped, so a generator that emits a newline ({{$randomLoremParagraphs}}) leaves the document parseable.

Secrets: neither Bruno format stores a secret's value — only its name. So pass secrets as run variables, which stay in memory and are never written to a file.

An environment name is a name, not a path. Anything containing a separator is refused.

Report files

run_collection returns its results as JSON, which is what an agent reads. The two other consumers of a test run read files, so report writes them:

{ "collectionPath": "/path/to/collection",
  "report": { "junit": "reports/junit.xml", "html": "reports/run.html" } }

Name either format or both. The result then carries reports, one entry per file written, with its absolute path and its size in bytes.

Documentation truncated — see the full README on GitHub.

Reviews

No reviews yet

Be the first to review this server!