kaia-mcp

tamago-labs/kaia-mcp

3.3

If you are the rightful owner of kaia-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The KAIA-MCP Server is a cutting-edge infrastructure that allows AI agents to interact with DeFi protocols on the KAIA blockchain, leveraging the Model Context Protocol (MCP) for seamless integration.

Tools
5
Resources
0
Prompts
0

KAIA-MCP Server

NPM Version License

AI Γ— DeFi Infrastructure for the Kaia Ecosystem

The KAIA-MCP Server enables AI agents to interact directly with DeFi protocols on the KAIA blockchain.
Built on the Model Context Protocol (MCP), it connects tools like Claude Desktop or Cursor.ai with live blockchain data and transaction execution.


Features

Multi-Protocol Support

  • Lending: KiloLend (Compound v2 fork) for supply, borrow, and repay
  • DEX: DragonSwap V3 for quotes and swaps
  • Price API: Real-time token prices from CoinMarketCap & CoinGecko API
  • AI-Managed Vaults: Automated cross-protocol strategies to boost yield (planned)
  • Market Intelligence: Real-time APYs, utilization, and TVL
  • Smart Wallet: Unified position and balance tracking

Using with Claude Desktop

  1. Install Claude Desktop if you haven't already
  2. Open Claude Desktop settings
  3. Add the KAIA MCP client to your configuration:
{
  "mcpServers": {
    "kaia-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@tamago-labs/kaia-mcp"
      ],
      "env": {
        "KAIA_RPC_URL": "https://public-en.node.kaia.io",
        "KAIA_AGENT_MODE": "transaction",
        "KAIA_PRIVATE_KEY": "YOUR_PRIVATE_KEY"
      },
      "disabled": false
    }
  }
}

Agent Modes

Read-Only Mode (Default)
  • Purpose: Safe exploration and data analysis without transaction capabilities
  • Use Case: Perfect for research, market analysis, and monitoring positions
  • Capabilities: Query market data, check wallet balances, monitor positions, get swap quotes
  • Security: No private key required - completely safe for data access
  • Configuration: Set KAIA_AGENT_MODE to "readonly" or omit the private key
Transaction Mode
  • Purpose: Full DeFi operations with the ability to execute transactions
  • Use Case: Active trading, lending, borrowing, and portfolio management
  • Capabilities: All read-only features plus execute transactions, supply/borrow assets, transfer tokens, execute DEX swaps
  • Security: Requires KAIA_PRIVATE_KEY - ensure secure key management
  • Configuration: Set KAIA_AGENT_MODE to "transaction" and provide a valid private key

Architecture

This MCP server follows a clean, modular architecture designed for multi-protocol support:

src/
β”œβ”€β”€ agent/
β”‚   └── wallet.ts            # Unified WalletAgent for all operations
β”œβ”€β”€ mcp/                     # MCP tool definitions and implementations
β”‚   β”œβ”€β”€ index.ts             # Main MCP server entry point and tool registry
β”‚   β”œβ”€β”€ kilolend/           # KiloLend protocol tools
β”‚   β”œβ”€β”€ dragonswap/          # DragonSwap V3 protocol tools
β”‚   β”œβ”€β”€ price-api/          # Price API tools for token prices
β”‚   └── wallet/              # General wallet operations
β”œβ”€β”€ tools/                  # Core utility functions
β”‚   └── price-api/          # Price API core functions
β”œβ”€β”€ contracts/               # Smart contract interfaces and ABIs
β”‚   β”œβ”€β”€ comptroller.ts       # KiloLend Comptroller contract
β”‚   β”œβ”€β”€ ctoken.ts           # KiloLend cToken contracts
β”‚   β”œβ”€β”€ erc20.ts            # Standard ERC-20 interface
β”‚   β”œβ”€β”€ wkaia.ts            # WKAIA contract interface
β”‚   └── dragonswap/         # DragonSwap contract ABIs
β”œβ”€β”€ utils/                  # Utility functions and helpers
β”‚   β”œβ”€β”€ errors.ts           # Error handling classes
β”‚   β”œβ”€β”€ formatting.ts       # Token amount formatting utilities
β”‚   └── validation.ts       # Input validation functions
β”œβ”€β”€ config.ts               # Configuration management and environment setup
β”œβ”€β”€ types.ts                # TypeScript type definitions
└── index.ts                # Main server entry point

