BobaBanana API

Connect an AI agent to BobaBanana with MCP

BobaBanana runs a remote MCP (Model Context Protocol) server at https://bobabanana.com/api/v1/mcp: add it to any MCP client with the header Authorization: Bearer <your bb_ key>, and the agent gets one tool for every API endpoint, with the same key, credits, limits and errors as the REST API. Nothing to install: the server runs on BobaBanana, and every tool call is an ordinary API call made with your key.

View as Markdown

At a glance

Server URL
https://bobabanana.com/api/v1/mcp
Transport
Streamable HTTP (JSON answers, no SSE stream, no session)
Protocol versions
2025-06-18 and 2025-03-26
Auth
Authorization: Bearer bb_... (or X-API-Key: bb_...), the same keys as the REST API
Tools
22, one per endpoint, plus wait_for_job
Cost
tools cost what the same REST call costs; reading tools are free

Connect a client#

Every MCP client that supports remote servers over HTTP needs the same three things: the URL, the transport (http, also called "Streamable HTTP") and the Authorization header. Keep the key in an environment variable named BOBABANANA_API_KEY and never paste it into a prompt.

  1. Create an API key in the BobaBanana studio under Settings → API keys (see authentication), and store it as BOBABANANA_API_KEY.
  2. Add the server to your client, using its own way of adding a remote HTTP server (the examples below).
  3. Check the connection: ask the agent to call get_balance. A 401 means the header is missing or the key is wrong.

A command-line coding agent#

Most command-line agents add a remote server with one command that takes a name, the transport, the URL and a header. The general shape is:

<agent-cli> mcp add --transport http bobabanana https://bobabanana.com/api/v1/mcp --header "Authorization: Bearer $BOBABANANA_API_KEY"

Use your agent's own command name, and check its help for the exact flag names (--transport, --header).

Clients configured with a JSON file#

Desktop apps and editors that read a JSON settings file (for example Cursor's mcp.json) take the URL and the header:

{
  "mcpServers": {
    "bobabanana": {
      "url": "https://bobabanana.com/api/v1/mcp",
      "headers": {
        "Authorization": "Bearer ${env:BOBABANANA_API_KEY}"
      }
    }
  }
}

Some clients name the block servers instead of mcpServers, or want "type": "http" next to the URL; how a client fills in an environment variable also differs. Check your client's docs for the file's place and its exact keys.

Clients that only start local servers#

A client that can only launch local (stdio) servers can reach a remote server through a small local bridge program that forwards stdio to a URL and adds the header. Point the bridge at https://bobabanana.com/api/v1/mcp and give it the Authorization header with your key.

Tools the agent gets#

Tools the agent gets
Tool Does Calls
generate_image Make a picture from a prompt and up to 10 reference pictures or library assets. Returns a job; then call wait_for_job. POST /v1/images
generate_video Make a video: animate a picture, generate from text, copy a clip's motion (motion_video), extend a clip (extend_video) or make a character talk (voice + script). Returns a job; then call wait_for_job. Use dry_run: true or max_credits to control cost. POST /v1/videos
estimate_video Price a motion transfer (a video with motion_video) before making it: scenes, multiplier, credits. Makes nothing. POST /v1/videos/estimate
generate_speech Speak text in a saved voice (@handle) or a voice cloned from a sample (needs voice_consent). Returns a job; then call wait_for_job. POST /v1/speech
generate_sound_effect Make a 2 to 20 second sound effect from a description. Returns a job; then call wait_for_job. POST /v1/sound-effects
wait_for_job Wait for a job to finish, up to timeout_seconds (60 by default, 90 at most), and return it. Call again while status is queued or running; on succeeded, output holds signed download links. Never create the job again while waiting. GET /v1/jobs/{job_id}
upscale_job Make a larger, sharper copy of a finished image or video job. Check get_upscale_options first. Returns a job; then call wait_for_job. POST /v1/jobs/{job_id}/upscale
get_upscale_options List the upscale factors a finished job allows and what each costs. GET /v1/jobs/{job_id}/upscale-options
list_assets Find approved library characters, objects, places and scenes to use by @handle. GET /v1/assets
list_voices Find saved voices to use as voice: '@handle'. GET /v1/voices
get_balance Check the workspace's available credits before a costly job. GET /v1/balance
list_prices Read the price table (credits per job kind). GET /v1/prices
get_status Check which kinds of generation are available now, your queue length, typical times and prices. GET /v1/status
upload_file Upload a reference picture or audio file once, from a public https:// URL or base64 data, and use its file_id in later calls for 24 hours. Create calls also take url or data inputs directly, so upload only to reuse a file. POST /v1/files
get_file Get an uploaded file: type, size, dimensions and when it expires. GET /v1/files/{file_id}
delete_file Delete an uploaded file that no unfinished job uses. DELETE /v1/files/{file_id}
list_jobs List this key's jobs, newest first, optionally by status or type, one page at a time. GET /v1/jobs
get_job Get one job now (or wait up to 30 seconds with wait): status, cost, and output links once it has succeeded. GET /v1/jobs/{job_id}
cancel_job Cancel an unfinished job; credits for steps that have not run are released. POST /v1/jobs/{job_id}/cancel
delete_job Delete a finished job and its results. The job stays counted toward the daily limit. DELETE /v1/jobs/{job_id}
replay_webhook Send a finished job's webhook again, with the same event id. POST /v1/jobs/{job_id}/webhook/replay
get_asset Get one approved library asset by @handle or id. GET /v1/assets/{handle}

Every tool's input schema is read from the OpenAPI spec, so its fields, limits and descriptions are exactly those of the endpoint; each tool also says whether it only reads (readOnlyHint), deletes or stops something (destructiveHint) or is safe to repeat (idempotentHint). The same tools, as plain JSON for other tool-use APIs, are in tools.json.

  • Create tools (generate_image, generate_video, generate_speech, generate_sound_effect, upscale_job) answer with a job. They take dry_run: true to price a request without making anything, and max_credits to cap it.
  • idempotency_key on a create tool works like the Idempotency-Key header: the same key and the same arguments within 24 hours return the first job. When you leave it out, a new key is made for the call and named in the result, so the agent can retry that exact call safely.
  • wait_for_job waits up to timeout_seconds (60 by default, 90 at most) and returns as soon as the job is succeeded, failed or canceled. If the job is still running, call it again; never create the job again.
  • upload_file takes a public https:// url or base64 data (about 25 MB) and returns a file whose id works as file_id for 24 hours. Create tools also take url and data inputs directly.

Results and errors#

A tool result carries the API's JSON answer twice: as structuredContent and as JSON text in content, for clients that only read text. When the API answers with an error, the result has isError: true and structuredContent.error holds the same object the REST API sends, plus the HTTP status and, for 429 and 503, retry_after in seconds:

{
  "isError": true,
  "structuredContent": {
    "error": {
      "code": "insufficient_credits",
      "message": "Needs 4 credits, you have 0.",
      "required": 4,
      "available": 0,
      "docs": "https://bobabanana.com/docs/api/errors/",
      "status": 402
    }
  }
}

Read code and param, fix the arguments and call again; the errors page says what to do for each code. Protocol problems (an unknown tool or method, a malformed message) are JSON-RPC errors instead: -32700 parse error, -32600 invalid request, -32601 unknown method, -32602 unknown tool or bad params.

Talk to the server with curl#

The server speaks JSON-RPC 2.0 over POST. Each request is answered on its own (there is no session to keep), so these calls can be sent in any order.

curl -s https://bobabanana.com/api/v1/mcp \
  -H "Authorization: Bearer $BOBABANANA_API_KEY" \
  -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"}}}'

The answer names the protocol version, the server (BobaBanana) and short instructions for the agent:

{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-06-18","capabilities":{"tools":{"listChanged":false}},"serverInfo":{"name":"BobaBanana","title":"BobaBanana","version":"1.3.0"},"instructions":"..."}}

List the tools, then call one:

curl -s https://bobabanana.com/api/v1/mcp \
  -H "Authorization: Bearer $BOBABANANA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "MCP-Protocol-Version: 2025-06-18" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'

curl -s https://bobabanana.com/api/v1/mcp \
  -H "Authorization: Bearer $BOBABANANA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "MCP-Protocol-Version: 2025-06-18" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_balance","arguments":{}}}'

