Datai MCP Server

Datai MCP Server

Enables AI agents to retrieve real-time data on wallet DeFi positions, token balances, and NFT holdings across multiple blockchains. It supports hundreds of protocols and provides specialized tools for chain-specific or protocol-specific portfolio analysis.

Category
访问服务器

README

Datai MCP Server

Datai Network

Datai MCP lets your AI agent understand a wallet’s DeFi, token, and NFT holdings in seconds.

Whether you're building with Eliza OS, Cursor, or any local agent stack — simply plug in a wallet address, and the MCP server delivers clean, real-time context powered by the Datai API.

Perfect for AI agents, LLM plugins, and devs needing agentic access to wallet data.

Datai MCP is a TypeScript-based MCP server that enables seamless interaction with a wallet's portfolio data through AI-powered interfaces, powered by the same API behind Datai Network's analytics engine.

Features

  • 8 Comprehensive DeFi Tools: Complete coverage of a wallet's DeFi positions and token balance analysis
  • Multi-Chain Support: Ethereum, Arbitrum, Polygon, Avalanche, BSC, Base, Optimism, and more to come
  • Multi-Protocol Support – Hundreds of DeFi protocols
  • Fast Setup – Just plug in your wallet address, and the MCP delivers fresh on-chain data
  • Built for AI Devs – Integrates with any MCP-ready agent framework (Eliza, Cursor, Claude)
  • Real-Time Data – Powered by Datai’s API wallet data pipeline
  • Debug-Friendly – Truncated responses for dev testing and memory-safe exploration
  • Error Handling: Comprehensive error management and validation
  • Performance Monitoring: Request timing and execution tracking

Example Use Case: Building an AI Wallet Copilot

You're creating an AI agent that helps users understand their crypto portfolio. With Datai MCP:

  1. Your user connects their wallet.
  2. Your agent uses get_all_defi_positions to fetch their DeFi strategy.
  3. The agent summarizes key holdings, flags risk exposure, and recommends actions.

All without you needing to build a blockchain indexer.

Tools Available

Retrieve a wallet's portfolio data using the following tools:

Tool Description Parameters
get_all_defi_positions Get all DeFi positions across all supported chains wallet
get_defi_by_chain Get DeFi positions for a specific blockchain wallet, chain
get_defi_multi_chains Get DeFi positions across multiple chains wallet, chains[]
get_defi_by_protocol Get DeFi positions for a specific protocol wallet, protocol
get_defi_balances_by_chain Get DeFi protocol balances by chain wallet, chain
get_overall_balance_all_c Get overall balance across all chains wallet
get_overall_balance_by_chain Get overall balance for a specific chain wallet, chain
get_wallet_balances_by_chain Get token balances for a specific chain wallet, chain

Tip: Use get_all_defi_positions for a full portfolio scan, or chain/protocol-specific tools for targeted prompts.

Supported Chains

Supported Protocols

Integration with Cursor

To connect to the MCP server from Cursor:

  1. Open Cursor and go to Settings (gear icon in the top right)
  2. Click on "MCP" in the left sidebar
  3. Click "Add new global MCP server"
  4. Enter the following configuration:

Local Development Configuration

{
  "mcpServers": {
    "datai-fastmcp-server-local": {
      "command": "node",
      "args": ["/path/to/your/datai-mcp/dist/index.js"],
      "env": {
        "DATAI_API_KEY": "your_api_key_here",
        "DATAI_LIMIT": "1",
        "DATAI_DEBUG_TRUNCATE": "true",
        "DATAI_CONNECTION_TIMEOUT": "130000",
        "DATAI_RESPONSE_TIMEOUT": "90000",
        "PORT": "3099",
        "DEBUG": "true",
        "NODE_ENV": "production",
        "MCP_DISABLE_PINGS": "true"
      }
    }
  }
}

Production Configuration (NPX - Coming Soon)

{
  "mcpServers": {
    "datai-fastmcp-server": {
      "command": "npx",
      "args": ["-y", "datai-mcp-server@1.0.3"],
      "env": {
        "DATAI_API_KEY": "your_api_key_here",
        "DATAI_LIMIT": "1",
        "DATAI_DEBUG_TRUNCATE": "true",
        "DATAI_CONNECTION_TIMEOUT": "130000",
        "DATAI_RESPONSE_TIMEOUT": "90000",
        "PORT": "3099",
        "DEBUG": "true",
        "NODE_ENV": "production",
        "MCP_DISABLE_PINGS": "true"
      }
    }
  }
}

Environment Variables

