Oak Agent KitRobinhood Chain · MCP
Menu

Coming soon · Oak is not released yet.

Set up

A local wallet for your agent, at launch.

Prepare for launch

Oak is one MCP for the whole chain: one install gives your AI agent a local wallet and complete modules for 25 ecosystem projects on Robinhood Chain (chain ID 4663, 0x1237).


1. Install with One Command

Read this section

Requires Node.js 22 LTS (>=22.12.0 <23). Install the add-on globally from npm at release (or build from the workspace below during pre-launch) with:

Pre-launch (0.0.0) now: Installation instructions will be published at launch.


2. Create Your Wallet (oak init)

Read this section

Run oak init in your own terminal, never through the agent:

oak init

What happens during oak init:

  1. Oak checks that stdin and stdout are attached to a terminal (isTTY). Remember that setup is trusted because you run it in your own terminal, not because a terminal exists (an agent with shell access can allocate a PTY). Running oak init yourself keeps your recovery phrase out of the AI's prompt, tool outputs, and logs.
  2. Oak generates a 24-word recovery phrase locally and prints it once. Write the words down offline.
  3. Oak prompts you (with hidden input) to confirm three randomly selected words from your phrase.
  4. Oak prints the default region notice and not affiliated with Robinhood disclosure, encrypts the private key with AES-256-GCM into ~/.oak/wallet.enc (mode 0600 in ~/.oak mode 0700), and stores the 32-byte encryption key in your OS keychain (macOS Keychain, Windows Credential Manager, or Linux persistent Secret Service).
  5. If a persistent OS keychain is unavailable, Oak prompts you to set a passphrase (at least 12 characters) and derives the encryption key with scrypt (N=131072, r=8, p=1). With passphrase storage, unlocking requires your terminal each time.

Your private key never leaves your computer, and Oak cannot recover a lost key.


3. Choose Network and Configure Chain Settings

Read this section

Store your configuration in ~/.oak/config.json (mode 0600) using oak config set <key> <value> or pass matching environment variables.

Oak targets Robinhood Chain mainnet (OAK_NETWORK=mainnet, chain ID 4663, 0x1237) by default. To test Oak's own contracts and ERC-8004 identity on Robinhood Chain Testnet (46630, 0xb626), opt in explicitly with OAK_NETWORK=testnet and OAK_CHAIN_ID=46630:

# Mainnet (default: OAK_NETWORK=mainnet, chain ID 4663)
oak config set OAK_NETWORK mainnet
oak config set OAK_CHAIN_ID 4663
oak config set OAK_SERVER_URL https://api.oakagentkit.org  # optional mainnet override
oak config set OAK_RPC_URL <your-keyed-robinhood-chain-4663-rpc-url>
oak config set OAK_SUBSCRIPTION_ADDRESS <subscription-contract-address>
oak config set OAK_USDG_ADDRESS 0x5fc5360d0400a0fd4f2af552add042d716f1d168
oak config set OAK_TOKEN_ADDRESS <canonical-oak-token-address>
oak config set OAK_ORACLE_ADDRESS <oracle-contract-address>
oak config set OAK_ETH_USDG_POOL_ADDRESS 0x52e65B17fB6E5BA00Ed806f37Afcd2DaA50271Ca

For Robinhood Chain Testnet (46630) opt-in:

Use a matching testnet Oak server and testnet contract addresses for every required setting above. The four commands below alone are not a complete deployment configuration. Testnet exposes basic tools and ERC-8004 identity tools; swap routes and the other ecosystem modules are not configured there.

oak config set OAK_NETWORK testnet
oak config set OAK_CHAIN_ID 46630
oak config set OAK_RPC_URL <your-robinhood-chain-testnet-46630-rpc-url>
oak config set OAK_USDG_ADDRESS 0x7E955252E15c84f5768B83c41a71F9eba181802F

Network safety rules enforced at startup:

  • If OAK_NETWORK, OAK_CHAIN_ID, or any deployment address environment variable disagrees with ~/.oak/config.json, Oak refuses to start (OAK_NETWORK disagrees with the local config; set the network in the config explicitly.).
  • Do not mix mainnet (4663) and testnet (46630) RPCs or pin a mainnet contract address in a testnet config (Set OAK_NETWORK to mainnet (4663) or testnet (46630). and Set OAK_CHAIN_ID to <selectedChainId> in the local deployment config.).

