Hugging Face Dataset Viewer on MCP Server
Explore Hugging Face datasets on MCP server with search, filtering, dataset statistics, and one-click data export for fast analysis.
Overview
This MCP (Model Context Protocol) server provides a lightweight viewer for Hugging Face datasets. It exposes a searchable, filterable interface and simple APIs that let developers inspect dataset metadata, preview examples, compute basic statistics, and export subsets for downstream analysis. The server is intended to speed up data exploration when preparing training or evaluation pipelines that run alongside an MCP-compliant model service.
The viewer is useful when you want to rapidly understand the contents and shape of a dataset without downloading full archives or writing ad-hoc scripts. It supports text- and table-oriented datasets, enables faceted search and sampling, and offers one-click export to common formats so you can iterate faster on preprocessing, labeling, or model-context creation.
GitHub: https://github.com/privetin/dataset-viewer
Features
- Browse Hugging Face datasets metadata and splits
- Full-text search and field-level filtering across examples
- Sample preview of records (configurable sample size)
- Computation of common dataset statistics (counts, distributions, missing values)
- One-click export to CSV / JSON for quick analysis
- REST API endpoints for programmatic access (indexing, search, export)
- Works as an MCP server component to integrate dataset context with model responses
- Docker support for quick deployment
Installation / Configuration
Prerequisites: Python 3.8+, Git, and (optionally) Docker. You will typically need a Hugging Face token for private datasets or rate-limited access.
Clone and install locally:
Set required environment variables (example):
# optional, required for private datasets or higher rate limits
# optional cache directory for downloaded datasets
Run the server with an ASGI server (uvicorn example):
# If the package exposes `app` at dataset_viewer.app:app — adjust import path if different
Docker (build and run):
Configuration options can also be provided via a config file (config.yaml) if the project exposes one — check the repo root for default configuration templates.
Environment variables and configuration (common options)
| Variable | Purpose | Default |
|---|---|---|
| HF_TOKEN | Hugging Face access token (optional) | none |
| DATA_DIR | Local cache directory for datasets | ./data_cache |
| PORT | HTTP port for the server | 8080 |
| LOG_LEVEL | Logging verbosity (DEBUG/INFO/WARN) | INFO |
Available Tools / Resources
- Web UI: interactive front-end to search, filter, preview, and export dataset slices.
- REST API: endpoints for programmatic listing of datasets, split metadata, search queries, and export requests.
- Exporter: background job or synchronous endpoint that writes selected records to CSV or NDJSON for downstream tooling.
- Statistics engine: computes basic distributions, null counts, and example summaries per field.
- MCP integration layer: adapters that allow dataset context to be requested by MCP-aware model tooling.
Refer to the repository’s API documentation or code comments for the exact endpoint paths and payload formats.
Use Cases
Quick dataset inspection before training
- Browse a dataset’s splits and label distribution to decide whether to subsample or re-balance.
- Export a stratified sample as CSV and run local experiments in a Jupyter notebook.
Data-driven prompt/context building for models
- Use the REST API to fetch examples matching a query and assemble context windows for an LLM that follows MCP conventions.
Labeling and annotation preparation
- Filter examples by field value or missing labels, export a CSV subset, and feed it into your annotation tool.
Preprocessing pipeline debugging
- Preview raw examples and computed statistics to validate tokenization, text normalization, or column mappings before batching into training pipelines.
Lightweight dataset sharing within a team
- Spin up the Docker container and allow teammates to explore dataset structure and example content without downloading large files locally.
Tips for Developers
- If you plan to index large datasets, run the server with sufficient disk cache and monitor memory usage.
- Use HF_TOKEN for private datasets or to avoid low anonymous request limits from the Hugging Face Hub.
- Check the repository README and API docs for exact route names and sample payloads if you need to automate export workflows.
For more details, sample code, and the latest updates, see the project on GitHub: https://github.com/privetin/dataset-viewer.