A CLI and MCP server that give developers and AI agents access to Starknet DeFi (swaps, staking, lending, DCA, vaults and more), built on the Starkzap SDK.
npx starkfi@latest --help
Why StarkFi?
Most DeFi tools are built for humans clicking buttons. StarkFi is built for agents.
- π€ 51 MCP tools β Any AI assistant (Cursor, Claude, Antigravity) can execute DeFi operations autonomously
- β‘ Atomic Batching β Combine swap + stake + lend + send into a single multicall transaction
- πΈ Gas Abstraction β Pay gas in STRK, ETH, USDC, USDT, or DAI β or let the developer sponsor gas entirely
- π Confidential Transfers β Privacy-preserving transfers via Tongo Cash (ZK proofs)
- π DCA β Recurring buy orders via AVNU and Ekubo
- π§ͺ Simulate Everything β Dry-run any transaction before broadcasting
- π¬ Telegram Bot β Chat-based DeFi via natural language with BYOAI model (separate repository)
The hosted auth server is offline. Login, transaction signing and gas sponsorship go through the StarkFi auth server in
server/, which holds the Privy credentials. The CLI defaults to the hosted instance athttps://starkfi-production.up.railway.app, which is currently offline (it answers404 Application not found), soauth loginand every transaction need an auth server you run yourself, selected withSTARKFI_API_URL. See Self-hosting the auth server.
Quick Start
# 0. Point the CLI at your auth server (see "Self-hosting the auth server" below)
export STARKFI_API_URL=http://localhost:3001
# 1. Authenticate
npx starkfi@latest auth login user@example.com
npx starkfi@latest auth verify user@example.com <OTP_CODE>
# 2. Check balance
npx starkfi@latest balance
# 3. Swap tokens
npx starkfi@latest trade 100 USDC ETH --simulate # Preview
npx starkfi@latest trade 100 USDC ETH # Execute
# 4. View portfolio
npx starkfi@latest portfolio
Self-hosting the auth server
You need Node.js 22.12+, pnpm, and a Privy app with email login enabled (its App ID and App secret).
git clone https://github.com/ahmetenesdur/starkfi.git
cd starkfi/server
pnpm install
cp .env.example .env # set PRIVY_APP_ID, PRIVY_APP_SECRET and JWT_SECRET (openssl rand -base64 32)
pnpm dev # http://localhost:3001; check it with: curl http://localhost:3001/health
Then export STARKFI_API_URL=http://localhost:3001 in the shell where you log in. The session records that server, and every later command, including the MCP server, signs and sponsors transactions through it, so keep it running; log in again after switching servers. Gasfree (sponsored) mode also needs AVNU_API_KEY on the server. Details: Auth Server Β· Self-hosting guide.
What You Can Do
| Feature | CLI Example | Docs |
|---|---|---|
| Swap | trade 100 USDC ETH --provider auto | Trading |
| Multi-Swap | multi-swap "100 USDC>ETH, 50 DAI>STRK" | Trading |
| Batch | batch --swap "0.1 ETH USDC" --stake "50 STRK karnot" | Batch |
| Stake | stake 100 -v karnot | Staking |
| Lend | lend-supply 100 -p Prime -t USDC | Lending |
| DCA | dca-create 1000 USDC ETH --per-cycle 10 --frequency P1D | DCA |
| Troves Vaults | troves-deposit 100 evergreen_strk | Troves |
| LST Staking | lst-stake 100 | LST |
| Confidential | conf-fund 100 --token USDC | Confidential |
| Portfolio | portfolio-rebalance --target "50 ETH, 30 USDC, 20 STRK" | Portfolio |
| Gas Modes | config set-gasfree on / config set-gas-token USDC | Configuration |
β Full CLI Reference (50 commands)
AI Integration
MCP Server (51 Tools)
npx starkfi@latest mcp-start
Add to your AI client config (Cursor, Claude Desktop, Antigravity):
{
"mcpServers": {
"starkfi": {
"command": "npx",
"args": ["-y", "starkfi@latest", "mcp-start"]
}
}
}
| Category | Tools | Count |
|---|---|---|
| Auth & Config | get_auth_status, config_action | 2 |
| Wallet | get_balance, get_portfolio, deploy_account, send_tokens, get_tx_status, rebalance_portfolio | 6 |
| Trade | get_swap_quote, swap_tokens, get_multi_swap_quote, multi_swap, batch_execute | 5 |
| Staking | list_validators, list_pools, get_staking_info, get_stake_status, stake_tokens, unstake_tokens, claim_rewards, compound_rewards | 8 |
| Lending | 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 | 10 |
| DCA | dca_preview, dca_create, dca_list, dca_cancel | 4 |
| Confidential | confidential_setup, confidential_balance, confidential_fund, confidential_transfer, confidential_withdraw, confidential_ragequit, confidential_rollover | 7 |
| Troves Vaults | list_troves_strategies, get_troves_position, troves_deposit, troves_withdraw | 4 |
| LST Staking | get_lst_position, get_lst_stats, lst_stake, lst_redeem, lst_exit_all | 5 |
β Full MCP Documentation Β· Tool Schemas (MCP.md)
Agent Skills (14 Workflows)
npx skills add ahmetenesdur/starkfi
Pre-packaged multi-step workflows for AI coding assistants β authenticate, swap, stake, lend, DCA, batch, and more.
Telegram Bot
Chat-based DeFi via natural language with BYOAI model (OpenAI, Claude, Gemini).
β Bot Setup Β· Repository
Architecture
src/
βββ commands/ # 14 command groups (50 commands)
βββ services/ # 17 service modules
βββ mcp/ # MCP server (51 tools, stdio transport)
βββ lib/ # 15 shared utilities
skills/ # 14 agent skills
server/ # Auth server (Hono + Privy TEE)
docs/ # Documentation site (Fumadocs)
β Architecture Deep Dive Β· Security Model
Starkzap Modules
StarkFi leverages all core Starkzap v3 modules:
| Module | Usage |
|---|---|
| Wallets | OnboardStrategy.Privy + argentXV050 for email-based wallet onboarding |
| Paymaster | Gas abstraction with v3 { type: "paymaster", gasToken } union |
| Staking | Multi-token lifecycle (STRK, WBTC, tBTC, SolvBTC, LBTC) |
| DCA | Recurring buy orders via AVNU and Ekubo |
| TxBuilder | Atomic multicall batching (swap + stake + lend + send + DCA + troves) |
| Confidential | Privacy-preserving transfers via Tongo Cash (ZK proofs) |
| Troves | DeFi vault strategies β deposit/withdraw into yield-bearing vaults |
| Endur LST | Liquid staking (STRK β xSTRK) β yield embedded in share price |
| ERC-20 | Token presets, balance queries, transfers, approvals |
Development
Requires Node.js 22+ and pnpm.
git clone https://github.com/ahmetenesdur/starkfi.git
cd starkfi
pnpm install
pnpm build # Bundle the CLI β dist/
pnpm dev -- --help # Run from source with tsx
pnpm typecheck # tsc --noEmit
pnpm lint # ESLint
pnpm test # Vitest
pnpm format # Prettier
Auth Server
cd server && pnpm install && cp .env.example .env && pnpm dev
pnpm typecheck && pnpm lint && pnpm test # same checks as CI
Contributing
- Fork the repository and create a feature branch
- Install dependencies:
pnpm install - Verify:
pnpm typecheck && pnpm lint && pnpm test && pnpm build(and the same inserver/if you touched it) - Submit a pull request with a clear description
For bugs and feature requests, open an issue.
License
MIT β ahmetenesdur