Skip to main content
Glama

Hugging Face MCP Server

by evalstate

hf-mcp-server packages

Quick Guide

This repo contains:

  • (/mcp) MCP Implementations of Hub API and Search endpoints for integration with MCP Servers.
  • (/app) An MCP Server and Web Application for deploying endpoints.

MCP Server

The following transports are supported:

  • STDIO
  • SSE (To be deprecated, but still commonly deployed).
  • StreamableHTTP
  • StreamableHTTP in Stateless JSON Mode (StreamableHTTPJson)

The Web Application and HTTP Transports start by default on Port 3000.

SSE and StreamableHTTP services are available at /sse and /mcp respectively. Although though not strictly enforced by the specification this is common convention.

Tip

The Web Application allows you to switch tools on and off. For STDIO, SSE and StreamableHTTP this will send a ToolListChangedNotification to the MCP Client. In StreamableHTTPJSON mode the tool will not be listed when the client next requests the tool lists.

Development

This project uses pnpm for build and development.

pnpm run clean -> clean build artifacts

pnpm run build -> build packages

pnpm run start -> start the mcp server application

pnpm run buildrun -> clean, build and start

pnpm run dev -> concurrently watch mcp and start dev server with HMR

Docker Build

Build the image:

docker build -t hf-mcp-server .

Run with default settings (Streaming HTTP JSON Mode), Dashboard on Port 3000:

docker run --rm -p 3000:3000 -e DEFAULT_HF_TOKEN=hf_xxx hf-mcp-server

Run STDIO MCP Server:

docker run -i --rm -e TRANSPORT=stdio -p 3000:3000 -e DEFAULT_HF_TOKEN=hf_xxx hf-mcp-server

TRANSPORT can be stdio, sse, streamingHttp or streamingHttpJson (default).

Transport Endpoints

The different transport types use the following endpoints:

  • SSE: /sse (with message endpoint at /message)
  • Streamable HTTP: /mcp (regular or JSON mode)
  • STDIO: Uses stdin/stdout directly, no HTTP endpoint

Stateful Connection Management

The sse and streamingHttp transports are both stateful - they maintain a connection with the MCP Client through an SSE connection. When using these transports, the following configuration options take effect:

Environment VariableDefaultDescription
MCP_CLIENT_HEARTBEAT_INTERVAL30000msHow often to check SSE connection health
MCP_CLIENT_CONNECTION_CHECK90000msHow often to check for stale sessions
MCP_CLIENT_CONNECTION_TIMEOUT300000msRemove sessions inactive for this duration
MCP_PING_ENABLEDtrueEnable ping keep-alive for sessions
MCP_PING_INTERVAL30000msInterval between ping cycles

Environment Variables

The server respects the following environment variables:

  • TRANSPORT: The transport type to use (stdio, sse, streamableHttp, or streamableHttpJson)
  • DEFAULT_HF_TOKEN: ⚠️ Requests are serviced with the HF_TOKEN received in the Authorization: Bearer header. The DEFAULT_HF_TOKEN is used if no header was sent. Only set this in Development / Test environments or for local STDIO Deployments. ⚠️
  • If running with stdio transport, HF_TOKEN is used if DEFAULT_HF_TOKEN is not set.
  • HF_API_TIMEOUT: Timeout for Hugging Face API requests in milliseconds (default: 12500ms / 12.5 seconds)
  • USER_CONFIG_API: URL to use for User settings (defaults to Local front-end)
  • MCP_STRICT_COMPLIANCE: set to True for GET 405 rejects in JSON Mode (default serves a welcome page).
-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

An MCP server that provides Hugging Face Hub API and Search endpoints through multiple transport protocols (STDIO, SSE, StreamableHTTP, and StreamableHTTPJson), enabling integration with AI model capabilities.

  1. Quick Guide
    1. MCP Server
  2. Development
    1. Docker Build
      1. Transport Endpoints
      2. Stateful Connection Management
      3. Environment Variables

    Related MCP Servers

    • -
      security
      A
      license
      -
      quality
      An MCP server that generates 2D and 3D game assets from text prompts using AI models from Hugging Face Spaces, allowing developers to easily create game art through Claude Desktop or other MCP clients.
      Last updated -
      34
      JavaScript
      MIT License
      • Apple
      • Linux
    • -
      security
      A
      license
      -
      quality
      A Model Context Protocol server that provides Claude and other LLMs with read-only access to Hugging Face Hub APIs, enabling interaction with models, datasets, spaces, papers, and collections through natural language.
      Last updated -
      4
      Python
      MIT License
      • Apple
    • -
      security
      A
      license
      -
      quality
      An MCP server that tracks trending AI models, datasets, and spaces on Hugging Face.
      Last updated -
      Python
      MIT License
    • -
      security
      F
      license
      -
      quality
      A Multi-modal Conversation Protocol (MCP) server that enables interacting with web APIs through a curl-like interface, providing access to various websites and APIs with user authentication and response transformations.
      Last updated -
      1
      TypeScript

    View all related MCP servers

    MCP directory API

    We provide all the information about MCP servers via our MCP API.

    curl -X GET 'https://glama.ai/api/mcp/v1/servers/evalstate/hf-mcp-server'

    If you have feedback or need assistance with the MCP directory API, please join our Discord server