StarkFiStarkFi

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:

  1. Node.js v18 or later
  2. StarkFi Auth Server running (required for authentication and signing)
  3. 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_status first 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

CategoryCountTools
Auth & Config2get_auth_status, config_action
Wallet6get_tx_status, get_balance, deploy_account, send_tokens, get_portfolio, rebalance_portfolio
Trade5get_swap_quote, swap_tokens, get_multi_swap_quote, multi_swap, batch_execute
Staking8list_validators, list_pools, get_staking_info, get_stake_status, stake_tokens, unstake_tokens, claim_rewards, compound_rewards
Lending10list_lending_pools, get_lending_position, supply_assets, withdraw_assets, borrow_assets, repay_debt, close_position, monitor_lending_position, auto_rebalance_lending, lending_quote_health
DCA4dca_preview, dca_create, dca_list, dca_cancel
Troves4list_troves_strategies, get_troves_position, troves_deposit, troves_withdraw
LST5get_lst_position, get_lst_stats, lst_stake, lst_redeem, lst_exit_all
Confidential7confidential_setup, confidential_balance, confidential_fund, confidential_transfer, confidential_withdraw, confidential_ragequit, confidential_rollover

How It Works

  1. StarkFi starts an MCP server via starkfi mcp-start
  2. The server uses StdioServerTransport for communication
  3. AI clients connect and discover all 51 tools with JSON schemas
  4. The AI sends tool calls, StarkFi executes them on Starknet
  5. Results are returned as structured JSON

All tools return consistent error responses with typed StarkfiError codes — see Error Handling.

Read-Only vs Transactional

Read-OnlyTransactional
Examplesget_balance, get_swap_quote, list_validatorsswap_tokens, send_tokens, stake_tokens
Side effectsNone — safe to call freelyMutates blockchain state
User confirmationNot neededAlways required before execution
SimulationN/ASet simulate: true to preview fees without executing

Agent Best Practices

  1. Always authenticate first — call get_auth_status before any operation
  2. Quote before executing — call get_swap_quote before swap_tokens, and get_multi_swap_quote before multi_swap
  3. Use simulation — set simulate: true on any transactional tool to preview fees
  4. Confirm with the user — never execute a transactional tool without explicit user confirmation
  5. Check existing positions — use get_stake_status, get_lending_position, get_troves_position, get_lst_position, and dca_list before creating new positions to avoid duplicates
  6. Confidential lifecycle — call confidential_setup and confidential_balance before transactional operations; remind users to confidential_rollover after receiving transfers
  7. Troves safety — always call list_troves_strategies to validate a strategy exists before depositing
  8. LST yield model — Endur LST yield is embedded in the share price. Do not call claim_rewards for LST positions — use lst_redeem or lst_exit_all instead

Starting the Server

starkfi mcp-start

Or 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
Edit on GitHub

Last updated on

On this page