Starkfi README

The full upstream README, mirrored for reference. Install config, tool schemas, adoption signals and our own overview live on the Starkfi listing page.

StarkFi β€” The AI-native DeFi toolkit for Starknet

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.

CI npm version npm downloads Documentation

Terminal
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 at https://starkfi-production.up.railway.app, which is currently offline (it answers 404 Application not found), so auth login and every transaction need an auth server you run yourself, selected with STARKFI_API_URL. See Self-hosting the auth server.


Quick Start

server.ts
# 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

β†’ Full Quick Start Guide

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

bash
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

FeatureCLI ExampleDocs
Swaptrade 100 USDC ETH --provider autoTrading
Multi-Swapmulti-swap "100 USDC>ETH, 50 DAI>STRK"Trading
Batchbatch --swap "0.1 ETH USDC" --stake "50 STRK karnot"Batch
Stakestake 100 -v karnotStaking
Lendlend-supply 100 -p Prime -t USDCLending
DCAdca-create 1000 USDC ETH --per-cycle 10 --frequency P1DDCA
Troves Vaultstroves-deposit 100 evergreen_strkTroves
LST Stakinglst-stake 100LST
Confidentialconf-fund 100 --token USDCConfidential
Portfolioportfolio-rebalance --target "50 ETH, 30 USDC, 20 STRK"Portfolio
Gas Modesconfig set-gasfree on / config set-gas-token USDCConfiguration

β†’ Full CLI Reference (50 commands)


AI Integration

MCP Server (51 Tools)

Terminal
npx starkfi@latest mcp-start

Add to your AI client config (Cursor, Claude Desktop, Antigravity):

config.json
{
  "mcpServers": {
    "starkfi": {
      "command": "npx",
      "args": ["-y", "starkfi@latest", "mcp-start"]
    }
  }
}
CategoryToolsCount
Auth & Configget_auth_status, config_action2
Walletget_balance, get_portfolio, deploy_account, send_tokens, get_tx_status, rebalance_portfolio6
Tradeget_swap_quote, swap_tokens, get_multi_swap_quote, multi_swap, batch_execute5
Stakinglist_validators, list_pools, get_staking_info, get_stake_status, stake_tokens, unstake_tokens, claim_rewards, compound_rewards8
Lendinglist_lending_pools, get_lending_position, supply_assets, withdraw_assets, borrow_assets, repay_debt, close_position, monitor_lending_position, auto_rebalance_lending, lending_quote_health10
DCAdca_preview, dca_create, dca_list, dca_cancel4
Confidentialconfidential_setup, confidential_balance, confidential_fund, confidential_transfer, confidential_withdraw, confidential_ragequit, confidential_rollover7
Troves Vaultslist_troves_strategies, get_troves_position, troves_deposit, troves_withdraw4
LST Stakingget_lst_position, get_lst_stats, lst_stake, lst_redeem, lst_exit_all5

β†’ Full MCP Documentation Β· Tool Schemas (MCP.md)

Agent Skills (14 Workflows)

Terminal
npx skills add ahmetenesdur/starkfi

Pre-packaged multi-step workflows for AI coding assistants β€” authenticate, swap, stake, lend, DCA, batch, and more.

β†’ Skills Documentation

Telegram Bot

Chat-based DeFi via natural language with BYOAI model (OpenAI, Claude, Gemini).

β†’ Bot Setup Β· Repository


Architecture

Code
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:

ModuleUsage
WalletsOnboardStrategy.Privy + argentXV050 for email-based wallet onboarding
PaymasterGas abstraction with v3 { type: "paymaster", gasToken } union
StakingMulti-token lifecycle (STRK, WBTC, tBTC, SolvBTC, LBTC)
DCARecurring buy orders via AVNU and Ekubo
TxBuilderAtomic multicall batching (swap + stake + lend + send + DCA + troves)
ConfidentialPrivacy-preserving transfers via Tongo Cash (ZK proofs)
TrovesDeFi vault strategies β€” deposit/withdraw into yield-bearing vaults
Endur LSTLiquid staking (STRK β†’ xSTRK) β€” yield embedded in share price
ERC-20Token presets, balance queries, transfers, approvals

Development

Requires Node.js 22+ and pnpm.

bash
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

bash
cd server && pnpm install && cp .env.example .env && pnpm dev
pnpm typecheck && pnpm lint && pnpm test   # same checks as CI

β†’ Development Guide


Contributing

  1. Fork the repository and create a feature branch
  2. Install dependencies: pnpm install
  3. Verify: pnpm typecheck && pnpm lint && pnpm test && pnpm build (and the same in server/ if you touched it)
  4. Submit a pull request with a clear description

For bugs and feature requests, open an issue.

License

MIT β€” ahmetenesdur