Hugging Face Logo

Hugging Face

Official Remote Remote

Integrates with Hugging Face's ecosystem to search models, datasets, and papers while dynamically co...

3 views
0 installs
Updated Jan 15, 2026
Not audited
Integrates with Hugging Face's ecosystem to search models, datasets, and papers while dynamically connecting to Gradio-based tools hosted on Spaces for extended ML capabilities.

HTTP HEADERS — Authorization (Hugging Face token)

  1. Go to https://huggingface.co and sign in to your account. (huggingface.co)
  2. Open your profile → Settings → Access Tokens (or visit Settings → Access Tokens). (huggingface.co)
  3. Click "New token" / "Create new token". Give it a descriptive name (e.g., "FastMCP Integration") and select an appropriate role:
    • Choose "read" if you only need read/inference access.
    • Choose "write" (or a fine‑grained token granting specific scopes) only if you must push or modify repos. For production, prefer fine‑grained tokens to limit scope. (huggingface.co)
  4. Create the token and copy it immediately — the token is shown only once. Store it securely (password manager/secret store). (huggingface.co)
  5. In the FastMCP connection interface (use the "Install Now" / add connector flow), add an HTTP header with:
    • Header name: Authorization
    • Header value: Bearer YOUR_HF_TOKEN
      Example value: Bearer hf_XXXXXXXXXXXXXXXXXXXX (include the "Bearer " prefix exactly).
      Enter this in the Headers section of the FastMCP connection dialog when installing the Hugging Face MCP connector.

ENVIRONMENT VARIABLES (if you prefer env vars or for server/docker deploys)

  1. Decide which env var to set:
    • DEFAULT_HF_TOKEN — used by the MCP server when no Authorization header is provided (useful for local/dev or STDIO deployments).
    • HF_TOKEN — used by some local clients/SDKs and when running stdio transport.
      (Set the one appropriate to your deployment; the README shows DEFAULT_HF_TOKEN for docker examples and HF_TOKEN for stdio.) (huggingface.co)
  2. Example — Docker run (from the README) to set a default token:
    • docker run --rm -p 3000:3000 -e DEFAULT_HF_TOKEN=hf_XXXXXXXXXXXXXXXX hf-mcp-server
      Replace hf_XXXXXXXXXXXXXXXX with the token you copied. (Do not expose this token in public images or logs.)
  3. Example — shell export for local runs:
    • export HF_TOKEN=hf_XXXXXXXXXXXXXXXX
      Then start the MCP server (or your local client) so the process inherits the environment variable. (huggingface.co)
  4. If you use both a header and an env var: the server prefers an Authorization: Bearer header for each incoming request; DEFAULT_HF_TOKEN / HF_TOKEN serve as fallbacks for local/dev usage. (Use env vars only for secure server-side deployments — avoid setting defaults in production images.) (huggingface.co)

Important notes and best practices

  1. The Authorization header must include the "Bearer " prefix exactly: e.g., Authorization: Bearer hf_XXXXXXXX. Do not omit "Bearer ".
  2. Tokens are displayed only once when created — copy and store them securely. If a token is exposed, immediately revoke/rotate it. (huggingface.co)
  3. For production use prefer fine‑grained tokens with the minimal scopes required. This limits blast radius if a token is leaked. (huggingface.co)

Where to put the values in FastMCP

  1. Click the "Install Now" / add-connector button in FastMCP.
  2. In the connection form that appears, enter:
    • Headers → Authorization : Bearer YOUR_HF_TOKEN
    • (Optional) Environment variables → add DEFAULT_HF_TOKEN or HF_TOKEN with the token value if you want the MCP server to use it as a fallback.
  3. Save/install the connector. The MCP server will use the provided header for incoming requests; env vars are used by the server/process if no header is sent or for local deployments.

If you want, tell me whether you need the exact click-path for the FastMCP UI you’re using (Claude/Gemini/VSCode/other) and I’ll give the precise UI steps for that client.

Quick Start

More for API Development

View All →

More for Developer Tools

View All →

Report Issue

Thank you! Your issue report has been submitted successfully.