Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PETASATS_HOMENoChanges the location where the kit creates and stores keys (default is ~/.petasats).

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

PetaSats buyer kit. It buys BSV with USDC on Base through a cross-chain atomic swap with the counterparty. It runs on this computer and keeps its keys here; no service ever holds the user's funds.

SCOPE: USDC on Base -> BSV only. About $5 to $100 per swap. Each buyer: at most 3 swaps and $200 per day. A shared daily total can make the service busy; a declined request can be retried later.

UNITS: amounts are decimal strings in the smallest unit. USDC has 6 decimals ("25000000" = 25 USDC). BSV is in satoshis ("100000000" = 1 BSV). ETH is in wei. A dollar amount the user names is the USDC to spend: "$10 of BSV" means amount_in "10000000".

STEPS

  1. wallet_info. The kit needs USDC on Base at its own Base address (baseAddress in wallet_info); ETH for gas is optional. If it has no USDC, tell the user that address and what to send. If it has USDC but no ETH, ask the user whether the kit may use 0.50 USDC of its balance to buy ETH for gas, and say the 0.50 USDC comes out of their balance; otherwise tell them to send a little ETH to that address. Each yes covers one purchase. After a yes, call buy_gas, and call it again only while its result asks you to. Once state is 'filled' or 'expired', or 'rejected' with sold 'nothing', that purchase is over: ask again before another. Never move the user's funds from another wallet unless they ask.

  2. get_quote. It shows the exact BSV for an exact USDC amount, the rate and the costs. A quote lasts about 60 seconds.

  3. If a person is directing you, show them the quote and get a clear yes. This is the only time to ask about the swap. If they already gave you an amount and a limit, that is the yes.

  4. swap_asset_to_bsv with quote_id (or min_bsv_out). If the quote has expired, the kit gets a new one and goes ahead only if it pays at least min_bsv_out, or 99% of the old quote.

  5. wait_for_swap until done is true (each call waits up to about 50 seconds). A swap usually finishes within about an hour: the counterparty's BSV lock and the kit's claim each wait for a BSV block, and a delivery to another address goes out together with the claim.

  6. Results: delivered or settled = BSV received; refunded = the USDC came back to the kit; failed = nothing was locked.

REPORTING

  • A person is watching: give one short line only when the stage changes, then a final summary with the amounts, the txids and their links.

  • Called by a program or another agent: return only the final result or the error.

  • Never pause, slow down or ask anything once a swap has started. Reporting never holds up the swap.

SAFETY

  • Standard speed is the default. Fast mode is the buyer's explicit choice and both sides must agree; otherwise the swap waits for one BSV confirmation. Fast mode makes the kit reveal its secret against an unconfirmed BSV lock. If the counterparty double-spends that lock, you can lose the swap amount. It is available only when both sides agree and the amount is at most $25; otherwise the swap waits for one BSV confirmation.

  • Keep this MCP server running until the swap is done. If it stops, the swap resumes safely when it starts again. If it stays stopped for more than about 2 hours after the USDC lock, the swap cannot finish; the kit then refunds the USDC the next time it runs after the Base timelock ends (about 10 hours after the lock).

  • The kit refuses a new swap or a withdrawal while a swap is in progress.

  • stop_spending stops new swaps and withdrawals until the user runs npx petasats-mcp resume in a terminal. Limits in limits.json can also refuse destinations and daily spending.

  • withdraw_bsv and withdraw_base send funds out of the kit. Use only an address the user gave you, and confirm it with them.

  • When the user asks to close, shut down or empty the kit, call close_kit with the Base and BSV addresses they gave and confirmed, and call it again until state is closed.

  • Never open, print or send the kit's keys file. Tell the user to keep a backup of it: it holds the only copy of the kit's keys.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{}
resources
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
get_quoteA

Get a live quote for buying BSV with USDC on Base. Read-only: nothing is locked or spent. Call it before swap_asset_to_bsv and show the quote to the person directing you; it lasts about 60 seconds, and passing its quote_id to swap_asset_to_bsv uses these terms. Returns quote_id, expires_at, usdc_in, bsv_out, est_bsv_received_sats (after the BSV claim fee), rate_usd_per_bsv, market_mid_usd_per_bsv, price_vs_mid_percent, costs and limits. If the counterparty declines (busy or over a limit), the error carries code, retry_after_s and retry_hint. To send the BSV to another wallet, use fund_wallet: the same quote plus the exact swap call.

