mcp-crosschain-swap
v0.0.2
Published
MCP Server for DeFi swap aggregation
Downloads
92
Maintainers
Readme
LeoKit MCP Server
Give AI assistants like Claude superpowers to interact with DeFi. This MCP server lets Claude quote and execute cross-chain swaps across 30+ blockchains using the LeoKit aggregation API.
⚠️ Security Warning: Never commit API keys to version control. Always use environment variables or secure secret management. Read SECURITY.md before deploying.
Features
- Multi-protocol quotes: Get swap quotes from THORChain, MAYAChain, Chainflip, Relay, and NEAR
- Cross-chain swaps: Generate unsigned transactions for 30+ blockchains
- Transaction tracking: Monitor swap status across protocols
- Asset discovery: List all supported tokens with current prices
- Balance queries: Check wallet balances across multiple chains
Installation
cd apps/leokit-mcp
npm install
npm run buildConfiguration
Get your API key from dash.leokit.dev.
🔐 Security First:
- Never hardcode API keys in your code
- Use environment variables for all secrets
- Don't commit
.envfiles to git - Enable auth in production (never use
MCP_AUTH_DISABLED=true)
Environment variables:
# Custom LeoKit API URL (defaults to https://api.leokit.dev)
export LEOKIT_API_URL="https://api.leokit.dev"
# Disable authentication for development (not recommended for production)
export MCP_AUTH_DISABLED=true
# Cache TTL for validated keys in milliseconds (default: 300000 = 5 minutes)
export MCP_AUTH_CACHE_TTL=300000Quick Setup with Claude Desktop
Option 1: Web-Based Setup (Easiest) 🌐
Visit leokit.io/mcp-setup for an interactive setup guide that generates your configuration automatically.
Option 2: One-Line Setup Script 🚀
⚠️ Security Note: Review scripts before running them. You can view the source at the URLs below.
Option 3: Manual Configuration
Remote Server (Recommended)
Add to your Claude Desktop config (~/.config/claude/claude_desktop_config.json on macOS/Linux or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"leokit": {
"transport": {
"type": "http",
"url": "http://mcp.leokit.dev/mcp",
"headers": {
"Authorization": "Bearer your-leokit-api-key"
}
}
}
}
}Local Installation
{
"mcpServers": {
"leokit": {
"command": "npx",
"args": ["-y", "@inleo/leokit-mcp"],
"env": {
"LEOKIT_API_KEY": "your-leokit-api-key"
}
}
}
}After setup: Restart Claude Desktop and ask:
- "Help me set up LeoKit" → Runs
leokit_setup - "Is my API key working?" → Runs
leokit_validate_key - "List available LeoKit tools"
Available Tools
🚀 Getting Started Tools
leokit_setup
Get help setting up your LeoKit API key. Perfect for first-time users!
Just ask Claude:
- "Help me set up LeoKit"
- "How do I get a LeoKit API key?"
What it provides:
- Step-by-step setup guide
- Links to create an account
- Configuration examples
- Current setup status
leokit_validate_key
Test if your API key is working.
Parameters:
api_key(optional): Test a specific key
Just ask Claude:
- "Is my LeoKit API key working?"
- "Validate my API key"
What it checks:
- API key validity
- Connection to LeoKit API
- Provides troubleshooting tips
💱 Swap & DeFi Tools
leokit_get_quote
Get swap quotes from multiple DEX protocols.
Parameters:
from_asset(required): Source asset (e.g.,ETH.ETH,BTC.BTC)to_asset(required): Destination assetamount(required): Amount to swap (e.g.,1.5)origin(required): Sender wallet addressdestination(required): Recipient wallet addressapi_key(optional): Override default API key
Example:
Get a quote for swapping 1 ETH to BTC
- from_asset: ETH.ETH
- to_asset: BTC.BTC
- amount: 1
- origin: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb
- destination: bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlhleokit_create_deposit
Generate unsigned transactions for a swap.
Parameters:
quote_id(required): Quote ID fromleokit_get_quoteprotocol(required): Protocol to use (e.g.,thorchain,mayachain)api_key(optional): Override default API key
leokit_check_status
Check the status of a swap transaction.
Parameters:
quote_id(required): Original quote IDtx_id(required): Transaction hash on source chainprotocol(optional): Protocol hintapi_key(optional): Override default API key
leokit_get_assets
List supported tokens across blockchains.
Parameters:
chain(optional): Filter by chain (e.g.,ETH,BTC,ARB)api_key(optional): Override default API key
leokit_get_balances
Get wallet balances across multiple chains.
Parameters:
wallets(required): Array of{ address, chain }objectsapi_key(optional): Override default API key
Example:
{
"wallets": [
{ "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", "chain": "ETH" },
{ "address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh", "chain": "BTC" }
]
}Development
# Watch mode
npm run dev
# Test with MCP inspector
npm run inspect
# Build
npm run buildAsset Format
LeoKit uses a standardized asset format: CHAIN.SYMBOL-ADDRESS
Native assets:
BTC.BTC- BitcoinETH.ETH- EthereumNEAR.NEAR- NEAR Protocol
Tokens:
ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48- USDC on EthereumARB.USDC-0xaf88d065e77c8cC2239327C5EDb3A432268e5831- USDC on Arbitrum
Supported Chains
30+ blockchains including:
- EVM: Ethereum, Arbitrum, BSC, Polygon, Avalanche, Optimism, Base
- UTXO: Bitcoin, Litecoin, Dogecoin
- Cosmos: THORChain, MAYAChain, Kujira
- Other: NEAR, Solana, Tron, Cardano, XRP
Security
- API keys are SHA-256 hashed before caching
- Rate limiting: 100 req/15min per IP
- Input validation on all parameters
- Request size limits: 1MB max
- See SECURITY.md for full policy
Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
Changelog
See CHANGELOG.md for release history.
Support
- Documentation: leokit.io
- Dashboard: dash.leokit.dev
License
MIT - see LICENSE for details.
