MCP Server
51 MCP tools for AI-native Starknet DeFi automation
What is MCP?
The Model Context Protocol (MCP) is an open standard that enables AI assistants (like Claude, Cursor, Windsurf, Antigravity) to interact with external tools. StarkFi runs as an MCP server, exposing every DeFi feature as a typed tool with Zod-validated schemas.
Prerequisites
Before using StarkFi MCP tools:
- Node.js v18 or later
- StarkFi Auth Server running (required for authentication and signing)
- Authentication — run
npx starkfi@latest auth login <email>and verify with the OTP before the MCP server can execute transactions
Important: The MCP server requires an active authenticated session. Always call
get_auth_statusfirst to verify the session is active before attempting any wallet operations.
Getting Started
1. Configure your AI client → See Setup
2. get_auth_status → Verify session is active
3. Read-only tools → Query balances, quotes, positions (safe, no confirmation needed)
4. Transactional tools → Execute swaps, sends, staking (requires user confirmation)Tool Categories
| Category | Count | Tools |
|---|---|---|
| Auth & Config | 2 | get_auth_status, config_action |
| Wallet | 6 | get_tx_status, get_balance, deploy_account, send_tokens, get_portfolio, rebalance_portfolio |
| Trade | 5 | get_swap_quote, swap_tokens, get_multi_swap_quote, multi_swap, batch_execute |
| Staking | 8 | list_validators, list_pools, get_staking_info, get_stake_status, stake_tokens, unstake_tokens, claim_rewards, compound_rewards |
| Lending | 10 | list_lending_pools, get_lending_position, supply_assets, withdraw_assets, borrow_assets, repay_debt, close_position, monitor_lending_position, auto_rebalance_lending, lending_quote_health |
| DCA | 4 | dca_preview, dca_create, dca_list, dca_cancel |
| Troves | 4 | list_troves_strategies, get_troves_position, troves_deposit, troves_withdraw |
| LST | 5 | get_lst_position, get_lst_stats, lst_stake, lst_redeem, lst_exit_all |
| Confidential | 7 | confidential_setup, confidential_balance, confidential_fund, confidential_transfer, confidential_withdraw, confidential_ragequit, confidential_rollover |
How It Works
- StarkFi starts an MCP server via
starkfi mcp-start - The server uses
StdioServerTransportfor communication - AI clients connect and discover all 51 tools with JSON schemas
- The AI sends tool calls, StarkFi executes them on Starknet
- Results are returned as structured JSON
All tools return consistent error responses with typed StarkfiError codes — see Error Handling.
Read-Only vs Transactional
| Read-Only | Transactional | |
|---|---|---|
| Examples | get_balance, get_swap_quote, list_validators | swap_tokens, send_tokens, stake_tokens |
| Side effects | None — safe to call freely | Mutates blockchain state |
| User confirmation | Not needed | Always required before execution |
| Simulation | N/A | Set simulate: true to preview fees without executing |
Agent Best Practices
- Always authenticate first — call
get_auth_statusbefore any operation - Quote before executing — call
get_swap_quotebeforeswap_tokens, andget_multi_swap_quotebeforemulti_swap - Use simulation — set
simulate: trueon any transactional tool to preview fees - Confirm with the user — never execute a transactional tool without explicit user confirmation
- Check existing positions — use
get_stake_status,get_lending_position,get_troves_position,get_lst_position, anddca_listbefore creating new positions to avoid duplicates - Confidential lifecycle — call
confidential_setupandconfidential_balancebefore transactional operations; remind users toconfidential_rolloverafter receiving transfers - Troves safety — always call
list_troves_strategiesto validate a strategy exists before depositing - LST yield model — Endur LST yield is embedded in the share price. Do not call
claim_rewardsfor LST positions — uselst_redeemorlst_exit_allinstead
Starting the Server
starkfi mcp-startOr configure it as an MCP server in your AI client's config — see Setup.
See Also
- MCP Setup — Configure Claude Desktop, Cursor, and Antigravity
- Agent Skills — Pre-packaged multi-step workflows (complementary to MCP tools)
- Security Architecture — MCP security model, tool hints, and sandboxing
Last updated on