Dataset Viewer MCP server

Integrates with the Hugging Face Dataset Viewer API to enable exploration, analysis, and content retrieval of datasets hosted on the Hugging Face Hub.
Back to servers
Setup instructions
Provider
privetin
Release date
Jan 02, 2025
Language
Python
Stats
28 stars

The Dataset Viewer MCP Server provides a convenient way to interact with the Hugging Face Dataset Viewer API, allowing you to browse, search, and analyze datasets hosted on the Hugging Face Hub directly through MCP protocol integration.

Features Overview

Resources

  • Works with dataset:// URI scheme for accessing Hugging Face datasets
  • Handles dataset configurations and splits
  • Provides paginated access to dataset contents
  • Supports authentication for private datasets
  • Enables searching and filtering dataset contents
  • Delivers dataset statistics and analysis

Available Tools

The server comes with several useful tools:

  • validate - Check if a dataset exists and is accessible
  • get_info - Get detailed information about a dataset
  • get_rows - Get paginated contents of a dataset
  • get_first_rows - Get first rows from a dataset split
  • get_statistics - Get statistics about a dataset split
  • search_dataset - Search for text within a dataset
  • filter - Filter rows using SQL-like conditions
  • get_parquet - Download entire dataset in Parquet format

Installation

Prerequisites

  • Python 3.12 or higher
  • uv for package management

Setup Steps

  1. Clone the repository:

    git clone https://github.com/privetin/dataset-viewer.git
    cd dataset-viewer
    
  2. Create and activate a virtual environment:

    # Create virtual environment
    uv venv
    
    # Activate on Unix/MacOS
    source .venv/bin/activate
    
    # Activate on Windows
    .venv\Scripts\activate
    
  3. Install the package:

    uv add -e .
    

Configuration

Setting Environment Variables

For accessing private datasets, set your Hugging Face API token:

# On Unix/MacOS
export HUGGINGFACE_TOKEN=your_token_here

# On Windows
set HUGGINGFACE_TOKEN=your_token_here

Integrating with Claude Desktop

To use the Dataset Viewer MCP Server with Claude Desktop, add the following to your Claude Desktop configuration file:

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

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

Using the MCP Server

Tool Usage Examples

Validating a Dataset

validate(dataset="stanfordnlp/imdb")

Getting Dataset Information

get_info(dataset="stanfordnlp/imdb")

Retrieving Dataset Rows

get_rows(dataset="stanfordnlp/imdb", config="plain_text", split="train", page=0)

Searching Within a Dataset

search_dataset(dataset="stanfordnlp/imdb", config="plain_text", split="train", query="excellent movie")

Filtering Dataset Contents

filter(
  dataset="stanfordnlp/imdb", 
  config="plain_text", 
  split="train", 
  where="label > 0", 
  orderby="label DESC"
)

Working with Private Datasets

For private datasets, include the auth_token parameter in your tool calls:

get_info(dataset="your-org/private-dataset", auth_token="YOUR_HF_TOKEN")

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "dataset-viewer" '{"command":"uv","args":["--directory","parent_to_repo/dataset-viewer","run","dataset-viewer"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later