Optional settings:

  • OAK_RPC_URL_<chainId>: RPC endpoint for an inbound Relay origin chain (for example, OAK_RPC_URL_8453 for Base or OAK_RPC_URL_42161 for Arbitrum when calling relay_bridge_in).
  • OAK_RETIRED_SUBSCRIPTION_ADDRESSES: Comma-separated retired subscription contract addresses, newest first.
  • OAK_FINALITY: Confirmation mode (finalized by default, safe, or a positive integer block count).
  • profile: JSON string for ERC-8004 agent identity registration (oak setup register or oak register).
  • grandfather: JSON string containing the OakGrandfather/v1 Merkle tree when migrating from a retired subscription contract.

Wallet private keys and mnemonics are rejected by oak config set.


4. Connect Your AI Agent (MCP Snippets)

Read this section

Every supported agent connects to Oak over stdio by running oak mcp. On startup and once every hour, oak mcp reconciles any pending local journal entries, verifies your ERC-8004 identity status, and checks whether your subscription renewal is due. Read tools work immediately; action tools require a verified ERC-8004 identity and an active subscription.

Claude Code

claude mcp add oak -- oak mcp

Codex

Add to ~/.codex/config.toml:

[mcp_servers.oak]
command = "oak"
args = ["mcp"]

Gemini

Add to ~/.gemini/settings.json:

