agentleFS
GoPlausibleGoPlausible/algorand-mcp/AGENTS.md

algorand-mcp

AGENTS.md44 starsChanged 5 months agoMITView on GitHub

This document describes how AI agents should interact with the Algorand blockchain through the Algorand MCP server. It covers tool usage patterns, transaction workflows, safety rules, and common pitfalls. Algorand MCP is a local MCP server that runs on the user's machine. It provides 126 tools across 15 categories for full Algorand blockchain access. Mnemonics are stored in a local SQLite agent-wallet DB (~/.algorand-mcp/wallet.db, mode 0600) — they never appear in tool responses, logs, or MCP messages. The MCP server…

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository5 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

5 rules. About 1 is common, 1 is distinctive, and 3 are very specific to this project.

  • ≈1

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every tool that interacts with the blockchain accepts a network parameter:

    line 39
  2. Very specific:

    Always confirm with the user which network to use before transactions.

    line 47
  3. Very specific:

    Always check the asset's decimals field with api_algod_get_asset_by_id before computing amounts.

    line 57
  4. Distinctive:

    Use the wallet tools for signing — they hold the agent's mnemonics in the local agent-wallet DB and sign on your behalf.

    line 94
  5. Common:

    When the user provides their own secret key (not using the wallet):

    line 117

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Algorand MCP — Agent Guide

This document describes how AI agents should interact with the Algorand blockchain through the Algorand MCP server. It covers tool usage patterns, transaction workflows, safety rules, and common pitfalls.

Overview

Algorand MCP is a local MCP server that runs on the user's machine. It provides 126 tools across 15 categories for full Algorand blockchain access. Mnemonics are stored in a local SQLite agent-wallet DB (~/.algorand-mcp/wallet.db, mode 0600) — they never appear in tool responses, logs, or MCP messages. The MCP server holds the keys and signs on the agent's behalf.

Key difference from remote MCP servers: This server runs locally, signing happens on the user's machine using mnemonics held in the agent-wallet DB, and the agent provides the network parameter (mainnet, testnet, or localnet) on each tool call.

Calling MCP Tools

MCP tools are deferred — you MUST use ToolSearch to load them before calling:

ToolSearch("+algorand wallet")                                    # Search by keyword — loads matching tools
ToolSearch("select:mcp__algorand-mcp__wallet_get_info")           # Load a specific tool by full name

Once loaded, call them normally:

mcp__algorand-mcp__wallet_get_info { "network": "testnet" }

Full tool name pattern: mcp__algorand-mcp__<tool_name>. If you get "tool not found", use ToolSearch("+algorand <keyword>") to load it first.

Session Start

At the beginning of every Algorand session:

  1. Load tools — Call ToolSearch("+algorand wallet") to load wallet tools
  2. Check wallet — Call wallet_get_info with the target network to verify a wallet account exists and is active.
  3. If no accounts — Guide the user to create one with wallet_add_account (sets the nickname).
  4. If account needs funding — Generate an ARC-26 QR code with generate_algorand_qrcode (returns { qr, uri, link, expires_in } — display the qr text and shareable link) or direct the user to the testnet faucet: https://lora.algokit.io/testnet/fund
  5. If account needs USDC funding — Direct to testnet USDC faucet: https://faucet.circle.com/

Network Selection

Every tool that interacts with the blockchain accepts a network parameter:

ValueDescription
mainnetAlgorand mainnet (default if omitted) — real value, exercise caution
testnetAlgorand testnet — safe for development and testing
localnetLocal development network (requires ALGORAND_LOCALNET_URL env var)

Always confirm with the user which network to use before transactions. Default to testnet during development.

Amounts and Decimals

AssetUnit1 Whole Token =
ALGOmicroAlgos1,000,000
USDC (ASA 31566704)micro-units1,000,000 (6 decimals)
Custom ASAsbase unitsDepends on decimals field

