tolla-pass
OfficialREADME.md
# TOLLA Pass
Pass is a local wallet for AI agents. It pays x402 APIs in USDG on Robinhood Chain, and it checks spend caps before it signs anything. The agent can spend inside the caps. It cannot raise them.
Pass ships as one command, `tolla-pass`. It is a CLI for you and an MCP stdio server for your agent.
## Status and limits (read this first)
- **Beta, version 0.1.1.** Not published to npm. You install it from this repository.
- **Robinhood Chain and USDG only.** Pass pays the x402 v2 `exact` scheme on `eip155:4663` with USDG (`0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168`). It refuses any other network, asset or scheme, and signs nothing for them. Most lanes in the public x402 index are on other networks, so Pass cannot pay them yet.
- **Real payments proven.** The first funded toll (0.01 USDG to a TOLLA Booth) settled on Robinhood Chain on 2 Nov 2026: tx `0xb577f4f9ac7c43135e20c76a3b922fe29d3ff187019ca559f719a529d48c5b84`. Still beta: fund a Pass with small amounts.
- Pass does not pay gas. The merchant's facilitator submits the transfer. You only need USDG.
## Install
Requires Node 20 or newer.
```sh
git clone https://github.com/tolla-network/pass.git
cd pass
npm install
npm run build
npm install -g . # puts `tolla-pass` on your PATH
# or, without a global install:
node /path/to/pass/dist/cli.js help
```
## Set up
```sh
tolla-pass init # asks for a passphrase (8+ characters), prints the new address
tolla-pass address
tolla-pass balance # USDG on Robinhood Chain
```
Send USDG on Robinhood Chain to the address. Only send what you are ready to let the agent spend.
`init` will not replace an existing pass unless you add `--force`. If you replace it, the old key is gone for good. Move its funds out first.
## Caps
`~/.tolla/caps.json` is created on `init`:
```json
{ "perCall": "0.05", "perDay": "5.00", "perMerchant": "1.00", "allow": ["*"], "network": "eip155:4663" }
```
Amounts are in USDG. Before Pass signs, it refuses the call (and signs nothing) when:
| Check | Refused when |
|---|---|
| `perCall` | the price is above it |
| `perDay` | the last 24 hours of payments plus this price would go above it |
| `perMerchant` | the last 24 hours paid to this host plus this price would go above it |
| `allow` | the host is not on the list (`"*"` allows every host; `"*.example.com"` allows a domain) |
The 24 hours are a rolling window, not a calendar day. Every payment counts from the moment Pass signs it, even if the call then fails. A signed authorization can be settled until it expires (at most 5 minutes), so Pass assumes it was.
Change caps with the CLI. Only you run this, never the agent:
```sh
tolla-pass caps # show
tolla-pass caps set perDay 10
tolla-pass caps set perCall 0.02
tolla-pass allow add api.example.com
tolla-pass allow remove "*" # allow only the hosts you listed
tolla-pass spend # 24h totals and the last 20 payments
```
A running MCP server reads `caps.json` again on every call. Your changes apply at once.
The MCP server has no tool that edits caps or the allow-list. The agent can pass `maxPrice` on a call. It can only make that call stricter.
## Calling an API from the CLI
```sh
tolla-pass call https://api.example.com/data
tolla-pass call https://api.example.com/run --method POST --data '{"q":"hello"}' --max-price 0.01
```
If the API answers 402, Pass reads the price from the `PAYMENT-REQUIRED` header (or from the JSON body if the header is missing). It runs the cap checks, then signs an EIP-3009 `transferWithAuthorization` for exactly that amount to the merchant's `payTo`. Then it sends the request again with a `PAYMENT-SIGNATURE` header. The output shows the status, the body, and any `PAYMENT-RESPONSE` and `TOLLA-RECEIPT` the merchant sent back.
## Using it from an agent (MCP)
Claude Desktop (`claude_desktop_config.json`), Claude Code (`.mcp.json`) and other MCP clients:
```json
{
"mcpServers": {
"tolla-pass": {
"command": "tolla-pass",
"args": ["mcp"],
"env": { "TOLLA_PASS_PASSPHRASE": "your passphrase" }
}
}
}
```
Without a global install, use `"command": "node"` and `"args": ["/path/to/pass/dist/cli.js", "mcp"]`.
With Claude Code you can also run: `claude mcp add tolla-pass -e TOLLA_PASS_PASSPHRASE=... -- tolla-pass mcp`
Tools:
- `tolla_wallet`: the address, USDG balance, caps and the last 24 hours of spend.
- `tolla_lanes`: search the TOLLA lanes index (`https://tolla.network/api/lanes?q=`). Each lane shows `payableByPass`, which is true only if it accepts Robinhood Chain.
- `tolla_call`: call a URL and pay its x402 toll, inside the caps. Takes `url`, `method`, `json` or `body`, `headers`, `maxPrice`. The returned body is cut at 20,000 characters.
- `tolla_spend`: 24h totals per merchant, remaining daily budget and recent payments.
## Environment
| Variable | Use |
|---|---|
| `TOLLA_PASS_PASSPHRASE` | passphrase for the encrypted key (needed for `mcp`; the CLI asks if it is not set) |
| `TOLLA_HOME` | state folder instead of `~/.tolla` |
| `TOLLA_RPC_URL` | Robinhood Chain RPC instead of `https://rpc.mainnet.chain.robinhood.com` |
## Files
- `~/.tolla/pass.json`: the private key, encrypted with scrypt (N=2^17) and AES-256-GCM under your passphrase. Mode 0600.
- `~/.tolla/caps.json`: caps and allow-list.
- `~/.tolla/ledger.jsonl`: one line when a payment is signed and one with its outcome: time, host, URL, amount, payTo, status, transaction and receipt when known.
## Security notes
- Pass never prints, logs, returns or writes the private key in plaintext. There is no export command.
- Caps stop the agent through MCP. They do not stop a process that can edit files in your home folder. If your agent also has shell or file access, it could edit `caps.json` or read the passphrase from its own config. For real money, run the agent where it cannot reach `~/.tolla`, and keep only a small balance on the Pass.
- The passphrase is stored in your MCP client config. Anyone who can read that file and `pass.json` can spend the funds.
- Pass only calls `https://` URLs (plain `http://` is allowed for localhost, for testing). It does not follow redirects on its own.
- Caps are enforced inside one process. If you run the CLI and the MCP server at the same moment, two payments signed in the same instant could both pass the same remaining budget.
## Where each rule lives in the code
| Rule | File |
|---|---|
| Cap checks (per call, per day, per merchant, allow list) | `src/caps.ts`, `src/pass.ts` |
| Only Robinhood Chain, USDG, x402 `exact` | `src/chain.ts`, `src/pass.ts` |
| Key encryption (scrypt + AES-256-GCM), file modes | `src/store.ts` |
| MCP tools (no tool edits caps) | `src/mcp.ts` |
| CLI commands | `src/cli.ts` |
| Spend ledger | `src/store.ts` |
## Tests
```sh
npm run build
TOLLA_RPC_URL=https://rpc.mainnet.chain.robinhood.com node test/run-tests.mjs
```
The tests use a temporary `TOLLA_HOME` and a local mock merchant (`test/mock-402.mjs`). The mock recovers the EIP-712 signer and checks value, payee and the time window. The balance test reads the chain through `TOLLA_RPC_URL`.
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues