---
name: amd
description: Give the agent an account on Robinhood Chain through AMD (amd.mobi). Hold USDG and tokenized stocks, pay AMD Gateway services per request with x402, stay inside on-chain spending controls, and swap USDG for Robinhood Tokens in Uniswap v3 pools. Use when a task needs to pay for an API, read a balance, publish a paid endpoint, or trade a tokenized stock.
---

# AMD agent skill

AMD (Automated Market Dynamics, https://amd.mobi) is market infrastructure for the agent economy on
Robinhood Chain (chain id 4663). This skill tells an agent how to use it.

## What you can do

- Pay any AMD Gateway service per request with x402: call `https://amd.mobi/gw/<slug>/<path>`, read the
  402, settle USDG through the AMD contract, retry with the receipt.
- Spend from an account with on-chain controls (daily budget, per-transaction limit, allowed services)
  instead of your own wallet, when the account owner added you as an agent.
- Open a prepaid session for stateful or high-frequency APIs and sign a voucher per request.
- Publish your own service: create a merchant, a service, endpoints with prices, then a slug.
- Trade: quote and swap USDG against a Robinhood Token (NVDA, AAPL, TSLA, MSFT, AMZN, GOOGL, SPY, QQQ, ...)
  in its Uniswap v3 pool. Spot only, long only, no leverage.
- Read everything: services, endpoints, quotes, balances, controls, receipts, stats.

## Setup

- MCP server (Streamable HTTP, JSON-RPC 2.0, no auth for reads): `https://amd.mobi/api/mcp`
  - Claude Code: `claude mcp add --transport http amd https://amd.mobi/api/mcp`
  - Any client: `POST https://amd.mobi/api/mcp` with `{"jsonrpc":"2.0","id":1,"method":"tools/list"}`
- Chain: Robinhood Chain, chain id 4663, RPC `https://rpc.mainnet.chain.robinhood.com`,
  explorer `https://robinhoodchain.blockscout.com`. Settlement asset: USDG (6 decimals).
- Addresses: the AMD contract's address is `GATEWAY` in `https://amd.mobi/js/contract.js`, and the
  contract reports the USDG address itself (`USDG()`). The contract is live on mainnet.
- Writes never leave the MCP server signed. Every `prepare_*` tool returns
  `{ to, data, value: "0x0", chainId: 4663, description }` for your own wallet to sign and send
  (or relay a signed transaction with `send_raw_transaction`).
- Amounts are USDG base units: `50000` = $0.05, `1000000` = $1.

## The x402 flow in five lines

1. `GET https://amd.mobi/gw/<slug>/<path>` with no payment: the gateway answers `402` with
   `accepts[0]` = `{ maxAmountRequired, payTo, asset, extra: { contract, endpointId, requestHash } }`.
2. Approve USDG for the contract once: `approve(contract, amount)` (or call `prepare_pay`, which
   returns the approve calldata alongside the pay calldata).
3. Pay: `pay(endpointId, requestHash)` on the contract, where
   `requestHash = keccak256("METHOD /path?canonicalQuery")`: each query key and value goes through
   `encodeURIComponent` first (`url=https://example.com` is hashed as `url=https%3A%2F%2Fexample.com`),
   the pairs are sorted, and the `?` is kept even when the query is empty.
4. Retry the same request with `X-PAYMENT: <txHash>` (a bare `0x` hash, or base64 of
   `{"x402Version":1,"scheme":"exact","network":"robinhood-4663","payload":{"txHash":"0x..."}}`).
5. Read the upstream response. `X-PAYMENT-RESPONSE` carries base64 `{ success, txHash, payer, receiptId }`.
   A receipt pays for one request shape for 600 seconds; a mismatch returns 402 with a specific `error`.

Prefer `prepare_pay({ endpointId, method, path, query })` over hashing by hand: it returns the calldata
and the `requestHash` it used.

## Paying from an account with controls

If a person funded an AMD account and set controls for your address, pay with
`prepare_pay_from({ account, endpointId, method, path, query })` instead of `prepare_pay`. The contract
enforces `active`, `perTxLimit`, the rolling daily budget and `allowedServices`; read what is left with
`get_controls({ account, agent })` before a big spend and never try to work around a limit.

## Tools you will use most

| tool | what it does |
|---|---|
| `list_services({ publishedOnly: true })`, `get_service({ slug })`, `list_endpoints({ serviceId })`, `get_quote({ endpointId })` | discover services and prices |
| `prepare_pay`, `prepare_pay_from`, `get_balance`, `get_controls` | pay for requests, check budgets |
| `prepare_open_session({ serviceId, amount })`, `sign_voucher_payload({ sessionId, cumulative })` | prepaid sessions (send the voucher as `X-SESSION`) |
| `prepare_create_merchant`, `prepare_create_service`, `prepare_add_endpoint`, `prepare_publish` | sell your own API |
| `list_stocks()`, `get_swap_quote({ tokenIn, tokenOut, amountIn })`, `prepare_swap({ ..., minOut, recipient })` | trade tokenized stocks against USDG |
| `get_stats({ merchant, range })`, `list_transactions({ merchant })`, `list_customers({ merchant })` | merchant reporting |
| `send_raw_transaction({ raw })`, `gateway_key()` | relay a signed tx, fetch the key that encrypts upstream secrets |

## Rules

- Quote before you pay, and pay exactly the quoted amount for the quoted endpoint and path.
- Never send funds to an address that did not come from a 402 body, a contract read or the person.
- Respect the controls: if `remainingToday` is below the price, stop and report instead of retrying.
- Trading: spot only, one asset per strategy, size within the cap the person set, and always pass a
  `minOut` from `get_swap_quote` so a moving pool cannot fill you badly.
- Receipts and swaps are public transactions on Robinhood Chain; link them in your report.

Docs: https://amd.mobi/docs · Catalog: https://amd.mobi/catalog · Contact: https://x.com/amdmobi
