TypeScript + MCP: 45 Tools for Building AI Agent Financial Infrastructure
Your AI agent can browse the web, write code, and manage files — but can it swap tokens? Most AI agent frameworks give you powerful tools for reasoning and action, but the moment your agent needs to touch money — pay for an API call, rebalance a portfolio, or send a reward — you're back to writing custom blockchain glue code. WAIaaS is an open-source, self-hosted Wallet-as-a-Service that gives your agent a real wallet, a policy engine, and 45 MCP tools it can use immediately.
The Gap Between AI Agents and Blockchains
If you've built anything with Claude, LangChain, CrewAI, or AutoGPT, you've probably hit this wall. Your agent is smart enough to decide what to do — "swap 0.1 SOL for USDC when the price is right" — but has no way to actually do it. Blockchain interactions require private key management, RPC connections, transaction signing, gas estimation, and a dozen other things that don't belong inside your agent's reasoning loop.
The usual answer is to bolt on a custom signing service, hardcode an RPC URL, and hope nothing goes wrong. That works until you need spending limits, multi-chain support, or a way to approve large transactions before they go out. Then you're building infrastructure instead of building your agent.
WAIaaS handles all of that. You spin up a Docker container, create a wallet, issue a session token to your agent, and connect it to Claude (or any MCP-compatible framework) in about ten minutes.
What Your Agent Gets: 45 MCP Tools
The MCP server (@waiaas/mcp) exposes 45 tools that cover everything a financially capable agent needs. Here's the full list, grouped by what they do:
Wallet and balance: get-wallet-info, get-address, get-balance, get-assets, get-tokens, get-nonce, resolve-asset
Transactions: send-token, send-batch, sign-transaction, sign-message, simulate-transaction, get-transaction, list-transactions, list-incoming-transactions, get-incoming-summary
DeFi: action-provider, get-defi-positions, get-health-factor, approve-token, list-offchain-actions
NFTs: get-nft-metadata, list-nfts, transfer-nft
Account Abstraction: build-userop, sign-userop
x402 payments: x402-fetch
ERC-8004 agent identity: erc8004-get-agent-info, erc8004-get-reputation, erc8004-get-validation-status
ERC-8128 signing: erc8128-sign-request, erc8128-verify-signature
WalletConnect: wc-connect, wc-disconnect, wc-status
Session and policy: list-sessions, list-credentials, get-policies, connect-info
Utilities: call-contract, encode-calldata, get-rpc-proxy-url, get-provider-status, hyperliquid, polymarket
That's not a toy integration. That's a complete financial stack your agent can operate through natural language.
Getting Claude Set Up in 10 Minutes
Here's the fastest path from zero to a Claude agent that has a working wallet.
Step 1: Start WAIaaS
git clone https://github.com/waiaas/WAIaaS.git
cd WAIaaS
docker compose up -d
The default port binding is 127.0.0.1:3100:3100, so the API is only accessible locally by default. That's intentional — your agent's wallet shouldn't be exposed to the internet without deliberate configuration.
Step 2: Create a wallet and session
# Create a Solana mainnet wallet
curl -X POST http://127.0.0.1:3100/v1/wallets \
-H "Content-Type: application/json" \
-H "X-Master-Password: my-secret-password" \
-d '{"name": "trading-wallet", "chain": "solana", "environment": "mainnet"}'
# Create a session token for your agent
curl -X POST http://127.0.0.1:3100/v1/sessions \
-H "Content-Type: application/json" \
-H "X-Master-Password: my-secret-password" \
-d '{"walletId": "<wallet-uuid>"}'
The session token (wai_sess_...) is what your agent uses. It can't create wallets, change policies, or do anything administrative — it's scoped to transactions and queries only.
Or skip the curl commands entirely and use the CLI:
npm install -g @waiaas/cli
waiaas init
waiaas start
waiaas quickset --mode mainnet
quickset creates wallets and MCP sessions in a single step and prints the config JSON you need for the next step.
Step 3: Configure Claude Desktop
Drop this into ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"waiaas": {
"command": "npx",
"args": ["-y", "@waiaas/mcp"],
"env": {
"WAIAAS_BASE_URL": "http://127.0.0.1:3100",
"WAIAAS_SESSION_TOKEN": "wai_sess_<your-token>",
"WAIAAS_DATA_DIR": "~/.waiaas"
}
}
}
}
Restart Claude Desktop, and you're done. Now Claude can:
- "Check my wallet balance" → calls
get_balance - "Swap 0.1 SOL for USDC on Jupiter" → calls the Jupiter swap action via
action-provider - "Show my DeFi positions across all protocols" → calls
get_defi_positions
Step 4: Run multiple agents with separate wallets
Real agent systems often need isolation — a trading agent shouldn't share a wallet with a payments agent. WAIaaS supports this natively with one MCP server entry per wallet:
{
"mcpServers": {
"waiaas-trading": {
"command": "npx",
"args": ["-y", "@waiaas/mcp"],
"env": {
"WAIAAS_BASE_URL": "http://127.0.0.1:3100",
"WAIAAS_AGENT_ID": "019c47d6-51ef-7f43-a76b-d50e875d95f4",
"WAIAAS_AGENT_NAME": "trading-agent",
"WAIAAS_DATA_DIR": "~/.waiaas"
}
},
"waiaas-solana": {
"command": "npx",
"args": ["-y", "@waiaas/mcp"],
"env": {
"WAIAAS_BASE_URL": "http://127.0.0.1:3100",
"WAIAAS_AGENT_ID": "019c4cd2-86e8-758f-a61e-9c560307c788",
"WAIAAS_AGENT_NAME": "solana-wallet",
"WAIAAS_DATA_DIR": "~/.waiaas"
}
}
}
}
Each agent sees only its own wallet. Policies are per-wallet. A bug in one agent can't drain the other's funds.
For Builders Who Prefer Code: The TypeScript SDK
If you're building a custom agent with LangChain, AutoGPT, or a bespoke loop, MCP might not be the right interface. The TypeScript SDK (@waiaas/sdk) gives you the same capabilities as direct API calls, with proper types and error handling built in.
npm install @waiaas/sdk
Here's a complete pattern for sending a transaction and polling for confirmation — the kind of thing you'd put inside a LangChain tool or a CrewAI task:
import { WAIaaSClient, WAIaaSError } from '@waiaas/sdk';
const client = new WAIaaSClient({
baseUrl: process.env['WAIAAS_BASE_URL'] ?? 'http://localhost:3100',
sessionToken: process.env['WAIAAS_SESSION_TOKEN'],
});
// Step 1: Check wallet balance
const balance = await client.getBalance();
console.log(`Balance: ${balance.balance} ${balance.symbol} (${balance.chain}/${balance.network})`);
// Step 2: Send tokens
const sendResult = await client.sendToken({
type: 'TRANSFER',
to: 'recipient-address',
amount: '0.001',
});
console.log(`Transaction submitted: ${sendResult.id} (status: ${sendResult.status})`);
// Step 3: Poll for confirmation
const POLL_TIMEOUT_MS = 60_000;
const startTime = Date.now();
while (Date.now() - startTime < POLL_TIMEOUT_MS) {
const tx = await client.getTransaction(sendResult.id);
if (tx.status === 'COMPLETED') {
console.log(`Transaction confirmed! Hash: ${tx.txHash}`);
break;
}
if (tx.status === 'FAILED') {
console.error(`Transaction failed: ${tx.error}`);
break;
}
await new Promise(resolve => setTimeout(resolve, 1000));
}
Error handling deserves a mention here. When a transaction is blocked by a policy, you get a structured error back — not a raw exception:
try {
const tx = await client.sendToken({ to: '...', amount: '1.0' });
} catch (error) {
if (error instanceof WAIaaSError) {
console.error(`API Error: [${error.code}] ${error.message}`);
// error.code examples: INSUFFICIENT_BALANCE, POLICY_DENIED, TOKEN_EXPIRED
}
}
A POLICY_DENIED error means your spending limit kicked in — which is exactly what you want if your agent goes off the rails. That's not a bug; that's the safety net working.
The Part Most Tutorials Skip: Spend Limits
Giving an AI agent access to a live wallet without guardrails is a bad idea. WAIaaS has a 21-type policy engine built for this exact problem, and it's worth spending two minutes setting it up before you fund your agent's wallet.
The most important policy is SPENDING_LIMIT. It maps transaction amounts to one of four security tiers:
- INSTANT — execute immediately, no notification
- NOTIFY — execute immediately, send you a notification
- DELAY — queue the transaction for N seconds (cancellable during the window)
- APPROVAL — require your explicit approval via WalletConnect or Telegram
curl -X POST http://127.0.0.1:3100/v1/policies \
-H "Content-Type: application/json" \
-H "X-Master-Password: my-secret-password" \
-d '{
"walletId": "<wallet-uuid>",
"type": "SPENDING_LIMIT",
"rules": {
"instant_max_usd": 100,
"notify_max_usd": 500,
"delay_max_usd": 2000,
"delay_seconds": 900,
"daily_limit_usd": 5000
}
}'
With this config: transactions under $100 go straight through, $100–$500 trigger a notification, $500–$2,000 are held for 15 minutes before executing (giving you time to cancel), and anything over $2,000 requires your explicit approval.
You can also use simulate-transaction (or the simulate_transaction MCP tool) to dry-run a transaction before it touches the blockchain:
curl -X POST http://127.0.0.1:3100/v1/transactions/send \
-H "Content-Type: application/json" \
-H "Authorization: Bearer wai_sess_<token>" \
-d '{
"type": "TRANSFER",
"to": "recipient-address",
"amount": "0.1",
"dryRun": true
}'
This is especially useful during development — your agent can simulate a transaction to see whether it would succeed and which policy tier it would hit, without actually spending anything.
DeFi Actions: 15 Protocols Ready to Go
The action-provider MCP tool and the /v1/actions/:provider/:action REST endpoint give your agent access to 15 integrated DeFi protocols: Aave v3, Across, D'CENT Swap, Drift, ERC-8004, Hyperliquid, Jito staking, Jupiter swap, Kamino, Lido staking, LI.FI, Pendle, Polymarket, XRPL DEX, and 0x swap.
Here's what a Jupiter swap looks like at the REST level — the same thing happens under the hood when Claude calls the action-provider MCP tool:
curl -X POST http://127.0.0.1:3100/v1/actions/jupiter-swap/swap \
-H "Content-Type: application/json" \
-H "Authorization: Bearer wai_sess_<token>" \
-d '{
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": "1000000000"
}'
The agent doesn't need to know how Jupiter's API works, handle slippage manually, or construct the transaction. It just says "swap" and WAIaaS handles the rest — including routing through the 7-stage transaction pipeline (validate → auth → policy → wait → execute → confirm) before anything hits the chain.
x402: Agents That Pay for Their Own API Calls
One of the more interesting capabilities is x402 support. The x402 HTTP payment protocol lets API providers charge per-request in crypto. With the x402-fetch MCP tool (or x402Fetch() in the SDK), your agent can call paid APIs automatically — no manual payment flow, no subscriptions, no API keys to manage.
The X402_ALLOWED_DOMAINS policy type controls which domains your agent is allowed to pay:
{"domains": ["api.example.com", "*.openai.com"]}
Without a matching entry, x402 payments to that domain are blocked. Again, default-deny.
What to Build Next
The infrastructure is the easy part. Once your agent has a wallet and spending limits, the interesting questions become: what decisions should it make autonomously, at what thresholds does a human need to be in the loop, and how do you audit what it did?
WAIaaS addresses the audit question through transaction history (all 7 transaction types — Transfer, TokenTransfer, ContractCall, Approve, Batch, NftTransfer, ContractDeploy — are logged), incoming transaction monitoring with real-time notifications, and the admin UI at /admin where you can review everything.
For the human-in-the-loop question, the DELAY and APPROVAL tiers in the policy engine, combined with WalletConnect integration for mobile approval, give you a practical answer without requiring you to build it yourself.
Quick Start Checklist
git clone https://github.com/waiaas/WAIaaS.git && docker compose up -d- Create a wallet:
waiaas quickset --mode mainnet(or use curl) - Set a spending limit policy before funding the wallet
- Add the MCP config to Claude Desktop
- Ask Claude to check the balance
That's it. The wallet is live, the tools are connected, and the policy engine is watching.
Star the project and read the full docs:
- GitHub: https://github.com/waiaas/WAIaaS
- Official site: https://waiaas.ai
The OpenAPI spec and interactive reference are available at http://127.0.0.1:3100/doc and `http://127.0.0.1:
Top comments (0)