Always check the asset's decimals field with api_algod_get_asset_by_id before computing amounts.

Common Mainnet Assets

AssetASA IDDecimals
ALGOnative6
USDC315667046
USDT3127696
goETH3861927258
goBTC3861959408

Always verify asset IDs on-chain — scam tokens use similar names.

Pre-Transaction Checklist

Before ANY transaction:

  1. MBR (Minimum Balance Requirement) — Account needs 0.1 ALGO base + 0.1 ALGO per asset opt-in + 0.1 ALGO per app opt-in.
  2. Asset opt-in — Verify with api_algod_get_account_asset_info before ASA transfers. If not opted in, opt-in first.
  3. Fees — Every transaction costs 0.001 ALGO (1,000 microAlgos) minimum.
  4. Balance check — Fetch current balance with wallet_get_info or api_algod_get_account_info before signing.
  5. Order — Fund the account with ALGO first, then do asset transactions.

Transaction Types

TypeCodeTools
ALGO paymentpaymake_payment_txn
Asset transfer / opt-inaxfermake_asset_transfer_txn
Asset create / config / destroyacfgmake_asset_create_txn, make_asset_config_txn, make_asset_destroy_txn
Asset freezeafrzmake_asset_freeze_txn
Application (smart contract)applmake_app_create_txn, make_app_call_txn, make_app_update_txn, make_app_delete_txn, make_app_optin_txn, make_app_closeout_txn, make_app_clear_txn
Key registrationkeyregmake_keyreg_txn

Wallet Transaction Workflow (Recommended)

Use the wallet tools for signing — they hold the agent's mnemonics in the local agent-wallet DB and sign on your behalf.

StepToolPurpose
1wallet_get_infoVerify active account, check balance
2Query toolsGet blockchain data (account info, asset info, etc.)
3make_*_txnBuild the transaction
4wallet_sign_transactionSign with active wallet account
5send_raw_transactionSubmit signed transaction to network
6Query toolsVerify result on-chain

One-Step Asset Opt-In

For asset opt-ins, use the shortcut:

wallet_optin_asset { assetId: 31566704, network: "testnet" }

This creates, signs, and submits the opt-in in a single call.

External Key Transaction Workflow

When the user provides their own secret key (not using the wallet):

StepToolPurpose
1make_*_txnBuild the transaction
2sign_transactionSign with provided secret key hex
3send_raw_transactionSubmit signed transaction

Atomic Group Transaction Workflow

For atomic (all-or-nothing) multi-transaction groups:

StepToolPurpose
1make_*_txn (multiple)Build each transaction
2assign_group_idAssign group ID to all transactions
3wallet_sign_transaction_groupSign all transactions in group with wallet
4send_raw_transactionSubmit all signed transactions

Best-Price Swap via Haystack Router (DEX Aggregator)

Haystack Router aggregates quotes across multiple Algorand DEXes (Tinyman V2, Pact, Folks) and LST protocols (tALGO, xALGO) to find the optimal swap route and execute atomically.

StepToolPurpose
1wallet_get_infoVerify active account, check balance
2api_haystack_needs_optinCheck if address needs opt-in for the target asset
3wallet_optin_assetOpt-in if needed
4api_haystack_get_swap_quotePreview best-price quote — show user output, USD values, route, price impact
5User confirmsAlways confirm before executing
6api_haystack_execute_swapAll-in-one: quote + sign via wallet + submit + confirm

CRITICAL: Swap Direction (type parameter)

The type parameter determines whether amount is exact input or exact output. Getting this wrong means the user spends or receives the wrong amount.

