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.
- llms.txtllms.txt
- algorand-interactionSkill
- algorand-x402-paymentSkill
- alpha-arcade-interactionSkill
- haystack-router-interactionSkill
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
- Very specific: line 39
Every tool that interacts with the blockchain accepts a network parameter:
- Very specific: line 47
Always confirm with the user which network to use before transactions.
- Very specific: line 57
Always check the asset's decimals field with api_algod_get_asset_by_id before computing amounts.
- Distinctive: line 94
Use the wallet tools for signing — they hold the agent's mnemonics in the local agent-wallet DB and sign on your behalf.
- Common: line 117
When the user provides their own secret key (not using the wallet):
≈ “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.
Files
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 nameOnce 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:
- Load tools — Call
ToolSearch("+algorand wallet")to load wallet tools - Check wallet — Call
wallet_get_infowith the target network to verify a wallet account exists and is active. - If no accounts — Guide the user to create one with
wallet_add_account(sets the nickname). - If account needs funding — Generate an ARC-26 QR code with
generate_algorand_qrcode(returns{ qr, uri, link, expires_in }— display theqrtext and shareablelink) or direct the user to the testnet faucet: https://lora.algokit.io/testnet/fund - 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:
| Value | Description |
mainnet | Algorand mainnet (default if omitted) — real value, exercise caution |
testnet | Algorand testnet — safe for development and testing |
localnet | Local 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
| Asset | Unit | 1 Whole Token = |
| ALGO | microAlgos | 1,000,000 |
| USDC (ASA 31566704) | micro-units | 1,000,000 (6 decimals) |
| Custom ASAs | base units | Depends on decimals field |
Always check the asset's decimals field with api_algod_get_asset_by_id before computing amounts.
Common Mainnet Assets
| Asset | ASA ID | Decimals |
| ALGO | native | 6 |
| USDC | 31566704 | 6 |
| USDT | 312769 | 6 |
| goETH | 386192725 | 8 |
| goBTC | 386195940 | 8 |
Always verify asset IDs on-chain — scam tokens use similar names.
Pre-Transaction Checklist
Before ANY transaction:
- MBR (Minimum Balance Requirement) — Account needs 0.1 ALGO base + 0.1 ALGO per asset opt-in + 0.1 ALGO per app opt-in.
- Asset opt-in — Verify with
api_algod_get_account_asset_infobefore ASA transfers. If not opted in, opt-in first. - Fees — Every transaction costs 0.001 ALGO (1,000 microAlgos) minimum.
- Balance check — Fetch current balance with
wallet_get_infoorapi_algod_get_account_infobefore signing. - Order — Fund the account with ALGO first, then do asset transactions.
Transaction Types
| Type | Code | Tools |
| ALGO payment | pay | make_payment_txn |
| Asset transfer / opt-in | axfer | make_asset_transfer_txn |
| Asset create / config / destroy | acfg | make_asset_create_txn, make_asset_config_txn, make_asset_destroy_txn |
| Asset freeze | afrz | make_asset_freeze_txn |
| Application (smart contract) | appl | make_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 registration | keyreg | make_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.
| Step | Tool | Purpose |
| 1 | wallet_get_info | Verify active account, check balance |
| 2 | Query tools | Get blockchain data (account info, asset info, etc.) |
| 3 | make_*_txn | Build the transaction |
| 4 | wallet_sign_transaction | Sign with active wallet account |
| 5 | send_raw_transaction | Submit signed transaction to network |
| 6 | Query tools | Verify 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):
| Step | Tool | Purpose |
| 1 | make_*_txn | Build the transaction |
| 2 | sign_transaction | Sign with provided secret key hex |
| 3 | send_raw_transaction | Submit signed transaction |
Atomic Group Transaction Workflow
For atomic (all-or-nothing) multi-transaction groups:
| Step | Tool | Purpose |
| 1 | make_*_txn (multiple) | Build each transaction |
| 2 | assign_group_id | Assign group ID to all transactions |
| 3 | wallet_sign_transaction_group | Sign all transactions in group with wallet |
| 4 | send_raw_transaction | Submit 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.
| Step | Tool | Purpose |
| 1 | wallet_get_info | Verify active account, check balance |
| 2 | api_haystack_needs_optin | Check if address needs opt-in for the target asset |
| 3 | wallet_optin_asset | Opt-in if needed |
| 4 | api_haystack_get_swap_quote | Preview best-price quote — show user output, USD values, route, price impact |
| 5 | User confirms | Always confirm before executing |
| 6 | api_haystack_execute_swap | All-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 says | type | amount is | fromASAID | toASAID |
| "Buy 10 ALGO with USDC" | "fixed-output" | 10000000 (desired output) | USDC | ALGO |
| "Buy 10 USDC with ALGO" | "fixed-output" | 10000000 (desired output) | ALGO | USDC |
| "Sell 10 ALGO for USDC" | "fixed-input" | 10000000 (exact spend) | ALGO | USDC |
| "Swap 10 ALGO to USDC" | "fixed-input" | 10000000 (exact spend) | ALGO | USDC |
| "Use 10 ALGO to buy USDC" | "fixed-input" | 10000000 (exact spend) | ALGO | USDC |
| "Buy USDC for 10 ALGO" | "fixed-input" | 10000000 (exact spend) | ALGO | USDC |
| "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 Type | Recommended Slippage |
| Stable pairs (ALGO/USDC) | 0.1-0.5% |
| Volatile pairs | 0.5-1% |
| Low liquidity | 1-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).
| Step | Tool | Purpose |
| 1 | wallet_get_info | Verify active account, check ALGO + USDC balance |
| 2 | alpha_get_live_markets | Browse available prediction markets |
| 3 | alpha_get_orderbook | Check liquidity and prices for a specific market |
| 4 | alpha_create_market_order or alpha_create_limit_order | Place an order |
| 5 | alpha_get_positions / alpha_get_open_orders | Check 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 inget_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/noProbrange 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-interactionskill.
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.
| Tool | Purpose |
wallet_add_account | Create new Algorand account (keypair) for agent with nickname |
wallet_remove_account | Remove account by nickname or index |
wallet_list_accounts | List all accounts with nicknames and addresses |
wallet_switch_account | Switch active account by nickname or index |
wallet_get_info | Active account info: address, balance |
wallet_get_assets | Asset holdings for active account |
wallet_sign_transaction | Sign single transaction |
wallet_sign_transaction_group | Sign atomic group (auto-assigns group ID) |
wallet_sign_data | Sign arbitrary hex data with raw Ed25519 |
wallet_optin_asset | One-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
depositAccountfield 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.
| Tool | Purpose |
api_haystack_get_swap_quote | Get optimized swap quote with routing, pricing, and price impact |
api_haystack_execute_swap | All-in-one swap: quote + sign (via wallet) + submit + confirm |
api_haystack_needs_optin | Check if address needs asset opt-in before swapping |
Swap workflow:
wallet_get_info— check balanceapi_haystack_needs_optin— check opt-in (if swapping to an ASA)api_haystack_get_swap_quote— preview quote, show userapi_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.
| Tool | Purpose |
api_pera_asset_verification_status | Get verification status of a mainnet asset (verified, trusted, suspicious, unknown) |
api_pera_verified_asset_details | Get detailed asset info from Pera (name, unit, logo, decimals, verification) |
api_pera_verified_asset_search | Search 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.
| Tool | Purpose |
alpha_get_live_markets | Fetch all live markets with prices, volume, categories |
alpha_get_reward_markets | Fetch markets with liquidity rewards (requires ALPHA_API_KEY) |
alpha_get_market | Fetch full details for a single market by app ID |
alpha_get_orderbook | Unified YES-perspective orderbook with spread |
alpha_get_open_orders | Open orders for a wallet on a specific market |
alpha_get_positions | YES/NO token positions across all markets |
alpha_create_limit_order | Place a limit order at a specific price |
alpha_create_market_order | Place a market order with auto-matching and slippage |
alpha_cancel_order | Cancel an open order (refunds collateral) |
alpha_amend_order | Edit an existing unfilled order in-place |
alpha_propose_match | Propose a match between a maker order and your wallet |
alpha_split_shares | Split USDC into equal YES + NO tokens |
alpha_merge_shares | Merge YES + NO tokens back into USDC |
alpha_claim | Claim 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).
| Tool | Purpose |
x402_discover_payment_requirements | Probe an x402 endpoint, return its accepts[] (cost, network, asset, payTo). No payment. |
make_http_request_with_x402 | Pay + 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_list | Browse cataloged paid resources. Filters: network, method, merchantId, limit, offset. Summary by default; full: true for verbatim. |
bazaar_search | Keyword search over Bazaar resources. Server-side: query, network. Client-side: scheme, maxUsdPrice, asset, payTo, extensions, includeTestnets. |
bazaar_get_resource_details | Fetch 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
- Mainnet = real value — Always confirm with the user before mainnet transactions.
- Private keys — Never log, display, disclose or store mnemonics/secret keys
- Address verification — Validate addresses with
validate_addressbefore transactions. Transactions are irreversible. - Asset verification — Verify asset IDs on-chain before interacting. Scam tokens use similar names. Use
api_pera_asset_verification_statusto check verification tier.
Error Handling
| Error | Cause | Solution |
No active account | No wallet account configured | Guide user to wallet_add_account |
Invalid Algorand address format | Bad address | Check with validate_address |
Asset hasn't been opted in | Recipient not opted in to ASA | Opt-in first |
Overspend / negative balance | Insufficient funds for amount + fee + MBR | Add funds or reduce amount |
Do not know how to serialize a BigInt | BigInt in JSON response | Should not occur (patched globally) |
Links
- GoPlausible: https://goplausible.com
- Algorand: https://algorand.co
- Algorand x402: https://x402.goplausible.xyz
- Algorand x402 test endpoints: https://example.x402.goplausible.xyz/
- Algorand x402 Facilitator: https://facilitator.goplausible.xyz
- Testnet Faucet: https://lora.algokit.io/testnet/fund
- Testnet USDC Faucet: https://faucet.circle.com/
- AlgoNode (public nodes): https://algonode.io
- Algorand Developer Docs: https://dev.algorand.co/
- Algorand Developer Docs Github: https://github.com/algorandfoundation/devportal
- GoPlausible x402-avm Documentation
- Coinbase x402 Protocol
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
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.

