Skip to main content

CLI, MCP and API

Wallet for Agents has three ways in for builders. The Keyban CLI runs in a terminal, a script or your coding agent. It also runs the MCP server that your agent connects to. The REST API lets your own backend manage everything over HTTPS. All three act on the same applications, wallets and limits.

CLIMCP serverREST API
ForYou, your scripts, your CI, your coding agentYour agentYour backend
ToPay from a script, create applications and wallets, and run each wallet tool as a commandPay, check the balance and the spending, run missionsManage applications, wallets, limits and missions, and read the spending
Signs in withYour Keyban account (keyban admin login), and the wallet file for wallet commandsThe wallet fileAn organization API key, in the X-Api-Key header
Start withnpx -y @keyban/cli@latest --helpnpx -y @keyban/cli@latest mcphttps://api.prod.keyban.io

CLI​

The Keyban CLI is the npm package @keyban/cli, and its command is keyban. Run it with npx, or install it once:

npx -y @keyban/cli@latest --help
npm install -g @keyban/cli

Keep @latest with npx: without a version, npx reuses the copy it cached the first time and never picks up a new release.

It has two groups of commands:

  • keyban wallet drives one wallet, payments included. Each tool of the MCP server is also a command, its name in kebab-case: keyban wallet x402-pay --url <url> --max-amount 0.01 pays an x402 service, keyban wallet transfer-usdc sends USDC, keyban wallet balance reads the balance. The same spending policy applies as through the MCP server. It reads the wallet kept on the machine, or the file that KEYBAN_WALLET_PATH names.
  • keyban admin manages your organization as you, with the rights of your role. Sign in first with keyban admin login, which opens your browser; keyban admin --help lists the commands. keyban admin new-wallet --share creates a wallet and writes its file in one step: the Integration guide uses it to create wallets for many agents.

MCP server​

keyban mcp runs the Keyban MCP server next to your agent, over stdio:

npx -y @keyban/cli@latest mcp

With Claude Code, for example: claude mcp add agent-wallet -- npx -y @keyban/cli@latest mcp. For the other assistants, the dashboard's Connect the agent gives the line to use.

It gives the agent the wallet tools: pay x402 services, transfer USDC, check the balance and the spending, and run missions. See Wallet MCP tools. The agent learns how to use them from the wallet skill, https://docs.keyban.io/.well-known/agent-skills/keyban-agent-wallet/SKILL.md.

When a person has signed in with keyban admin login on the same machine, the server also serves the admin tools, with that person's rights: see Admin tools. Sign in only on your own machine, never on one where an agent runs on its own.

keyban mcp --http serves the wallet tools over HTTP, without the admin tools, for Amazon Bedrock AgentCore only: it has no authentication of its own, and AgentCore authenticates the callers before they reach it.

REST API​

Your backend can manage Wallet for Agents over HTTPS, at https://api.prod.keyban.io: applications, wallets, spending policies, shared budgets, missions and spending. It authenticates with an organization API key, sent in the X-Api-Key header:

curl -H "X-Api-Key: $KEYBAN_API_KEY" https://api.prod.keyban.io/v1/agent-wallets

Create the key in the dashboard, in the API Keys tab of an application's settings. What the key may do is set when you create it: see API key permissions. A few operations that only an Owner or an Admin may run refuse an API key.

Every endpoint is described in the REST API reference, and as OpenAPI at https://api.prod.keyban.io/openapi.json.

The REST API manages, it does not pay. A payment is signed with the wallet's key share, which lives in the wallet file and which only the CLI and the MCP server use. Your agents pay through them.

One API underneath​

The keyban admin commands and the admin tools of the MCP server are built from the REST API's own OpenAPI description. They run the same operations, with the same checks and the same rights, so the three ways in always agree.