huggingface/hf-mcp-server
A TypeScript MCP gateway for Hugging Face Hub APIs and Gradio tools
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
This TypeScript pnpm workspace separates Hub API and search tool implementations in packages/mcp from the MCP server and web application in packages/app. The same integration is available as a STDIO subprocess or as stateless Streamable HTTP JSON at /mcp. The web app serves /metrics, and HTTP deployments publish a server card at /mcp/server-card with ETag-based revalidation. On HTTP, tool exposure follows the caller's resolved Hugging Face token permissions rather than a process-wide default token.
The tool surface extends beyond built-in Hub operations to Gradio Spaces and upstream MCP servers. PROXY_TOOLS_CSV accepts a local path or HTTPS URL; at startup the server runs initialize and tools/list against each configured endpoint with a 10-second timeout and skips sources that fail or return no tools. The gateway can consume upstream SSE or JSON responses without changing its own direct JSON-RPC response mode. Schema discovery uses a separate optional PROXY_TOKEN; forwarding the caller's token during calls and MCP App resource reads is a per-source policy.
Key Capabilities & Differentiators
The server gives MCP clients a tool interface to Hub search and APIs and access to Gradio applications. Anonymous callers receive read-only discovery. Authenticated callers can receive write, repository-creation, Jobs, or Sandbox tools as their scopes permit. One meaningful least-privilege distinction is Jobs: the legacy combined hf_jobs tool requires Jobs write capability, whereas ?bouquet=ptc exposes hf_jobs_list, hf_job_get, and hf_job_logs to read-only tokens.
The management UI covers server status and MCP method metrics. Its Skills tab separates metadata probes from successful reads of SKILL.md and supporting files; a read is not evidence of execution or complete installation. The live view is process-local, capped at 10,000 events and 24 hours, and currently covers Streamable HTTP JSON. A separate Events view tracks SEP-3415 capability advertisement, listing, and polling outcomes. For catalog operators, the Python 3 dynamic-Space health check inspects Hub runtime state and Gradio MCP schemas without invoking tools or waking sleeping Spaces by default.
Trade-offs & Limitations
Compared with calling the Hub API directly, this server removes the need to build a separate tool integration for each MCP client. In exchange, integrators must account for transport compatibility, token-dependent tool discovery, and the availability of configured upstreams. Compared with the hosted Hugging Face endpoint, self-hosting gives operators control over host policy, proxy sources, and telemetry exposure, but also transfers responsibility for TLS, access control, credentials, and upgrades. It does not turn the Hub or Spaces into an offline stack.
Two defaults deserve an explicit deployment decision. HTTP allows anonymous discovery by default; MCP_STRICT_TOKEN=true requires a token, rejects invalid tokens with 401, and returns 503 when validation is unavailable. Separately, proxy token forwarding defaults to true for compatibility; disable it for any upstream that does not need the caller's Hugging Face credential. The optional metrics password is a shared gate without user roles, rate limiting, or an audit trail. Use platform or reverse-proxy controls for management access rather than relying on that password alone.
Hardware & Deployment Guide
The lowest-maintenance path is https://huggingface.co/mcp. For a local client subprocess, use npx @llmindset/hf-mcp-server; for local stateless HTTP, use npx @llmindset/hf-mcp-server-http. Docker defaults to HTTP on port 3000, with /mcp for clients and /metrics for operators. The supplied Dockerfile uses node:24.22.3-alpine, tini, Corepack, and a frozen-lockfile pnpm install. Source builds use the Corepack-managed pnpm 10.12.3 workflow with pnpm install and pnpm build.
For shared HTTP deployments, set MCP_ALLOWED_HOSTS for the intended hostnames, decide whether anonymous discovery should be available, and protect management routes at the reverse proxy or platform. DEFAULT_HF_TOKEN and the HF_TOKEN fallback apply to STDIO only. Local hosting moves the gateway, not the Hub or remote tool execution, so plan for upstream connectivity rather than local inference hardware. Release v0.5.1 aligned Hub Link pagination, FUSE volume rules, and Job log streaming; v0.5.2 added MCP Events tracking and a dashboard tab; v0.5.3 updated the inference-provider examples for hf_models_search.
Teams that want MCP clients to discover Hub resources, invoke selected Gradio tools, or inspect Jobs with Hugging Face permissions enforced at tool registration.
You need offline inference, a general-purpose model-serving runtime, or a fixed set of Hub API calls that application code can make directly.
Quick Start & Installation
npx @llmindset/hf-mcp-server # Start in STDIO mode npx @llmindset/hf-mcp-server-http # Start in stateless Streamable HTTP JSON mode
Comparison vs. Top Coding, Skills & MCP Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| hf-mcp-server ★ | 326 | +2 | TypeScript | MIT | A TypeScript MCP gateway for Hugging Face Hub APIs and Gradio tools |
| rea | 488.8k | +7.6k | TypeScript | MIT | A local CLI and MCP server for evidence-backed app and binary analysis |
| chrome-devtools-mcp | 60.4k | +760 | TypeScript | Apache-2.0 | Chrome DevTools via MCP and CLI for live browser debugging and performance analy |
| skills | 42.3k | +1.1k | TypeScript | MIT | TypeScript CLI for distributing and restoring skills across coding agents |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/huggingface/hf-mcp-server.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about hf-mcp-server
How do I connect an MCP client, and where do credentials go?
Does self-hosting require a GPU, and how should I size it?
Can I run it commercially or deploy it inside my organization?
When should I use hosted MCP, self-hosted MCP, or the Hub API directly?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy