Skip to main content
The LeoKit MCP Server enables AI assistants like Claude to interact with DeFi protocols for quoting and executing cross-chain swaps across 30+ blockchains.

What is MCP?

Model Context Protocol (MCP) is an open standard that allows AI assistants to securely connect to external tools and data sources. The LeoKit MCP server exposes swap functionality as tools that Claude can use directly.

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 build

Configuration

Environment Variables

# Required: LeoKit API key
export LEOKIT_API_KEY="your-api-key"

# Optional: Custom API URL (defaults to https://api.leokit.dev)
export LEOKIT_API_URL="https://api.leokit.dev"
Get your API key from InLeo.

Claude Desktop Setup

Add to your Claude Desktop configuration file:
Edit ~/.config/claude/claude_desktop_config.json:
{
  "mcpServers": {
    "leokit": {
      "command": "node",
      "args": ["/path/to/apps/leokit-mcp/dist/index.js"],
      "env": {
        "LEOKIT_API_KEY": "your-api-key"
      }
    }
  }
}
After saving the config, restart Claude Desktop for the changes to take effect.

Available Tools

leokit_get_quote

Get swap quotes from multiple DEX protocols. Parameters:
ParameterRequiredDescription
from_assetYesSource asset (e.g., ETH.ETH, BTC.BTC)
to_assetYesDestination asset
amountYesAmount to swap (human-readable, e.g., 1.5)
originYesSender wallet address
destinationYesRecipient wallet address
api_keyNoOverride default API key
Example prompt:
Get a quote for swapping 1 ETH to BTC
- from_asset: ETH.ETH
- to_asset: BTC.BTC
- amount: 1
- origin: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb
- destination: bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh

leokit_create_deposit

Generate unsigned transactions for executing a swap. Parameters:
ParameterRequiredDescription
quote_idYesQuote ID from leokit_get_quote
protocolYesProtocol to use (thorchain, mayachain, chainflip, relay, near)
api_keyNoOverride default API key
The returned transaction is unsigned and must be signed by the user’s wallet before broadcasting.

leokit_check_status

Check the status of a swap transaction. Parameters:
ParameterRequiredDescription
quote_idYesOriginal quote ID
tx_idYesTransaction hash on source chain
protocolNoProtocol hint for faster lookup
api_keyNoOverride default API key

leokit_get_assets

List supported tokens across blockchains. Parameters:
ParameterRequiredDescription
chainNoFilter by chain (ETH, BTC, ARB, BSC, POLYGON, AVAX, NEAR)
api_keyNoOverride default API key

leokit_get_balances

Get wallet balances across multiple chains. Parameters:
ParameterRequiredDescription
walletsYesArray of { address, chain } objects
api_keyNoOverride default API key
Example:
{
  "wallets": [
    { "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", "chain": "ETH" },
    { "address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh", "chain": "BTC" }
  ]
}

Example Workflow

Here’s how Claude might help you execute a swap:
1

Get a Quote

Ask Claude: “I want to swap 0.5 ETH for USDC on Arbitrum”Claude uses leokit_get_quote to fetch quotes from multiple protocols and presents the best options.
2

Review Options

Claude shows you quotes from THORChain, Chainflip, and Relay with expected output amounts and fees.
3

Generate Transaction

You select THORChain. Claude uses leokit_create_deposit to generate the unsigned transaction.
4

Sign & Broadcast

You sign the transaction with your wallet and broadcast it to the network.
5

Track Status

Ask Claude: “What’s the status of my swap?”Claude uses leokit_check_status to monitor progress until completion.

Asset Format

LeoKit uses a standardized asset format: CHAIN.SYMBOL-ADDRESS Native assets:
  • BTC.BTC - Bitcoin
  • ETH.ETH - Ethereum
  • NEAR.NEAR - NEAR Protocol
Tokens:
  • ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 - USDC on Ethereum
  • ARB.USDC-0xaf88d065e77c8cC2239327C5EDb3A432268e5831 - USDC on Arbitrum
See the Asset Format Reference for full details.

Development

# Watch mode
npm run dev

# Test with MCP inspector
npm run inspect

# Build for production
npm run build

Troubleshooting

Cause: Config file not loaded or path incorrectSolution:
  1. Verify the path to dist/index.js is absolute and correct
  2. Ensure you ran npm run build in apps/leokit-mcp
  3. Restart Claude Desktop after editing config
Cause: Missing or invalid API keySolution: Verify LEOKIT_API_KEY is set correctly in the config’s env section
Cause: Unsupported swap route or insufficient liquiditySolution: Check that both assets are supported using leokit_get_assets

Next Steps