Haiku DeFi MCP

io.github.Haiku-Trading由 GitHub 帳號 Haiku-Trading 發布v0.0.8更新於 Oct 25, 2026

DeFi execution for AI agents — swap, lend, bridge, and yield across 22 chains.

已驗證STDIO僅桌面金融開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,讓 AI 助理透過 Haiku API 在 22 條 EVM 鏈上取得報價、簽署並執行 DeFi 兌換、跨鏈橋與收益操作。

可以做什麼
依鏈或類別查詢支援的代幣與 DeFi 資產,讀取跨鏈錢包餘額,並分析錢包的 DeFi 持倉、收益選項與抵押健康度。依 APY 或 TVL 排序尋找收益機會,可依網路、類別、最低 APY 與最低 TVL 篩選。取得兌換或投資組合再平衡報價,可設定滑價與目標權重。擷取 EIP-712 的 Permit2 與跨鏈橋簽署酬載,交由外部錢包簽署。執行報價:可用私鑰自行完成簽署與廣播,或回傳未簽署交易交由其他錢包工具廣播。
適用情境
當助理需要協助鏈上 DeFi 作業時使用:查詢餘額、比較收益、再平衡投資組合,或在支援的 EVM 網路上準備並執行兌換與跨鏈橋。
執行需求
透過 npx 在本機執行,需要 Node.js,使用 stdio 或選用的 HTTP 模式。需要連線至 Haiku API 的網路。選用的 HAIKU_API_KEY 可提高速率限制;選用的 WALLET_PRIVATE_KEY 可啟用自行執行;選用的 RPC_URL_{chainId} 可覆寫各鏈 RPC 位址。未設定私鑰時,須提供錢包位址與接收位址,並由另一個錢包工具負責簽署與廣播。
安裝前請注意
WALLET_PRIVATE_KEY 是原始私鑰,伺服器可據此自行簽署並廣播交易,一旦外洩資金即有風險,建議優先採用外部錢包方式。報價約五分鐘內有效,價格變動可能導致鏈上交易失敗。執行會動用真實資金,且可能需要先送出授權交易。錢包位址與報價會傳送至 Haiku API。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Haiku DeFi MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Haiku MCP Server

An MCP (Model Context Protocol) server that enables AI agents to execute blockchain transactions via the Haiku API.

[npm version] [GitHub]

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

Installation

bash
npm install haiku-mcp-server

Or run directly with npx:

bash
npx haiku-mcp-server

Configuration

Environment Variables

VariableRequiredDescription
HAIKU_API_KEYNoYour Haiku API key for higher rate limits. Contact [email protected] to request one.
HAIKU_BASE_URLNoAPI base URL. Defaults to https://api.haiku.trade/v1
WALLET_PRIVATE_KEYNoPrivate key (0x hex) for self-contained execution via haiku_execute.
RPC_URL_{chainId}NoOverride RPC URL for a specific chain (e.g., RPC_URL_42161 for Arbitrum).

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:

json
{  "mcpServers": {    "haiku": {      "command": "npx",      "args": ["haiku-mcp-server"]    }  }}

With API key for higher rate limits:

