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.
| CLI | MCP server | REST API | |
|---|---|---|---|
| For | You, your scripts, your CI, your coding agent | Your agent | Your backend |
| To | Pay from a script, create applications and wallets, and run each wallet tool as a command | Pay, check the balance and the spending, run missions | Manage applications, wallets, limits and missions, and read the spending |
| Signs in with | Your Keyban account (keyban admin login), and the wallet file for wallet commands | The wallet file | An organization API key, in the X-Api-Key header |
| Start with | npx -y @keyban/cli@latest --help | npx -y @keyban/cli@latest mcp | https://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 walletdrives 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.01pays an x402 service,keyban wallet transfer-usdcsends USDC,keyban wallet balancereads the balance. The same spending policy applies as through the MCP server. It reads the wallet kept on the machine, or the file thatKEYBAN_WALLET_PATHnames.keyban adminmanages your organization as you, with the rights of your role. Sign in first withkeyban admin login, which opens your browser;keyban admin --helplists the commands.keyban admin new-wallet --sharecreates 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.
Related
- Integration guide: wallets for the agents you build, created with the CLI.
- Agent skills: the instructions your agents follow to use these tools.
- Wallet MCP tools: what the agent can do.
- Admin tools: what a signed-in person can do from their assistant.
- REST API reference: every endpoint.
- Permissions and roles: who and which key may do what.