Dataset Viewer MCP Server

Dataset Viewer MCP Server

用于与Hugging Face数据集查看器API交互的MCP Server,提供数据集浏览、过滤和统计功能。

概述

这是一个用于与 Hugging Face 数据集查看器 API 交互的 MCP 服务器,使您能够轻松浏览和分析 Hugging Face Hub 上的数据集。

安装

前提条件

  • Python 3.12+
  • uv

步骤

# 1. 克隆仓库
git clone https://github.com/privetin/dataset-viewer.git
cd dataset-viewer

# 2. 创建并激活虚拟环境
uv venv
source .venv/bin/activate  # Unix
# 或 .venv\Scripts\activate  # Windows

# 3. 安装
uv add -e .

Claude Desktop 集成

编辑配置文件:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json

添加:

{
  "mcpServers": {
    "dataset-viewer": {
      "command": "uv",
      "args": ["run", "dataset-viewer"]
    }
  }
}

主要功能

  1. 验证数据集

    {
      "dataset": "stanfordnlp/imdb"
    }
    
  2. 获取数据集信息

    {
      "dataset": "stanfordnlp/imdb"
    }
    
  3. 查看数据集行

    {
      "dataset": "stanfordnlp/imdb",
      "config": "plain_text",
      "split": "train",
      "page": 0
    }
    
  4. 搜索数据集

    {
      "dataset": "stanfordnlp/imdb",
      "config": "plain_text",
      "split": "train",
      "query": "great movie"
    }
    
  5. 过滤和排序

    {
      "dataset": "stanfordnlp/imdb",
      "config": "plain_text",
      "split": "train",
      "where": "label = 'positive'",
      "orderby": "text DESC"
    }
    

访问私有数据集

为访问私有数据集,可以设置环境变量或在请求中传递令牌:

{
  "dataset": "your-account/private-dataset",
  "auth_token": "hf_..."
}

其他功能

  • 获取统计信息: 分析数据集结构和内容
  • 导出为 Parquet: 下载完整数据集

许可

MIT 许可 - 详情见 LICENSE 文件