json
{  "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 tokens
    • vault - eg. Yearn/Morpho yield vaults
    • weightedLiquidity - eg. Balancer LP tokens
    • concentratedLiquidity - eg. Uniswap V3 LP positions

Example:

json
{  "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 when WALLET_PRIVATE_KEY is not set; omit to auto-derive from WALLET_PRIVATE_KEY when it is set.

Example:

json
{  "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 spend
  • targetWeights (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 when WALLET_PRIVATE_KEY is not set — must be provided explicitly. When WALLET_PRIVATE_KEY is set, auto-derived if omitted. When WALLET_PRIVATE_KEY is not set (Path B), you must pass receiver explicitly.

Example:

json
{  "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 from haiku_get_quote — server resolves the full quote from session cache. QuoteId only works when the quote was returned by haiku_get_quote in the same MCP session; otherwise use quoteResponse.
  • quoteResponse (fallback): Full response object from haiku_get_quote, if quoteId is unavailable

Returns:

  • requiresPermit2: Whether Permit2 signature is needed
  • permit2: EIP-712 payload to pass to signTypedData (if required)
  • requiresBridgeSignature: Whether bridge signature is needed
  • bridgeIntent: EIP-712 payload to pass to signTypedData (if required)
  • sourceChainId: Chain ID for the transaction
  • instructions: Step-by-step instructions for completing the flow

Example:

json
{  "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., 5 means ≥5% APY)
  • minTvl (optional): Minimum TVL in USD (e.g., 1000000 means ≥$1M). Filters to established mainstream vaults.
  • sortBy (optional): apy (default) or tvl, descending
  • limit (optional): Max results (default 20)

Example:

json
{  "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:

json
{  "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 from haiku_get_quote
  • sourceChainId (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 from haiku_get_quote if present
  • bridgeSigningPayload (optional): Pass through from haiku_get_quote if present (cross-chain only)
  • approvals (optional): Pass through from haiku_get_quote if present

Example:

json
{  "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:

  1. If approvals is non-empty in the quote: broadcast each approval as a transaction { to, data, value } (include value when present, e.g. for native token) via your wallet MCP and wait for confirmation.
  2. If signatures are required: call haiku_prepare_signatures with the quoteId, sign the returned EIP-712 payloads via your wallet MCP, then pass the signatures here.

Parameters:

  • quoteId (required): Quote ID from haiku_get_quote
  • sourceChainId (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 be false — haiku returns the unsigned tx for you to broadcast
  • permit2Signature (optional): Signature from signing the Permit2 payload via your wallet MCP
  • userSignature (optional): Signature from signing the bridge payload via your wallet MCP (cross-chain only)

Example:

json
{  "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 Arbitrum
  • arb:0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee - Native ETH on Arbitrum
  • base:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 - USDC on Base

Supported Chains

ChainChain IDSlug
Arbitrum42161arb
Avalanche43114avax
Base8453base
Berachain80094bera
BNB Smart Chain56bsc
Bob60808bob
Ethereum1eth
Gnosis100gnosis
Hyperliquid999hype
Katana747474katana
Lisk1135lisk
MegaETH4326megaeth
Monad143monad
Optimism10opt
Plasma9745plasma
Polygon137poly
Scroll534352scroll
Sei1329sei
Sonic146sonic
Unichain130uni
World Chain480worldchain
ApeChain33139ape

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?, approvals2. haiku_execute(quoteId, sourceChainId, permit2SigningPayload?, bridgeSigningPayload?, approvals)   → Haiku broadcasts approvals, signs Permit2/bridge internally, broadcasts swap, returns tx hash

Path 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, approvals2. For each item in approvals: broadcast as transaction { to, data, value } (include value when present) via wallet MCP and wait for confirmation3. haiku_execute(quoteId, sourceChainId, broadcast: false)   → returns { transaction: { to, data, value, chainId } }4. Broadcast transaction via wallet MCP

With 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 confirmation3. haiku_prepare_signatures(quoteId) → returns normalized EIP-712 payloads + step-by-step instructions4. 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 iid2. haiku_get_quote with the chosen iid as a key in targetWeights3. Execute via Path A or Path B above

Portfolio Analysis & Optimization

1. haiku_analyze_portfolio with wallet address → review positions and opportunities2. Optionally haiku_discover_yields for broader market context3. haiku_get_quote to rebalance into higher-yielding positions4. Execute via Path A or Path B above

Transaction 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.

bash
npx haiku-mcp-server

Streamable HTTP

HTTP transport for remote hosting, Smithery, and web-based MCP clients.

bash
npx haiku-mcp-server --httpnpx haiku-mcp-server --http --port=8080

Endpoints:

  • POST /mcp — MCP Streamable HTTP endpoint
  • GET /health — Health check

Development

bash
# Install dependenciesnpm install
# Buildnpm 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 limitsHAIKU_API_KEY=your-key npm start

License

MIT

來源:README.md,提交 f751bb5

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.0.8最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分