Skip to content

MCP Server

@earnforge/mcp exposes 9 Earn-native MCP (Model Context Protocol) tools. Any LLM client that speaks MCP — Claude Desktop, Cursor, Windsurf, Continue, and others — can discover and call these tools to query vaults, compute risk, build deposit quotes, and more.

Terminal window
npm i -g @earnforge/mcp

Add the EarnForge MCP server to your client’s configuration file.

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
"mcpServers": {
"earnforge": {
"command": "npx",
"args": ["-y", "@earnforge/mcp"],
"env": {
"LIFI_API_KEY": "your-lifi-api-key-here"
}
}
}
}

Edit .cursor/mcp.json in your project root:

{
"mcpServers": {
"earnforge": {
"command": "npx",
"args": ["-y", "@earnforge/mcp"],
"env": {
"LIFI_API_KEY": "your-lifi-api-key-here"
}
}
}
}

Edit ~/.windsurf/mcp.json:

{
"mcpServers": {
"earnforge": {
"command": "npx",
"args": ["-y", "@earnforge/mcp"],
"env": {
"LIFI_API_KEY": "your-lifi-api-key-here"
}
}
}
}

List LI.FI Earn vaults with optional filters. Returns paginated vault data including APY, TVL, protocol info, and tags.

Parameters:

NameTypeRequiredDescription
chainIdnumbernoEVM chain ID (e.g. 8453 for Base, 1 for Ethereum)
assetstringnoUnderlying token symbol (e.g. “USDC”, “ETH”)
minTvlnumbernoMinimum TVL in USD
sortBystringnoSort field (e.g. “apy”, “tvl”)
limitnumbernoMax vaults to return (default 10)
strategystringnoStrategy preset: “conservative”, “max-apy”, “diversified”, “risk-adjusted”

Example prompt: “Show me the top 5 USDC vaults on Base with at least $1M TVL”


Get a single vault by its slug. Returns full vault details including APY breakdown, TVL, underlying tokens, protocol, and tags.

Parameters:

NameTypeRequiredDescription
slugstringyesVault slug: <chainId>-<vaultAddress>

Example prompt: “Get details for vault 8453-0xbeef0e0834849acc03f0089f01f4f1eeb06873c9”


List all blockchain chains supported by LI.FI Earn. Returns chain IDs, names, and CAIP identifiers.

Parameters: None.

Example prompt: “What chains does LI.FI Earn support?“


List all DeFi protocols available on LI.FI Earn. Returns protocol names and URLs.

Parameters: None.

Example prompt: “Which protocols are available on LI.FI Earn?“


Get DeFi portfolio positions for a wallet address.

Parameters:

NameTypeRequiredDescription
walletstringyesWallet address (0x…)

Example prompt: “Show me the Earn positions for wallet 0xabc123…“


Compute a composite 0-10 risk score for a vault. Dimensions: TVL magnitude, APY stability, protocol maturity, redeemability, and asset type.

Parameters:

NameTypeRequiredDescription
slugstringyesVault slug: <chainId>-<vaultAddress>

Example prompt: “What’s the risk score for the Aave USDC vault on Base?”

Labels: >= 7 is “low” risk (safe), 4-6.9 is “medium”, < 4 is “high” risk.


Build a deposit quote for an Earn vault. Returns transaction data ready to sign.

Parameters:

NameTypeRequiredDescription
slugstringyesVault slug: <chainId>-<vaultAddress>
walletstringyesWallet address
fromAmountstringyesHuman-readable amount (e.g. “100” for 100 USDC)
fromTokenstringnoOverride source token address
fromChainnumbernoOverride source chain ID
slippagenumbernoSlippage tolerance (e.g. 0.03 for 3%)

Example prompt: “Build a quote to deposit 100 USDC into the Aave vault on Base from my wallet 0x…”


Get a portfolio allocation suggestion using a risk-adjusted scoring engine.

Parameters:

NameTypeRequiredDescription
amountnumberyesTotal USD amount to allocate
assetstringnoFilter by token symbol
maxChainsnumbernoMax chains to spread across (default 5)
maxVaultsnumbernoMax vaults in allocation (default 5)
strategystringnoStrategy preset

Example prompt: “How should I allocate $10,000 in USDC across Earn vaults?“


Run preflight/pitfall checks on a vault before depositing.

Parameters:

NameTypeRequiredDescription
slugstringyesVault slug
walletstringyesWallet address
walletChainIdnumbernoCurrent wallet chain ID (detects chain mismatch)
depositAmountstringnoAmount for balance sufficiency check

Example prompt: “Run doctor checks on vault 8453-0xbeef… for wallet 0xabc…”


The MCP server uses the @modelcontextprotocol/sdk stdio transport. When started, it:

  1. Creates an EarnForge SDK instance (with caching: 60s TTL, 200 entries)
  2. Registers all 9 tools with Zod-validated parameter schemas
  3. Listens on stdin/stdout for MCP JSON-RPC messages

The server name is earnforge-mcp and version 0.1.0. Clients auto-discover the available tools from the server’s tool listing.

All tool responses are JSON-formatted text content. Errors include isError: true in the response for clients that support it.