Haiku DeFi MCP
OfficialHaiku DeFi MCP is a blockchain DeFi automation server that enables AI agents to discover tokens, check balances, get trading quotes, and execute on-chain transactions across 21+ blockchain networks (Ethereum, Arbitrum, Base, Polygon, Optimism, BNB Chain, Avalanche, Berachain, Sonic, and more).
Token Discovery (
haiku_get_tokens): List supported tokens and DeFi assets (vanilla tokens, Aave collateral/debt, yield vaults, Balancer/Uniswap LP positions) filtered by chain and category.Balance Checking (
haiku_get_balances): Retrieve wallet token balances across all supported chains with USD values, categorized positions, and optional partial refresh for specific chains after a swap.Trading Quotes (
haiku_get_quote): Get quotes for token swaps or portfolio rebalancing, including expected outputs, fees, gas estimates, and required approval/signing payloads.Signature Preparation (
haiku_prepare_signatures): Extract and normalize EIP-712 payloads (Permit2 and bridge intents) for external wallet signing via wallet MCPs like Coinbase, AgentKit, or Safe.Transaction Execution (
haiku_execute): Execute swaps in two modes — self-contained (signs and broadcasts automatically usingWALLET_PRIVATE_KEY) or external wallet mode (returns unsigned transaction for a wallet MCP to broadcast).Yield Discovery (
haiku_discover_yields): Find the highest-yielding DeFi opportunities across protocols and chains, filterable by APY, TVL, category (lending/vault/LP), and network.Portfolio Analysis (
haiku_analyze_portfolio): Analyze a wallet's current DeFi positions with enriched APY options, collateral health factors, and context-specific yield optimization opportunities.Flexible Integration: Works via stdio (Claude Desktop, Cursor) or Streamable HTTP (remote hosting, Smithery, web clients).
Allows external wallet signing via Coinbase MCP, with EIP-712 payloads and unsigned transactions for wallet-agent or AgentKit integration.
Provides tools for token discovery, balance checking, trading quotes, transaction building, and yield discovery across Ethereum and EVM-compatible chains via the Haiku API.
Haiku MCP Server
An MCP (Model Context Protocol) server that enables AI agents to execute blockchain transactions via the Haiku API.
Features
Token Discovery: List supported tokens and DeFi assets across 21 blockchain networks
Balance Checking: Get wallet balances across all supported chains
Trading Quotes: Get quotes for swaps and portfolio rebalancing
Transaction Building: Convert quotes to unsigned EVM transactions
Wallet Integration: Extract EIP-712 payloads for external wallet signing (Coinbase, AgentKit, Safe, etc.)
Self-Contained Execution: Optional end-to-end execution with WALLET_PRIVATE_KEY env var
Yield Discovery: Find the highest-yielding DeFi opportunities across protocols and chains, filtered by APY, TVL, and category
Portfolio Analysis: Analyze a wallet's holdings and surface context-specific yield opportunities based on what it actually holds
Related MCP server: maxia-mcp
Installation
npm install haiku-mcp-serverOr run directly with npx:
npx haiku-mcp-serverConfiguration
Environment Variables
Variable | Required | Description |
| No | Your Haiku API key for higher rate limits. Contact contact@haiku.trade to request one. |
| No | API base URL. Defaults to |
| No | Private key (0x hex) for self-contained execution via |
| No | Override RPC URL for a specific chain (e.g., |
Note: The API works without a key, but providing one unlocks higher rate limits for production use.
Claude Desktop Configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"haiku": {
"command": "npx",
"args": ["haiku-mcp-server"]
}
}
}With API key for higher rate limits:
{
"mcpServers": {
"haiku": {
"command": "npx",
"args": ["haiku-mcp-server"],
"env": {
"HAIKU_API_KEY": "your-api-key-here"
}
}
}
}Available Tools
haiku_get_tokens
Get supported tokens and DeFi assets for trading.
Parameters:
network(optional): Filter by chain ID (e.g., 42161 for Arbitrum)category(optional): Filter by token category:token- Vanilla tokens (ETH, USDC, etc.)collateral- eg. Aave aTokens (deposited collateral)varDebt- eg. Aave variable debt tokensvault- eg. Yearn/Morpho yield vaultsweightedLiquidity- eg. Balancer LP tokensconcentratedLiquidity- eg. Uniswap V3 LP positions
Example:
{
"network": 42161,
"category": "token"
}haiku_get_balances
Get token balances for a wallet address across all chains.
Parameters:
walletAddress(optional): Wallet address or ENS name. Required whenWALLET_PRIVATE_KEYis not set; omit to auto-derive fromWALLET_PRIVATE_KEYwhen it is set.
Example:
{
"walletAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}Omit walletAddress when WALLET_PRIVATE_KEY is set to use the derived address.
haiku_get_quote
Get a quote for a token swap or portfolio rebalance.
Note: Quotes are valid for 5 minutes, but execute as quickly as possible after quoting — the longer you wait, the more likely prices have moved and the transaction will fail on-chain.
Parameters:
inputPositions(required): Map of token IID to amount to spendtargetWeights(required): Map of output token IID to weight (must sum to 1)slippage(optional): Max slippage as decimal (default: 0.003)receiver: Receiving wallet address. Required whenWALLET_PRIVATE_KEYis not set — must be provided explicitly. WhenWALLET_PRIVATE_KEYis set, auto-derived if omitted. WhenWALLET_PRIVATE_KEYis not set (Path B), you must passreceiverexplicitly.
Example:
{
"inputPositions": {
"arb:0x82aF49447D8a07e3bd95BD0d56f35241523fBab1": "1.0"
},
"targetWeights": {
"arb:0xaf88d065e77c8cC2239327C5EDb3A432268e5831": 0.5,
"arb:0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9": 0.5
},
"slippage": 0.005
}Example above omits receiver (valid when WALLET_PRIVATE_KEY is set). For Path B, include "receiver": "0x...".
haiku_prepare_signatures
Extract and normalize EIP-712 signing payloads from a quote for external wallet signing (Path B only). When using quoteId, the quote must have been obtained in the same session.
Use this when a wallet MCP handles signing (Coinbase Payments MCP, wallet-agent, AgentKit, Safe, etc.). Returns standardized typed data that any wallet's signTypedData can consume, plus step-by-step instructions.
Parameters:
quoteId(preferred): Quote ID fromhaiku_get_quote— server resolves the full quote from session cache. QuoteId only works when the quote was returned byhaiku_get_quotein the same MCP session; otherwise usequoteResponse.quoteResponse(fallback): Full response object fromhaiku_get_quote, if quoteId is unavailable
Returns:
requiresPermit2: Whether Permit2 signature is neededpermit2: EIP-712 payload to pass tosignTypedData(if required)requiresBridgeSignature: Whether bridge signature is neededbridgeIntent: EIP-712 payload to pass tosignTypedData(if required)sourceChainId: Chain ID for the transactioninstructions: Step-by-step instructions for completing the flow
Example:
{
"quoteId": "abc123..."
}haiku_discover_yields
Discover yield-bearing opportunities across DeFi protocols, ranked by APY or TVL.
Use this to answer questions like "best lending yields on Arbitrum", "highest APY vaults
with at least $1M TVL", or "what can I do with USDC on Base". The iid field in results
can be used directly as a key in the targetWeights object in haiku_get_quote.
Parameters:
network(optional): Filter by chain ID (e.g., 42161 for Arbitrum)category(optional):lending(Aave collateral),vault(Yearn/Morpho),lp(Balancer/Uniswap),all(default)minApy(optional): Minimum APY as a percentage (e.g.,5means ≥5% APY)minTvl(optional): Minimum TVL in USD (e.g.,1000000means ≥$1M). Filters to established mainstream vaults.sortBy(optional):apy(default) ortvl, descendinglimit(optional): Max results (default 20)
Example:
{
"network": 42161,
"category": "lending",
"minTvl": 1000000,
"sortBy": "apy",
"limit": 10
}haiku_analyze_portfolio
Analyze a wallet's DeFi portfolio and surface relevant yield opportunities.
Returns current positions enriched with available APY options, collateral health factors,
and context-specific opportunities based on what the wallet actually holds. Pair with
haiku_discover_yields for broader market context, then use haiku_get_quote to execute.
Parameters:
walletAddress(required): Wallet address (0x...) to analyze
Example:
{
"walletAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}haiku_execute
Execute a quote. Two distinct paths depending on who holds the private key.
Path A — Self-contained (WALLET_PRIVATE_KEY set in env): Haiku signs Permit2/bridge payloads internally and broadcasts. Returns a tx hash.
Parameters:
quoteId(required): Quote ID fromhaiku_get_quotesourceChainId(recommended): Chain ID from the quote response. Omit only if the quote was obtained in the same session — the server can recover from cache.permit2SigningPayload(optional): Pass through fromhaiku_get_quoteif presentbridgeSigningPayload(optional): Pass through fromhaiku_get_quoteif present (cross-chain only)approvals(optional): Pass through fromhaiku_get_quoteif present
Example:
{
"quoteId": "abc123...",
"sourceChainId": 42161,
"permit2SigningPayload": { /* from haiku_get_quote, if present */ },
"approvals": [ /* from haiku_get_quote, if present */ ]
}Path B — External wallet (no WALLET_PRIVATE_KEY, using a wallet MCP): You sign and broadcast. broadcast: false is required — without WALLET_PRIVATE_KEY, haiku cannot sign or send the final EVM transaction. If you call haiku_execute with broadcast: true and no WALLET_PRIVATE_KEY, the server returns an error directing you to set broadcast: false and broadcast the returned transaction via your wallet MCP.
Before calling haiku_execute:
If
approvalsis non-empty in the quote: broadcast each approval as a transaction{ to, data, value }(includevaluewhen present, e.g. for native token) via your wallet MCP and wait for confirmation.If signatures are required: call
haiku_prepare_signatureswith the quoteId, sign the returned EIP-712 payloads via your wallet MCP, then pass the signatures here.
Parameters:
quoteId(required): Quote ID fromhaiku_get_quotesourceChainId(recommended): Chain ID from the quote response. Omit only if the quote was obtained in the same session — the server can recover from cache.broadcast(required): Must befalse— haiku returns the unsigned tx for you to broadcastpermit2Signature(optional): Signature from signing the Permit2 payload via your wallet MCPuserSignature(optional): Signature from signing the bridge payload via your wallet MCP (cross-chain only)
Example:
{
"quoteId": "abc123...",
"sourceChainId": 42161,
"broadcast": false,
"permit2Signature": "0x..."
}Returns { transaction: { to, data, value, chainId } } — pass transaction to your wallet MCP's sendTransaction.
Token IID Format
Tokens are identified using the IID format: chainSlug:tokenAddress
Examples:
arb:0x82aF49447D8a07e3bd95BD0d56f35241523fBab1- WETH on Arbitrumarb:0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee- Native ETH on Arbitrumbase:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913- USDC on Base
Supported Chains
Chain | Chain ID | Slug |
Arbitrum | 42161 | arb |
Avalanche | 43114 | avax |
Base | 8453 | base |
Berachain | 80094 | bera |
BNB Smart Chain | 56 | bsc |
Bob | 60808 | bob |
Ethereum | 1 | eth |
Gnosis | 100 | gnosis |
Hyperliquid | 999 | hype |
Katana | 747474 | katana |
Lisk | 1135 | lisk |
MegaETH | 4326 | megaeth |
Monad | 143 | monad |
Optimism | 10 | opt |
Plasma | 9745 | plasma |
Polygon | 137 | poly |
Scroll | 534352 | scroll |
Sei | 1329 | sei |
Sonic | 146 | sonic |
Unichain | 130 | uni |
World Chain | 480 | worldchain |
ApeChain | 33139 | ape |
Workflow Examples
Path A: Self-Contained Swap (WALLET_PRIVATE_KEY set)
Haiku handles all signing and broadcasting. Returns a tx hash.
1. haiku_get_quote(inputPositions, targetWeights) → returns quoteId, sourceChainId, permit2SigningPayload?, bridgeSigningPayload?, approvals
2. haiku_execute(quoteId, sourceChainId, permit2SigningPayload?, bridgeSigningPayload?, approvals)
→ Haiku broadcasts approvals, signs Permit2/bridge internally, broadcasts swap, returns tx hashPath B: External Wallet (wallet MCP handles signing + broadcasting)
Use when WALLET_PRIVATE_KEY is not set and a separate wallet MCP holds the keys.
Simple swap (no Permit2 or bridge signatures needed, e.g. native ETH input):
1. haiku_get_quote(inputPositions, targetWeights, receiver) → returns quoteId, sourceChainId, approvals
2. For each item in approvals: broadcast as transaction { to, data, value } (include value when present) via wallet MCP and wait for confirmation
3. haiku_execute(quoteId, sourceChainId, broadcast: false)
→ returns { transaction: { to, data, value, chainId } }
4. Broadcast transaction via wallet MCPWith Permit2 or bridge signatures (e.g. ERC-20 input or cross-chain swap):
1. haiku_get_quote(inputPositions, targetWeights, receiver) → returns quoteId, sourceChainId, approvals, permit2SigningPayload?, bridgeSigningPayload?
2. For each item in approvals: broadcast as transaction { to, data, value } (include value when present) via wallet MCP and wait for confirmation
3. haiku_prepare_signatures(quoteId) → returns normalized EIP-712 payloads + step-by-step instructions
4. Sign payloads via wallet MCP (e.g. coinbase_sign_typed_data) → get permit2Signature?, userSignature?
5. haiku_execute(quoteId, sourceChainId, permit2Signature?, userSignature?, broadcast: false)
→ returns { transaction: { to, data, value, chainId } }
6. Broadcast transaction via wallet MCP (e.g. coinbase_send_transaction)Yield Discovery
1. haiku_discover_yields with category/network/minTvl filters → find opportunities, note iid
2. haiku_get_quote with the chosen iid as a key in targetWeights
3. Execute via Path A or Path B abovePortfolio Analysis & Optimization
1. haiku_analyze_portfolio with wallet address → review positions and opportunities
2. Optionally haiku_discover_yields for broader market context
3. haiku_get_quote to rebalance into higher-yielding positions
4. Execute via Path A or Path B aboveTransaction Signing
Two modes depending on your setup:
Self-contained (WALLET_PRIVATE_KEY set): haiku_execute signs everything internally and broadcasts. Returns a tx hash. No external signing needed.
External wallet (no WALLET_PRIVATE_KEY): Use haiku_execute with broadcast: false (required — haiku cannot sign or broadcast without the private key). If you call haiku_execute with broadcast: true and no WALLET_PRIVATE_KEY, the server returns an error directing you to set broadcast: false and broadcast the returned transaction via your wallet MCP. Returns { transaction: { to, data, value, chainId } } for your wallet MCP to broadcast. If Permit2 or bridge signatures are required, call haiku_prepare_signatures first. If approvals are present in the quote, broadcast each approval { to, data, value } (include value when present, e.g. for native token) via your wallet MCP before calling haiku_execute.
The external wallet design allows agents to use any signing infrastructure (wallet MCPs, hardware wallets, custodial services, MPC, etc.).
Cross-Chain Bridge Signatures
For cross-chain swaps, the quote may return isComplexBridge: true, indicating a bridge intent signature is required in addition to (or instead of) Permit2.
Self-contained (Path A): Pass bridgeSigningPayload from the quote to haiku_execute — it handles the bridge signature internally.
External wallet (Path B): Call haiku_prepare_signatures with the quoteId — it returns a normalized bridgeIntent EIP-712 payload. Sign it via your wallet MCP and pass the result as userSignature to haiku_execute.
Transport Modes
Stdio (default)
Standard MCP stdio transport — used by Claude Desktop, Cursor, etc.
npx haiku-mcp-serverStreamable HTTP
HTTP transport for remote hosting, Smithery, and web-based MCP clients.
npx haiku-mcp-server --http
npx haiku-mcp-server --http --port=8080Endpoints:
POST /mcp— MCP Streamable HTTP endpointGET /health— Health check
Development
# Install dependencies
npm install
# Build
npm run build
# Run locally (stdio, works without API key)
npm start
# Run locally (HTTP)
npm run start:http
# Run with API key for higher rate limits
HAIKU_API_KEY=your-key npm startLicense
MIT
Available Tools
7 toolshaiku_analyze_portfolioA
Analyze a wallet's DeFi portfolio and surface relevant yield opportunities. Returns current positions enriched with available APY options, collateral health factors, and context-specific opportunities based on what the wallet actually holds. Use this when a user asks what they should do with their portfolio or wants yield optimization advice. Pair the output with haiku_discover_yields for broader market context, then use haiku_get_quote to execute.
Inputs: walletAddress (required).
haiku_discover_yieldsA
Discover yield-bearing opportunities across DeFi protocols. Returns APY, TVL, risk parameters, and token IIDs ready for haiku_get_quote. Use this to answer questions like 'best lending yields on Arbitrum', 'highest APY vaults with at least $1M TVL', or 'what can I do with USDC on BNB Chain'. The iid field in results can be used directly as a targetWeight key in haiku_get_quote.
Inputs: network, category, minApy, minTvl, +2 more.
haiku_executeA
Execute a quote. Call haiku_get_quote first, then choose a path: • Path A — Self-contained (WALLET_PRIVATE_KEY set): pass quoteId, sourceChainId, permit2SigningPayload + bridgeSigningPayload (if present in the quote), and approvals. Haiku signs Permit2/bridge internally, sends any approvals on-chain, and broadcasts. Returns tx hash. • Path B — External wallet (no WALLET_PRIVATE_KEY): broadcast: false is required. First broadcast any approvals from the quote via your wallet MCP (each is a {to, data} transaction). Then call haiku_prepare_signatures if signatures are needed → sign via wallet MCP → call haiku_execute with quoteId, sourceChainId, the signatures, and broadcast: false. Returns { transaction: { to, data, value, chainId } } — broadcast transaction via your wallet MCP. Always pass sourceChainId from the quote response.
Inputs: quoteId (required), permit2SigningPayload, bridgeSigningPayload, permit2Signature, +4 more.
haiku_get_balancesA
Get token balances for a wallet address. By default fetches across all supported chains. Pass chainIds for a partial refresh — only the specified chains are queried, which is faster and useful after a swap when you only need updated balances for the source and destination chains. Returns balances, USD prices, total portfolio value, and categorized positions (tokens, collateral, debt, vaults). walletAddress is optional when WALLET_PRIVATE_KEY is set in the environment.
Inputs: walletAddress, chainIds.
haiku_get_quoteA
Get a quote for a token swap or portfolio rebalance. Returns expected outputs, fees, gas estimates, and any required approvals. When signatures are required (Permit2 or bridge), EIP-712 signing payloads are included in the response. Two execution paths after getting a quote: • Path A — Self-contained (WALLET_PRIVATE_KEY set): call haiku_execute with quoteId, sourceChainId, permit2SigningPayload + bridgeSigningPayload (if present in this response), and approvals. Haiku signs and broadcasts automatically — returns tx hash. • Path B — External wallet (wallet MCP, broadcast: false required): (1) broadcast any approvals {to, data} via wallet MCP first; (2) call haiku_prepare_signatures with quoteId if signatures are needed → sign via wallet MCP; (3) call haiku_execute with quoteId, sourceChainId, signatures, and broadcast: false → returns { transaction: { to, data, value, chainId } } → broadcast transaction via wallet MCP.
Inputs: inputPositions (required), targetWeights (required), slippage, receiver.
haiku_get_tokensA
Get supported tokens and DeFi positions for trading. Includes vanilla tokens, Aave collateral/debt, yield vaults, and LP tokens. Use category filter to narrow results (e.g., 'collateral' for Aave aTokens). Returns token IIDs (unique identifiers), symbols, names, prices, and chain information. Use the IID format (chainSlug:tokenAddress) when specifying tokens in other tools.
Inputs: network, category.
haiku_prepare_signaturesA
External wallet signing path — use this instead of passing signing payloads directly to haiku_execute when WALLET_PRIVATE_KEY is not set or when a wallet MCP (Coinbase Payments MCP, wallet-agent, etc.) handles signing. Extracts and normalizes the EIP-712 payloads from a quote into a standard format any wallet's signTypedData can consume. Pass quoteId (preferred) — the server resolves the full quote from session cache. Alternatively pass the full quoteResponse object if quoteId is unavailable. After signing externally, pass permit2Signature and/or userSignature to haiku_execute.
Inputs: quoteId, quoteResponse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Tools have mostly distinct purposes: portfolio analysis, yield discovery, token queries, balance checking, quoting, execution, and signature preparation. However, haiku_execute and haiku_prepare_signatures have overlapping concerns around execution paths, which could cause some confusion.
All tools follow a consistent haiku_verb_noun pattern (analyze_portfolio, discover_yields, execute, get_balances, get_quote, get_tokens, prepare_signatures). The naming is predictable and intuitive.
Seven tools is an appropriate number for a DeFi MCP server covering portfolio analysis, yield discovery, quoting, execution, and token/balance queries. Each tool serves a clear purpose without unnecessary bloat.
The tool set covers the full lifecycle of DeFi interactions: discovery (haiku_discover_yields, haiku_get_tokens), analysis (haiku_analyze_portfolio, haiku_get_balances), quoting (haiku_get_quote), and execution (haiku_execute, haiku_prepare_signatures). No obvious gaps for typical DeFi workflows.
Maintenance
Related MCP Connectors
MCP server connecting AI agents to non-custodial staking data across 130+ networks.
Pay-per-call DeFi and macro intel for AI agents. x402 USDC tools via streamable HTTP /api/mcp.
Agent MCP for DeFi: cross-chain LINQ fan-out, AMM quotes/swaps, bridge, AI. Solana+EVM. Free+x402.
Trading tools for AI agents: token risk checks, swap quotes, unsigned swaps, holdings on 5 chains.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA comprehensive MCP server providing unified access to over 144 tools for lending, trading, and staking across six major DeFi protocols on the Stacks Bitcoin Layer 2. It enables AI agents to perform complex blockchain operations and interact with the DeFi ecosystem using natural language commands.3MIT
- AlicenseNot gradedqualityDmaintenanceAI-to-AI marketplace MCP server with 46 tools — swap 65+ crypto tokens on 7 chains, rent GPUs, trade 25 tokenized stocks, on-chain escrow (Solana + Base), DeFi yields, sentiment analysis, wallet monitoring, and image generation. Supports USDC payments across 14 blockchains.MIT
- AlicenseAqualityDmaintenanceMCP server providing AI agents with native access to Jupiter's full DeFi stack on Solana. It offers 17 tools covering swaps, tokens, lending, limit orders, DCA, prediction markets, perpetuals, and portfolio management.16MIT
- AlicenseAqualityCmaintenanceCross-chain DeFi intelligence MCP server for AI agents. 7 tools for yield discovery, pool analysis, profit simulation, risk scoring, whale tracking, impermanent loss calculation, and DeFi overview across 86 chains and 6,500+ liquidity pools.71AGPL 3.0