Quantum Agents
by Everleafapp
README.md
# Everleaf Quantum Agents
An [MCP](https://modelcontextprotocol.io) server and an agent skill that let AI agents check the quantum exposure of
crypto addresses and work with Leaf Vaults, built on the open-source
[Everleaf Quantum Kit](https://github.com/Everleafapp/quantum-kit).
> **Beta, not audited.** This server is new, and the Leaf Vault contracts it works with are beta and have not been
> audited. Keep small amounts in a Leaf Vault. Signing is off by default; read [SECURITY.md](SECURITY.md) before you
> turn it on.
## What it does
| Tool | What it does | Network | Secret |
|---|---|---|---|
| `scan_address` | Is an EVM, Solana or Bitcoin address's public key already on-chain, and how much native coin sits under it, per chain? | public RPCs / APIs | none |
| `explain_exposure` | Plain-language meaning of a verdict and the options someone has | none | none |
| `vault_address` | The Leaf Vault address for a public tree root and salt (= `LeafVaultFactory.predict`) | none | none |
| `vault_status` | A vault's on-chain state: deployed, balance, epoch, next leaf, leaves left, guardian, pending recovery | public RPC | none |
| `prepare_vault_action` | An unsigned vault batch (send, token transfer, contract call, regrow, guardian, cancel recovery) and the digest its next one-time key must sign | public RPC | none |
| `sign_vault_action` | **Off by default.** Signs a batch with the operator's vault key and the next unused leaf; never submits | public RPC | operator's seed file |
Every tool takes strict arguments (unknown fields are refused) and returns JSON. Amounts are decimal strings in base
units (wei, lamports, satoshis) alongside formatted values. Nothing is ever submitted to a chain by this server.
## Quantum risk, honestly
Most wallets are protected by an elliptic-curve key. A large, error-corrected quantum computer running Shor's
algorithm could compute such a private key from its **public key**. No machine today comes close, and nobody knows
when, or whether, one will exist. What can be checked now is which public keys are already visible:
- An EVM address shows its key the first time it signs a transaction (or an EIP-7702 authorization), and then on every
EVM chain, because one key signs on all of them.
- A Solana address is its public key.
- Bitcoin Taproot and pay-to-public-key outputs show the key at once; key-hash types show it at the first spend.
Anything public can be recorded now and attacked later ("harvest now, decrypt later"). A Leaf Vault signs with
WOTS+ one-time keys over keccak256: **quantum-resistant** on the assumption that the hash stays sound, not
"quantum-proof", and still running on chains whose validators and gas payers use elliptic-curve keys.
## Install
Node 20.19 or later. The package is not on npm; it installs from GitHub and builds itself.
```sh
npx -y github:Everleafapp/quantum-agents --version
```
Or from a clone:
```sh
git clone https://github.com/Everleafapp/quantum-agents && cd quantum-agents
npm ci && npm test
node dist/bin.js --help
```
### MCP client config
Most MCP clients take a JSON block like [examples/mcp-config.json](examples/mcp-config.json):
```json
{
"mcpServers": {
"quantum-agents": {
"command": "npx",
"args": ["-y", "github:Everleafapp/quantum-agents"],
"env": {}
}
}
}
```
From a clone, use `"command": "node", "args": ["/absolute/path/to/quantum-agents/dist/bin.js"]`. The server speaks
MCP over stdio and logs one line to stderr when it is ready.
### The skill
[skills/quantum-check/SKILL.md](skills/quantum-check/SKILL.md) tells an agent how to use these tools and how to talk
about quantum risk without overstating it. Copy the `skills/quantum-check` folder into your agent's skills directory
(for example `.claude/skills/` in a project), next to the MCP server config.
## Configuration
All optional. With no environment the server is read-only and uses the Quantum Kit's public endpoints.
| Variable | Meaning |
|---|---|
| `QK_RPC_<ID>` | Your own endpoints for a chain, comma-separated, `https://` (or `http://` on localhost): `QK_RPC_BSC`, `QK_RPC_BASE`, `QK_RPC_SOLANA`, `QK_RPC_BITCOIN` (an Esplora API), ... |
| `QUANTUM_AGENTS_TIMEOUT_MS` | Per-request timeout, 100 to 120000 (default 10000) |
| `QUANTUM_AGENTS_SEED_FILE` | Absolute path to a file with a vault's 24-word phrase, mode `0600`. **Turns on `sign_vault_action`.** |
| `QUANTUM_AGENTS_LEDGER` | The leaf ledger (default `ledger.json` next to the seed file) |
| `QUANTUM_AGENTS_TREE_DIR` | Tree caches `tree-0-<epoch>.json` (default the seed file's folder) |
| `QUANTUM_AGENTS_MAX_VALUE_WEI` | Refuse to sign a batch whose native value plus relay fee is above this |
EVM chains read by `scan_address`: Ethereum, Elysium, BNB Chain, Base, Arbitrum One, Avalanche C-Chain, HyperEVM,
Robinhood Chain, MegaETH, Arc, Monad, X Layer, Stable. The Leaf Vault factory
(`0x8a59Bf08A900Cc93e2df97A2Ed43490f5aB96DaF`) is on all of them except Ethereum.
Privacy: the addresses you scan are sent to the RPC and API providers in use. Configure your own endpoints if that
matters.
## Using the tools
Scan an address:
```json
{ "name": "scan_address", "arguments": { "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "chains": ["ethereum", "base"] } }
```
```jsonc
{
"exposure": "exposed",
"reason": "The public key is on-chain (sent on ethereum, base). One key signs on every EVM chain, ...",
"exposedOn": ["ethereum", "base"],
"atRiskTotal": [{ "symbol": "ETH", "amount": "8.96…" }],
"chains": [{ "chain": "ethereum", "status": "exposed", "balance": "5.83…", "atRisk": "5.83…", ... }],
"notes": ["Native coins only: tokens are not counted and nothing is priced.", ...]
}
```
Prepare a vault batch (nothing is signed):
```json
{
"name": "prepare_vault_action",
"arguments": {
"chain": "bsc",
"vault": "0xYourVault",
"actions": [{ "type": "send_native", "to": "0xRecipient", "value": "10000000000000000" }],
"maxRelayFee": "300000000000000",
"ttlSeconds": 3600
}
}
```
It returns the calls, a human `summary`, the vault's `epoch` and next `leafIndex`, and the `digest` that leaf must sign.
Action types: `send_native {to, value}`, `send_token {token, to, amount}`, `contract_call {target, data, value?}`,
`regrow {newRoot}`, `set_guardian {guardianRoot}` (all zeros removes it), `cancel_recovery`. Up to 16 per batch.
`reserved: true` uses one of the 16 reserved leaves, which may only regrow and manage the guardian.
A minimal client script: [examples/check-address.mjs](examples/check-address.mjs)
(`npm run build && node examples/check-address.mjs <address> [chain,...]`).
## Signing (opt-in)
`sign_vault_action` exists only when the operator sets `QUANTUM_AGENTS_SEED_FILE`. It takes the same arguments as
`prepare_vault_action` (without `leafIndex`) and:
1. reads the vault on-chain and refuses unless the configured key controls it (on-chain root, or the predicted address
for a vault not deployed yet);
2. refuses if the batch moves more than `QUANTUM_AGENTS_MAX_VALUE_WEI` (when set);
3. takes an exclusive lock next to the ledger, picks the next leaf above both the ledger and the vault's on-chain
counter, **writes it to the ledger before signing**, signs, and checks the signature against the root;
4. returns the signed batch, a relay request (`relay.request`, for `POST https://everleaf-app.xyz/api/relay/:chain` or any
relayer) and calldata. It submits nothing.
No tool argument can carry a seed or phrase, choose a leaf, or name a file. A vault directory made by
`quantum-kit keygen` works as is: point `QUANTUM_AGENTS_SEED_FILE` at its `phrase.txt` and the tree cache and ledger are
found next to it. Without a tree cache the first signature grows the tree (about 30 seconds) and caches it.
Turning signing on means an AI agent can spend from that vault within the limits above. Read
[SECURITY.md](SECURITY.md) first.
## Development
```sh
npm ci
npm test # type-checks and runs every test offline (mocked RPC), a few seconds
npm run build # dist/
```
The CI workflow is kept at [ci/github-actions.yml](ci/github-actions.yml); copy it to `.github/workflows/` to enable it.
## License
[MIT](LICENSE). Made by [Everleaf](https://everleaf-app.xyz).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues