(06)Use

Agents and the MCP server

An AI agent uses Ostra through an MCP server that runs on its own machine. The agent's seed and every one-time key stay there; the server checks each operation before a key signs it, and the relayer lets the agent pay gas in USDG.

Chain Robinhood Chain · 4663Code 64c3213

6.1How an agent uses Ostra#

The Ostra MCP server speaks the Model Context Protocol over stdio, so any MCP client can run it: an agent framework, a desktop assistant, a script. On first use it creates a 32-byte master seed in the agent's own directory; every vault key, leaf key and approval key derives from it keys.ts:1-12. The server reads the chain, simulates, signs locally and sends transactions through the relayer.

On start it checks that its RPC serves Robinhood Chain (4663) and refuses any other chain agent.ts:108. Its logs go to stderr as JSON lines and never carry the RPC URL, which may hold an API key server.ts:21-26.

6.2Running the server#

The server is published on npm as @ostraagent/mcp. It needs Node.js 22 or later and no configuration: the package carries the deployment record of Ostra on Robinhood Chain mainnet and the addresses of Ostra's relayer, keeper and aggregator packaged.ts:1-18. An MCP client starts it with npx, which fetches it on first use. In Claude Code:

claude mcp add ostra -- npx -y @ostraagent/mcp

In Claude Desktop, Cursor and other MCP clients, in the client's configuration:

{
  "mcpServers": {
    "ostra": {
      "command": "npx",
      "args": ["-y", "@ostraagent/mcp"]
    }
  }
}

Then the agent calls open_vault, which returns its vault's address; USDG sent there on Robinhood Chain is its balance. Every setting is optional:

VariableDefaultMeaning
OSTRA_HOME~/.ostraThe agent’s directory, mode 0700: the seed, the gas key and every record.
OSTRA_RPC_URLThe public RPCRobinhood Chain RPC. The public one is rate limited.
OSTRA_RPC_URL_FILENoneA 0600 file holding the RPC URL, when it carries an API key. Never printed.
OSTRA_RELAYER_URLOstra’s relayerSends every transaction, paid in USDG, so the agent needs no ETH. With off, the fee payer key pays gas in ETH.
OSTRA_KEEPER_URLOstra’s keeperClaims payments for the seller side. With off, accept_payments refuses.
OSTRA_AGGREGATOR_URLOstra’s aggregatorBatches shield deposits. With off, shield refuses.
OSTRA_DEPLOYMENTMainnetPath of another deployment record. With it, the three services default to off.

The configuration is read once at start config.ts:1-22. On a local fork of mainnet, set the three services to off: they act on mainnet. The package is the repository's mcp/ folder with the core and the SDK, bundled into one JavaScript file with its dependencies pinned pack.ts:1-11.

6.3The tools#

The 54 tools, by group. Amounts are decimal strings: USDG with at most 6 decimals, launched tokens, stock tokens and ETH with at most 18 tools.ts:1-5.

GroupTools
Vaultopen_vault, balance, withdraw
Paymentspay, open_channel, list_channels, close_channel, accept_payments, seller_balance, seller_withdraw
Tradingtokens, token_info, pool_info, quote_swap, buy, sell, token_vault, transfer_token, claim_dividends, claim_referral
Launchingpairs, fund_creator_vault, launch, launches, set_pool_setting, set_creator_share, release_creator_payout, creator_withdraw
Airdrops and vestingairdrop_fund, airdrop_start, airdrop_claim, airdrop_close, vesting_info, vesting_release, vesting_claim_dividends
Shielded poolshield, unshield, shield_status, auto_shield, private_withdraw
Recoveryrecovery_status, set_guardian, set_recovery_policy, cancel_recovery, support_recovery, request_recovery
Identityprofile, upload_image, publish_profile, set_profile, publish_token_metadata, set_token_metadata, register_agent, set_agent_uri

Launching from an agent#

launch creates a pool with a supply of one billion paired with USDG (the default), ETH or one of Robinhood's 32 stock tokens (pairs lists them with their USD price now). It launches from the agent's creator vault of that pair, optionally with a dev buy in the pair's token paid by that vault in the same transaction and vested to the agent's token vault. It takes a name, a symbol, a starting market cap in US dollars, set in the pair's token at its Chainlink price when it launches (or a start tick), and any LaunchParams field to override Ostra's defaults: taxes, buckets, anti-snipe, limits, graduation, volatility fee, circuit breaker. The relayer fronts the 0.0002 ETH launch fee and charges it in USDG tools.ts:171.

set_pool_setting changes a rule of the agent's pool in traders' favour only, and auto_shield makes the creator vault shield its payouts above a reserve on every sweep.

6.4Checked before signing#

A one-time key that signs an operation that then fails has to sign again, which the scheme forbids. So the server signs nothing that would failmessages.ts:19-24:

  • Simulation with a throwaway key. Every vault operation runs first exactly as it would be signed, from the relayer's account, on the latest block one second later, with a throwaway key's root put in place of the vault's own for the simulation only quote.ts:5-10.
  • Swaps are quoted. The quote finds the gas the swap needs and adds a margin, and signs a minimum output of the quote less the slippage, 1% by default and 10% at most.
  • Near the circuit breaker, no signature. A swap that would use more than 80% of the price move a pool allows in one transaction is refused, since a small move would make it fail quote.ts:18-20.
  • A signed operation goes first. If a spend was signed and has not landed, it is sent again before anything new is signed.
  • The relayer is paid before signing. Room in a relayer channel is reserved for an operation's price before its key signs, so a signed key can always be relayed.

A refusal comes back as refused_before_signing: nothing was signed or spent.

6.5Gas in USDG: the relayer#

The relayer sends the agent's calls from its own account, pays the gas in ETH and charges the vault in USDG server.ts:1-3, through a payment channel of 1 USDG, or more when a payment needs it config.ts:35-39.

RuleValue
PriceSimulated gas, plus its L1 data part, plus the gas every signed swap reserves, times the gas price; plus 10%
ETH to USDChainlink ETH/USD, plus the feed’s 0.5% deviation threshold; refused if older than 25 hours
Agent’s checkThe agent computes the same price itself and refuses to pay more than 2% above it
Calls per requestAt most 8, all or nothing
What it relaysOnly calls to Ostra’s contracts, USDG and WETH, in the shapes the agent’s vaults and the pool use

The relayer cannot change what an agent signed: a vault spend, a leaf spend and a deposit are each bound by their signatures to every field that moves value. It also keeps every WOTS signature it receives until the chain shows the key used, and refuses a second message for the same key gate.ts:83-87. Without a relayer, the agent pays gas in ETH from its own fee payer key.

6.6What stays on the machine#

  • The seed and the gas key, in files of mode 0600 in a 0700 directory owned by the agent's user; anything accessible to other users is refused disk.ts:1-7.
  • Every WOTS signature, written before it is used.
  • Records of vaults, launches, deposits and scheduled unshields, none of which hold secrets.

Nothing secret is ever printed, logged or sent anywhere.

6.7What comes next#

Every Ostra launch, with its chart and trades, is listed in the web app at app.ostraagent.xyz.