npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

datai-mcp-server

v1.0.3

Published

High-performance FastMCP TypeScript server for Datai blockchain data endpoints - NPX Ready

Readme

Datai MCP Server

Datai Network

A powerful Model Context Protocol (MCP) server for interacting with DeFi protocols and blockchain data through the Datai API. This server provides comprehensive tools for analyzing DeFi positions, balances, and protocol interactions across multiple blockchain networks.

Description

Datai MCP is a TypeScript-based MCP server that enables seamless interaction with DeFi protocols through AI-powered interfaces. It provides a comprehensive set of tools for DeFi analysis, portfolio management, and cross-chain data aggregation using the Datai API.

Features

  • 8 Comprehensive DeFi Tools: Complete coverage of DeFi positions and balance analysis
  • Multi-Chain Support: Ethereum, Arbitrum, Polygon, Avalanche, BSC, Base, Optimism
  • Real-time Data: Live DeFi protocol data from Datai API
  • Debug Mode: Intelligent data truncation for development and testing
  • MCP Compliant: Full TypeScript implementation with proper logging
  • Error Handling: Comprehensive error management and validation
  • Performance Monitoring: Request timing and execution tracking

Available 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 |

Supported Chains

  • eth - Ethereum
  • arb - Arbitrum
  • matic - Polygon
  • avax - Avalanche
  • bsc - Binance Smart Chain
  • base - Base
  • op - Optimism

Supported Protocols

  • Uniswap (V2, V3, V4)
  • Aave (V2, V3)
  • Compound
  • Balancer
  • SushiSwap
  • Curve
  • MakerDAO
  • And many more...

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", "[email protected]"],
      "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 DeFi 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

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

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.

Support

For support and questions:

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