A MCP server powered by the LiFi Network, giving best quotes and execution.
Overview The LI.FI MCP Server is a TypeScript-based application that acts as a middleware between an AI interface and the LI.FI SDK. By exposing specific "tools" through the Model Context Protocol, it allows an AI agent to understand, request, and execute complex cross-chain transfers on behalf of a user, streamlining the DeFi experience into natural language commands.
Key Features Zero-Config SDK Initialization:
The server pre-configures the LI.FI SDK with a specific integrator string (mcp-lifi-server) upon startup, ensuring all requests are properly tracked and authorized without requiring repetitive user setup. +1
Quote Retrieval Tool (get_quote):
Exposes a tool that maps natural language requests (e.g., "Bridge 10 USDC from Arb to Op") into structured QuoteRequest objects compatible with the LI.FI API.
Supports key parameters like fromChain, toChain, fromToken, toToken, and fromAmount. +1
Handles optional parameters such as slippage and allowSwitchChain to customize the route.
Wallet Integration (EVM):
Securely loads a user's private key from environment variables (.env) to instantiate a WalletClient using the Viem library.
Automatically manages chain interactions, allowing the server to sign transactions for supported EVM chains (Ethereum, Arbitrum, Optimism, Base, Polygon).
Transaction Execution Tool (execute_swap):
Takes a raw JSON quote generated by the get_quote tool and executes it on the blockchain.
Handles the full lifecycle of a transaction: checking token allowances, approving spend if necessary, switching chains, and broadcasting the transaction. +1
Multi-VM Architecture (In Progress):
Designed to support multiple virtual machines. Currently features a robust EVM implementation and a structural placeholder for Sui and Solana integration.
Technical Stack
Core Framework: Model Context Protocol (MCP) SDK.
DeFi Integration: LI.FI SDK (v3.0+) for routing and quoting.
Blockchain Interaction: Viem (for EVM wallet management and signing).
Runtime: Node.js (TypeScript).
Validation: Zod for strict schema validation of tool inputs.
Workflow User Request: A user asks Claude, "Swap 0.001 ETH on Arbitrum to USDC on Optimism."
Tool Call (get_quote): The MCP server parses this intent, queries the LI.FI API, and returns a detailed JSON quote with gas costs and estimated returns.
User Confirmation: The user reviews the quote and asks to proceed.
Execution (execute_swap): The server uses the loaded private key to sign the transaction and submits it to the network via the LI.FI SDK's executeRoute function.
Result: The server returns the transaction hash and status to the user.
It is made by leveraging MCP server and LiFi's SDK. Designed to support multiple virtual machines. Currently features a robust EVM implementation and a structural placeholder for Sui and Solana integration. Automatically manages chain interactions, allowing the server to sign transactions for supported EVM chains (Ethereum, Arbitrum, Optimism, Base, Polygon).

