Authentication
Gavana has two authentication paths, and which one you use is decided entirely by which server you connect to.
| Hosted MCP | Local stdio MCP | |
|---|---|---|
| Endpoint | https://app.gavana.ai/mcp | npx -y @gavana.ai/mcp@0.5.1 on your machine |
| Credential | Browser OAuth, PKCE, no token to copy | A saved CLI login, or an Agent Access token |
| Where it lives | The client’s own connector storage | Your MCP client’s private environment, or ~/.config/gavana/agent.json |
| Expiry | No automatic expiry; it remains active until you disconnect or revoke it | Never by default; optionally choose a custom 1–90 day expiry when you create the token |
| Revocation | Settings → Connect an agent → Connected | The same list — it holds OAuth grants and tokens together |
If you can use the hosted endpoint, use it. Nothing is safer than a credential you never have to handle.
Hosted: browser OAuth
You add an endpoint URL to your client, click connect, sign in to Gavana in a browser, review a consent screen, and approve. No token is ever pasted into a chat window, a config file, or a shell command. Settings → Connect an agent in Gavana walks you through this for each app.
What the flow supports
The authorization server metadata is published at https://app.gavana.ai/.well-known/oauth-authorization-server, and the hosted endpoint publishes protected-resource metadata at /.well-known/oauth-protected-resource/mcp.
Any MCP client that implements standard OAuth discovery finds everything it needs there. The declared surface is:
| Property | Value |
|---|---|
| Authorization endpoint | https://app.gavana.ai/oauth/authorize |
| Token endpoint | https://app.gavana.ai/oauth/token |
| Registration endpoint | https://app.gavana.ai/oauth/register |
| Revocation endpoint | https://app.gavana.ai/oauth/revoke |
| Grant types | authorization_code |
| Response types | code |
| Response modes | query |
| PKCE | S256 required |
| Client authentication | none — public clients with PKCE only |
| Bearer method | header |
Dynamic client registration is open, with real constraints: 1–10 redirect URIs, each an exact HTTPS or local-loopback callback, and a token_endpoint_auth_method of none. A registration asking for a client secret is rejected. There is no implicit grant and no password grant.
The consent screen
The approval page reads Connect followed by the client’s name and to Gavana, with the subtitle Secure OAuth connection, the account it is Connecting as, and the one place approved access returns to. Permissions are grouped and collapsed; expand a group to read each one:
| Group | Permissions it can hold |
|---|---|
| Canvases and images | canvas:read, canvas:write, asset:read |
| Elements and saved references | element:read, element:write, reference:extract |
| Image and video generation | image:generate, video:generate, job:manage |
https://app.gavana.ai/mcp grants eight scopes: canvas:read, canvas:write, asset:read, element:read, element:write, image:generate, video:generate, job:manage. There is no partial approval on this path — approving grants all eight. Cancel sends the client back with access_denied.
The authorization server’s metadata also lists reference:extract, so some clients (Codex, for one) ask for every advertised scope. Gavana narrows such a request to the scopes the MCP server can grant and refuses only when none remain.
A read-only connection — the Read-only access switch in Settings → Connect an agent, or --read-only on the gavana mcp helper — uses its own address and grants only canvas:read and element:read. It cannot read image assets, write, or generate.
Approving grants the client the ability to write canvases, manage Elements, and start provider-backed work. Read the list before you click through. The server’s own instructions tell the model to ask for explicit current-turn approval before paid tools, but the capability is present once you approve.
Browser origins
The hosted endpoints accept browser requests from https://chatgpt.com, https://claude.ai, and the Gavana origin itself, plus anything the deployment explicitly allows. A request carrying some other Origin header is refused with 403 before authentication is even attempted. Non-browser clients that send no Origin header are unaffected.
Local: Agent Access tokens
The local stdio server has no browser, so it uses a scoped, revocable Agent Access token — or, if you have already logged in with the CLI, the profile that login saved.
Creating one
The full walkthrough is on Create an Agent Access Token. In short: open Settings → Connect an agent → Developer, name the token after the client and device that will use it under Personal access tokens, keep the default eight permissions and Never expiry or make a deliberate narrower choice, click Create token, then copy the value — Gavana shows it exactly once.
Two details that matter later:
- The token’s name is written into provenance. A node created through a token named
Claude · MCPrecords that name, so canvas history can tell your clients apart without trusting a caller-supplied label. Use one descriptively named token per client rather than sharing one. - Expiry defaults to Never. Choose a custom 1–90 day expiry for a temporary credential. Scopes and expiry are fixed after creation, so replace the token to change either.
Tokens begin with cba_. That prefix is a stable compatibility identifier that predates the Gavana rename — a token starting with cba_ is current, not stale.
Configuring the server
The local server reads either environment variables or the saved CLI profile:
GAVANA_BASE_URL=https://app.gavana.ai
GAVANA_AGENT_TOKEN=<your Agent Access token>or ~/.config/gavana/agent.json, written by gavana auth login.
CRAFTBOARD_BASE_URL, CRAFTBOARD_AGENT_TOKEN, and CRAFTBOARD_AGENT_CONFIG_FILE still work as transition aliases, and the legacy ~/.config/craftboard/agent.json is read when the new path does not exist. Gavana-named variables take precedence.
Put the token in your MCP client’s private environment or secret store. Never in a shared configuration file, a repository, a chat message, or a shell command that lands in history. The install pages use read -rs prompts precisely so the token never appears in your shell history.
Logging in with the CLI instead
If the CLI is already set up, the local MCP server inherits its profile and you configure no token at all. gavana auth login with no token opens a browser and stores a revocable OAuth login — in macOS Keychain where available. To log the CLI in with an existing token instead:
read -rs 'GAVANA_AGENT_TOKEN?Paste Agent Access token: '; printf '\n'; printf '%s' "$GAVANA_AGENT_TOKEN" | gavana auth login --base-url 'https://app.gavana.ai' --token-stdin; unset GAVANA_AGENT_TOKENThe token goes in over stdin, so it never becomes a command-line argument visible to other processes or to your shell history.
The nine scopes
The same scopes apply to OAuth grants and to Agent Access tokens. A token can hold all nine; a hosted MCP connection holds at most the first eight.
| Scope | Token label | Grants | Depends on |
|---|---|---|---|
canvas:read | Read canvases | Find and read canvases, revisions, and node contents | — |
canvas:write | Change canvases | Change canvases, and add images and generation results to them | canvas:read |
asset:read | Read assets | Read the image assets connected to your work | — |
element:read | Read Elements | Find and read reusable Elements | — |
element:write | Create and manage Elements and Saved references | Create, update, archive, and restore Elements and Saved references | element:read |
image:generate | Generate/upload images and run Recipes | Generate and edit images, write image bytes into Gavana storage, and start any Recipe | canvas:read, canvas:write, asset:read |
video:generate | Generate videos from prompts and frames | Discover connected video models and start video work | canvas:read, asset:read |
job:manage | Observe and cancel Runs | Observe, resume, wait for, list, and cancel Runs and Jobs | — |
reference:extract | Analyze and save selected reference images | Upload selected reference images, analyze them with Gavana managed extraction, and save their ingredients | element:read, element:write, asset:read |
Dependencies are enforced when the token is created, not silently added at call time. Asking for image:generate without asset:read returns an error naming the missing scopes; the token creation form selects dependants for you, and clearing a prerequisite clears what depends on it. New tokens start with the first eight selected — everything except reference:extract, which no MCP tool, CLI command, or Canvas API operation on this site needs.
image:generate is the scope that governs writing image bytes into Gavana, not just generating them. That is why save_image_to_canvas requires it even though it generates nothing. A token scoped to canvas:read and canvas:write alone cannot save an image. Importing a product page through save_image_to_canvas with productPageUrl needs only canvas:read, canvas:write, and asset:read.
job:manage is easy to leave off and painful to be without. Without it, a client can start work but cannot poll, wait for, list, or cancel the Run it started. Every hosted tool that waits — generate_image_in_canvas, generate_video, run_canvas_workflow, recipe_run — and every tool that observes — get_image_run, list_image_runs, run_snapshot, get_video_job, get_canvas_workflow_run — requires it.
Which scopes each hosted tool needs
The hosted tools reference lists the exact scopes for every hosted tool, generated from the application’s tool registry. Two rules sit on top of that table:
- A merged input is authorized as the tool it replaced.
generate_image_in_canvaswithoperation: "edit"needsedit_image_in_canvas’s scopes,save_image_to_canvaswithproductPageUrlneedsimport_product_reference_pack’s,model_listwith a video capability needsvideo:generate, andguide_getwithqueryis authorized asguide_search. - Applying Elements adds
element:readto any image call that passes version-pinned Elements.
guide_get and guide_search require no scope at all, which is why an agent can always read the rules regardless of how narrowly it is provisioned.
Reading an authentication error
| Response | Means | Do this |
|---|---|---|
401 invalid_token | No bearer token, a malformed one, or one that expired or was revoked | Reconnect the client. For a local token created with a custom expiry, create a replacement when that expiry passes. |
403 insufficient_scope | The token is valid but lacks a scope the tool needs | The error names the missing scopes. Reconnect or recreate the token with those added. |
403 access_denied | The browser Origin is not allowed | You are calling from an origin Gavana does not accept. |
Tool error toolset_not_enabled | The connection’s profile, ?toolsets=, or ?excludeTools= left that tool — or the tool whose request it makes — out | Reconnect with an address that includes it. |
Both 401 and 403 come back with a WWW-Authenticate header pointing at the protected-resource metadata and listing the required scopes, so a well-behaved client can prompt you to reconnect rather than failing silently.
A scope error at the MCP layer is refused before the handler runs. Nothing partial happens, and no paid work starts.
Credential hygiene
- Never paste a token into a chat, an issue, a commit, or a screenshot.
- Never put a token in a URL — Gavana takes bearer tokens in the
Authorizationheader only. - Treat a scoped preview URL as a credential. The
previewUrlthatget_canvas_imageand successful image runs return is short-lived and carries its owntokenquery parameter, and anyone holding that URL can fetch the image until it expires. Do not paste one into a shared document, a ticket, or a public log. Hand people the canvas link thatcanvas_getreturns instead. - Never expose a connected provider’s configuration — keys, endpoints, or account details — in a transcript or a report.
- Use one named token per client so revoking one does not break the others, and so provenance stays readable. Settings → Connect an agent → Connected shows when each was last used.
- Use a custom expiry for a temporary or less-trusted device; otherwise revoke the token when that client or device is no longer trusted.
- When you report a problem to support, share the
X-Request-IDvalue from the failing response and nothing else. It identifies the request without exposing a credential or canvas content. - Webhook signing secrets are deliberately kept out of MCP tool arguments so they cannot enter a model-visible transcript. If you need callbacks, use the CLI’s
--webhook-secret-envoption or call the API from a trusted backend.