Skip to main content
Glama
Hugging Face MCP Server

Hugging Face MCP Server

🤗 フェイスMCPサーバー🤗

鍛冶屋のバッジ

Hugging Face Hub APIへの読み取り専用アクセスを提供するモデルコンテキストプロトコル(MCP)サーバー。このサーバーにより、ClaudeのようなLLM(法学修士)はHugging Faceのモデル、データセット、スペース、論文、コレクションを操作できるようになります。

コンポーネント

リソース

サーバーは、人気のHugging Faceリソースを公開します。

  • リソースにアクセスするためのカスタムhf:// URI スキーム

  • hf://model/{model_id} URI を持つモデル

  • hf://dataset/{dataset_id} URI を持つデータセット

  • hf://space/{space_id} URI を持つスペース

  • すべてのリソースには説明的な名前とJSONコンテンツタイプがあります

プロンプト

サーバーは 2 つのプロンプト テンプレートを提供します。

  • compare-models : 複数のHugging Faceモデル間の比較を生成します

    • 必須のmodel_ids引数(カンマ区切りのモデル ID)

    • モデルの詳細を取得し、比較のためにフォーマットします

  • summarize-paper : Hugging Faceの研究論文を要約します

    • 論文識別に必要なarxiv_id引数

    • 要約の深さを制御するためのオプションのdetail_level引数(brief/detailed)

    • 紙のメタデータと実装の詳細を組み合わせる

ツール

サーバーはいくつかのツール カテゴリを実装します。

  • モデルツール

    • search-models : クエリ、著者、タグ、制限などのフィルターを使用してモデルを検索します

    • get-model-info : 特定のモデルに関する詳細情報を取得する

  • データセットツール

    • search-datasets : フィルターを使用してデータセットを検索する

    • get-dataset-info : 特定のデータセットに関する詳細情報を取得する

  • 宇宙ツール

    • search-spaces : SDKタイプを含むフィルター付きの検索スペース

    • get-space-info : 特定のスペースに関する詳細情報を取得する

  • 紙ツール

    • get-paper-info : 論文とその実装に関する情報を取得する

    • get-daily-papers : 厳選された日刊紙のリストを取得する

  • 収集ツール

    • search-collections : さまざまなフィルターを使用してコレクションを検索する

    • get-collection-info : 特定のコレクションに関する詳細情報を取得する

Related MCP server: UIThub MCP Server

構成

サーバーは設定を必要としませんが、オプションの Hugging Face 認証をサポートしています。

  • HF_TOKEN環境変数を Hugging Face API トークンで設定します。

    • APIレート制限の引き上げ

    • プライベートリポジトリへのアクセス(承認されている場合)

    • 大量のリクエストに対する信頼性の向上

クイックスタート

インストール

Smithery経由でインストール

Smithery経由で Claude Desktop 用の huggingface-mcp-server を自動的にインストールするには:

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

クロードデスクトップ

MacOS の場合: ~/Library/Application\ Support/Claude/claude_desktop_config.json 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
    }
  }
}

発達

建築と出版

配布用のパッケージを準備するには:

  1. 依存関係を同期し、ロックファイルを更新します。

uv sync
  1. パッケージディストリビューションをビルドします。

uv build

これにより、 dist/ディレクトリにソースとホイールのディストリビューションが作成されます。

  1. PyPI に公開:

uv publish

注: 環境変数またはコマンド フラグを使用して PyPI 資格情報を設定する必要があります。

  • トークン: --tokenまたはUV_PUBLISH_TOKEN

  • またはユーザー名/パスワード: --username / UV_PUBLISH_USERNAMEおよび--password / UV_PUBLISH_PASSWORD

デバッグ

MCPサーバーはstdio経由で実行されるため、デバッグが困難になる場合があります。最適なデバッグ環境を実現するには、 MCP Inspectorの使用を強くお勧めします。

次のコマンドを使用して、 npm経由で MCP Inspector を起動できます。

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

起動すると、ブラウザでアクセスしてデバッグを開始できる URL がインスペクタに表示されます。

クロードの例題

このサーバーを Claude で使用する場合は、次のサンプルプロンプトを試してください。

  • 「Hugging Face で 1 億未満のパラメータを持つ BERT モデルを検索する」

  • 「Hugging Faceでテキスト分類に最も人気のあるデータセットを見つける」

  • 「Hugging Face で今日注目されている AI 研究論文は何ですか?」

  • 「Hugging Face MCPサーバーを使用して、arXiv ID 2307.09288の論文を要約してください」

  • 「Hugging FaceのLlama-3-8BとMistral-7Bモデルを比較」

  • 「画像生成に最も人気のあるGradio空間を表示」

  • 「TheBlokeが作成したMixtralモデルを含むコレクションを見つける」

トラブルシューティング

サーバーに問題が発生した場合:

  1. Claude Desktop でサーバー ログを確認します。

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

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

  2. APIレート制限エラーの場合は、Hugging Face APIトークンの追加を検討してください。

  3. Hugging Face APIにアクセスするために、マシンがインターネットに接続されていることを確認してください。

  4. 特定のツールが失敗する場合は、Hugging Faceのウェブサイトから同じデータにアクセスして、それが存在するかどうかを確認してください。

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: owner, item, query, limit.

search-datasetsC

Search for datasets on Hugging Face Hub

Inputs: query, author, tags, limit.

search-modelsC

Search for models on Hugging Face Hub

Inputs: query, author, tags, limit.

search-spacesC

Search for Spaces on Hugging Face Hub

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

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 10 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose with no ambiguity. The tools are cleanly separated into 'get-info' operations for specific resources (collections, daily papers, datasets, models, papers, spaces) and 'search' operations for those same resource types, making it easy for an agent to select the right tool based on whether it needs detailed information about a known item or wants to search for items.

    Naming Consistency5/5

    The tool names follow a perfectly consistent verb_noun pattern throughout. All tools use either 'get-[resource]-info' or 'search-[resource]s' with consistent hyphenation and pluralization, making the naming highly predictable and readable.

    Tool Count5/5

    With 10 tools, this is well-scoped for a Hugging Face Hub server. The count is appropriate as it covers multiple resource types (collections, papers, datasets, models, spaces) with both info retrieval and search capabilities, ensuring each tool earns its place without being overwhelming.

    Completeness4/5

    The tool surface is nearly complete for browsing and searching the Hugging Face Hub, covering key resources with both info and search operations. A minor gap is the lack of tools for interacting with resources (e.g., downloading models/datasets or running spaces), but for a read-only browsing server, it provides excellent coverage.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      A Python-based Model Context Protocol server that integrates with Claude Desktop, allowing users to connect to Hubble API services by configuring the server with their Hubble API key.
      7
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      An unofficial MCP server that provides semantic search capabilities for Hugging Face models and datasets, enabling Claude and other MCP-compatible clients to search, discover, and explore the Hugging Face ecosystem using natural language queries.
      20
      MIT