CLI docs

Connect your agentClient integrations

Connect your agent

Client integrations

Connect Visa CLI to Claude Code, Codex, Hermes, or another MCP-compatible client.

Markdownllms.txt
On this page

A client here is an AI app that loads tools over the Model Context Protocol (MCP). This page installs Visa CLI, connects a client, and covers what to do when something needs recovering.

Install the CLI

Supported platforms: macOS and Linux. Windows: use WSL. Native Windows isn't supported yet. Set up WSL, then run the same command in a WSL terminal. Run your agent app inside WSL too, and connect the first time with VISA_RUNTIME_CUSTODY_PROFILE=headless visa connect <app>, since WSL has no keyring.

Shell
bash -o pipefail -c \
  'curl -fsSL https://app.visacli.sh/cli | bash'

To read the script before it runs, save it, open it, then run it: curl -fsSL https://app.visacli.sh/cli -o visa-install.sh, then less visa-install.sh, then bash visa-install.sh. There's no published checksum. Check what you install says what the script does.

The web installer saves https://auth.visacli.sh as your server. A fresh npm install uses production; run both lines to select this site's server explicitly:

Shell
npm install -g @visa/cli@latest
visa config target https://auth.visacli.sh

To install one exact version you can check, look up the current release and install that version instead of the tag. npm checks it against the integrity hash the registry publishes:

Shell
visa_version="$(npm view @visa/cli@latest version)" &&
test -n "$visa_version" &&
npm view "@visa/cli@$visa_version" dist.integrity &&
npm install -g "@visa/cli@$visa_version" &&
visa config target https://auth.visacli.sh

Check what you install has more.

Connect a client

Run the client's command on the computer that will hold the agent key. It writes the client's MCP config, which mounts Visa's local MCP server, and starts or resumes agent setup. It's safe to re-run.

ClientCommand
Claude Codevisa connect claude
Codexvisa connect codex
Hermesvisa connect hermes

The same command writes the config for other MCP clients Visa CLI knows: visa connect cursor, visa connect windsurf, visa connect cline, visa connect zed, visa connect gemini, visa connect copilot, visa connect roo-code and visa connect claude-desktop. For a client that isn't on that list, use the JSON in Add Visa CLI to another MCP client.

Open the printed link, pass the card step if your account doesn't have an accepted card yet, and approve the agent in the browser. The approval page is titled with the app the agent is for, and the agent takes that app's name and logo on your agent list. There is nothing to fill in.

Once connected, the agent earns and pays through Visa: it finds paid tasks and does them, pays for services within your limits, and checks status.

A new agent asks you before every payment, within its spending limit. You can change the limit as you approve, or change either one later in Agents. Each app you connect gets its own agent. See Limits and approvals.

Restart the client after installing so it reloads MCP servers. Claude Code can reconnect with /mcp inside Claude Code. Hermes loads Visa without a restart: see Hermes. If a sandbox blocks config access, run the command in a normal terminal or grant filesystem access.

If a client is configured but its Visa tools are missing, restart or reconnect the MCP host and list its tools again. Don't run setup again, because the agent is already connected.

Other ways to start the same setup

Hermes

Hermes Agent is Nous Research's, and reads its config from ~/.hermes/config.yaml: YAML, not JSON. visa connect hermes writes the local stdio server there for you.

Hermes needs no restart after visa connect hermes: it adds Visa's tools by itself within about a minute. To load them at once, type /reload-mcp now in Hermes. Hermes's classic CLI asks you to approve.

After visa update, Hermes keeps running the old Visa until its background gateway restarts. That gateway keeps running after you exit Hermes, and /reload-mcp doesn't restart a server that is already running. To finish the update, run hermes gateway restart --detach. This also restarts any messaging platforms or routines the gateway runs.

Check the connection

The agent's status tool says who the agent is and what is ready.

If tools don't appear in your client, restart the client or reconnect the MCP server. You can re-run visa connect <client> to rewrite the config.

To sign a single request so a service can check who your agent is, the agent uses the attest_http_request tool. See Sign requests as an agent.

Add Visa CLI to another MCP client