swap_asset_to_bsvA

Buy BSV with this kit's USDC on Base through a non-custodial atomic swap with the counterparty. This moves funds: it locks USDC on Base, so get a quote with get_quote first and confirm it with the person directing you. Pass quote_id (or the quote object) to use that quote's terms, or min_bsv_out as a floor; if the quote has expired, the kit gets a new one and goes ahead only if it pays at least min_bsv_out, or 99% of the old quote. Returns at once with swap_id, stage, expected_minutes and the settlement mode; then call wait_for_swap until done is true. Refused while another swap is in progress or spending is stopped. If a swap cannot finish, the USDC comes back to the kit. speed is the buyer’s explicit choice; standard is the default. Fast mode makes the kit reveal its secret against an unconfirmed BSV lock. If the counterparty double-spends that lock, you can lose the swap amount. It is available only when both sides agree and the amount is at most $25; otherwise the swap waits for one BSV confirmation.

wait_for_swapA

Wait until a swap's stage changes or it finishes, then return its status. Read-only: it watches this kit's local swap record while the swap runs in the background. After swap_asset_to_bsv, call it repeatedly until swap.done is true; a swap usually finishes within about an hour. Returns changed (false when the wait ended with no change, which is normal: call again), waited_seconds, and swap, the same view swap_status gives: stage, stage_label, step and steps_total, done, outcome (delivered, settled, refunded or failed), eta_minutes and txids with explorer links. Sends progress notifications when the client supplies a progress token. Use swap_status for an instant read.

swap_statusA

Show the status of one swap, or of every swap this kit has made. Read-only and instant: it reads the kit's local swap records and changes nothing. Returns swaps, a list (empty when swap_id is unknown). Each entry has swap_id, stage and stage_label, step and steps_total, done, outcome (delivered, settled, refunded or failed), usdc_in, bsv_quoted, bsv_received once settled, deliver_to, eta_minutes, deadlines, txids with explorer links, needs_attention and what_to_do. To wait for the next change, use wait_for_swap rather than calling this in a loop.

wallet_infoA

Show this kit's own wallets: the Base address that pays for swaps, the BSV address that receives them, their balances, and whether spending is stopped. Read-only; never returns key material. Call it first: if the kit has no USDC, tell the user to send it to baseAddress. ETH for Base gas is optional: the user can send a little, or, after their yes, buy_gas buys it with 0.50 USDC. Returns baseAddress, bsvAddress, usdc and eth balances in atomic units, claimedBsvSats, unconfirmedBsvSats (BSV received but not confirmed yet), capUsdPerSwap, spending_stopped (with stopped_at and stop_reason), the limits from limits.json, door_identity, a backup_note when the wallet is new, and gas_topup (status, uid and open (true while the order could still fill; USDC withdrawals, swaps and close_kit wait until it is false)) when the kit has a gas purchase.

stop_spendingA

Emergency stop: block new swaps and withdrawals from this kit until the user runs npx petasats-mcp resume in a terminal; no tool can resume it. Use it when the user asks, or when something looks wrong. A swap already started still completes or refunds. Idempotent: calling it again keeps the first stop. Returns stopped: true, at (milliseconds since 1970) and reason, plus already_stopped: true when a stop was already in place.

withdraw_bsvA

Send all of this kit's confirmed BSV to one BSV address. This moves funds and cannot be undone: use only an address the user gave you, and confirm it with them first. It always sends the whole confirmed balance, and the network fee comes out of it; there is no partial amount. Refused while a swap or a BSV delivery is in progress, while spending is stopped, or when limits.json does not allow the address. Returns txid and sats sent, or sats 0 with a reason when there is no confirmed BSV. Use withdraw_base for USDC or ETH; to send a new swap's BSV straight to an address, pass deliver_to to swap_asset_to_bsv.

withdraw_baseA

Send USDC or ETH from this kit's Base wallet to another Base address. This moves funds and cannot be undone: use only an address the user gave you, and confirm it with them first. The kit pays the gas in ETH, so withdraw USDC before ETH. Refused while a swap is in progress, while spending is stopped, or when limits.json does not allow the address. Returns asset, amount (atomic and display), to, txid, status and a BaseScan url. Use withdraw_bsv for BSV.

fund_walletA