Installation

npm install
npm run build

Configuration

Environment Variables

Create a .env file based on .env.example:

# Required
KAIA_RPC_URL="https://public-en.node.kaia.io"         # KAIA Mainnet RPC URL

# Optional
KAIA_PRIVATE_KEY="your_private_key_here"             # Wallet private key (for transaction mode)
KAIA_AGENT_MODE="readonly"                           # "readonly" or "transaction" (defaults to readonly)
KAIA_NETWORK="kaia"                                  # Network (only kaia supported currently)

Available Tools

Wallet Tools

Read-Only Tools
ToolDescription
get_wallet_infoGet wallet information and token balances
Transaction Tools
ToolDescription
send_native_tokenSend native KAIA tokens
send_erc20_tokenSend ERC-20 tokens
wrap_kaiaWrap KAIA to WKAIA
unwrap_kaiaUnwrap WKAIA to KAIA
check_allowanceCheck token allowance for operations
approve_tokenApprove tokens for operations

KiloLend Tools

Read-Only Tools
ToolDescription
get_account_liquidityCheck account liquidity and health factor
get_marketsGet all lending markets with rates
get_protocol_statsGet protocol statistics and TVL
Transaction Tools
ToolDescription
enter_marketEnter markets to enable collateral usage
supply_to_marketSupply assets to lending market
borrow_from_marketBorrow from lending market
repay_borrowRepay borrowed positions
redeem_tokensRedeem cTokens (withdraw by cToken amount)
redeem_underlyingRedeem underlying tokens (withdraw by underlying amount)

Price API Tools

Read-Only Tools
ToolDescription
get_all_pricesGet all available prices from KiloLend price API
get_token_pricesGet prices for specific tokens (e.g., ['KAIA', 'BTC', 'ETH'])
get_kaia_ecosystem_pricesGet KAIA ecosystem token prices only (KAIA, BORA, MBX, SIX, SOMNIA, stKAIA)
get_major_crypto_pricesGet major cryptocurrency prices (BTC, ETH)
get_quick_pricesQuick price overview of KAIA, BTC, and ETH

DragonSwap Tools

Read-Only Tools
ToolDescription
dragonswap_get_pool_infoGet DragonSwap pool information
dragonswap_get_swap_quoteGet swap quotes without executing
dragonswap_get_routeGet best routing path for swaps (supports multi-hop)
Transaction Tools
ToolDescription
dragonswap_execute_swapExecute token swaps on DragonSwap

Supported Tokens

KiloLend Supported Tokens

  • KAIA: Native KAIA token
  • USDT: Tether USD (0xd077a400968890eacc75cdc901f0356c943e4fdb)
  • SIX: SIX token (0xEf82b1C6A550e730D8283E1eDD4977cd01FAF435)
  • BORA: BORA token (0x02cBE46fB8A1F579254a9B485788f2D86cAD51aa)
  • MBX: MARBLEX token (0xD068c52d81f4409B9502dA926aCE3301cc41f623)
  • stKAIA: Lair Staked KAIA (0x42952B873ed6f7f0A7E4992E2a9818E3A9001995)

