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.

Metadata

Release files for debank-scraper 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for debank-scraper 0.1.0
File Size Uploaded
debank_scraper-0.1.0.tar.gz 63.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for debank-scraper 0.1.0
File Interpreter ABI Platform
debank_scraper-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 74.1 kB

Release files / debank_scraper-0.1.0.tar.gz

Download URL debank_scraper-0.1.0.tar.gz
Size 63.2 kB
Tags Source
SHA-256 checksum
How to use checksums
09fa505d233a3fa2c6d2d9087b51de9921847edff993cc770569299077f9b58c
BLAKE2b-256 checksum
How to use checksums
5fef787e3596bf4c5611321e66aaeb580833147bfe0d2dc524be0f60351de5a8
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / debank_scraper-0.1.0-py3-none-any.whl

Download URL debank_scraper-0.1.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd58a341063958320714e9c2195b3ec192257dd44a4bc376d591a83d0380f76e
BLAKE2b-256 checksum
How to use checksums
3cf027f02937217285e6436cacff81eeb97e3c055e3e964d18eb904f7391ed2c
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page