User saystypeamount isfromASAIDtoASAID
"Buy 10 ALGO with USDC""fixed-output"10000000 (desired output)USDCALGO
"Buy 10 USDC with ALGO""fixed-output"10000000 (desired output)ALGOUSDC
"Sell 10 ALGO for USDC""fixed-input"10000000 (exact spend)ALGOUSDC
"Swap 10 ALGO to USDC""fixed-input"10000000 (exact spend)ALGOUSDC
"Use 10 ALGO to buy USDC""fixed-input"10000000 (exact spend)ALGOUSDC
"Buy USDC for 10 ALGO""fixed-input"10000000 (exact spend)ALGOUSDC
"Get me 5 USDC""fixed-output"5000000 (desired output)(ask user)USDC

Rules:

  • "Buy X of Y" = fixed-output (exact output). amount = X, toASAID = Y
  • "Sell/swap/use X of Y" = fixed-input (exact input). amount = X, fromASAID = Y
  • If ambiguous, ASK the user — never guess.

Slippage Guidance

Pair TypeRecommended Slippage
Stable pairs (ALGO/USDC)0.1-0.5%
Volatile pairs0.5-1%
Low liquidity1-3%

Alpha Arcade Prediction Markets

Trade on-chain prediction markets (YES/NO outcomes) denominated in USDC via the Alpha Arcade integration (14 tools). All prices and quantities use microunits (1,000,000 = $1.00 or 1 share).

StepToolPurpose
1wallet_get_infoVerify active account, check ALGO + USDC balance
2alpha_get_live_marketsBrowse available prediction markets
3alpha_get_orderbookCheck liquidity and prices for a specific market
4alpha_create_market_order or alpha_create_limit_orderPlace an order
5alpha_get_positions / alpha_get_open_ordersCheck portfolio

Key Points

  • USDC required — all trades are USDC-denominated (ASA 31566704). Wallet must be opted in.
  • ALGO collateral — each order locks ~0.957 ALGO for the on-chain escrow MBR, refunded on cancel/fill.
  • Market vs limit — market orders fill immediately (appear in get_positions), limit orders sit on the book (appear in get_open_orders).
  • Multi-choice markets — trade using options[].marketAppId, not the parent market ID.
  • Save escrowAppId — returned by order creation, required for cancel/amend.
  • Probabilities are microunits — yesProb/noProb range 0–1,000,000, NOT percentages. Divide by 1,000,000 for display.

For detailed Alpha Arcade workflows (orderbook mechanics, split/merge shares, claiming, collateral model, common pitfalls), load the alpha-arcade-interaction skill.

Tool Categories

Wallet (10 tools)

Agent wallet backed by local SQLite (~/.algorand-mcp/wallet.db, mode 0600). The MCP server holds the mnemonics and signs on your behalf — they are never returned in tool responses.

ToolPurpose
wallet_add_accountCreate new Algorand account (keypair) for agent with nickname
wallet_remove_accountRemove account by nickname or index
wallet_list_accountsList all accounts with nicknames and addresses
wallet_switch_accountSwitch active account by nickname or index
wallet_get_infoActive account info: address, balance
wallet_get_assetsAsset holdings for active account
wallet_sign_transactionSign single transaction
wallet_sign_transaction_groupSign atomic group (auto-assigns group ID)
wallet_sign_dataSign arbitrary hex data with raw Ed25519
wallet_optin_assetOne-step asset opt-in (create + sign + submit)

Account Management (8 tools)

Key derivation and account creation (keys returned in the clear — use wallet tools for secure storage).

create_account, rekey_account, mnemonic_to_mdk, mdk_to_mnemonic, secret_key_to_mnemonic, mnemonic_to_secret_key, seed_from_mnemonic, mnemonic_from_seed

Utility (13 tools)

Address validation, encoding, signing, and server health.

ping, validate_address, encode_address, decode_address, get_application_address, bytes_to_bigint, bigint_to_bytes, encode_uint64, decode_uint64, verify_bytes, sign_bytes, encode_obj, decode_obj

Transaction Building (18 tools)

Build unsigned transaction objects. Must be signed before submission.