How the server behaves#

  • Same rules as REST. Each tool call runs as one REST request made with your key, so the limits (jobs per key per 24 hours, unfinished jobs), credit holds, idempotency and maintenance pauses apply exactly as they do to the API. A key sees only its own jobs and its workspace's files and assets.
  • Answers. Requests are answered with application/json; notifications get 202 with no body. GET answers 405: there is no event stream.
  • Versions. initialize agrees on 2025-06-18 or 2025-03-26 (a client that asks for another version is offered 2025-06-18). Later requests may send MCP-Protocol-Version; an unknown version there gets 400.
  • Browsers. A request with an Origin header from another site gets 403 bad_origin, so a web page cannot use a key stored in someone's browser.
  • Auth errors. No key or a wrong key gets 401 with a WWW-Authenticate: Bearer header and the usual missing_api_key or invalid_api_key body.

Frequently asked questions#

Does the MCP server cost anything extra?#

No. Reading tools are free, and a create tool costs exactly what the same REST call costs, held and charged the same way. Use dry_run: true to see the price first.

Is a separate key or sign-in needed?#

No. Use a normal BobaBanana API key in the Authorization header. The server does not use a browser sign-in flow.

Why did my agent make the same picture twice?#

It created the job twice instead of waiting. Tell it to call wait_for_job with the job's id until the status is final, and to resend a create call only with the same idempotency_key.

Can the agent wait longer than one wait_for_job call?#

Not in one call: wait_for_job returns after timeout_seconds at most, with the job's current status. Calling it again continues the wait; long videos can take several calls.

Which tools change or delete things?#

cancel_job, delete_job and delete_file carry destructiveHint: true; the create tools and upload_file add things and spend credits; every get_ and list_ tool only reads. Many clients ask before running a tool that is not read-only.

Does the server support resources, prompts or SSE streaming?#

No. It offers tools only, answers every request with plain JSON, and keeps no session, which is all a client needs to use the API.

Last updated · View as Markdown · llms.txt