Variable Description Default Required
DATAI_API_KEY Your Datai API key - ✅ Yes
DATAI_LIMIT API response limit (1-100) 10 No
DATAI_DEBUG_TRUNCATE Enable data truncation for debugging false No
DATAI_CONNECTION_TIMEOUT Connection timeout in ms 130000 No
DATAI_RESPONSE_TIMEOUT Response timeout in ms 90000 No
DEBUG Enable debug logging false No
PORT Server port 3099 No

Debug Mode

When DATAI_DEBUG_TRUNCATE is set to "true", the server will intelligently truncate API responses to prevent memory issues during development and testing. This provides:

  • Minimal Output: Reduces 1000+ line responses to ~15 lines
  • Structure Preservation: Shows data types, array lengths, object keys
  • Sample Data: First few items/values for verification
  • Clear Status: Indicates when truncation is active

Example truncated output:

{
  "__debug_truncated": true,
  "__summary": {
    "type": "array",
    "length": 25,
    "item_types": ["object"],
    "first_item_keys": ["chain", "name", "commonName", "logo", "site"]
  },
  "__sample_data": {
    "chain": "eth",
    "name": "uniswap3",
    "commonName": "Uniswap V3"
  },
  "__message": "✅ Tool working - data truncated for debugging"
}

Integration with Claude Desktop

To connect to the MCP server from Claude Desktop:

  1. Open Claude Desktop and go to Settings
  2. Click on "Developer" in the left sidebar
  3. Click the "Edit Config" Button
  4. Add the configuration to the claude_desktop_config.json file
  5. Save the file and restart Claude Desktop

Local Development

Prerequisites

Quick Start

  1. Clone the repository:
git clone https://github.com/Datai-Network/datai-fastmcp-server.git

cd datai-fastmcp-server
  1. Install dependencies:
npm install
  1. Build the project:
npm run build
  1. Configure your MCP client with the local configuration shown above

  2. Start using the tools in your MCP-compatible client!

Available Scripts

  • npm run build: Build the TypeScript project
  • npm run dev: Build and watch for changes
  • npm run test: Run test suite (coming soon)

API Integration

This server integrates with the Datai API to provide real-time wallet portfolio data:

  • Base URL: https://api-v1.mymerlin.io
  • Authentication: API key-based
  • Rate Limiting: Configurable via DATAI_LIMIT
  • Timeout Handling: Configurable connection and response timeouts
  • Error Handling: Comprehensive error transformation and logging

Sign up here to obtain your Datai API Key, email address required.

Security Considerations

  • API Key Protection: Never commit API keys to version control
  • Environment Variables: Use secure environment variable management
  • Input Validation: All inputs are validated using Zod schemas
  • Error Sanitization: Sensitive information is filtered from error messages
  • Timeout Protection: Prevents hanging requests with configurable timeouts

Important Note on Response Size and Agent Compatibility

The Datai MCP is designed to enrich AI agents with real-time wallet portfolio data (token balances, DeFi positions). However, certain wallets can generate very large responses, especially when:

  • Holding dozens or hundreds of tokens
  • Engaging with multiple DeFi protocols
  • Using many chains simultaneously

Potential Issues for AI Agents

As of this version, responses are not summarized. The full dataset is returned by default, unless truncated. This may lead to issues in agent environments, such as:

  • Exceeding LLM context limits (resulting in cut-off or ignored data)
  • Slower performance or longer reasoning time
  • Memory or token quota overruns in hosted environments
  • Confusing or degraded agent behavior due to input overload

Recommendations

Until summarization and modular querying are available, we recommend:

  • Using lightweight wallets for testing and debugging
  • Manually filtering or summarizing MCP responses before injecting into your agent
  • Keeping response size in mind when designing prompts or managing memory
  • Opening an issue or contacting us if you'd like early access to summary endpoints

We are actively improving the agent compatibility layer - including modular endpoints and data summarization options in upcoming releases.

Contributing

We welcome contributions! Please ensure:

  1. All code follows TypeScript best practices
  2. Comprehensive error handling is implemented
  3. Input validation is present for all tools
  4. Logging is FastMCP compliant
  5. Tests are included for new features

License

This project is licensed under the MIT License - see the LICENSE file for details.

About Datai

Datai is building the agentic data layer for Web3. We provide high-quality, real-time data pipelines powering agents, AI copilots, and smart protocols. The Datai MCP is one step in our journey to make wallet data accessible, actionable, and agent-ready.

Explore more: https://datai.network

Feedback or Support?

We’re building this for the agent dev community and highly appreciate your input:

  • Create an issue in the GitHub repository
  • Check the documentation for common solutions
  • Review the debug output when DATAI_DEBUG_TRUNCATE=true

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选