make_payment_txn, make_keyreg_txn, make_asset_create_txn, make_asset_config_txn, make_asset_destroy_txn, make_asset_freeze_txn, make_asset_transfer_txn, make_app_create_txn, make_app_update_txn, make_app_delete_txn, make_app_optin_txn, make_app_closeout_txn, make_app_clear_txn, make_app_call_txn, assign_group_id, sign_transaction, encode_unsigned_transaction, decode_signed_transaction

Algod (5 tools)

TEAL compilation, transaction simulation, and submission.

compile_teal, disassemble_teal, send_raw_transaction, simulate_raw_transactions, simulate_transactions

Algod API (13 tools)

Direct algod node queries for account, asset, application, and transaction data.

api_algod_get_account_info, api_algod_get_account_application_info, api_algod_get_account_asset_info, api_algod_get_application_by_id, api_algod_get_application_box, api_algod_get_application_boxes, api_algod_get_asset_by_id, api_algod_get_pending_transaction, api_algod_get_pending_transactions_by_address, api_algod_get_pending_transactions, api_algod_get_transaction_params, api_algod_get_node_status, api_algod_get_node_status_after_block

Indexer API (17 tools)

Historical blockchain queries — accounts, assets, transactions, applications.

api_indexer_lookup_account_by_id, api_indexer_lookup_account_assets, api_indexer_lookup_account_app_local_states, api_indexer_lookup_account_created_applications, api_indexer_search_for_accounts, api_indexer_lookup_applications, api_indexer_lookup_application_logs, api_indexer_search_for_applications, api_indexer_lookup_application_box, api_indexer_lookup_application_boxes, api_indexer_lookup_asset_by_id, api_indexer_lookup_asset_balances, api_indexer_lookup_asset_transactions, api_indexer_search_for_assets, api_indexer_lookup_transaction_by_id, api_indexer_lookup_account_transactions, api_indexer_search_for_transactions

NFDomains (6 tools)

Algorand Name Service (.algo names).

api_nfd_get_nfd, api_nfd_get_nfds_for_addresses, api_nfd_get_nfd_activity, api_nfd_get_nfd_analytics, api_nfd_browse_nfds, api_nfd_search_nfds

NFD Important: When using NFD names for transactions, always use the depositAccount field from the NFD response, NOT other address fields.

Tinyman AMM (9 tools)

Decentralized exchange operations.

api_tinyman_get_pool, api_tinyman_get_pool_analytics, api_tinyman_get_pool_creation_quote, api_tinyman_get_liquidity_quote, api_tinyman_get_remove_liquidity_quote, api_tinyman_get_swap_quote, api_tinyman_get_asset_optin_quote, api_tinyman_get_validator_optin_quote, api_tinyman_get_validator_optout_quote

Haystack Router (3 tools)

DEX aggregator for optimal swap routing across Tinyman V2, Pact, Folks, and LST protocols (tALGO, xALGO). Finds best prices across multiple DEXes and executes atomically.

ToolPurpose
api_haystack_get_swap_quoteGet optimized swap quote with routing, pricing, and price impact
api_haystack_execute_swapAll-in-one swap: quote + sign (via wallet) + submit + confirm
api_haystack_needs_optinCheck if address needs asset opt-in before swapping

Swap workflow:

  1. wallet_get_info — check balance
  2. api_haystack_needs_optin — check opt-in (if swapping to an ASA)
  3. api_haystack_get_swap_quote — preview quote, show user
  4. api_haystack_execute_swap — execute after user confirms

Pera Asset Verification (3 tools)

Pera Wallet verified asset data. Mainnet only — the Pera public API does not support testnet or localnet.

ToolPurpose
api_pera_asset_verification_statusGet verification status of a mainnet asset (verified, trusted, suspicious, unknown)
api_pera_verified_asset_detailsGet detailed asset info from Pera (name, unit, logo, decimals, verification)
api_pera_verified_asset_searchSearch Pera verified assets by name, unit name, or keyword

Use Pera tools to verify asset legitimacy before interacting with unknown ASAs on mainnet.

