Dataset Viewer MCP Server

Dataset Viewer MCP Server

site icon
2025.01.06 14
Python数据集浏览数据分析内容生成
Dataset Viewer MCP Server 是一个用于与 Hugging Face Dataset Viewer API 交互的 MCP 服务器,提供浏览和分析托管在 Hugging Face Hub 上的数据集的能力。
View on GitHub

Overview

基本能力

产品定位

Dataset Viewer MCP Server 是一个用于浏览和分析 Hugging Face Hub 上数据集的工具,提供丰富的查询和过滤功能。

核心功能

  • 使用 dataset:// URI 方案访问 Hugging Face 数据集
  • 支持数据集配置和分割
  • 提供分页访问数据集内容
  • 处理私有数据集的认证
  • 支持搜索和过滤数据集内容
  • 提供数据集统计和分析

适用场景

  • 数据科学家需要快速浏览和分析公开数据集
  • 研究人员需要查询特定数据子集
  • 开发者需要集成数据集浏览功能到自己的应用中

工具列表

  1. validate: 检查数据集是否存在且可访问
  2. get_info: 获取数据集的详细信息
  3. get_rows: 获取数据集的分页内容
  4. get_first_rows: 获取数据集分割的第一行数据
  5. get_statistics: 获取数据集分割的统计信息
  6. search_dataset: 在数据集中搜索文本
  7. filter: 使用类似SQL的条件过滤行
  8. get_parquet: 下载整个Parquet格式的数据集

常见问题解答

  • 需要访问私有数据集时,需提供 auth_token 参数
  • 分页查询时使用 page 参数(0-based)

使用教程

使用依赖

  • Python 3.12 或更高版本
  • uv - 快速Python包安装器和解析器

安装教程

  1. 克隆仓库:
git clone https://github.com/privetin/dataset-viewer.git
cd dataset-viewer
  1. 创建虚拟环境并安装:
# 创建虚拟环境
uv venv

# 激活虚拟环境
# Unix:
source .venv/bin/activate
# Windows:
.venv\Scripts\activate

# 开发模式安装
uv add -e .

调试方式

  1. 验证数据集:
{
  "dataset": "stanfordnlp/imdb"
}
  1. 获取数据集信息:
{
  "dataset": "stanfordnlp/imdb"
}
  1. 搜索数据集内容:
{
  "dataset": "stanfordnlp/imdb",
  "config": "plain_text",
  "split": "train",
  "query": "great movie"
}
  1. 过滤和排序行:
{
  "dataset": "stanfordnlp/imdb",
  "config": "plain_text",
  "split": "train",
  "where": "label = 'positive'",
  "orderby": "text DESC",
  "page": 0
}
  1. 获取数据集统计:
{
  "dataset": "stanfordnlp/imdb",
  "config": "plain_text",
  "split": "train"
}

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。