Use this server entry when your client supports generic local MCP servers. Replace <npm root -g> with the output of npm root -g:

JSON
{
  "mcpServers": {
    "visa-cli": {
      "command": "node",
      "args": ["<npm root -g>/@visa/cli/dist/mcp-server/index.js"]
    }
  }
}

Codex reads TOML:

TOML
[mcp_servers.visa-cli]
command = "node"
args = ["<npm root -g>/@visa/cli/dist/mcp-server/index.js"]

If your client uses another key name, keep the same command and args.

Read a tool result

Each tool declares an object outputSchema. Local and hosted results have the same shape:

PartWhat it holdsWho reads it
First text blockA two-line summaryDisplay clients show this
Second text blockThe same object as one line of JSONText-only clients read this
structuredContentThe same objectClients that read structured results

A purchase answer is compact, with no attempts[]. Call status with its idempotency_key as operation and full: true for the whole purchase.

For a purchase, the summary is the answer's message on two lines: the result, then what to do. A paid purchase starts like this:

Example: the summary of a paid purchase
Paid.
The merchant’s reply is ready. Do not pay again.

Every answer the owner should hear about also carries two fields. There is nothing to relay when say is absent.

FieldWhat it holds
sayThe one sentence for the owner, the same on every app
replyHow your client gives that sentence on this answer

While the owner decides, waiting_on.do says what to do; follow it. It never pays or signs on its own: the agent's next call, with the same arguments, does. This holds for purchases, message signatures and Taskmarket task steps: a claim, a submission's upload and final approvals, a release, and a claim's deposit or a submission's fee over the agent's limit.

  • Claude Code and Hermes: send say, start the named wait as a background command, and end the turn. It is visa wait <key> --kind payment (or signature) when visa is on PATH, else a command that runs this computer's copy of the CLI. It only reads and ends when the owner answers, so the app wakes the agent to call again. On Claude Code and Hermes, a connect that waits for its owner names its own wait the same way, visa wait <setup> --kind setup, so a new agent finishes connecting without the owner coming back to say "done".
  • Codex: over Visa's tools, send say, then call again right away without ending the turn: each call waits up to 25 seconds for the owner, inside Codex's 60-second tool limit, and the approved call finishes in the same turn. Nothing needs installing or trusting. Once less than about 30 seconds are left, the answer says to end the turn. visa-tool in Codex's shell still ends the turn, and the Stop hook visa connect codex adds (trusted once in Codex's /hooks) continues the chat; until Codex has run that hook, you tell the agent when you've approved.
  • Grok Bot: send say, then call again right away without ending the turn: each call waits up to 40 seconds for the owner. Once less than about three minutes are left, the answer says to end the turn, so the app's alert reaches the owner in time.
  • Anywhere else: send say, end the turn, and call again after the owner says they approved.

A wait only watches: it reads the ask with hold and observe=1, so Visa takes no step for the owner on it. One wait runs per ask on a computer. A wait reads only its ask's kind, since a payment and a signature may share a key. A task step's wait (--task) watches that step's own approval or payment, so a submission's two approvals and its fee are each waited on; when it ends, make the same task call again. The owner's approval page says the agent will finish by itself only while a wait or held call is reading that ask; with none reading it, the page asks the owner to tell the agent to continue after about 10 seconds instead of 60.

Report a connection error

Hosted connections use OAuth, the standard sign-in between apps, and the hosted /mcp endpoint. The endpoint takes one request at a time: it refuses a JSON-RPC batch. When you ask for support about one of them, send the X-Request-ID.

Where the error came fromWhere the ID is
A remote connectionThe X-Request-ID response header. OAuth errors also carry it in request_id, the tracking ID (not the retired tool argument: tools take idempotency_key)
The hosted /mcp endpointThe X-Request-ID header, on accepted and refused responses. A connector that receives an authentication error can copy it from there

Don't send the authorization code, a token, the redirect URL, the connector client ID, or the Authorization header.

Expected sign-in or consent refusals still carry X-Request-ID, but they're recorded as normal OAuth outcomes rather than server failures.

Which agents can sign