Plan sending BSV to a specific BSV address, paid with this kit's USDC on Base. Read-only: it returns a live quote and the exact swap_asset_to_bsv call (with deliver_to set), but moves nothing. Use it when the BSV should land in another wallet; use get_quote when it can stay in this kit. Fails if the kit could not start that swap now (spending stopped, address refused by limits.json, or over the daily limit). Returns plan, quote (the get_quote fields; valid about 60 seconds), swap_call and non_custodial.

list_liquidityA

List the trading pairs this kit supports and how each one settles. Read-only and offline: a fixed list with no prices or balances; use get_quote for a live price and wallet_info for balances. Today there is one pair, USDC on Base to BSV, settled by an on-chain atomic swap with the counterparty; PetaSats never holds funds. Returns pairs (each with pair, route and note), count, non_custodial and settlement.

close_kitA

Empty this kit into the user's own wallets, then stop it: it spends nothing more until the user runs npx petasats-mcp resume in a terminal. This moves funds and cannot be undone: base_address and bsv_address must be addresses the user gave you and confirmed, never this kit's own addresses. Each call takes at most one step and returns at once; call it again after call_again_after_seconds until state is 'closed'. It refuses while a swap is running, naming the swap, or while spending is already stopped for another reason. It sends USDC first, then BSV, then ETH. Only ETH dust that cannot pay its own gas (and, rarely, a BSV amount too small to send) is left behind. It never deletes, prints or sends the kit's keys file; keys_note explains that once closed. Returns state ('refused', 'in_progress' or 'closed'), sent (every send made in this close-down so far), and either reason with an optional retry_after_seconds, did and next with call_again_after_seconds, or closed_at, final and keys_note.

buy_gasA

Buy a little ETH for Base gas with exactly 0.50 USDC from this kit's own balance, so a kit funded with USDC alone can swap and withdraw. This moves the user's funds: call it only after the user says yes, and tell them the 0.50 USDC comes out of their balance. Each yes covers one purchase. It signs one CoW Protocol order that sells 0.50 USDC for ETH paid to this kit's own Base address; a CoW Protocol solver settles it and pays the network fee, so it works with no ETH in the kit. Refused when the kit already has gas (0.00002 ETH or more), holds less than 0.50 USDC, or spending is stopped. While a Base withdrawal or swap lock is still being confirmed, it is refused for 30 s; call it again then. Each call returns within about a minute; while state is 'pending', call it again after call_again_after_seconds, and call again whenever a result asks you to. Once state is 'filled' or 'expired', or 'rejected' with sold 'nothing', that purchase is over: report it, and ask the user again before another. Calling again never places a new order while an earlier one could still fill. Returns state ('pending', 'filled', 'expired', 'rejected' or 'refused'), with uid, order_url, sold, min_eth and, once filled, eth_received when it is known; or reason.

pay_402A

Pay a BSV pay-per-call API (HTTP 402, BRC-166) from this kit's own BSV. Call with confirm false to see the price first.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
About PetaSatsThe non-custodial model + supported pair
InstructionsBuyer kit operating instructions

TDQS

A4.3/5.0

Scored across 13 tools

Disambiguation4/5

Most tools have clearly distinct purposes: quote vs. swap, withdraw_bsv vs. withdraw_base, wait_for_swap vs. swap_status are all explicitly contrasted in their descriptions. The main soft overlap is get_quote/fund_wallet, which both return a quote and exact swap call, though the descriptions distinguish 'BSV stays in kit' vs. 'BSV goes elsewhere'.

Naming Consistency4/5

Thirteen names are overwhelmingly snake_case verb_noun (get_quote, withdraw_bsv, buy_gas, stop_spending, close_kit). Minor deviations: two noun-phrase names (wallet_info, swap_status) and one three-part verb (swap_asset_to_bsv), which are still readable and unambiguous.

Tool Count5/5

13 tools fall squarely in the well-scoped range for a swap-and-custody kit. Each covers a distinct lifecycle step (quote, swap, status/wait, withdraw, gas, stop, close, pay) with no filler tools.

Completeness4/5

The full swap lifecycle is covered: quote, execute, poll/wait, status, withdraw on both chains, gas top-up, emergency stop, and teardown via close_kit. The only intentional dead ends are resume-after-stop and key handling, which explicitly require the user's terminal — a documented safety choice rather than a real gap.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues