algorand-remote-mcp
If you are the rightful owner of algorand-remote-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This repository contains a remote Model Context Protocol (MCP) server for Algorand, designed to facilitate interaction with the Algorand blockchain using the MCP protocol.
Algorand Remote MCP Server
This repository contains a remote Model Context Protocol (MCP) server for Algorand, designed to facilitate interaction with the Algorand blockchain using the MCP protocol. It is built on Cloudflare Workers and utilizes Server-Sent Events (SSE) for real-time communication.
New Features
- Google OAuth Authentication: Users can authenticate with their Google accounts to access the MCP server
- Per-User Wallet Management: Each authenticated user gets their own dedicated Algorand wallet
- Account Persistence: Wallets are stored in Cloudflare KV storage and associated with user emails
- Wallet Reset Capability: Users can reset their wallet and generate a new one if needed
Getting Started
Connect Claude Desktop to your MCP server
You can connect to your remote MCP server from local MCP clients using the mcp-remote proxy.
To connect to your MCP server from Claude Desktop, follow Anthropic's Quickstart and within Claude Desktop go to Settings > Developer > Edit Config.
Update with this configuration:
{
"mcpServers": {
"algorand-remote-mcp": {
"command": "npx",
"args": [
"mcp-remote",
"https://algorand-remote-mcp.your-account.workers.dev/sse" // or http://localhost:8787/sse for local development
]
}
}
}
Restart Claude and you should see the tools become available.
Development:
Prerequisites
- Node.js (v18 or later)
- Wrangler (Cloudflare Workers CLI)
- An Algorand node access (via AlgoNode (Nodely), or your own node)
- Google OAuth credentials (for authentication)
Installation
-
Clone the repository:
git clone https://github.com/GoPlausible/algorand-mcp.git cd algorand-mcp/packages/server-sse
-
Install dependencies:
npm install
-
Configure environment variables:
- Environment variables are set in
wrangler.jsonc
under thevars
section - Sensitive values should be set as secrets (see Deployment section)
- Add OAuth credentials as secrets
- Environment variables are set in
Development
To run the server locally for development:
npm run dev
This starts the server on localhost:8787
.
Google OAuth Setup
To set up Google OAuth authentication:
-
Create OAuth 2.0 credentials in the Google Cloud Console:
- Create a new project (or use an existing one)
- Configure the OAuth consent screen
- Create OAuth 2.0 credentials (Web application)
- Add authorized redirect URIs:
- For local development:
http://localhost:8787/callback
- For production:
https://your-worker-subdomain.workers.dev/callback
- For local development:
-
Set the required environment secrets:
npx wrangler secret put GOOGLE_CLIENT_ID npx wrangler secret put GOOGLE_CLIENT_SECRET npx wrangler secret put COOKIE_ENCRYPTION_KEY # A random string for cookie signing
-
Configure KV namespaces in
wrangler.jsonc
:"kv_namespaces": [ { "binding": "AGENT_SESSIONS", "id": "your-kv-namespace-id-for-sessions" }, { "binding": "OAUTH_KV_ACCOUNTS", "id": "your-kv-namespace-id-for-accounts" } ]
Deployment
To deploy to Cloudflare Workers:
-
Authenticate with Cloudflare (if not already done):
npx wrangler login
-
Configure your environment:
- Edit
wrangler.jsonc
to set your environment variables - Set up secrets for sensitive information:
# Set up various secrets npx wrangler secret put ALGORAND_AGENT_WALLET # Default wallet (fallback) npx wrangler secret put GOOGLE_CLIENT_ID npx wrangler secret put GOOGLE_CLIENT_SECRET npx wrangler secret put COOKIE_ENCRYPTION_KEY # (You'll be prompted to enter the value for each)
Don't forget to remove sensitive values from wrangler.jsonc file so they are only served from secrets.
- Edit
-
Create KV namespaces:
npx wrangler kv:namespace create "OAUTH_KV" npx wrangler kv:namespace create "OAUTH_KV_ACCOUNTS"
-
Add the KV namespace IDs to
wrangler.jsonc
as shown above. -
Deploy to Cloudflare Workers:
npm run deploy
Your MCP server will be available at https://algorand-remote-mcp.[your-worker-subdomain].workers.dev
.
Environment Variables
⚠️ IMPORTANT SECURITY WARNING
For sensitive variables like
GOOGLE_CLIENT_ID
, andGOOGLE_CLIENT_SECRET
, it is strongly recommended to use Cloudflare Worker secrets instead of defining them in wrangler.jsonc. Store sensitive credentials using:npx wrangler secret put VARIABLE_NAME
This ensures sensitive values are encrypted and not stored in plaintext configuration files.
The MCP server relies on the following environment variables:
Variable | Description | Default |
---|---|---|
ALGORAND_NETWORK | Network to connect to (mainnet/testnet) | testnet |
ALGORAND_ALGOD | Base URL for Algorand node | https://testnet-api.algonode.cloud |
ALGORAND_ALGOD_API | Full API URL with version | https://testnet-api.algonode.cloud/v2 |
ALGORAND_INDEXER | Base URL for Algorand indexer | https://testnet-idx.algonode.cloud |
ALGORAND_INDEXER_API | Full API URL with version | https://testnet-idx.algonode.cloud/v2 |
ALGORAND_TOKEN | API token for Algorand nodes | "" |
NFD_API_URL | NFD API URL for name resolution | https://api.nf.domains |
ITEMS_PER_PAGE | Default pagination items per page | 10 |
GOOGLE_CLIENT_ID | Google OAuth client ID | (Required as secret) |
GOOGLE_CLIENT_SECRET | Google OAuth client secret | (Required as secret) |
COOKIE_ENCRYPTION_KEY | Key for cookie encryption | (Required as secret) |
Authentication Flow
The authentication flow works as follows:
- User connects to the MCP server
- User is redirected to Google OAuth for authentication
- After successful authentication, the user's email is used to look up or create a wallet
- All transactions use the user's dedicated wallet
Per-User Wallet Management
Each authenticated user gets their own dedicated Algorand wallet:
- Wallets are stored in the
OAUTH_KV_ACCOUNTS
KV namespace - The user's email is used as the key to store/retrieve the wallet mnemonic
- If a user doesn't have a wallet, one is automatically created
- The wallet persists across sessions, providing a consistent identity
Wallet Reset Tool
Users can reset their wallet using the reset-wallet_account
tool:
- This generates a new Algorand account
- The new wallet replaces the old one in KV storage
- All future operations will use the new wallet
Available Tools and Resources
Tools
Account Management Tools
create_account
: Create a new Algorand accountrecover_account
: Recover an Algorand account from mnemoniccheck_balance
: Check the balance of an Algorand accountreset-wallet_account
: Reset the user's wallet and generate a new one
Utility Tools
validate_address
: Check if an Algorand address is validencode_address
: Encode a public key to an Algorand addressdecode_address
: Decode an Algorand address to a public keyget_application_address
: Get the address for a given application IDbytes_to_bigint
: Convert bytes to a BigIntbigint_to_bytes
: Convert a BigInt to bytesencode_uint64
: Encode a uint64 to bytesdecode_uint64
: Decode bytes to a uint64verify_bytes
: Verify a signature against bytes with an Algorand addresssign_bytes
: Sign bytes with a secret keyencode_obj
: Encode an object to msgpack formatdecode_obj
: Decode msgpack bytes to an object
Transaction Management Tools
Payment Transaction Tools
create_payment_transaction
: Create a payment transaction on Algorandsign_transaction
: Sign an Algorand transaction with a mnemonicsubmit_transaction
: Submit a signed transaction to the Algorand network
Asset Transaction Tools
create_asset
: Create a new Algorand Standard Asset (ASA)asset_optin
: Opt-in to an Algorand Standard Asset (ASA)transfer_asset
: Transfer an Algorand Standard Asset (ASA)
Application Transaction Tools
create_application
: Create a new smart contract application on Algorandcall_application
: Call a smart contract application on Algorandoptin_application
: Opt-in to an Algorand applicationupdate_application
: Update an existing smart contract applicationdelete_application
: Delete an existing smart contract applicationcloseout_application
: Close out from an Algorand applicationclear_application
: Clear state for an Algorand application
Group Transaction Tools
assign_group_id
: Assign a group ID to a set of transactions for atomic executioncreate_atomic_group
: Create an atomic transaction group from multiple transactionssend_atomic_group
: Sign and submit an atomic transaction group in one operation
Algorand Node Interaction Tools
compile_teal
: Compile TEAL source codedisassemble_teal
: Disassemble TEAL bytecode into source codesend_raw_transaction
: Submit signed transactions to the Algorand networksimulate_raw_transactions
: Simulate raw transactionssimulate_transactions
: Simulate encoded transactions
ARC-26 URI Tools
generate_algorand_uri
: Generate a URI following the ARC-26 specificationgenerate_payment_uri
: Generate a payment URI following the ARC-26 specificationgenerate_asset_transfer_uri
: Generate an asset transfer URI following the ARC-26 specification
API Integration Tools
General API Tools
api_request
: Make a request to an external APIapi_indexer_search
: Search the Algorand indexer for accounts, transactions, assets, or applications
NFD API Tools
api_nfd_get_nfd
: Get NFD domain information by nameapi_nfd_get_nfds_for_address
: Get all NFD domains owned by an addressapi_nfd_get_nfd_activity
: Get activity for an NFD domainapi_nfd_get_nfd_analytics
: Get analytics for an NFD domainapi_nfd_browse_nfds
: Browse NFD domains with filtering optionsapi_nfd_search_nfds
: Search for NFD domains
Algod API Tools
api_algod_get_account_info
: Get current account balance, assets, and auth addressapi_algod_get_account_application_info
: Get account-specific application informationapi_algod_get_account_asset_info
: Get account-specific asset informationapi_algod_get_application_info
: Get application detailsapi_algod_get_application_box_value
: Get application box contentsapi_algod_get_application_boxes
: Get all application boxesapi_algod_get_application_state
: Get application global stateapi_algod_get_asset_info
: Get asset detailsapi_algod_get_asset_holding
: Get asset holding information for an accountapi_algod_get_transaction_info
: Get transaction details by transaction IDapi_algod_get_pending_transactions
: Get pending transactions from algod mempool
Indexer API Tools
api_indexer_lookup_account_by_id
: Get account information from indexerapi_indexer_lookup_account_assets
: Get account assetsapi_indexer_lookup_account_app_local_states
: Get account application local statesapi_indexer_lookup_account_created_applications
: Get applications created by this accountapi_indexer_search_for_accounts
: Search for accounts with various criteriaapi_indexer_lookup_applications
: Get application information from indexerapi_indexer_lookup_application_logs
: Get application log messagesapi_indexer_search_for_applications
: Search for applications with various criteriaapi_indexer_lookup_application_box
: Get application box by nameapi_indexer_lookup_application_boxes
: Get all application boxesapi_indexer_lookup_asset_by_id
: Get asset information from indexerapi_indexer_lookup_asset_balances
: Get accounts that hold a specific assetapi_indexer_search_for_assets
: Search for assets with various criteriaapi_indexer_lookup_transaction_by_id
: Get transaction details from indexerapi_indexer_lookup_account_transactions
: Get transactions related to an accountapi_indexer_search_for_transactions
: Search for transactions with various criteria
Knowledge Management Tools
get_knowledge_doc
: Get markdown content for specified knowledge documentslist_knowledge_docs
: List available knowledge documents by category
Resources
Wallet Resources
Wallet Account
: Account information for the configured walletWallet Account Assets
: Asset holdings for the configured walletWallet Account Address
: Algorand address of the configured walletWallet Mnemonic
: Mnemonic phrase of the configured walletWallet Public Key
: Public key of the configured walletWallet Secret Key
: Secret key of the configured wallet
Knowledge Resources
Algorand Knowledge Full Taxonomy
: Complete taxonomy of Algorand documentationAlgorand Request for Comments
: ARCs documentationSoftware Development Kits
: SDKs documentationAlgoKit
: AlgoKit documentationAlgoKit Utils
: AlgoKit utilities documentationTEALScript
: TEALScript documentationPuya
: Puya documentationLiquid Auth
: Liquid Auth documentationPython Development
: Python development documentationDeveloper Documentation
: General developer documentationCLI Tools
: Command-line interface tools documentationNode Management
: Node management documentationDeveloper Details
: Developer details documentation
Architecture
This MCP server is built using:
- Cloudflare Workers: For serverless, edge-based execution
- Server-Sent Events (SSE): For real-time communication with MCP clients
- Algorand JavaScript SDK: For interacting with the Algorand blockchain
- Cloudflare R2 Storage: For storing and retrieving knowledge documentation
- Cloudflare KV Storage: For storing user wallets and session data
- Google OAuth: For user authentication
The architecture follows these key patterns:
- McpAgent Pattern: For handling MCP protocol communication
- Modular Tools & Resources: Organized by functionality category
- Tool Managers: Separate managers for different categories of tools (transaction, utility, etc.)
- Resource Providers: Organized access to blockchain data
- OAuth Authentication: Secure user authentication flow
- Per-User Wallet Management: Isolated wallet environments for each user
Project Structure
packages/server-sse/
├── src/
│ ├── index.ts # Main entry point
│ ├── types.ts # Type definitions
│ ├── oauth-handler.ts # OAuth implementation
│ ├── workers-oauth-utils.ts # OAuth utilities
│ ├── resources/ # Resource implementations
│ │ └── wallet/ # Wallet resources
│ ├── tools/ # Tool implementations
│ │ ├── accountManager.ts # Account management tools
│ │ ├── utilityManager.ts # Utility tools
│ │ ├── algodManager.ts # Algorand node interaction tools
│ │ ├── arc26Manager.ts # ARC-26 URI generation tools
│ │ ├── knowledgeManager.ts # Knowledge management tools
│ │ ├── walletManager.ts # Wallet management tools
│ │ ├── apiManager/ # API integration tools
│ │ │ ├── algod/ # Algod API tools
│ │ │ ├── indexer/ # Indexer API tools
│ │ │ └── nfd/ # NFD API tools
│ │ └── transactionManager/ # Transaction tools
│ │ ├── generalTransaction.ts # Payment transactions
│ │ ├── assetTransactions.ts # Asset operations
│ │ ├── appTransactions.ts # Application operations
│ │ └── groupTransactions.ts # Atomic group operations
│ └── utils/ # Utility functions
│ ├── responseProcessor.ts # Response formatting
│ ├── Guide.js # Guide content for agents
│ └── oauth-utils.ts # OAuth utility functions
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the .