LI.FI Cross-Chain Swap
STDIOCross-chain swap functionality integrator across multiple liquidity pools and bridges.
Cross-chain swap functionality integrator across multiple liquidity pools and bridges.
⚠️ IMPORTANT SECURITY DISCLAIMER ⚠️
DO NOT use this tool with your main wallet keystore or wallets containing significant funds!
This tool is for testing and experimental purposes only. There is potential for loss of funds due to:
- Software bugs or security vulnerabilities
- Transaction errors or misconfigurations
- Network issues or smart contract failures
Neither LI.FI nor the developers of this tool are responsible for any loss of funds resulting from the use of this freely available open-source software.
Use at your own risk with test wallets only.
This MCP server integrates with the LI.FI API to provide cross-chain swap functionality across multiple liquidity pools and bridges via the Model Context Protocol (MCP).
The Model Context Protocol (MCP) is a protocol for AI model integration, allowing AI models to access external tools and data sources.
get-tokens
chains
, chainTypes
, minPriceUSD
get-token
chain
(required), token
(required)get-chains
chainTypes
get-chain-by-id
id
(required)get-chain-by-name
name
(required)get-quote
fromChain
, toChain
, fromToken
, toToken
, fromAddress
, fromAmount
, etc.get-status
txHash
(required), bridge
, fromChain
, toChain
get-connections
fromChain
, toChain
, fromToken
, toToken
, chainTypes
get-tools
chains
get-wallet-address
get-native-token-balance
rpcUrl
(required), address
(required)get-token-balance
rpcUrl
, tokenAddress
, walletAddress
get-allowance
rpcUrl
, tokenAddress
, ownerAddress
, spenderAddress
Note: These tools are only available when the server is started with the
--keystore
flag.
execute-quote
rpcUrl
, transactionRequest
approve-token
rpcUrl
, tokenAddress
, spenderAddress
, amount
transfer-token
rpcUrl
, tokenAddress
, to
, amount
transfer-native
rpcUrl
, to
, amount
go install github.com/lifinance/lifi-mcp@latest
Start the MCP server:
lifi-mcp
With keystore for transaction capabilities:
lifi-mcp --keystore <keystore-name> --password <keystore-password>
Check the version:
lifi-mcp --version
You can import the server in your Go projects:
import "github.com/lifinance/lifi-mcp/server" func main() { // Create a new server with version s := server.NewServer("1.0.0") // Start the server in stdio mode if err := s.ServeStdio(); err != nil { log.Fatalf("Server error: %v", err) } }
For in-process usage with the mcp-go client library:
import ( "context" "log" "github.com/mark3labs/mcp-go/client" "github.com/mark3labs/mcp-go/client/transport" "github.com/lifinance/lifi-mcp/server" ) func main() { // Create the LiFi MCP server lifiServer := server.NewServer("1.0.0") // Create an in-process transport using the server's MCPServer inProcessTransport := transport.NewInProcessTransport(lifiServer.GetMCPServer()) // Create an MCP client using the in-process transport mcpClient := client.NewMCPClient(inProcessTransport) // Start the transport ctx := context.Background() if err := mcpClient.Connect(ctx); err != nil { log.Fatalf("Failed to connect: %v", err) } defer mcpClient.Close() // Initialize the client if err := mcpClient.Initialize(ctx); err != nil { log.Fatalf("Failed to initialize: %v", err) } // List available tools tools, err := mcpClient.ListTools(ctx) if err != nil { log.Fatalf("Failed to list tools: %v", err) } // Use the tools... result, err := mcpClient.CallTool(ctx, "get-chain-by-name", map[string]any{ "name": "ethereum", }) if err != nil { log.Fatalf("Failed to call tool: %v", err) } }
The server will search for keystore files in the standard Ethereum keystore directory:
To integrate this server with apps that support MCP:
{ "mcpServers": { "lifi": { "command": "lifi-mcp", "args": [] } } }
With keystore for transaction capabilities:
{ "mcpServers": { "lifi": { "command": "lifi-mcp", "args": ["--keystore", "your-keystore", "--password", "your-password"] } } }
MIT