Skip to main content

DeBank Scraper

PyPI version License: MIT Python: 3.11+ MCP Server Playwright

An asynchronous, headless browser-based scraper and Model Context Protocol (MCP) server for extracting complete multi-chain EVM wallet portfolios, token balances, and DeFi protocol positions from DeBank.


✨ Features

  • 🪙 Multi-Chain Token Balances: Retrieves price, amount, USD value, and chain identification for all held assets.
  • 🚜 DeFi Protocol Breakdown: Extracts pools, staking, lending, reward balances, and LP positions across EVM chains.
  • 🤖 MCP Server Support: Exposes tools and resources to query live wallet portfolios directly inside AI assistants (Claude, Cursor, Gemini, Copilot).
  • Fast & Asynchronous: Built with Playwright and modern async Python (asyncio).
  • 📦 CLI & Library Ready: Run as a standalone CLI tool, import as a Python library, or run as a stdio MCP server.

🔧 Prerequisites

  • Python 3.11 or higher
  • uv (recommended) or pip
  • Chromium browser installed (install via playwright install chromium)

📦 Installation

From PyPI (Recommended)

# Using uv (recommended)
uv add debank-scraper
# or install CLI globally
uv tool install debank-scraper

# Using pip
pip install debank-scraper

# Install browser binaries
playwright install chromium

From Source

# Clone the repository
git clone https://github.com/nichsedge/debank-scraper.git
cd debank-scraper

# Install dependencies and setup Playwright
uv sync
uv run playwright install chromium

🚀 Usage

1. CLI Usage

Run directly using uv run or via uvx:

# Scrape specific EVM address to default ./data directory
uv run debank-scrape 0x1234567890abcdef1234567890abcdef12345678

# Save to a custom output directory or file
uv run debank-scrape 0x1234567890abcdef1234567890abcdef12345678 -o ./output/portfolio.json

# Run with visible browser (non-headless) for debugging
uv run debank-scrape 0x1234567890abcdef1234567890abcdef12345678 --no-headless

# Use environment variables
export EVM_ADDRESS="0x1234567890abcdef1234567890abcdef12345678"
export PORTFOLIO_DATA_DIR="./data"
uv run debank-scrape

CLI Options

Option Flag Description
address Positional Target EVM address (or defaults to EVM_ADDRESS env var)
Output Path -o, --output Destination file or directory for the output JSON
Visible Mode --no-headless Open browser window in non-headless mode
Timeout --timeout Page load timeout in milliseconds (default: 30000)

2. Python Library Usage

import asyncio
from debank_scraper import DeBankScraper, scrape_debank

async def main():
    scraper = DeBankScraper(headless=True)
    portfolio = await scraper.scrape("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045")

    print(f"Total Net Worth: {portfolio['wallet']['total_net_worth']}")
    print(f"Tokens tracked: {len(portfolio['tokens'])}")
    print(f"Protocols active: {len(portfolio['protocols'])}")

asyncio.run(main())

3. Model Context Protocol (MCP) Server

Connect DeBank Scraper to your MCP client (Claude Desktop, Cursor, etc.).

Claude Desktop Configuration

Add to claude_desktop_config.json (~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "debank": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/debank-scraper",
        "run",
        "debank-mcp"
      ]
    }
  }
}

Available MCP Capabilities

  • Tool: get_wallet_portfolio(address: str) — Retrieves complete token holdings, protocol yields, and DeFi positions for any EVM wallet address.
  • Resource: debank://wallet/{address} — Dynamic resource providing raw JSON portfolio data for an EVM wallet address.

📊 Output Data Schema

The scraper outputs structured JSON containing:

{
  "timestamp": "2026-08-15T01:23:45.678Z",
  "wallet": {
    "total_net_worth": "$125,430.50",
    "change_24h": "+2.4%"
  },
  "social": {
    "ranking": "1,234",
    "followers": "56",
    "following": "12",
    "tvf": "$1.2M"
  },
  "tokens": [
    {
      "symbol": "ETH",
      "chain": "eth",
      "price": "$2,650.00",
      "amount": "10.5",
      "usd_value": "$27,825.00"
    }
  ],
  "protocols": [
    {
      "name": "Aave V3",
      "chain": "eth",
      "net_usd_value": "$50,000.00",
      "portfolio_items": [...]
    }
  ],
  "nfts": []
}

📄 License

Distributed under the MIT License. See LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

debank_scraper-0.1.0.tar.gz (63.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

debank_scraper-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file debank_scraper-0.1.0.tar.gz.

File metadata

  • Download URL: debank_scraper-0.1.0.tar.gz
  • Upload date:
  • Size: 63.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for debank_scraper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 09fa505d233a3fa2c6d2d9087b51de9921847edff993cc770569299077f9b58c
MD5 42e2e014643dafc1547046eb546966d2
BLAKE2b-256 5fef787e3596bf4c5611321e66aaeb580833147bfe0d2dc524be0f60351de5a8

See more details on using hashes here.

File details

Details for the file debank_scraper-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: debank_scraper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for debank_scraper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd58a341063958320714e9c2195b3ec192257dd44a4bc376d591a83d0380f76e
MD5 5dc8aba85a7fdbe26757cf84e8d897c9
BLAKE2b-256 3cf027f02937217285e6436cacff81eeb97e3c055e3e964d18eb904f7391ed2c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page