Back to Home
huggingface icon

hf-mcp-server

Verified Safe

by huggingface

Overview

The Hugging Face MCP Server acts as a universal adapter, allowing various LLM clients (like Claude, Gemini, VSCode, Cursor) to interact with the Hugging Face Hub, Gradio applications, and other Hugging Face services through a standardized Model Context Protocol (MCP) interface.

Installation

Run Command
npx @llmindset/hf-mcp-server

Environment Variables

  • TRANSPORT
  • PORT
  • JSON_MODE
  • DEFAULT_HF_TOKEN
  • HF_TOKEN
  • HF_API_TIMEOUT
  • USER_CONFIG_API
  • MCP_STRICT_COMPLIANCE
  • AUTHENTICATE_TOOL
  • SEARCH_ENABLES_FETCH
  • GRADIO_DISCOVERY_CONCURRENCY
  • GRADIO_SPACE_INFO_TIMEOUT
  • GRADIO_SCHEMA_TIMEOUT
  • GRADIO_SPACE_CACHE_TTL
  • GRADIO_SCHEMA_CACHE_TTL
  • HSTS
  • CORS_ALLOWED_ORIGINS
  • ANALYTICS_MODE
  • TEMPLOG_MAX
  • LOG_QUERY_EVENTS
  • LOG_SYSTEM_EVENTS
  • LOGGING_DATASET_ID
  • LOGGING_HF_TOKEN
  • LOG_LEVEL
  • DYNAMIC_SPACE_DATA

Security Notes

The server's design focuses on proxying and facilitating interactions with external Hugging Face APIs and Gradio Spaces. It handles authentication via Hugging Face tokens, which can be provided in the Authorization header or as a `DEFAULT_HF_TOKEN` environment variable. The `start.sh` script explicitly warns about the security implications of `DEFAULT_HF_TOKEN`, indicating awareness of this risk. Extensive network interactions occur with `huggingface.co` and `*.hf.space`. CORS is configured with a default allowlist but is overrideable via environment variables. Input validation for tool calls is performed using `zod` schemas, mitigating common injection risks. While the server constructs commands for remote job execution (e.g., `uv run` commands for the Hugging Face Jobs API), it does not execute these commands locally, shifting that security boundary to the remote Hugging Face Jobs platform. No direct instances of `eval()` for local server execution were found. The primary security considerations for operators revolve around secure management of Hugging Face API tokens and careful configuration of environment variables, especially `DEFAULT_HF_TOKEN` and `CORS_ALLOWED_ORIGINS`.

Similar Servers

Stats

Interest Score42
Security Score7
Cost ClassMedium
Avg Tokens1000
Stars184
Forks49
Last Update2025-12-18

Tags

Hugging FaceMCP ServerLLM IntegrationAI ToolsGradio