MCP DeBank
Query cross-chain DeFi portfolio data, token balances, and protocol positions via the DeBank API.
- Package:
@iqai/mcp-debank - Provider: DeBank
Overview
The DeBank MCP server gives your agent access to DeBank's cross-chain portfolio data. It can retrieve wallet token balances, protocol positions, transaction history, and total portfolio value across all major EVM chains.
Authentication Modes
DeBank supports two mutually exclusive access modes: a DeBank API Key for direct access, or an IQ Gateway for proxied access. If both are provided, the gateway takes priority.
Getting Started
Install the package:
pnpm add @iqai/mcp-debankUse the server in your agent:
import { McpDebank } from "@iqai/adk";
const toolset = McpDebank({
env: {
DEBANK_API_KEY: process.env.DEBANK_API_KEY,
},
});
const tools = await toolset.getTools();import { McpToolset } from "@iqai/adk";
const toolset = new McpToolset({
name: "Debank MCP Client",
description: "Client for DeBank cross-chain portfolio data",
transport: {
mode: "stdio",
command: "npx",
args: ["-y", "@iqai/mcp-debank"],
env: {
DEBANK_API_KEY: process.env.DEBANK_API_KEY,
PATH: process.env.PATH || "",
},
},
});
const tools = await toolset.getTools();{
"mcpServers": {
"debank-mcp-server": {
"command": "npx",
"args": ["-y", "@iqai/mcp-debank"],
"env": {
"DEBANK_API_KEY": "your_debank_api_key"
}
}
}
}Environment Variables
| Variable | Required | Description |
|---|---|---|
DEBANK_API_KEY | Required for API key mode | API key obtained from the DeBank platform |
IQ_GATEWAY_URL | Required for gateway mode | Base URL of the IQ Gateway service |
IQ_GATEWAY_KEY | Required for gateway mode | Authentication key for the IQ Gateway |
Credentials
To get a DeBank API Key:
- Visit DeBank Open API
- Sign up and create a project
- Copy your API Key from the dashboard
Available Tools
debank_get_supported_chain_list_userQuery:string
debank_get_supported_chain_listDescription
Retrieve a comprehensive list of all blockchain chains supported by the DeBank API. Returns information about each chain including their IDs, names, logo URLs, native token IDs, wrapped token IDs, and pre-execution support status.
debank_get_chainid:string_userQuery:string
debank_get_chainDescription
Retrieve detailed information about a specific blockchain chain supported by DeBank. Returns chain details including ID, name, logo URL, native token ID, wrapped token ID, and whether it supports pre-execution of transactions.
debank_get_all_protocols_of_supported_chainschain_ids:string_userQuery:string
debank_get_all_protocols_of_supported_chainsDescription
Retrieve a list of all DeFi protocols across specified or all supported blockchain chains. Returns essential information about each protocol including ID, chain ID, name, logo URL, site URL, portfolio support status, and TVL. Returns top 20 protocols by default.
debank_get_protocol_informationid:string_userQuery:string
debank_get_protocol_informationDescription
Fetch detailed information about a specific DeFi protocol. Returns protocol details including ID, associated chain, name, logo URL, site URL, portfolio support status, and total value locked (TVL). Useful for analyzing individual protocols across different chains.
debank_get_top_holders_of_protocolid:stringstart:integerlimit:integer_userQuery:string
debank_get_top_holders_of_protocolDescription
Retrieve a list of top holders within a specified DeFi protocol, ranked by their holdings. Provides insights into the distribution and concentration of holdings among participants. Supports pagination for large result sets.
debank_get_pool_informationid:stringchain_id:string_userQuery:string
debank_get_pool_informationDescription
Retrieve detailed information about a specific liquidity pool. Returns pool details including ID, chain, protocol ID, contract IDs, name, USD value of deposited assets, total user count, and count of valuable users (>$100 USD value).
debank_get_token_informationchain_id:stringid:string_userQuery:string
debank_get_token_informationDescription
Fetch comprehensive details about a specific token on a blockchain. Returns token information including contract address, chain, name, symbol, decimals, logo URL, associated protocol ID, USD price, verification status, and deployment timestamp. Essential for token analysis and display.
debank_get_list_token_informationchain_id:stringids:string_userQuery:string
debank_get_list_token_informationDescription
Retrieve detailed information for multiple tokens at once on a specific chain. Returns an array of token objects with comprehensive details. Useful for bulk token data retrieval, with support for up to 100 token addresses per request.
debank_get_top_holders_of_tokenid:stringchain_id:stringstart:integerlimit:integer_userQuery:string
debank_get_top_holders_of_tokenDescription
Fetch the top holders of a specified token, showing the largest token holders ranked by their holdings. Supports both contract addresses and native token IDs. Useful for analyzing token distribution and ownership concentration. Supports pagination for detailed analysis.
debank_get_token_history_priceid:stringchain_id:stringdate_at:string_userQuery:string
debank_get_token_history_priceDescription
Retrieve the historical price of a specified token for a given date. Essential for financial analysis, historical comparison, and tracking price movements over time. Returns price data for the UTC time zone on the specified date.
debank_get_user_used_chain_listid:string_userQuery:string
debank_get_user_used_chain_listDescription
Retrieve a list of blockchain chains that a specific user has interacted with. Returns details about each chain including ID, name, logo URL, native token ID, wrapped token ID, and the birth time of the user's address on each chain.
debank_get_user_chain_balancechain_id:stringid:string_userQuery:string
debank_get_user_chain_balanceDescription
Fetch the current balance of a user's account on a specified blockchain chain. Returns the balance in USD value, providing a snapshot of the user's holdings on that chain.
debank_get_user_protocolprotocol_id:stringid:string_userQuery:string
debank_get_user_protocolDescription
Get detailed information about a user's positions within a specified DeFi protocol. Returns protocol details and the user's portfolio items including assets, debts, and rewards in that protocol.
debank_get_user_complex_protocol_listchain_id:stringid:string_userQuery:string
debank_get_user_complex_protocol_listDescription
Retrieve detailed portfolios of a user on a specific chain across multiple protocols. Returns comprehensive information about the user's engagements including protocol details and portfolio items with assets, debts, and positions.
debank_get_user_all_complex_protocol_listid:stringchain_ids:string_userQuery:string
debank_get_user_all_complex_protocol_listDescription
Retrieve a user's detailed portfolios across all supported chains within multiple protocols. Provides a comprehensive overview of investments and positions across the entire DeFi ecosystem. Can be filtered by specific chains.
debank_get_user_all_simple_protocol_listid:stringchain_ids:string_userQuery:string
debank_get_user_all_simple_protocol_listDescription
Fetch a user's balances in protocols across all supported chains. Returns simplified protocol information including TVL and basic details. Useful for getting a quick overview of a user's protocol engagements.
debank_get_user_token_balancechain_id:stringid:stringtoken_id:string_userQuery:string
debank_get_user_token_balanceDescription
Retrieve a user's balance for a specific token. Returns detailed token information including name, symbol, decimals, USD price, and the user's balance amount.
debank_get_user_token_listid:stringchain_id:stringis_all:boolean_userQuery:string
debank_get_user_token_listDescription
Retrieve a list of tokens held by a user on a specific chain. Returns token details including symbol, decimals, USD price, and balance amounts. Can filter for core/verified tokens or include all tokens.
debank_get_user_all_token_listid:stringis_all:boolean_userQuery:string
debank_get_user_all_token_listDescription
Retrieve a user's token balances across all supported chains. Provides a comprehensive list of all tokens held by the user, offering insights into their wider cryptocurrency portfolio.
debank_get_user_nft_listid:stringchain_id:stringis_all:boolean_userQuery:string
debank_get_user_nft_listDescription
Fetch a list of NFTs owned by a user on a specific chain. Returns NFT details including contract ID, name, description, content type, and attributes. Can filter for verified collections only.
debank_get_user_all_nft_listid:stringis_all:booleanchain_ids:string_userQuery:string
debank_get_user_all_nft_listDescription
Retrieve a user's NFT holdings across all supported chains. Provides an aggregate list of NFTs held by the user with details including contract ID, name, and content type. Can be filtered by specific chains.
debank_get_user_history_listid:stringchain_id:stringtoken_id:stringstart_time:integerpage_count:integer_userQuery:string
debank_get_user_history_listDescription
Fetch a user's transaction history on a specified chain. Returns a list of past transactions with details including transaction type, tokens involved, values, and timestamps. Supports filtering by token and pagination.
debank_get_user_all_history_listid:stringstart_time:integerpage_count:integerchain_ids:string_userQuery:string
debank_get_user_all_history_listDescription
Retrieve a user's transaction history across all supported chains. Provides a comprehensive overview of DeFi activities across the entire blockchain ecosystem. Supports pagination and chain filtering.
debank_get_user_token_authorized_listid:stringchain_id:string_userQuery:string
debank_get_user_token_authorized_listDescription
Fetch a list of tokens for which a user has granted spending approvals on a specified chain. Returns details about each approval including amount, spender address, and associated protocol information. Useful for security audits.
debank_get_user_nft_authorized_listid:stringchain_id:string_userQuery:string
debank_get_user_nft_authorized_listDescription
Retrieve a list of NFTs for which a user has given spending permissions on a specified chain. Returns details including contract IDs, names, symbols, spender addresses, and approved amounts for ERC1155 tokens. Important for security reviews.
debank_get_user_total_balanceid:string_userQuery:string
debank_get_user_total_balanceDescription
Retrieve a user's total net assets across all supported chains. Calculates and returns the total USD value of assets including both tokens and protocol positions. Provides a complete snapshot of the user's DeFi portfolio.
debank_get_user_chain_net_curveid:stringchain_id:string_userQuery:string
debank_get_user_chain_net_curveDescription
Retrieve a user's 24-hour net asset value curve on a single chain. Shows the changes in total USD value of assets over the last 24 hours, providing insights into portfolio fluctuations on that specific chain.
debank_get_user_total_net_curveid:stringchain_ids:string_userQuery:string
debank_get_user_total_net_curveDescription
Retrieve a user's 24-hour net asset value curve across all chains. Provides a comprehensive view of total USD value changes over the last 24 hours, helping track overall portfolio performance. Can be filtered by specific chains.
debank_get_gas_priceschain_id:string_userQuery:string
debank_get_gas_pricesDescription
Fetch current gas prices for different transaction speed levels on a specified chain. Returns prices for slow, normal, and fast transaction speeds with estimated confirmation times. Crucial for transaction cost estimation.
debank_pre_exec_transactiontx:stringpending_tx_list:string_userQuery:string
debank_pre_exec_transactionDescription
Simulate the execution of a transaction or sequence of transactions before submitting them on-chain. Returns detailed information about balance changes, gas estimates, and success status. Useful for DEX swaps requiring token approvals or complex transaction sequences.
debank_explain_transactiontx:string_userQuery:string
debank_explain_transactionDescription
Decode and explain a given transaction in human-readable terms. Returns details about function calls, parameters, and actions derived from the transaction data. Supports complex transactions across multiple protocols.
Integration Example
import { AgentBuilder, McpDebank } from "@iqai/adk";
import * as dotenv from "dotenv";
dotenv.config();
async function main() {
// Initialize McpDebank toolset
const toolset = McpDebank({
env: {
DEBANK_API_KEY: process.env.DEBANK_API_KEY,
},
});
// Get available McpDebank tools
const debankTools = await toolset.getTools();
// Create agent with McpDebank tools
const { runner } = await AgentBuilder.create("debank_agent")
.withModel("gemini-2.5-flash")
.withDescription("A DeFi portfolio agent that tracks cross-chain positions")
.withTools(...debankTools)
.build();
const response = await runner.ask(
"What is the total portfolio value of 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 across all chains?",
);
console.log(response);
}
main().catch(console.error);