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.
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.
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
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-serverRun STDIO MCP Server:
docker run -i --rm -e TRANSPORT=stdio -p 3000:3000 -e DEFAULT_HF_TOKEN=hf_xxx hf-mcp-serverTRANSPORT can be stdio, sse, streamingHttp or streamingHttpJson (default).
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
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
stdiotransport,HF_TOKENis used ifDEFAULT_HF_TOKENis not set. HF_API_TIMEOUT: Timeout for Hugging Face API requests in milliseconds (default: 12500ms / 12.5 seconds)