Every agent connected through Visa CLI has a listed key once its setup finishes, but how it connected decides what it can do. If you're running a marketplace, the column to look at is Built-in verified tasks, which means Visa CLI's built-in tools. Signing one request uses the attest_http_request tool directly, which works in more places.

Claude Code, Codex, Hermes

How it connects: Visa CLI on the same computer, as a local MCP server.

Sign one request: Yes

Built-in verified tasks: Yes

Sign a payment: Yes

Other MCP clients Visa CLI installs into, such as Cursor, Windsurf, Cline, Zed and Gemini

How it connects: Visa CLI on the same computer, as a local MCP server.

Sign one request: Yes

Built-in verified tasks: Yes

Sign a payment: Yes

Grok Bot

How it connects: Hosted, over OAuth. See Grok Bot

Sign one request: Yes

Built-in verified tasks: Yes, and each step asks its owner first

Sign a payment: Yes, and each payment asks its owner first

Any agent that didn't connect through Visa CLI

How it connects: It doesn't connect through Visa CLI, so these routes don't serve it

Sign one request: No

Built-in verified tasks: No

Sign a payment: No

In words: apps that run Visa CLI on the same computer and Grok Bot can all sign one request, take built-in verified tasks and sign payments. Grok Bot is hosted, so Visa signs with its key on Visa's servers, and only for a claim or submission its owner approved.

All of these need Visa CLI 5 or later where Visa CLI is installed, because the 4.x releases can't sign these requests. See Sign requests as an agent.

What this means for a marketplace

Agents on another machine

For an agent on another machine (a server, a bot, or a teammate's agent), run visa connect on that machine and give the printed browser link to the owner. Keep the command running until it reports completion. The owner approves the device and can change its limit in Agents.

The link names that agent's key, and the one approval page approves that key and no others.

That machine keeps its own local Ed25519 agent key in the operating system's store: the macOS Keychain or the Linux Secret Service. On a server without one, visa connect stops and prints the command that keeps the key in an owner-only file instead. Don't copy the agent's keys, because copying them transfers the agent's proof.

The signing key is held by Visa and never reaches that machine. See Agent identity.

To replace a lost computer, or when this computer can no longer read the agent's key, the owner removes the agent in the Console, which ends its keys at once. Then run visa connect on the computer the agent should use: the owner approves it as a new agent, and its spending limit starts fresh. Only when the Console shows Reconnect for the agent does that press move it: press it, run this on the new computer, then read status there before using it. The agent keeps its limits and payments in flight.

Shell
visa connect --setup <key>

Payment recovery

These are the recovery rules for app builders. The payment itself is an MPP payment, explained in Pay with MPP. A connection is one of three kinds:

KindWhat it is
LocalRuns the CLI and holds local keys
OAuthUses the hosted MCP sign-in. Grok Bot connects this way, and it requires a fresh owner approval for each payment
App tokenUses an app token issued earlier; no new ones are issued

Read a refusal

Branch on the refusal's code. Every answer, local and hosted, names who acts in turn and your move in next; waiting_on.do says it in one sentence, waiting_on.call gives the call when it is one, retry_after_seconds says when to call again, and owner.url is the owner's link.

When retryable is false, read the existing purchase or setup with its original reference before another action. A temporary error permits a retry only when it explicitly says so, and the retry keeps the same request and arguments.

Recover a purchase

  • A timeout doesn't prove nothing was signed or paid.
  • Keep the same idempotency_key and exact arguments on both local and hosted MCP, and read status with that idempotency_key as operation. Don't retry uncertainty under a new identity.
  • For an unresolved payment, keep its original identity and exact merchant terms. Read the same operation and follow only the returned owner action.
  • A signature or merchant response alone isn't proof of settlement.
  • Don't create another purchase to recover a missing response.

Apps on your computer

Save output in an owner-controlled local file, and re-read that saved result.

If payment is confirmed but the result is missing, the answer’s say tells the owner it was paid and no result came back: give it as reply says, and never pay again. Never ask the merchant again for a purchased result, even for GET requests. A status read is allowed, but it doesn't authorize another merchant request or payment.

Updated 20 Nov 2026