BrandBrain Flow Orchestrator MCP Server
Compose BrandBrain asset flows, run mock/live generation, and fetch outputs
BrandBrain Flow Orchestrator scores 55 (Fair), with no SPDX license recorded. It installs as a local process. It declares 40 tools. Filed under Uncategorized. Package registries report about 115 downloads a week. Install configs are generated for 10 clients. Being listed in the registry is not the same as being vendor-official.
Fair trust
55 of 100 from six public signals. Nobody can buy a point.
- Listed in the official MCP registry.
- No license recorded.
License, quality and maintenance
Quality: Grade A
92/100 for listing completeness. Lost points: 6 of 40 tools barely described, short summary.
How quality is graded
Where the 55 comes from
22 + 20 + 0 + 0 + 10 + 3 = 55. Each factor is capped, so no single signal can carry a listing.
Active in the official MCP registry, plus a known vendor namespace.
Registry: 22 of 30 points.How recently the repository saw a commit or release.
Maintenance: 20 of 20 points.GitHub stars and weekly downloads, on a log scale.
Popularity: 0 of 20 points.A clear, OSI-style open-source license.
License: 0 of 10 points.Not archived, a secure install path, a pinned version.
Security: 10 of 10 points.A real summary, a README with depth, listed tools.
Docs: 3 of 10 points.Install
Pick your client, copy the config, paste it in.
Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.
{ "mcpServers": { "skunkworq-flow-orchestrator": { "command": "npx", "args": [ "-y", "brandbrain-flow-orchestrator-mcp@0.4.0" ], "env": { "BRANDBRAIN_API_URL": "", "BRANDBRAIN_APP_URL": "", "BRANDBRAIN_FLOW_MCP_BEARER_TOKEN": "YOUR_BRANDBRAIN_FLOW_MCP_BEARER_TOKEN", "BRANDBRAIN_MAX_PROVIDER_SPEND_USD_MICROS": "" } } }}
Environment variables
| Name | Required | Notes |
|---|---|---|
BRANDBRAIN_API_URL | Optional | Override the BrandBrain API endpoint (defaults to https://api.brandbrain.dev). Only needed for self-hosted/dev deployments. |
BRANDBRAIN_APP_URL | Optional | Override the BrandBrain web app URL used for browser auth flows (defaults to https://brandbrain.dev). |
BRANDBRAIN_FLOW_MCP_BEARER_TOKENSecret | Optional | Optional static bearer token for non-interactive environments. Browser OAuth via login_brandbrain is preferred. |
BRANDBRAIN_MAX_PROVIDER_SPEND_USD_MICROS | Optional | Per-run provider spend ceiling in USD micros (1000000 = $1.00). Live runs are refused while unset; mock runs work without it. |
Tools40Tool docs quality grade D
All capabilitiesaspect_ratiotool1:1
The model cannot produce the requested aspect ratio.
The run's estimate is above the lower of the server ceiling and the call's cap, so the payment authorisation would not cover it.
backend_outdatedtoolThe API is older than this server: its catalogue lacks billed sizes, or its create response lacks the idempotency field.
savetocollection got a reference upload; collections hold generated images only.
generate_imagetoolPaid: 1–4 studio images in one call, capped by maxcostusd
An input is out of range, such as a maxcostusd with more than six decimals.
max_cost_usdtoolrequired
The model is retired, cannot run live on this server, or makes only vector (SVG) output.
model_unknowntoolThe model is not in the catalogue, or a selection.prefer id is not. Use auto or a provider/modelid from listimagemodels. The message names the id.
no_runstoolgetgeneration found a project with no runs yet.
not_foundtoolA project, run, image or collection was not found in your workspaces.
About
Flow Orchestrator MCP
Hosted connector and plugins: Connect Claude or Codex. The portable BrandBrain plugin bundles this skill and the hosted MCP endpoint. See setup and deployment. Hosted connections authenticate through the client's OAuth controls; the local login commands below apply to stdio sessions.
MCP server for BrandBrain FlowSpec sessions and asset-generation workflow execution.
This server sits on top of the BrandBrain backend flow-session API. It does not talk to model providers directly. The backend remains the source of truth for:
- canonical template bundles
- persisted flow sessions
- validation
- mock and live execution
- run traces and artifacts
Studio tools
The studio tools make, find and reuse images in BrandBrain studio projects. They are
registered before the other tools, so they lead the tool list. Hosted and local servers
expose the same studio tools. A local server also accepts absolute png, jpeg or webp
paths in reference_images; the hosted connector does not, and uses image ids only.
generate_image(paid) makes 1–4 images in one call and saves them to a studio project. Passmax_cost_usd, the most the whole call may cost in USD, all images together. The call returns within about 20 seconds with any finished images and aproject_id. Repeating an identical call never pays twice (replayed: true); passvariationfor new images.get_generationwaits up to about 40 seconds for a project's runs and returns their images and cost. It reads saved runs, so it works after a reconnect. It never starts or pays.list_imagesandget_imagefind saved images by workspace, project or a title or description query.get_imagereturns one image's prompt, model, cost, links and a preview.save_to_collectionandlist_collectionskeep generated images as reusable collections. Eachsave_to_collectioncall makes a new collection.cancel_generationasks a running run to stop. A provider call already under way may still be charged;get_generationshows the final cost.upscale_imageupscales a saved image 2× or 4× on BrandBrain's own upscaler. No provider is charged. The result is a new image in Activity, not in Assets.upload_reference_imageadds a reference image for BrandBrain's app. The server lists it to every client; hosts that support MCP Apps hide it from the model, and others list it.list_image_modelsprices one shape (aspect_ratio,quality,count) and shows each model's price per image, who pays, whether it fits the cap, whether it fits your remaining allowance (fits_allowance), its selection class and recommended flag, and whatautowould pick.list_provider_keyslists the provider keys you can pay with in a workspace (id, label, personal or workspace, models, status — never the key itself) and the workspace's payer settings. Pass akey_idasgenerate_image'spay_with. Keys are added in the studio, never through the MCP.generate_videomakes one short video (about 3–15 s) into a project, paid only by your own or the workspace's OpenRouter or Gemini key; BrandBrain's key never pays for video. Passmax_cost_usd;model: "auto"follows your selection (by defaultrecommended: established models, your own key first; orcheapestorbest) within it, and picks only a model your keys can pay for that makes the asked length, resolution and sound (no_model_for_shapewhen none does).selectionsays how auto picks (see "Model selection" below).first_framestarts from animage_id. Videos take 1–6 minutes: pollget_videowith theproject_idandvideo_id, which gives a 1-hourdownload_urlonce it is done.list_video_modelsshows lengths, resolutions, sound, price and payer per model (docs/flow-video-generation.md).- The server's per-run ceiling applies only to BrandBrain's key: a model your own or a workspace key
pays for is capped by
max_cost_usdalone. The ceiling still travels with the run, so the backend refuses to pay such a run with BrandBrain's key. get_usagereports your platform allowance for a month: used, limit, remaining, when it resets, and spend split by payer. A platform-paidgenerate_imagethat doesn't fit what is left is refused withallowance_exhaustedbefore anything is created. Adding your own provider key is not capped.
generate_image inputs
| Input | Default | Meaning |
|---|---|---|
prompt | required | What to make, 1–6000 characters. Saved as the project's brief. |
max_cost_usd | required | The most the whole call may cost, all images together. Above 0, at most 100, at most six decimals. |
aspect_ratio | 1:1 | 1:1, 4:5, 16:9 or 9:16. |
count | 1 | 1–4 images; each is one paid run. |
quality | high | high or standard. standard needs a model with a separate standard price. It is never lowered for you. |
model | auto | auto, or provider/model_id from list_image_models. OpenRouter ids contain /; the first / splits the provider. |
style | none | Art direction, up to 2000 characters. |
palette | none | Up to 5 hex colours, such as #1A1A1A. |
reference_images | none | Up to 4 image_ids from this workspace (or local file paths on a local server). |
workspace_id | none | Required when you belong to several workspaces. |
project_id | none | Add to an earlier project made by an agent (source: "mcp") instead of starting one. |
variation | 1 | Change to 2, 3, … to get new images for an otherwise identical request. |
pay_with | auto | Who pays. auto follows the workspace's payer policy and your preference; personal, workspace, own (either, never BrandBrain's key), server, or a key_id from list_provider_keys. A named payer never falls back. |
selection | none | How auto picks: strategy, prefer, exclude (see "Model selection"). Ignored when model names a model, and the result says so. |
Model selection
auto picks the model that the eligible models rank first under selection.strategy, after
exclude removes some and prefer tries its ids in order:
strategy:recommended(the default) takes the provider's recommended model on the best payer (your key, then a workspace key, then the server's), then a fixed per-image price ahead of a token-priced estimate, then price.cheapesttakes the lowest price.besttakes the cheapest premium model that fits, then standard, then budget.prefer: up to 10 exactprovider/model_idvalues, tried in order. The first one that fits wins, even when it is legacy or experimental.exclude: up to 20 entries, each an exact id or a prefix ending in one*(openrouter/*). Exclude is applied beforeprefer, so it beats it.
Each field you leave out inherits the setting of the person or the workspace (the studio's Settings
→ Connections), then the built-in default. An empty list is a value: "prefer": [] means prefer nothing.
Every model has a class (premium, standard, budget, legacy or experimental). The strategies
rank only premium, standard and budget models; a legacy or experimental model is picked only when
prefer names it. list_image_models and list_video_models show each model's class, its
recommended flag, and the effective selection with where each field came from.
chosen_because says which rule chose the model. A project keeps its model on a later call only
when the call has no selection, and the model is not excluded.
Auto never picks a model that cannot run live, has no usable price, or bills reference images when the call sends references.
Pricing and the spend ceiling
Each model's price comes from the server's catalogue; an unknown price is never treated as free.
A call is priced as need = ceil(1.1 × price) per image, so provider settlement can run slightly
above its estimate. The call is refused unless need fits both the server's ceiling and
max_cost_usd / count.
- Local stdio: the user sets
BRANDBRAIN_MAX_PROVIDER_SPEND_USD_MICROS(whole micro-dollars;50000is $0.05). - Hosted: the gateway's ceiling is
mcpGateway.maxProviderSpendUSDMicros. Production uses50000. - Unset:
generate_imagerefuses withspend_ceiling_unconfiguredand nothing is charged.
Prices as of 2026-11-06, at a cap of $0.05 for one image (prices change; list_image_models
is the live source). Models that fit: at 1:1 high, 17 models, the cheapest
openrouter/black-forest-labs/flux.2-klein-4b at about $0.0147; at 16:9, 4:5 or 9:16 high,
12 models, the cheapest openrouter/black-forest-labs/flux.2-klein-4b at about $0.0220; at 1:1
standard, 9 models, the cheapest openrouter/openai/gpt-5-image-mini at about $0.0084; at 16:9,
4:5 or 9:16 standard, 4 models, the cheapest openai/gpt-image-2.5-flare at about $0.0103.
With these prices, auto picks openrouter/black-forest-labs/flux.2-klein-4b at 1:1 high (about
$0.0147), and openai/gpt-image-2.5-flare otherwise: about $0.0412 at 16:9, 4:5 or 9:16 high,
$0.0132 at 1:1 standard, and $0.0103 at the other shapes at standard quality. A fixed per-image
price beats a cheaper token-priced estimate, so auto does not always pick the cheapest model.
Refusal codes
A refusal is a result with status: "refused", isError: true and refusal.code. Every paid
refusal says nothing was charged. Where a model could fit, the result also carries
fitting_options (model, aspect ratio, quality, cost, and the max_cost_usd each needs).
| Code | When |
|---|---|
invalid_arguments | An input is out of range, such as a max_cost_usd with more than six decimals. |
workspace_required | You belong to several workspaces and passed no workspace_id. workspaces lists them. |
workspace_not_found | The workspace_id is not one of your workspaces. |
workspace_mismatch | The project is in a different workspace from workspace_id. |
role_cannot_generate | Your role in the workspace is viewer. |
spend_ceiling_unconfigured | No server spend ceiling is set. |
spend_ceiling_invalid | The server's spend ceiling is set but is not a valid amount. |
backend_outdated | The API is older than this server: its catalogue lacks billed sizes, or its create response lacks the idempotency field. |
model_unknown | The model is not in the catalogue, or a selection.prefer id is not. Use auto or a provider/model_id from list_image_models. The message names the id. |
model_unavailable | The model is retired, cannot run live on this server, or makes only vector (SVG) output. |
quality_unavailable | The model has no separate standard price at this size. |
aspect_ratio_unsupported | The model cannot produce the requested aspect ratio. |
references_unsupported | The explicit model cannot take the requested references. |
pricing_unavailable | The model has no usable price at this size and quality. |
provider_credentials_unavailable | No key can pay for the model in this workspace. Add one under Connections → Image providers. |
over_ceiling | One image needs more than the server's ceiling. |
over_max_cost | The call needs more than max_cost_usd. max_cost_needed_usd says how much. |
nothing_fits | No model can make the requested image within the cap, with the keys available. Also when selection.exclude removes every model that fits. |
only_unlisted_models_fit | Only legacy or experimental models fit the cap. The message names them: name one with model, or add it to selection.prefer. |
price_changed | The backend's price for the prepared run moved past the budget. |
authorization_budget_insufficient | The run's estimate is above the lower of the server ceiling and the call's cap, so the payment authorisation would not cover it. |
provider_authorization_unavailable | The backend preflight returned no authorization scope or authority hash; nothing was charged. |
timed_out_before_start | Checks did not finish within 40 seconds. Nothing was dispatched. |
project_not_agent | The project was made in the studio, so the agent will not change it. |
project_archived | The project is archived and read-only. |
project_not_guided | The project is not a single-image project. Omit project_id, or pass variation for a new project. |
project_changed | The project changed twice while the call ran. Call again. |
reference_invalid | A reference is not a BrandBrain image id, or is not a readable png, jpeg or webp file within the size limit. |
reference_unavailable | A reference is not available in this workspace. |
not_found | A project, run, image or collection was not found in your workspaces. |
no_runs | get_generation found a project with no runs yet. |
collection_needs_generated | save_to_collection got a reference upload; collections hold generated images only. |
upscaler_unavailable | The upscaler is not running. Try again later. |
Inside a successful result, errors[] can carry a per-run dispatch_refused,
idempotency_conflict or provider_authorization_mismatch. Those mean that run did not start;
the others may have.
Native image library
The connector implements OpenAI MCP Extensions
with the official TypeScript SDK. In compatible hosts, BrandBrain images opens
from the plugin sidebar or a chat tab. open_image_library {} lists your workspace's saved
images, newest first, in pages of 16; sessionId shows one project's images. First/Previous/Next
controls stay below a bounded, responsive scroll area. Detail/back restores the
current page, scroll and focused flow without downloading its covers again. get_flow_outputs renders that
same gallery directly beside the conversation, while keeping standard MCP image
content and artifact links for clients without app support.
Search your flows with a composer @mention. Mentions resolve through authenticated
brandbrain://flows/{sessionId} resources and carry the saved flow context.
The library supports /flows/{sessionId}?runId={runId} app-relative deep links.
Opening, searching, and refreshing the library only reads existing data. The image-request form sends your prompt to the conversation; generation still uses the existing validated flow and spend-authorization path. The staged-image update adds Create variation: select an existing output, describe the change, and send its exact session/run/node/artifact identity and original URL as source context before the chat message. This action preserves the source and does not authorize spending. It requires a host that supports context updates; see Staged image graphs.
The library uses 160-pixel covers and image details use 640-pixel previews from the authenticated thumbnail endpoint. Covers are bounded to 16 images, 48 KiB per 160-pixel preview and 384 KiB total, with two downloads at a time. Run outputs use 320-pixel previews, at most 96 KiB each and 384 KiB in total. Image details remain bounded to 16 images, 5 MiB per image and 10 MiB total, with three downloads at a time. Canvas covers retain the newest saved image when a newer run fails, and saved reference canvases have covers too. Cover source and mock status are labeled separately from the latest run status. Reference previews use the authenticated viewing-session/node endpoint; historical output covers use their exact owned session/run/artifact identities. Original artifact links remain available when a preview is omitted. Original sizes and URLs describe the source image, not the smaller preview. Credentials stay on the server; the embedded app uses MCP-supplied image bytes.
The same bounded raster previews are mirrored in component-only
_meta.preview_images with explicit image indices, so covers and details survive
hosts that restore structured data without native image content. This adds no
artifact downloads; it duplicates the existing preview bytes in the wire result.
The app validates both transports and makes one read-only recovery when promised
previews are missing, then shows a notice if the host still omits them.
The UI resource is versioned (ui://brandbrain/image-library-v0.9.0.html) to
refresh cached app code after releases. ui://brandbrain/image-library-v0.8.1.html, ui://brandbrain/image-library-v0.7.0.html, the
previous ui://brandbrain/image-library-v0.5.10.html, v0.5.9, v0.5.8, v0.5.7, v0.5.6, v0.5.5, v0.5.4, v0.5.3 and unversioned URIs remain
aliases for existing clients.
Reopen an already-open library after a connector update to load the current
resource.
Refresh keeps the current page or selected run and existing previews. Reads have a fixed 30-second deadline, with Cancel while loading and a retry after a failure; late responses are ignored.
Local stdio installs now require Node.js 22+. npm run build compiles both the
server and a self-contained HTML app into dist/; the hosted gateway image uses
the same build. Reconnect your MCP client after installing the updated server.
Native entrypoints and mentions appear only in hosts that support the extensions.
Empty-flow cleanup
archive_empty_asset_flows {} previews which active flows have no saved images.
It checks all recorded runs and saved image references, preserving flows whose
latest run is empty but whose older history has images. Active and uncertain
runs are skipped. After an explicit user request to archive empty flows,
archive_empty_asset_flows { dryRun: false } rechecks eligibility and archives
only those empty flows. Archival retains read-only history; it does not delete
images or cancel work. No image generation is involved.
Staged image graphs — unreleased backend required
The staged-image backend change in this checkout is not yet a production guarantee. Updating the MCP package or UI alone does not enable it. Until the matching backend is deployed and verified, use one session per generated image and an explicit saved-original reference between sessions; do not launch a multi-generate live graph on an older backend.
On the updated backend, manifest-less session runs in both mock and live
mode execute exactly one generate target. Pass targetNodeId explicitly; omitting
it selects the first generate node in stored node order, not the whole graph.
An output-node target resolves to its generate producer and generates again.
Read get_flow_outputs to retrieve an existing image.
The staged-campaign template has a master and two independent branches:
generate_master → output_master → generate_portrait → output_portrait
↘ generate_landscape → output_landscape
Run and inspect the master first, then target either child. A child resolves the latest eligible completed producer image in the same session. Live accepts only live sources; mock can use an eligible mock or live source, whichever is newest. A newer failed or empty run does not erase an earlier eligible source. Durable source reuse verifies the exact immutable finalized artifact and its producer inputs, including prompt, style, model, reference content and topology. Changed producer inputs require a new producer run before continuation. An otherwise relevant source with stale, broken or uncommitted evidence fails closed instead of silently selecting an older image. Legacy mock history without a frozen producer snapshot is eligible only for mock validation, never live. Preflight authority binds the durable source run, checkpoint, artifact, and content hash. A newer eligible source changes that authority, so prepare again and obtain fresh paid confirmation rather than retrying stale authorization.
Each generate may have one incoming output reference plus multiple
ReferenceNode inputs. These references condition a new image; they do not join
pixels. compose_flow_images separately joins 1–16 image layers locally and
saves an output; it is not a dedicated graph node. Inpaint/outpaint use the first
resolved reference as their source, so additional references are not independently
masked. Import a compositor output as an explicit reference for a later generation.
Mock each intended session stage separately. The local floweval full-graph mock
is a different evaluation path and does not demonstrate that one session call
executes every stage. Every live stage remains one separately confirmed provider
action; the asset-set manifest and local-recovery rules below are unchanged.
See the staged-image guide and template instructions. The saved staged campaign playground has a copied reference and a validated revision 3. No production runs or provider calls were made for this playground setup; its existence does not establish that the staged backend has been deployed.
Quickstart — graph workflows
For single images use generate_image (see Studio tools). The six calls below build a graph
workflow from nothing to images. Every step works on an ordinary MCP client; no task
capability is required anywhere on this path.
login_brandbrain # only if a flow tool returns "Not authenticated"
list_asset_flows # what canvases already exist (optional `query` filter)
create_asset_flow { title, goal } # goal is written into the flow's brief prompt node
apply_flow_edits { sessionId, ops } # any structural change: one ordered op list, one save
start_asset_flow_run { sessionId, mode: "mock" }
get_asset_flow_task { taskId } # poll until status is "completed" or "failed"
get_flow_outputs { sessionId } # metadata + fetchable artifact URLs + inline previews
open_flow_gallery { sessionId } # visual review in the browser
Concretely:
- Find or create.
list_asset_flowsreturnsid,title,revision,updated_at, graph size, and acanvas_urlfor every stored canvas, so you never need to already hold a session id.create_asset_flow { title, goal }infers a starter template from the goal text and writes that goal into the scaffold's brief prompt node, so the created flow generates your subject rather than the template's placeholder. The response reports which node received it asgoal_applied_to_node_id. - Edit with
apply_flow_edits. The backend validates the whole graph on every save, so build or extend a generate chain with one ordered op list rather than several single-node calls. See Incremental editing. - Run with
start_asset_flow_run+get_asset_flow_task. This is the canonical run path for every client.mode: "mock"costs nothing;mode: "live"spends real money and requiresBRANDBRAIN_MAX_PROVIDER_SPEND_USD_MICROSplus fresh, call-specific user confirmation. - Collect with
get_flow_outputs. Each output carriesartifact_url(a backend/api/v1/canvas/...URL, fetchable with this server's own auth) andopen_in_browser(the app URL a signed-in human can open).open_flow_galleryopens the whole run gallery.
Asset-set flows (a plan node with a named, approved manifest) have their own two-approval lifecycle — see Asset-set authoring and delivery. Nothing in this quickstart bypasses it.
What it is for
Use this MCP server when an LLM or operator needs to:
- seed a new asset-generation flow from a canonical template
- build or refine a stored asset canvas workflow on demand
- validate chaining and node structure before generation
- run the workflow in
mockmode first - run a confirmed provider call in
livemode, or restart supported local asset-set processing from a preserved source sheet - fetch a canvas URL that opens the stored workflow in the app
Quickstart
The server is published on npm as brandbrain-flow-orchestrator-mcp and runs over stdio — no global install needed:
npx -y brandbrain-flow-orchestrator-mcp
Point any MCP client at it with the production endpoints:
{
"mcpServers": {
"brandbrain-flow-orchestrator": {
"command": "npx",
"args": ["-y", "brandbrain-flow-orchestrator-mcp"],
"env": {
"BRANDBRAIN_API_URL": "https://api.brandbrain.dev",
"BRANDBRAIN_APP_URL": "https://brandbrain.dev"
}
}
}
}
Then call login_brandbrain (browser OAuth) and verify with whoami_brandbrain.
Connect Codex or Claude
The transport is local stdio. Codex and Claude start the server on your computer;
the server connects to BrandBrain over HTTPS. For this local configuration, browser sign-in is provided by the
login_brandbrain tool. The portable plugin uses the separately hosted
https://api.brandbrain.dev/mcp endpoint and the client's OAuth controls.
Codex (CLI and desktop share the MCP configuration):
codex mcp add brandbrain-flow-orchestrator --env BRANDBRAIN_API_URL=https://api.brandbrain.dev --env BRANDBRAIN_APP_URL=https://brandbrain.dev -- npx -y brandbrain-flow-orchestrator-mcp
Remote connector (Claude connectors / plugins)
The hosted endpoint is a single URL — add it as a custom connector and sign in with your BrandBrain account when prompted (OAuth 2.1 + PKCE):
https://api.brandbrain.dev/mcp
claude mcp add --transport http brandbrain-flow-orchestrator https://api.brandbrain.dev/mcp
The connector serves OAuth discovery (RFC 8414/9728), dynamic client registration, and PKCE authorization-code + refresh grants; connector credentials map to your BrandBrain agent session. The same endpoint works for claude.ai connectors and any remote-MCP client.
Claude Code (stdio)
claude mcp add --transport stdio --scope user brandbrain-flow-orchestrator -e BRANDBRAIN_API_URL=https://api.brandbrain.dev -e BRANDBRAIN_APP_URL=https://brandbrain.dev -- npx -y brandbrain-flow-orchestrator-mcp
Claude Desktop: merge the JSON above into your existing mcpServers configuration,
then restart the app. See the Claude Code MCP guide
and Claude Desktop local-server guide.
To run changes in this checkout that are not yet released on npm, build and register the local server:
cd mcp/flow-orchestrator
npm ci
npm run build
node dist/index.js config codex --local
node dist/index.js config claude-code --local
node dist/index.js config claude-desktop --local
Each config command prints a command or configuration to copy; it does not modify
client settings. --local uses the absolute Node executable and built server path,
including correct quoting for checkout paths with spaces. Omit --local to print
configuration for the npm package.
Connect once, then check the account:
node dist/index.js login
node dist/index.js status
The standalone login gives the browser five minutes without an MCP request timeout.
Codex and Claude on the same computer share that account for the same backend. Tokens
stay in the local credential cache; provider keys stay on the backend. Use
node dist/index.js logout to revoke and remove that shared login. Set a separate
BRANDBRAIN_FLOW_MCP_SESSION_FILE for clients that need independent accounts.
To resume a canvas, send the agent: “Use BrandBrain flow <session-id>. Inspect the
stored graph, help me refine it, validate it, and run a mock preview. Ask before paid
generation.” Flow IDs come from the canvas URL or list_asset_flows.
Installer script
From a repo checkout, ./install.sh detects Claude Code, Claude Desktop, and Codex, registers the
server with the production env, and offers to install the bundled agent skill (see
Agent skill):
cd mcp/flow-orchestrator
./install.sh # or ./install.sh --yes to accept every prompt
Registries
A server.json is included for the official MCP Registry
(dev.brandbrain/flow-orchestrator), which powers the MCP server marketplaces in VS Code
and other clients. The registry verifies ownership via the mcpName field in
package.json, so the npm package must be published before mcp-publisher publish will
succeed.
A smithery.yaml is included for the Smithery registry (stdio, npx
command, config schema for the env vars).
Live runs need a spend ceiling
Live (paid) runs are refused unless the server's environment sets
BRANDBRAIN_MAX_PROVIDER_SPEND_USD_MICROS (USD micros; 1000000 = $1.00) — see
Environment. Mock runs work without it.
Backend contract
The server wraps these backend endpoints:
GET /api/v1/canvas/templatesGET /api/v1/canvas/sessions— optionalinclude_previews=trueadds batched latest-run/cover metadataPOST /api/v1/canvas/sessions/archive-empty— dry-run preview or history-preserving cleanupPOST /api/v1/canvas/sessionsGET /api/v1/canvas/sessions/:sessionIdPUT /api/v1/canvas/sessions/:sessionIdDELETE /api/v1/canvas/sessions/:sessionId— idempotent archival (204), not permanent deletionPUT /api/v1/canvas/sessions/:sessionId/asset-set-plans/:planNodeIdPOST /api/v1/canvas/sessions/:sessionId/asset-set-plans/:planNodeId/approvePOST /api/v1/canvas/sessions/:sessionId/asset-set-plans/:planNodeId/approve-and-runGET /api/v1/canvas/sessions/:sessionId/asset-set-plans/:planNodeId/historyPOST /api/v1/canvas/sessions/:sessionId/validatePOST /api/v1/canvas/sessions/:sessionId/runsGET /api/v1/canvas/sessions/:sessionId/runs/:runIdGET /api/v1/canvas/sessions/:sessionId/runs/:runId/outputsGET /api/v1/canvas/sessions/:sessionId/runs/:runId/artifacts/:artifactIdPOST /api/v1/canvas/sessions/:sessionId/regenerate
In production, the backend must have access to the canonical flow bundles at BRANDBRAIN_FLOW_TEMPLATE_ROOT.
Environment
BRANDBRAIN_API_URL- Backend API base URL.
- Default:
https://api.brandbrain.devin this checkout. Explicitly set it for local development.
BRANDBRAIN_APP_URL- Optional app base URL used to generate returned canvas links.
- Default:
https://brandbrain.dev, orhttp://localhost:3333when the API uses local HTTP.
BRANDBRAIN_FLOW_MCP_BEARER_TOKEN- Optional static bearer token.
- Usually not needed once browser OAuth login is configured.
BRANDBRAIN_FLOW_MCP_SESSION_FILE- Optional absolute path for an isolated local credential cache. By default all clients
using the same backend share
~/.brandbrain/flow-mcp-session-<backend-hash>.json.
- Optional absolute path for an isolated local credential cache. By default all clients
using the same backend share
BRANDBRAIN_MAX_PROVIDER_SPEND_USD_MICROS- The most this server may authorise a single
liverun to spend, in USD micros (1000000= $1.00). The backend caps any one run at100000000($100.00) regardless. - There is no default and no value meaning unlimited. Leave it unset and
every
liverun is refused before any request reaches the backend; onlymockruns work. - This is deliberately process environment rather than a tool argument, so an agent driving this server cannot choose its own spend ceiling. Set it yourself, in your MCP client configuration, to the most you are willing to lose on one run.
- This configured limit is frozen into the authorization for each live run. The backend's positive preflight estimate must fit within it; pricing estimates and reservations remain separate from the approved spend limit.
- The most this server may authorise a single
See .env.example.
Install and run
From a repo checkout (mcp/flow-orchestrator):
cd mcp/flow-orchestrator
npm install
npm run build
BRANDBRAIN_API_URL=http://127.0.0.1:4444 npm start
For local iteration:
cd mcp/flow-orchestrator
npm install
BRANDBRAIN_API_URL=http://127.0.0.1:4444 npm run dev
MCP client configuration
Published package (preferred — see Quickstart):
{
"mcpServers": {
"brandbrain-flow-orchestrator": {
"command": "npx",
"args": ["-y", "brandbrain-flow-orchestrator-mcp"],
"env": {
"BRANDBRAIN_API_URL": "https://api.brandbrain.dev",
"BRANDBRAIN_APP_URL": "https://brandbrain.dev"
}
}
}
}
Built server from a checkout:
{
"mcpServers": {
"brandbrain-flow-orchestrator": {
"command": "node",
"args": [
"<repo-checkout>/mcp/flow-orchestrator/dist/index.js"
],
"env": {
"BRANDBRAIN_API_URL": "https://api.brandbrain.dev",
"BRANDBRAIN_APP_URL": "https://brandbrain.dev"
}
}
}
}
Agent skill
The source of truth for the agent skill that teaches agents how to drive this server safely lives
in this repository at skill/ (SKILL.md + references/ + agents/openai.yaml). It
also ships inside the published npm package, next to this README.
The skill is task-first. SKILL.md covers generate_image with a stated price cap, waiting
with get_generation, refusals and fitting_options, identical-call retries, finding and reusing
images, and workspaces. references/advanced.md covers graph workflows for icon sets, transparent
or SVG packs and multi-step graphs. Its rules apply in full: list templates first, validate after
edits, run mock before live, confirm every paid provider call, and return canvas_url to the
user. The mock-first rule does not apply to generate_image, which builds a fixed single-generate
graph that preflight validates before anything is paid.
To install it for Codex, copy the directory into the skills root:
cp -R skill/ ~/.codex/skills/brandbrain-flow-orchestrator/
For other agents, copy skill/ into their skills directory (or point them at the packaged copy
inside brandbrain-flow-orchestrator-mcp). ./install.sh offers the Codex copy automatically.
Dev server with tsx:
{
"mcpServers": {
"brandbrain-flow-orchestrator": {
"command": "npx",
"args": [
"tsx",
"<repo-checkout>/mcp/flow-orchestrator/src/index.ts"
],
"env": {
"BRANDBRAIN_API_URL": "http://127.0.0.1:4444",
"BRANDBRAIN_APP_URL": "http://127.0.0.1:3000"
}
}
}
}
Tools
list_agents and get_agent use the current agent:flows session and the
user-scoped /api/v1/agents API. They expose no remote commands or added admin
authority. Match the returned exact agent ID before attributing a hostname or
version to a machine. Another account's and unknown IDs share the same 404.
Agent observations are self-reported, with server heartbeat age and freshness.
Stale/offline jobs and installation state are last observed; current loaded
state becomes unknown. Model installation, byte progress, loaded weights and
historical successful local inference are independent fields. A capability tag
does not prove readiness. Existing v1.13.0 clients lack this new model telemetry
and return models_reporting: unsupported, models: null; a recognized empty
catalog instead returns reported and []. A missing inference timestamp is
unknown, not proof of failure. Reading status never downloads or loads models,
starts inference, restarts an agent or changes jobs.
Deploy the backend tracking endpoints before updating the MCP server. An agent
release is needed for the new model/pressure/inference telemetry; old clients
retain their identity/version/job heartbeat compatibility. Separately enrolled
rig:* workers and unattributed registry rows are not assigned to a user by
hostname. The full wire contract is in docs/fleet/orchestrator-api.md.
| Tool | Purpose | Typical use |
|---|---|---|
generate_image | Paid: 1–4 studio images in one call, capped by max_cost_usd | Make an image; state the cap before calling |
get_generation | Waits up to about 40 s for a project's runs and returns images and cost; never pays | After generate_image returns running |
list_images | Saved images in a workspace, newest first, by project or title query | Find earlier work |
get_image | One image's prompt, model, cost, links and a preview | Inspect a saved image |
save_to_collection | A new collection from 1–16 generated images | Keep images for reuse |
list_collections | Collections with each image's id and whether it can be a reference | Pick references |
cancel_generation | Asks a run to stop; a provider call under way may still be charged | Stop a run |
upscale_image | 2× or 4× on BrandBrain's upscaler; no provider charge | Enlarge a saved image |
upload_reference_image | App-only: adds a png, jpeg or webp reference to the workspace | Used by BrandBrain's app |
get_usage | Your platform allowance for a month: used, limit, remaining, reset time, spend by payer | Check what is left before a paid call |
list_provider_keys | Your and the workspace's provider keys (metadata only) and the payer settings | Choose a key for pay_with |
generate_video | One paid video into a project, on your own or a workspace key only | Make a short video |
get_video | A video's status, cost and 1-hour download link | Poll a video until it is done |
list_video_models | Video models priced for a shape, with who would pay | Choose a video model |
open_image_library | App entry point for the saved-image library | Browse images in a host that supports MCP Apps |
login_brandbrain | Open BrandBrain browser login and store a local MCP session | First step when the backend is protected and no local agent session exists |
whoami_brandbrain | Inspect the locally stored MCP session | Confirm the active BrandBrain agent identity before editing flows |
logout_brandbrain | Revoke the stored MCP refresh session and clear local credentials | Explicitly end a local MCP login |
list_agents | Read this account's agents, with bounded host/ID search and heartbeat freshness | Identify a BrandBrain runtime without guessing its ID from a hostname |
get_agent | Read one owned agent's version, jobs, resources, model installation/download/load and historical inference evidence | Inspect readiness before separately authorizing work on that exact machine |
list_asset_flow_templates | Discover canonical starter flows | First step when the user describes a goal but not a template |
list_asset_flows | List active canvases (id, title, revision, updated_at, node/edge counts, canvas_url), with server-side query, bounded limit (default 50, maximum 100) and opaque cursor; archived: true lists archived flows and their archived_at timestamps instead | Find an existing canvas or its retained history |
create_asset_flow | Create a stored flow session from a template, goal, or explicit flowSpec; the goal is written into the scaffold's brief prompt node | Start a new workflow |
get_asset_flow | Fetch the stored session and flow spec | Inspect current graph before editing |
edit_asset_flow | Replace title/description and optionally replace the stored flowSpec | Structural edits after creation |
update_asset_set_plan | Atomically update asset-set authoring fields and persist a complete draft manifest proposal | Configure a named asset set before asking the user to approve it |
approve_asset_set_plan | Approve the exact persisted manifest revision and content hash | Record explicit user approval without forging manifest authority fields |
approve_and_run_asset_set_plan | Approve the exact persisted manifest revision/hash and start its run in one durable, idempotent backend launch | The user has approved that exact manifest and (for live) that exact paid call |
get_asset_set_plan_history | Fetch manifest revisions and approval events | Audit the persisted asset-set lifecycle |
validate_asset_flow | Run backend graph validation | After every material edit and before any run |
start_asset_flow_run | Start a background mock or live run and return a pollable task envelope; on the staged backend, targetNodeId selects one generate and omission selects the first | Standard MCP clients; staged graphs require the matching backend described above |
get_asset_flow_task | Poll a background task started by the MCP server | Check status until completed or failed |
start_regenerate_asset_flow_node | Start a background regeneration request from a target node | Polling clients; staged manifest-less targets select one generate, asset-set local targets rerun the set-scoped pipeline from split; older backends need the scope checks below |
run_asset_flow | Execute the session in mock or live mode — task-capable clients only | Task-backed execution for long-running runs; other clients get pointed back to start_asset_flow_run |
regenerate_asset_flow_node | Start a task-backed regeneration request from a target node — task-capable clients only | Asset-set local reprocessing or separately confirmed generation after checking the deployed backend's target semantics |
get_asset_flow_run | Inspect a stored run result and traces | Audit what happened after execution |
compare_image_models | Clone a one-generate-node session once per model (same prompt, style, references), preflight all of them, and start the runs — live only under a total ceiling you pass | Compare engines on the same brief: OpenRouter's Gemini/Flux/Seedream against gpt-image-2; each sibling is an ordinary session with its own gallery |
list_image_models | Every provider's image models with lifecycle, reference support, price per image for the requested aspect ratio and quality, fit under the cap, payer, and auto's pick | Pick a model and a price before a paid call; the only way to discover OpenRouter's model ids |
get_flow_processor_health | Read normalized local processor readiness and pinned revisions | Verify zero-token local split/background/vector processing is available before relying on it |
get_flow_outputs | Return every durable output's metadata, a backend artifact_url and a browser open_in_browser URL, with a bounded inline preview | View/validate generated assets after a run (run the flow first) |
get_flow_trace | Per-node run trace: status, timing, resolved prompts, provider request highlights, artifacts, errors | Investigate why a run/node failed or what was sent to the provider |
open_flow | Open the flow's canvas (/crm/canvas/{id}) in your default browser | Jump from MCP to the visual editor |
open_flow_gallery | Open the flow's run gallery (/crm/canvas/{id}/gallery) in your default browser | Review every run's output images + per-image cost/trace after running |
Providers and models
A generate node names a provider and a model_id; the backend's image-model catalogue is the
only authority on which pairs are valid, and list_image_models reads it:
| Provider | Model ids | Notes |
|---|---|---|
openai | gpt-image-2 (default), gpt-image-1.5, gpt-image-1 | OpenAI's own endpoint; per-image pricing by quality and size; paid by a personal or workspace key, or the server's OPENAI_API_KEY |
gemini | gemini-3.1-flash-image | Google's own endpoint |
openrouter | forty-odd, by vendor-qualified id: google/gemini-3.1-flash-image, black-forest-labs/flux.2-klein-4b, bytedance-seed/seedream-4.5, recraft/recraft-v4, meta/muse-image, openai/gpt-image-2, … | One key for every vendor; no default model, so model_id is required. Paid by a personal or workspace key, or by the server's OPENROUTER_API_KEY |
Which key pays for a live run, by default: your personal key for the model, then your personal key for the provider, then a workspace key for the model or provider (when you can edit that workspace), then the server key. Workspace owners and admins can put workspace keys first or turn the server key off, each person can set a preference, and pay_with picks one payer for a call (Settings → Connections → Who pays). Add keys in BrandBrain Canvas under Connections → Image providers; the contract is in docs/flow-provider-keys.md. list_image_models shows which key pays for each model.
Prices differ by an order of magnitude — a 1024² image runs from about $0.01 (Muse Image, flat per
generated image) and $0.015 (Flux.2 klein) through $0.04 (Seedream, Recraft) and $0.08 (Gemini 3.1
flash via OpenRouter) to $0.21 (gpt-image-2) — and the preflight ceiling list_image_models reports
is the same one a live run is authorised against. For token-billed OpenRouter models (Google's and
OpenAI's) that ceiling is derived from the vendors' published per-image token counts at the
expensive end; the actual charge is reported after the call.
Asset-set authoring and delivery
Asset sets use a persisted plan and manifest lifecycle. Do not skip or combine the two approval boundaries: the user first approves the proposed manifest, then later confirms the specific paid provider call immediately before live execution.
Use this sequence for a new or changed asset set:
get_asset_flow
-> update_asset_set_plan
-> present the persisted draft and wait for explicit user manifest approval
-> approve_asset_set_plan
-> validate_asset_flow
-> run_asset_flow(mode="mock") or start_asset_flow_run(mode="mock") + polling
-> present the paid-call scope and wait for explicit confirmation
-> run_asset_flow(mode="live") or start_asset_flow_run(mode="live") + polling
-> get_flow_outputs
-> open_flow_gallery
approve_and_run_asset_set_plan collapses the mechanical approve → prepare → run sequence into
the backend's own durable launch route (.../approve-and-run). It does not collapse the two
approval boundaries:
- it still requires the exact
manifestContentHashthe user approved (a canonicalsha256:<64 hex>digest; anything else is refused locally), plus both expected revisions; mode: "mock"carries no authorization at all;mode: "live"first preflights the plan's single downstream generate node, then authorizes the operator-configuredBRANDBRAIN_MAX_PROVIDER_SPEND_USD_MICROSlimit for that launch, provided the backend's positive estimate fits within it. The estimate remains separate from the scope-bound spending authorization. Without a configured ceiling the launch is refused before any request reaches the launch route.
It is idempotent: an omitted idempotencyKey is generated, and replaying the same key returns the
same approval and run rather than approving twice. Use it when the user has already approved that
exact manifest (and, for live, that exact paid call); use approve_asset_set_plan on its own
when approval and execution are separated in time.
The four plan-lifecycle tools accept camelCase MCP inputs:
| Tool | Required inputs |
|---|---|
update_asset_set_plan | sessionId, planNodeId, positive expectedFlowRevision, non-negative expectedManifestRevision, non-empty label, brief, and desiredPurpose, requestedCount from 1 through 64, requestedFormats exactly ["png"] or ["png", "svg"], and the complete proto-JSON manifest object |
approve_asset_set_plan | sessionId, planNodeId, positive expectedFlowRevision, positive expectedManifestRevision, and the exact non-empty manifestContentHash returned with the persisted draft |
approve_and_run_asset_set_plan | the same five, with manifestContentHash constrained to a canonical sha256:<64 hex> digest, plus mode (mock default, live) and an optional idempotencyKey |
get_asset_set_plan_history | sessionId and planNodeId |
update_asset_set_plan is one atomic write: it updates the plan authoring fields and complete
manifest proposal together, recomputes the canonical manifest hash, and persists a new draft. Read
the returned persisted draft, revisions, and content hash; do not calculate or invent approval
fields in the client. Present the named items, layout, required formats, and spend policy to the
user. Only after the user approves that exact proposal should the client call
approve_asset_set_plan using the returned revisions and hash. Stale revision or hash conflicts
must be surfaced to the caller, followed by a fresh get_asset_flow; do not retry with guessed
values. get_asset_set_plan_history is the source of truth for revision and approval records.
The format contract is intentionally narrow:
- Every item must request PNG as both a desired and required format. A transparent PNG is the required master.
- SVG may be the optional second requested format. It is desired and published only after the sanitizer, complexity, and raster-fidelity gates pass.
- Mark SVG required in the manifest only when the user explicitly requires vector delivery and accepts that a failed SVG gate leaves that item requiring review. An optional SVG failure must not erase or fail a valid PNG master.
Generic graph-editing tools cannot author or alter an asset-set plan node. This includes
edit_asset_flow, apply_flow_edits, and the individual incremental edit tools: they cannot add,
remove, or change plan fields, manifest contents, or approval state. Use
update_asset_set_plan for authoring changes and approve_asset_set_plan for approval.
After approval, require validate_asset_flow to return valid=true, then finish a terminal mock
run before considering live execution. Immediately before a provider-backed source-generation run:
- Inspect the persisted graph and selected execution target. Exactly one provider-backed node may be reachable by that live run; if more than one is reachable, stop instead of using regeneration as a workaround. A zero-provider asset-set local reprocessing run is a distinct recovery path described below and must be verified from its returned target and usage evidence.
- Tell the user the operation, provider/model when known, item or set scope, expected size/quality, and estimated or bounded cost when available. Ask for explicit confirmation of that one call.
- After confirmation, start one live run with a new
idempotencyKey. Further provider calls need fresh confirmation.
For asset-set templates configured for local review, the approved source sheet then proceeds through the canonical local split, background removal, trim/normalization, vectorization, review, and output stages. These local post-processing stages consume no model/provider tokens and incur no provider cost; verify that claim from returned usage, trace, or cost evidence. Do not claim an unverified zero-token result. If semantic provider review is enabled, stop before an atomic live run because the current MCP surface cannot separately confirm and dispatch that additional paid stage.
Finish with get_flow_outputs and open_flow_gallery. get_flow_outputs returns the complete
outputs metadata array for the selected run. Every durable output carries two links:
artifact_url— the backend${BRANDBRAIN_API_URL}/api/v1/canvas/sessions/.../artifacts/...URL. This is the one an agent can actually fetch, because it is served by the same API this server authenticates against.open_in_browser— the app${BRANDBRAIN_APP_URL}/api/canvas/...URL, for a signed-in human.
Neither link carries credentials or a signed query string. get_flow_outputs inlines previews for
at most 16 outputs, subject to the per-image byte cap; outputs beyond that preview limit remain
present in metadata with both URLs. Use those URLs for individual PNG/SVG delivery and the gallery
for visual review.
Incremental editing
Edit a stored canvas without resending the whole graph (preferred over edit_asset_flow, which
replaces the entire flowSpec).
Asset-set plan nodes are the exception: generic whole-flow and incremental edits cannot add, remove, or modify them. Follow the dedicated asset-set authoring and delivery lifecycle instead.
Important — the backend validates the WHOLE graph on every save. Each single-op tool below does its own
PUT, so it is rejected (HTTP 400) if it leaves the graph transiently invalid. A generate node needs ≥1 input edge and ≥1 output edge, so you cannot add a bare generate node and wire it up in separate calls. To build or extend a generate chain, useapply_flow_edits, which applies an ordered op list in memory and saves once — only the final graph is validated.
| Tool | Purpose |
|---|---|
apply_flow_edits | Batch: apply an ordered list of ops in one save. Use this to build/extend chains. |
add_flow_node | Add one node (type = prompt/reference/style/generate/output/frame/note); auto-positions and auto-ids if omitted. Safe alone only for nodes valid while unwired (prompt/style/reference/note/frame). |
update_flow_node | Patch a node's fields and/or position by nodeId |
remove_flow_node | Remove a node and any edges referencing it |
connect_flow_nodes | Add an edge between two existing nodes (prompt|reference|style|output -> generate, or generate -> output) |
disconnect_flow_nodes | Remove an edge by edgeId, or by sourceNodeId+targetNodeId |
set_generate_target | Set a generate node's surface/aspectRatio/composition target |
Tool inputs are camelCase (modelId, sourceNodeId); they are emitted to the backend as the
canonical snake_case proto-JSON. Each tool returns the backend validation result.
Example — build a full prompt+style → generate → output chain in one call:
apply_flow_edits {
"sessionId": "flow_session_...",
"ops": [
{ "op": "add_node", "type": "prompt", "id": "bp", "text": "A bold packshot on seamless paper" },
{ "op": "add_node", "type": "style", "id": "bs", "palette": ["#0a0a0a", "#f5f5f0"] },
{ "op": "add_node", "type": "generate", "id": "bg", "provider": "openai", "modelId": "gpt-image-1" },
{ "op": "add_node", "type": "output", "id": "bo" },
{ "op": "connect", "sourceNodeId": "bp", "targetNodeId": "bg" },
{ "op": "connect", "sourceNodeId": "bs", "targetNodeId": "bg" },
{ "op": "connect", "sourceNodeId": "bg", "targetNodeId": "bo" },
{ "op": "set_generate_target", "nodeId": "bg", "surface": "packshot", "aspectRatio": "1:1" }
]
}
Task-backed run tools
run_asset_flow and regenerate_asset_flow_node are registered as MCP task tools.
- plain
client.callTool(...)is not the right API for these tools - task-capable clients should use
client.experimental.tasks.callToolStream(...) - this avoids the default short request timeout problem on real image generation
- the MCP task stays
workingwhile the backend run isqueuedorrunning; it does not complete merely because the asynchronous dispatch returned a run ID - backend
completedandpartialruns complete the MCP task; backendfailed,cancelled, andoutcome_unknownruns fail it while retaining the terminal run and error in the stored task result - a requested task TTL that is shorter than the bounded backend polling window is raised to a safe accepted TTL so the SDK task store cannot expire before terminal evidence is persisted
- accepted TTLs are capped at
2,147,000,000ms(just below Node's signed 32-bit timer maximum), including when a client requests a larger value - terminal polling retries only transient read failures (network/timeouts, HTTP 429, and HTTP 5xx) with bounded exponential backoff and jitter inside one overall deadline; authentication, other HTTP 4xx, and unsupported backend statuses fail immediately
- the default poll deadline is mode-aware:
liveruns poll for up to 30 minutes (a ~10-minute asset-set generation fits inside one task), whilemockruns keep the short ~9.5-minute default; a constructor/configuredrunPollTimeoutMsalways overrides the default - each run read has a wall-clock timeout that aborts the request and releases the poll loop even if bearer-token resolution or another dependency ignores cancellation; late settlement cannot change the terminal task result
- access-token refreshes are coalesced within a process and locked across local clients (refresh tokens are single-use), bounded to 10 seconds, and receive the run-read cancellation signal while callers wait; transient failures preserve the session and any still-valid access token
- task-backed and standard tools share one 32-operation execution limit across dispatch and terminal polling; capacity is released when that lifecycle reaches a terminal outcome
Clients without task augmentation (Claude Code included) should use the polling pair. A plain
callToolofrun_asset_floworregenerate_asset_flow_nodeno longer produces a bare-32601: the server answers with an error result naming the tool to use instead (start_asset_flow_run/start_regenerate_asset_flow_node, thenget_asset_flow_task) and a machine-readablestructuredContentof{ error: "task_augmentation_required", use_instead: [...] }. No run is dispatched by that guidance response.
Example:
const stream = client.experimental.tasks.callToolStream(
{
name: "run_asset_flow",
arguments: { sessionId, mode: "mock" },
},
CallToolResultSchema,
{ task: { ttl: 600000 } },
);
for await (const message of stream) {
if (message.type === "result") {
console.log(message.result.structuredContent);
}
}
Standard polling tools
Some MCP clients do not support the experimental task streaming API and can only issue ordinary
callTool(...) requests. For those clients, the server also exposes a polling pair:
start_asset_flow_runget_asset_flow_task
and the regenerate equivalents:
start_regenerate_asset_flow_nodeget_asset_flow_task
start_* returns immediately with a task payload like:
{
"task": {
"id": "flow_task_...",
"kind": "run",
"status": "working",
"session_id": "flow_session_...",
"mode": "mock",
"poll_interval_ms": 1000
}
}
Poll until the task is terminal. queued and running backend runs remain working; completed
and partial map to completed, while failed, cancelled, and outcome_unknown map to failed.
The terminal polling envelope contains the refreshed backend run, including its result/error
evidence. Dispatch happens once; polling only reads the pinned session/run identity and does not
repeat provider work. Transient reads use bounded backoff; non-transient errors and unknown statuses
fail immediately. While a task is working, run_id, backend_status, poll_attempts, and
updated_at advance with polling progress; last_poll_error is included while retrying a transient
read failure.
Each start_* call creates a distinct dispatch attempt, including keyless calls and repeated calls
with the same explicit idempotency key. This ensures the backend can re-evaluate the latest flow
revision and lineage; canonical idempotency/replay decisions remain backend-owned. If distinct
dispatches return the same immutable session/run ID, the MCP server shares only their terminal GET
FlowRun promise to avoid redundant reads. Each caller independently builds its task result from
that run and its own dispatch envelope, so prepared authority is never borrowed from another caller.
Local processor health
Call get_flow_processor_health before promising no-token local asset processing. It is a read-only,
allowlisted view of /health/processors that reports enabled, available, platform,
execution_class, provider_token_cost, revisions.vtracer, revisions.resvg, and any health
error. Its capabilities object reports split, trim_normalize, vectorize, local_review,
and the background-removal fields deterministic_matte_or_alpha, local_model_fallback, and
production_ready. Background removal is production-ready only when the deterministic path is
present and the configured local BiRefNet fallback passes its provenance-aware health probe. A
runtime without BiRefNet can still preserve valid alpha or remove a known matte, but callers must
not promise general-purpose background removal when production_ready is false. Missing capability
fields from older backends default to false. Unknown backend fields are dropped so credentials and
transport details cannot be exposed. An unavailable optional processor is returned as health
evidence even when the backend health route uses HTTP 503. These checks are local and have no
provider-token cost.
Then poll:
const started = await client.callTool({
name: "start_asset_flow_run",
arguments: { sessionId, mode: "mock" },
});
const taskId = (started.structuredContent as { task?: { id?: string } }).task?.id;
for (;;) {
const polled = await client.callTool({
name: "get_asset_flow_task",
arguments: { taskId },
});
const payload = polled.structuredContent as {
task?: { status?: string };
run?: { id?: string };
};
if (payload.task?.status === "completed" || payload.task?.status === "failed") {
console.log(payload);
break;
}
await new Promise((resolve) => setTimeout(resolve, 1000));
}
Notes:
get_asset_flow_taskreturns the finalrunpayload once the background task completes- after completion, use
get_asset_flow_runif you want the persisted run again later - the polling task registry is in-memory to the MCP server process, so task IDs are not durable across MCP restarts
- the shared execution coordinator rejects new work before backend dispatch when its 32-operation capacity is full, regardless of whether work came from a standard or task-backed tool
- capacity is released after dispatch and terminal-poll failures as well as normal completion; a rejected shared poll is removed before the next attempt, so a retry performs a fresh backend read
- the standard registry retains at most 128 tasks, evicts the oldest terminal entries as needed, and expires terminal entries after 10 minutes
- prepared POST requests still carry the expected flow revision and resolved-policy hash, but those values are not exposed as fenced durable identity because the persisted FlowRun does not echo them. Retained dispatch identity contains only matchable fields: session, execution mode, actual target, generated or supplied idempotency key, approved manifest hash, and execution lineage. Durable failed-run evidence is accepted only from the typed error around the actual run or regenerate POST and only when every retained field matches; get-session/prepare/authentication failures never carry run evidence, and legacy fields that were not sent remain absent
- retained failure diagnostics follow the real FlowRun ProtoJSON shape and are explicitly allowlisted
and bounded, with a hard 64 KiB serialized budget across the result diagnostic envelope. Later
entries are deterministically dropped, and
diagnostics_truncatedis set whenever a count limit, per-string bound, or global byte budget clips retained diagnostics. Safe trace/checkpoint/processor/item/artifact identifiers, statuses, issue codes, dimensions, sizes, hashes, MIME types, and durations may be retained; prompts, request/response bodies, provider usage, evidence JSON, credentials, filesystem paths, URLs, provenance, secrets, and unknown fields are discarded
Browser OAuth login
The preferred auth path is browser-based Google OAuth through BrandBrain:
- call
login_brandbrain - the MCP server opens
/login/agenton the BrandBrain app with a localhostagent_callback - BrandBrain redirects to the backend Google OAuth start endpoint
- after Google authentication, the backend redirects back to the local MCP callback with an OTC
- the MCP server checks a per-login callback nonce, exchanges the OTC for agent tokens, and atomically stores them in an owner-readable credential file
The callback listens only on loopback, ignores unrelated requests, does not log the one-time code, and closes after completion, cancellation, or timeout. The backend parses callback URLs and rejects credentials, non-loopback hosts and invalid ports. Session refreshes use a shared file lock so simultaneous Codex and Claude requests cannot redeem the same single-use refresh token. Crashed locks expire automatically.
Use whoami_brandbrain to confirm the current session and logout_brandbrain to revoke it.
If a flow tool returns Not authenticated. Run login_brandbrain first., do that before retrying.
Recommended workflow
1. Log in when needed
login_brandbrainwhoami_brandbrain
2. Start from templates unless you have a reason not to
Preferred path:
list_asset_flow_templatescreate_asset_flowwith:titlegoalif you want the tool to infer a templatetemplateIdif you know the exact starter
- read back
canvas_url
This keeps the first graph aligned with the checked-in canonical bundles.
goal does two things: it infers the template, and it is written into the scaffold's brief prompt
node
Frequently asked questions
What is BrandBrain Flow Orchestrator MCP Server?
Compose BrandBrain asset flows, run mock/live generation, and fetch outputs
How do I install BrandBrain Flow Orchestrator MCP Server in Claude Desktop, Cursor, or VS Code?
Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. BrandBrain Flow Orchestrator MCP Server runs locally from the npm package brandbrain-flow-orchestrator-mcp with the command npx -y brandbrain-flow-orchestrator-mcp@0.4.0.
Does BrandBrain Flow Orchestrator MCP Server support remote (HTTP) connections?
No remote endpoint is listed for BrandBrain Flow Orchestrator MCP Server. It runs locally on your machine over stdio, started by your MCP client.
What tools does BrandBrain Flow Orchestrator MCP Server provide?
BrandBrain Flow Orchestrator MCP Server provides 40 tools, including aspect_ratio, aspect_ratio_unsupported, authorization_budget_insufficient, and backend_outdated. See the full tool list for descriptions and parameters.
How is BrandBrain Flow Orchestrator MCP Server's trust score calculated?
BrandBrain Flow Orchestrator MCP Server scores 55 out of 100 (Fair). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.
Reviews
No reviews yet—Be the first to review
No published reviews yet. Used it? Tell the next person how it went.
Sign inA verified email is required to review this server.
Add badge to your README
Paste either snippet into the repository README. The image links to this listing.