Alpha Arcade (14 tools)

On-chain prediction market trading — browse markets, place orders, manage positions, split/merge shares, claim winnings.

ToolPurpose
alpha_get_live_marketsFetch all live markets with prices, volume, categories
alpha_get_reward_marketsFetch markets with liquidity rewards (requires ALPHA_API_KEY)
alpha_get_marketFetch full details for a single market by app ID
alpha_get_orderbookUnified YES-perspective orderbook with spread
alpha_get_open_ordersOpen orders for a wallet on a specific market
alpha_get_positionsYES/NO token positions across all markets
alpha_create_limit_orderPlace a limit order at a specific price
alpha_create_market_orderPlace a market order with auto-matching and slippage
alpha_cancel_orderCancel an open order (refunds collateral)
alpha_amend_orderEdit an existing unfilled order in-place
alpha_propose_matchPropose a match between a maker order and your wallet
alpha_split_sharesSplit USDC into equal YES + NO tokens
alpha_merge_sharesMerge YES + NO tokens back into USDC
alpha_claimClaim USDC from a resolved market

x402 HTTP Payments (5 tools)

HTTP-native micropayments protocol. The first two tools handle paid-request flow; the three bazaar_* tools talk to the discovery directory hosted by the configured facilitator (facilitator.goplausible.xyz by default, override with BAZAAR_BASE_URL).

ToolPurpose
x402_discover_payment_requirementsProbe an x402 endpoint, return its accepts[] (cost, network, asset, payTo). No payment.
make_http_request_with_x402Pay + fetch a paid resource. Auto-discovers if paymentRequirements is omitted. Builds an atomic fee-payer + payment group, signs the payment leg with the active wallet, retries with PAYMENT-SIGNATURE.
bazaar_listBrowse cataloged paid resources. Filters: network, method, merchantId, limit, offset. Summary by default; full: true for verbatim.
bazaar_searchKeyword search over Bazaar resources. Server-side: query, network. Client-side: scheme, maxUsdPrice, asset, payTo, extensions, includeTestnets.
bazaar_get_resource_detailsFetch one resource by its exact resource URL.

Coinbase Wallet MCP compatibility: the first two tools mirror Coinbase's x402 surface (same names + input shapes), so agents trained on Coinbase x402 work drop-in against Algorand x402. The bazaar_* tools follow the same convention.

ARC-26 URI (1 tool)

Generate Algorand payment URIs and QR codes per the ARC-26 specification via QRClaw service. Returns { qr, uri, link, expires_in } — a UTF-8 text QR code, the algorand:// URI, a shareable hosted link, and link expiry.

generate_algorand_qrcode

Knowledge Base (1 tool)

Access the embedded Algorand developer documentation taxonomy.

get_knowledge_doc

Knowledge categories: arcs, sdks, algokit, algokit-utils, tealscript, puya, liquid-auth, python, developers, clis, nodes, details

Pagination

API responses are paginated. Every API tool accepts optional itemsPerPage (default 10) and pageToken parameters. Pass pageToken from a previous response to fetch the next page.

Security Rules

  1. Mainnet = real value — Always confirm with the user before mainnet transactions.
  2. Private keys — Never log, display, disclose or store mnemonics/secret keys
  3. Address verification — Validate addresses with validate_address before transactions. Transactions are irreversible.
  4. Asset verification — Verify asset IDs on-chain before interacting. Scam tokens use similar names. Use api_pera_asset_verification_status to check verification tier.

Error Handling

ErrorCauseSolution
No active accountNo wallet account configuredGuide user to wallet_add_account
Invalid Algorand address formatBad addressCheck with validate_address
Asset hasn't been opted inRecipient not opted in to ASAOpt-in first
Overspend / negative balanceInsufficient funds for amount + fee + MBRAdd funds or reduce amount
Do not know how to serialize a BigIntBigInt in JSON responseShould not occur (patched globally)

Links

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.