Dataset Viewer MCP Server
An MCP server for interacting with the Hugging Face Dataset Viewer API, providing capabilities to browse and analyze datasets hosted on the Hugging Face Hub.
Features
Resources
- Uses
dataset://
URI scheme for accessing Hugging Face datasets - Supports dataset configurations and splits
- Provides paginated access to dataset contents
- Handles authentication for private datasets
- Supports searching and filtering dataset contents
- Provides dataset statistics and analysis
Tools
The server provides the following tools:
-
validate
- Check if a dataset exists and is accessible
- Parameters:
dataset
: Dataset identifier (e.g. 'stanfordnlp/imdb')auth_token
(optional): For private datasets
-
get_info
- Get detailed information about a dataset
- Parameters:
dataset
: Dataset identifierauth_token
(optional): For private datasets
-
get_rows
- Get paginated contents of a dataset
- Parameters:
dataset
: Dataset identifierconfig
: Configuration namesplit
: Split namepage
(optional): Page number (0-based)auth_token
(optional): For private datasets
-
get_first_rows
- Get first rows from a dataset split
- Parameters:
dataset
: Dataset identifierconfig
: Configuration namesplit
: Split nameauth_token
(optional): For private datasets
-
get_statistics
- Get statistics about a dataset split
- Parameters:
dataset
: Dataset identifierconfig
: Configuration namesplit
: Split nameauth_token
(optional): For private datasets
-
search_dataset
- Search for text within a dataset
- Parameters:
dataset
: Dataset identifierconfig
: Configuration namesplit
: Split namequery
: Text to search forauth_token
(optional): For private datasets
-
filter
- Filter rows using SQL-like conditions
- Parameters:
dataset
: Dataset identifierconfig
: Configuration namesplit
: Split namewhere
: SQL WHERE clause (e.g. "score > 0.5")orderby
(optional): SQL ORDER BY clausepage
(optional): Page number (0-based)auth_token
(optional): For private datasets
-
get_parquet
- Download entire dataset in Parquet format
- Parameters:
dataset
: Dataset identifierauth_token
(optional): For private datasets
Installation
Prerequisites
- Python 3.12 or higher
- uv - Fast Python package installer and resolver
Setup
- Clone the repository:
1git clone https://github.com/privetin/dataset-viewer.git 2cd dataset-viewer
- Create a virtual environment and install:
1# Create virtual environment 2uv venv 3 4# Activate virtual environment 5# On Unix: 6source .venv/bin/activate 7# On Windows: 8.venv\Scripts\activate 9 10# Install in development mode 11uv add -e .
Configuration
Environment Variables
HUGGINGFACE_TOKEN
: Your Hugging Face API token for accessing private datasets
Claude Desktop Integration
Add the following to your Claude Desktop config file:
On Windows: %APPDATA%\Claude\claude_desktop_config.json
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
1{ 2 "mcpServers": { 3 "dataset-viewer": { 4 "command": "uv", 5 "args": [ 6 "run", 7 "dataset-viewer" 8 ] 9 } 10 } 11}
Usage Examples
- Validate a dataset:
1{ 2 "dataset": "stanfordnlp/imdb" 3}
- Get dataset information:
1{ 2 "dataset": "stanfordnlp/imdb" 3}
- Search dataset contents:
1{ 2 "dataset": "stanfordnlp/imdb", 3 "config": "plain_text", 4 "split": "train", 5 "query": "great movie" 6}
- Filter and sort rows:
1{ 2 "dataset": "stanfordnlp/imdb", 3 "config": "plain_text", 4 "split": "train", 5 "where": "label = 'positive'", 6 "orderby": "text DESC", 7 "page": 0 8}
- Get dataset statistics:
1{ 2 "dataset": "stanfordnlp/imdb", 3 "config": "plain_text", 4 "split": "train" 5}
License
MIT License - see LICENSE for details