{
  "mcpServers": {
    "oak": {
      "command": "oak",
      "args": ["mcp"]
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "oak": {
      "command": "oak",
      "args": ["mcp"]
    }
  }
}

Grok and Other MCP Clients

Configure any stdio MCP client with:

command: oak
args: mcp

5. Set Up Identity, Fund the Wallet, and Subscribe

Read this section

Step 1: Set up your ERC-8004 identity (oak setup)

Every action tool requires a verified ERC-8004 agent identity on the pinned IdentityRegistry (0x8004A169FB4a3325136EB29fA0ceB6D2e539a432) plus an active subscription. Read tools (find_token, balances, price, quote, preview, history, positions, account, and module reads) stay open without an identity or subscription.

Before registering a new identity, run oak address and send ETH for gas on your configured network. Linking an existing identity needs no ETH. Replace the example profile's name, description, and image URL with your own before registering.

Run oak setup in your terminal (or call the local MCP tool oak_setup):

# Interactive prompt in your terminal:
# "Identity first: type register (public registration, needs ETH), or link <agentId> (owner signature, no ETH):"
oak setup

# Option A: Link an existing ERC-8004 agent ID (no ETH needed, no on-chain transaction)
oak setup link <agentId>

# Option B: Register a new ERC-8004 agent ID on-chain (needs ETH for gas)
oak config set profile '{"type":"https://eips.ethereum.org/EIPS/eip-8004#registration-v1","name":"my-agent","description":"My Oak agent","image":"https://example.com/my-agent.png","services":[],"x402Support":false,"active":true,"registrations":[]}'
oak setup register
# Pass --no-tag to omit the default oak.registrar marker:
oak setup register --no-tag
  • How oak setup link <agentId> works (gasless): If your agent wallet does not own <agentId> directly, oak setup link <agentId> prints a single-use 5-minute EIP-712 OakIdentityLink challenge (audience: "oak-identity-link/v1") in your terminal and prompts with hidden input for the current NFT owner's signature. Never paste a private key or recovery words. The server checks ownerOf(agentId) at a canonical block, stores the verified link (linkId), and never stores the raw signature. If the agent wallet itself already owns <agentId>, it signs locally without prompting.
  • How oak setup register works (on-chain): Mints a new ERC-8004 identity NFT to your agent wallet on IdentityRegistry, verifies ownership with the server, and saves { chainId, registry, agentId } in ~/.oak/config.json.

Step 2: Fund the agent wallet and subscribe

Print your agent's wallet address:

oak address

Send funds directly to that address on your configured network: Robinhood Chain mainnet (4663), or testnet (46630) if selected:

  1. ETH for network gas fees (required for on-chain registration, subscribing, and trading; not required for oak setup link <agentId>).
  2. USDG (0x5fc5360d0400a0fd4f2af552add042d716f1d168 on mainnet, 0x7E955252E15c84f5768B83c41a71F9eba181802F on testnet 46630, 6 decimals) for your monthly subscription and any swaps, vault deposits, or orders.
  3. $OAK (18 decimals) if you choose the holder plan: you need only the entry-price count N at sign-up. Joining has a one-time sign-up burn that burns 5% of N (ceil(N * 5 / 100)) from that holding and records the remaining N - burn as your tracked signupOakCount (for example, hold 20,000 $OAK at sign-up, 1,000 $OAK burns, and 19,000 $OAK is tracked while subscribed). In packages/addon/src/subscribe.ts, the add-on reads [count, burn] from quoteHolder, passes maxCount = ceilPercent(count) (at most 1% above count) to subscribeWithAuthorization, and approves the exact quoted burn (approval(this.deployment.oak, contract, burn.toString(), this.deployment.chainId)), never unlimited.

Then subscribe from your terminal:

# Holder plan: 9 USDG per 30 days; hold N $OAK, 5% burns at sign-up, N - burn tracked
oak subscribe --plan holder

# No-hold plan: 9 USDG + (entry price / 6) per 30 days (12.333333 USDG floor), no $OAK required
oak subscribe --plan nohold

6. First Read, First Action, and Unlinking

Read this section

First reads and buying a token (find_token → quote → preview → swap)

The TSLA swap example below is for mainnet (4663); testnet has no configured swap routes.

# First read: check subscription status, $OAK held vs required, launch phase, and no-hold price
oak status

# One-call portfolio reads: balances batches token reads via Multicall3; positions queries all 25 modules in one call
oak call balances '{}'
oak call positions '{}'

# First action: buy a token in four steps (find_token -> quote -> preview -> swap)
# 1. Discover or verify a token by name, symbol, or address on chain 4663
oak call find_token '{"query":"TSLA"}'

# 2. Get a 60-second swap quote across KyberSwap, Velora, and Pons launch curves using verified symbols
#    (ETH, USDG, WETH, USDe, OAK, or official stock tickers) or a verified token address.
#    Quotes warn when price impact exceeds 2% against fresh reference prices.
oak call quote '{"from":"USDG","to":"TSLA","amountIn":"10000000","slippageBps":50}'

# 3. Preview an unsigned transaction sequence via eth_simulateV1
#    (swap reuses a matching preview from the same block within 12 seconds so it does not re-simulate twice)
oak call preview '{"txs":[...]}'

# 4. Execute the swap by quoteId (builds exact approvals only, never unlimited; signs locally and broadcasts)
oak call swap '{"quoteId":"<quoteId>"}'

# Manage opt-in declarative project recipes (data-only, as-is)
oak recipes add <npm-pkg-or-local-path>
oak recipes list
oak recipes remove <project>

Unlinking, transfers, and outages

# Unlink from the linked agent wallet (gasless; clears local identity, pauses actions, keeps reads open)
oak identity unlink

# Or revoke a link as the current NFT owner by linkId (prompts for owner EIP-712 unlink signature in terminal)
oak identity unlink --owner <linkId>
  • Unlink (oak identity unlink or MCP tool oak_identity_unlink): Immediately revokes the link in the server store and removes identity from ~/.oak/config.json. Read tools remain available; action tools pause until you run oak setup again.
  • NFT transfer or burn: On every action tool call, the server verifies ownerOf(agentId) and checks for any Transfer log since linkedBlock at a canonical block. If the ERC-8004 NFT was transferred or burned, linked action access ends immediately, the add-on clears the local identity config, and reads stay open.
  • Server or RPC outage: If identity verification cannot reach the chain or server (Identity status is unavailable. Please try again. Reads remain available; actions are paused.), the add-on keeps your saved identity in ~/.oak/config.json and asks you to try again once the service recovers. Read tools stay open.

7. Troubleshooting and Recovery Table

Read this section

Every error message in Oak is a plain sentence naming the state and the exact command to fix it:

State / Message Cause Exact Action to Fix
run this in your own terminal, not through the agent oak init or oak export was invoked without an interactive TTY. Run oak init or oak export directly in your own system terminal.
Run oak setup to register or link an ERC-8004 identity first. Reads remain available; actions are paused. / Verify or link an ERC-8004 identity with oak setup. Reads remain available, actions paused. An action tool was called before setting up an ERC-8004 identity (identity.ts and the Oak server). Run oak setup link <agentId> (no ETH) or oak setup register (needs ETH), or call oak_setup.
Identity changed, expired or link revoked. Run oak setup link <agentId> with the current owner to verify or link it again. Reads remain available; actions are paused. The linked ERC-8004 NFT was transferred or burned, or the link was revoked (identity.ts). Local identity config was cleared. Run oak setup link <agentId> with a fresh signature from the current NFT owner, or register a new agent ID with oak setup register.
Identity status is unavailable. Please try again. Reads remain available; actions are paused. The server or RPC could not verify identity status during an outage (identity.ts). Saved local identity is preserved. Keep your config as-is and retry the action once the RPC or server is reachable; read tools continue to work.
This wallet does not own that agent ID. Ask the current owner to sign the link in oak setup link <agentId>. / Owner signature does not match the current agent owner. Ask the current owner to sign with oak setup link <agentId>. Direct verification was attempted for an agentId owned by another wallet, or the pasted signature was not from ownerOf(agentId). Run oak setup link <agentId> in your terminal and sign the EIP-712 challenge with the wallet that currently owns <agentId>.
The identity challenge expired. Run oak setup link <agentId> again for a fresh owner signature. More than 5 minutes passed before submitting the owner's EIP-712 signature, or the challenge nonce was already consumed. Run oak setup link <agentId> again and paste the fresh signature within 5 minutes.
Wrong identity network or registry. Set OAK_NETWORK and OAK_CHAIN_ID to match the owner’s agent, then run oak setup again. The identity registry or chain ID does not match the configured network (4663 mainnet vs 46630 testnet). Align OAK_NETWORK and OAK_CHAIN_ID in ~/.oak/config.json, then run oak setup.
OAK_NETWORK disagrees with the local config; set the network in the config explicitly. / Set OAK_NETWORK to mainnet (4663) or testnet (46630). Environment variables and ~/.oak/config.json specify different networks (mainnet vs testnet), or OAK_NETWORK has an invalid value. Set OAK_NETWORK, OAK_CHAIN_ID, and OAK_RPC_URL to the same network (4663 or 46630) in ~/.oak/config.json.
needs ETH for network fees: send ETH to <address> on chain <chainId>. / Needs ETH for network fees: send ETH to <address> on chain <chainId>. Wallet ETH balance cannot cover value + gas * maxFeePerGas (including 25% gas headroom) in sender.ts, or is 0 in subscribe.ts. Send native ETH on the named chain to <address> (oak address) and retry.
No active subscription. Use oak subscribe --plan nohold; only the no-hold plan at 12.333333 USDG per 30 days is open. Action tool called while plan == "none" during curve (checked by the Oak server). Run oak subscribe --plan nohold.
No active subscription. The pool is warming up; both plans wait for 30 minutes of history before oak subscribe. Action tool called while plan == "none" during warmup (checked by the Oak server). Wait until the pool has 30 minutes of history, then run oak subscribe.
No active subscription. Use oak subscribe --plan holder or oak subscribe --plan nohold and top up USDG for the subscription. Action tool called while plan == "none" during ready (checked by the Oak server). Top up USDG (and $OAK if joining holder) and run oak subscribe --plan holder or oak subscribe --plan nohold.
No subscription. Use oak subscribe --plan holder or oak subscribe --plan nohold. oak renew / ensureSubscribed called when the wallet has no subscription record (renew.ts). Run oak subscribe --plan holder or oak subscribe --plan nohold.
Holder plan is closed during the curve; use oak subscribe --plan nohold. $OAK is in the curve phase (phase != 2 on Pons) when running oak subscribe --plan holder. Join with oak subscribe --plan nohold at the 12.333333 USDG floor, or wait until $OAK graduates and completes warmup.
Price warmup: wait until the pool has 30 minutes of history, then retry. $OAK graduated (phase == 2), but the v4 pool is under 30 minutes old (history_too_thin). Wait until the pool is 30 minutes old; both plans wait during warmup and sign nothing.
Subscription is paid; renewal is not due. More than 3 days remain before paidUntil and access checks pass (renew.ts). No action needed; renewal opens when <= 3 days remain (prepaying is capped at 90 days ahead).
subscription ended <date>; keep the agent running to renew or run oak renew paidUntil is in the past (checked by the Oak server). Read tools still work; action tools are paused. Top up USDG (and ETH for gas) if needed, then run oak renew or start oak mcp.
hold at least <N> $OAK (you hold <M>) / Buy back <count> OAK base units (token <oak>, decimals 18) to restore access. / Needs <oakRequired> OAK base units (token <oak>, decimals 18). Buy back OAK and retry. Holder-plan wallet's $OAK balance is below its tracked signupOakCount (the Oak server, renew.ts) or below the required count at sign-up/migration (subscribe.ts). Buy back $OAK to at least the required count; for an active subscription, access resumes immediately on the next call with no new fee.
Renewal/payment needs <amount> USDG base units (token <usdg>, decimals 6). Top up and run oak renew; tools are paused until payment succeeds. Wallet USDG balance is below the subscription or renewal price (subscribe.ts). Send USDG (0x5fc5360d0400a0fd4f2af552add042d716f1d168, 6 decimals) to your wallet and run oak renew (or oak subscribe).
your paid days carry over with oak renew when it is due Wallet is an active holder on a retired subscription contract and is listed in the grandfather Merkle tree, but tried to run oak subscribe (subscribe.ts). Do not run oak subscribe (which would forfeit old paid days). Wait until <= 3 days remain and run oak renew to migrate at your recorded post-burn count with zero burn.
Wallet journal is unresolved; wait for the pending transaction before a new action. A previously signed transaction in ~/.oak/<address>.pending.json has not yet been confirmed or reconciled (sender.ts). Run oak renew (or start oak mcp), which reconciles or fee-bumps the identical call at the same nonce before starting a new action.
Wallet journal is unreadable or invalid; resolve it before a new action. ~/.oak/<address>.pending.json or .cleared.json failed integrity, ownership, mode (0600), or signature validation (journal.ts). Inspect ~/.oak/ permissions (0700 directory, 0600 files owned by your user) and resolve the corrupted journal file after verifying on-chain nonces.
Payment failed or remains pending; tools are paused. Run oak renew to reconcile the wallet journal before another payment. A subscription payment threw a sender exception leaving the journal to be checked (subscribe.ts). Run oak renew to reconcile the wallet journal before attempting another payment.
Already subscribed; use oak renew, or oak cancel before switching plans. oak subscribe was called while the wallet already has an active plan on the current contract (subscribe.ts). Use oak renew to extend the current plan, or run oak cancel (which ends access immediately and forfeits remaining paid days) before running oak subscribe --plan <holder|nohold>.

Run oak init --recover in your own terminal to restore your 24-word backup on a new computer. To replace an existing wallet, use oak init --recover --replace; Oak preserves an encrypted backup and asks you to confirm the recovered address. Never enter recovery words in an agent chat, arguments, environment variables or MCP tools.

For stdio MCP, Oak needs an accessible persistent OS keychain (Linux: Secret Service in the same unlocked user/D-Bus session as the MCP client). A passphrase-only wallet currently supports interactive CLI commands in your own terminal; it cannot start oak mcp through a pipe. Do not send the passphrase through MCP or store it in argv/environment variables. To enable MCP for an existing fallback wallet, first configure a persistent keychain, then restore with oak init --recover --replace yourself in your terminal and confirm the address. Keep the old encrypted backup and recovery words offline.

Mainnet uses https://api.oakagentkit.org by default. Override it with oak config set OAK_SERVER_URL <https-url> or OAK_SERVER_URL; testnet requires an explicit matching service URL. Configure the published deployment addresses and your RPC before starting MCP.

Transactions reported as “awaiting finality” keep their signed journal evidence until final. New actions wait for reconciliation; a removed receipt is recovered at the same nonce, or an expired call has its nonce replaced with a zero-value self-transfer. Do not delete journal files to force a retry. If a sequence stops after approval, the error lists token, spender, base-unit amount and chain. The next action previews and revokes the remaining allowance before new work; keep ETH available for cleanup. You can also call approve(spender, 0) on that token in your own wallet on the named chain.

Price notes require an ETH/USD pool observation no older than 30 minutes and a current 30-minute OAK trade window. Missing, future-dated or stale sources refuse note issuance with a retry explanation; an old Uniswap observation extrapolated by observe(0) does not qualify.