DragonSwap Supported Tokens

  • KAIA: Native token
  • WKAIA: Wrapped KAIA (0x19aac5f612f524b754ca7e7c41cbfa2e981a4432)
  • USDT: Official USDT(0xd077a400968890eacc75cdc901f0356c943e4fdb)
  • USDT: Wormhole USDT(0x5c13e303a62fc5dedf5b52d66873f2e59fedadc2)
  • BORA: BORA Token (0x02cBE46fB8A1F579254a9B485788f2D86cAD51aa)
  • MBX: MARBLEX Token (0xD068c52d81f4409B9502dA926aCE3301cc41f623)
  • stKAIA: Lair Staked KAIA (0x42952B873ed6f7f0A7E4992E2a9818E3A9001995)

Future Protocol Support

We're actively working on adding support for:

  • Additional Lending Protocols: More lending platforms
  • Staking Protocols: Liquid staking and Lair Finance integration
  • Cross-Chain Messaging: Chainlink CCIP for cross-chain operations
  • Yield Farming: Cross-protocol yield optimization

Contract Addresses

Kaia Mainnet

KiloLend (Compound v2)
  • Comptroller: 0x0B5f0Ba5F13eA4Cb9C8Ee48FB75aa22B451470C2
  • Markets:
    • cUSDT: 0x498823F094f6F2121CcB4e09371a57A96d619695
    • cSIX: 0xC468dFD0C96691035B3b1A4CA152Cb64F0dbF64c
    • cBORA: 0x7a937C07d49595282c711FBC613c881a83B9fDFD
    • cMBX: 0xE321e20F0244500A194543B1EBD8604c02b8fA85
    • cKAIA: 0x98Ab86C97Ebf33D28fc43464353014e8c9927aB3
    • cStKAIA: 0x0BC926EF3856542134B06DCf53c86005b08B9625
DragonSwap V3
  • Router: 0xA324880f884036E3d21a09B90269E1aC57c7EC8a
  • Quoter V2: 0x673d88960D320909af24db6eE7665aF223fec060
  • Factory: 0x7431A23897ecA6913D5c81666345D39F27d946A4

Troubleshooting

If you're using Ubuntu or another Linux environment with NVM, you'll need to manually configure the path. Follow these steps:

  1. Install the KAIA MCP under your current NVM-managed Node.js version.
npm install -g @tamago-labs/kaia-mcp
  1. Due to how NVM installs libraries, you may need to use absolute paths in your config. Replace the example values below with your actual username and Node version:
{
  "mcpServers": {
    "kaia-mcp": {
      "command": "/home/YOUR_NAME/.nvm/versions/node/YOUR_NODE_VERSION/bin/node",
      "args": [
        "/home/YOUR_NAME/.nvm/versions/node/YOUR_NODE_VERSION/bin/@tamago-labs/kaia-mcp"
      ],
      "env": {
        "KAIA_RPC_URL": "https://public-en.node.kaia.io",
        "KAIA_AGENT_MODE": "transaction",
        "KAIA_PRIVATE_KEY": "YOUR_PRIVATE_KEY"
      }
    }
  }
}
  1. Restart Claude Desktop and it should work now.

Environment Variable Issues

If you encounter issues with environment variables not being recognized:

  1. Check required variables: Make sure KAIA_RPC_URL is always set
  2. Verify mode settings: KAIA_AGENT_MODE should be either "readonly" or "transaction"
  3. Private key format: KAIA_PRIVATE_KEY must be 64 hex characters (with or without 0x prefix)
  4. Debug logging: The server will log all configuration on startup to stderr

Work with Local Files

When working with local files especially when using KAIA CLI tools for smart contract development to create, build, and test a Move package on your machineβ€”you'll need to import an additional MCP server library of filesystem made by Claude team. Use with:

"filesystem": {
  "command": "npx",
  "args": [
    "-y",
    "@modelcontextprotocol/server-filesystem",
    "${workspaceFolder}"
  ],
  "env":{
        
  },
  "disabled": false
}

workspaceFolder refers to your working directory. You can provide more than one argument. Subfolders or specific files can then be referenced in your AI prompt.

If you're using Linux and encounter issues during setup, please refer to the troubleshooting section.

License

MIT License - see LICENSE file for details.