Skip to main content
Glama
Hugging Face MCP Server

Hugging Face MCP Server

by hwwang06

🤗 Hugging Face MCP Server 🤗

A Model Context Protocol (MCP) server that provides read-only access to the Hugging Face Hub APIs. This server allows LLMs like Claude to interact with Hugging Face's models, datasets, spaces, papers, and collections.

Components

Resources

The server exposes popular Hugging Face resources:

  • Custom hf:// URI scheme for accessing resources

  • Models with hf://model/{model_id} URIs

  • Datasets with hf://dataset/{dataset_id} URIs

  • Spaces with hf://space/{space_id} URIs

  • All resources have descriptive names and JSON content type

Prompts

The server provides two prompt templates:

  • compare-models: Generates a comparison between multiple Hugging Face models

    • Required model_ids argument (comma-separated model IDs)

    • Retrieves model details and formats them for comparison

  • summarize-paper: Summarizes a research paper from Hugging Face

    • Required arxiv_id argument for paper identification

    • Optional detail_level argument (brief/detailed) to control summary depth

    • Combines paper metadata with implementation details

Tools

The server implements several tool categories:

  • Model Tools

    • search-models: Search models with filters for query, author, tags, and limit

    • get-model-info: Get detailed information about a specific model

  • Dataset Tools

    • search-datasets: Search datasets with filters

    • get-dataset-info: Get detailed information about a specific dataset

  • Space Tools

    • search-spaces: Search Spaces with filters including SDK type

    • get-space-info: Get detailed information about a specific Space

  • Paper Tools

    • get-paper-info: Get information about a paper and its implementations

    • get-daily-papers: Get the list of curated daily papers

  • Collection Tools

    • search-collections: Search collections with various filters

    • get-collection-info: Get detailed information about a specific collection

Related MCP server: HF MCP Server

Configuration

The server does not require configuration, but supports optional Hugging Face authentication:

  • Set HF_TOKEN environment variable with your Hugging Face API token for:

    • Higher API rate limits

    • Access to private repositories (if authorized)

    • Improved reliability for high-volume requests

Quickstart

Install

Installing via Smithery

To install huggingface-mcp-server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @shreyaskarnik/huggingface-mcp-server --client claude

Claude Desktop

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

"mcpServers": {
  "huggingface": {
    "command": "uv",
    "args": [
      "--directory",
      "/absolute/path/to/huggingface-mcp-server",
      "run",
      "huggingface_mcp_server.py"
    ],
    "env": {
      "HF_TOKEN": "your_token_here"  // Optional
    }
  }
}

Development

Building and Publishing

To prepare the package for distribution:

  1. Sync dependencies and update lockfile:

uv sync
  1. Build package distributions:

uv build

This will create source and wheel distributions in the dist/ directory.

  1. Publish to PyPI:

uv publish

Note: You'll need to set PyPI credentials via environment variables or command flags:

  • Token: --token or UV_PUBLISH_TOKEN

  • Or username/password: --username/UV_PUBLISH_USERNAME and --password/UV_PUBLISH_PASSWORD

Debugging

Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.

You can launch the MCP Inspector via npm with this command:

npx @modelcontextprotocol/inspector uv --directory /path/to/huggingface-mcp-server run huggingface_mcp_server.py

Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.

Example Prompts for Claude

When using this server with Claude, try these example prompts:

  • "Search for BERT models on Hugging Face with less than 100 million parameters"

  • "Find the most popular datasets for text classification on Hugging Face"

  • "What are today's featured AI research papers on Hugging Face?"

  • "Summarize the paper with arXiv ID 2307.09288 using the Hugging Face MCP server"

  • "Compare the Llama-3-8B and Mistral-7B models from Hugging Face"

  • "Show me the most popular Gradio spaces for image generation"

  • "Find collections created by TheBloke that include Mixtral models"

Troubleshooting

If you encounter issues with the server:

  1. Check server logs in Claude Desktop:

    • macOS: ~/Library/Logs/Claude/mcp-server-huggingface.log

    • Windows: %APPDATA%\Claude\logs\mcp-server-huggingface.log

  2. For API rate limiting errors, consider adding a Hugging Face API token

  3. Make sure your machine has internet connectivity to reach the Hugging Face API

  4. If a particular tool is failing, try accessing the same data through the Hugging Face website to verify it exists

Available Tools

10 tools
get-collection-infoC

Get detailed information about a specific collection

Inputs: namespace (required), collection_id (required).

get-daily-papersB

Get the list of daily papers curated by Hugging Face

Inputs: no named parameters.

get-dataset-infoC

Get detailed information about a specific dataset

Inputs: dataset_id (required).

get-model-infoB

Get detailed information about a specific model

Inputs: model_id (required).

get-paper-infoC

Get information about a specific paper on Hugging Face

Inputs: arxiv_id (required).

get-space-infoC

Get detailed information about a specific Space

Inputs: space_id (required).

search-collectionsC

Search for collections on Hugging Face Hub

Inputs: item, limit, owner, query.

search-datasetsC

Search for datasets on Hugging Face Hub

Inputs: tags, limit, query, author.

search-modelsC

Search for models on Hugging Face Hub

Inputs: tags, limit, query, author.

search-spacesC

Search for Spaces on Hugging Face Hub

Inputs: sdk, tags, limit, query, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 10 tools

    Disambiguation4/5

    Each resource type (models, datasets, spaces, papers, collections) has a clear search/get pair, so boundaries are generally distinct. The only mild overlap is between get-daily-papers (a curated list) and get-paper-info (a specific paper), but the descriptions distinguish them adequately.

    Naming Consistency4/5

    All names follow a hyphenated verb-first pattern (search-X, get-X-info), which is predictable and readable. Minor inconsistency: search tools use plural resource nouns (search-models) while get tools use singular (get-model-info), plus get-daily-papers deviates slightly in structure.

    Tool Count5/5

    Ten tools is well within the ideal 3-15 range and each is scoped to a distinct resource/action. No redundant or filler tools; the set maps cleanly onto the Hub's main entity types.

    Completeness4/5

    Strong coverage of the read/lookup lifecycle across models, datasets, spaces, papers, and collections, covering the hub-browsing domain well. Minor gaps: no general paper search (only curated daily papers) and no file/tree listing or author/org tools, but these are workaround-able.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables access to the Hugging Face Hub API to search and retrieve information about machine learning models, datasets, and their metadata. Provides comprehensive tools for exploring the Hugging Face ecosystem including model details, dataset information, and parquet file access.
      8
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Search and retrieve models, datasets, and spaces from Hugging Face Hub. Enables browsing trending items and getting detailed info on repos.
      117 npm
      MIT