|
| 1 | +# HF MCP Server |
| 2 | + |
| 3 | +The Hugging Face MCP (Model Context Protocol) Server connects your MCP‑compatible AI assistant (for example Cursor, VS Code extensions, Zed, or Claude Desktop) directly to the Hugging Face Hub. Once connected, your assistant can search and explore Hub resources and use community tools, all from within your editor. |
| 4 | + |
| 5 | +<Tip warning={true}> |
| 6 | +This feature is experimental and will continue to evolve. |
| 7 | +</Tip> |
| 8 | + |
| 9 | +## What you can do |
| 10 | + |
| 11 | +- Search and explore Hub resources: models, datasets, Spaces, and papers |
| 12 | +- Run community tools via MCP‑compatible Gradio apps hosted on Spaces |
| 13 | +- Bring results back into your assistant with metadata, links, and context |
| 14 | + |
| 15 | +## Get started |
| 16 | + |
| 17 | +1) Open your MCP settings: visit https://huggingface.co/settings/mcp while logged in. |
| 18 | + |
| 19 | +2) Pick your client: select your MCP‑compatible client (for example Cursor, VS Code, Zed, Claude Desktop). The page shows client‑specific instructions and a ready‑to‑copy configuration snippet. |
| 20 | + |
| 21 | +3) Paste and restart: copy the snippet into your client’s MCP configuration, save, and restart/reload the client. You should see “Hugging Face” (or similar) listed as a connected MCP server in your client. |
| 22 | + |
| 23 | +<Tip> |
| 24 | +The settings page generates the exact configuration your client expects. Use it rather than writing config by hand. |
| 25 | +</Tip> |
| 26 | + |
| 27 | +## Using the server |
| 28 | + |
| 29 | +After connecting, ask your assistant to use the Hugging Face tools. Example prompts: |
| 30 | + |
| 31 | +- “Search Hugging Face models for Llama‑3.1 fine‑tunes for summarization.” |
| 32 | +- “Find a Space that can transcribe audio files.” |
| 33 | +- “Show datasets about weather time‑series.” |
| 34 | +- “Look up papers on diffusion transformers and list recent ones.” |
| 35 | + |
| 36 | +Your assistant will call MCP tools exposed by the HF MCP Server and return results (titles, owners, downloads, links, and so on). You can then open the resource on the Hub or continue iterating in the same chat. |
| 37 | + |
| 38 | +## Add community tools (Gradio MCP) |
| 39 | + |
| 40 | +You can extend your setup with MCP‑compatible Gradio apps built by the community: |
| 41 | + |
| 42 | +- Explore Spaces with MCP support: https://huggingface.co/spaces?filter=mcp-server |
| 43 | +- Follow your client’s instructions to add an additional MCP server by URL, or use the prompts in https://huggingface.co/settings/mcp if available in your client’s card. |
| 44 | + |
| 45 | +Gradio MCP apps expose their functions as tools (with arguments and descriptions) so your assistant can call them directly. |
| 46 | + |
| 47 | +## Security and permissions |
| 48 | + |
| 49 | +- Scoped access: the server uses your authenticated Hugging Face account to access Hub resources. You can review or revoke access anytime from your Hugging Face settings. |
| 50 | +- Least surprise: tools only perform actions you prompt them to do in your assistant; browsing and lookups are read‑only. |
| 51 | +- Privacy: results returned to your client are based on your account’s visibility and permissions (for example, private org content remains private). |
| 52 | + |
| 53 | +## Troubleshooting |
| 54 | + |
| 55 | +- Not showing up in client: re‑open https://huggingface.co/settings/mcp and re‑copy the configuration for your specific client, then restart the client. |
| 56 | +- Auth or 401/403 errors: ensure you are signed in on the Hugging Face website in the same browser/profile you used to open the settings page; if your client supports tokens, update them and try again. |
| 57 | +- Enterprise network issues: some clients use Server‑Sent Events (SSE) or websockets—ensure your network/proxy allows these connections. |
| 58 | + |
| 59 | +## Learn more |
| 60 | + |
| 61 | +- Settings and client setup: https://huggingface.co/settings/mcp |
| 62 | +- Changelog announcement: https://huggingface.co/changelog/hf-mcp-server |
| 63 | +- Agents on the Hub overview: ./agents |
| 64 | +- MCP spec and ecosystem: https://github.com/modelcontextprotocol/spec |
| 65 | + |
0 commit comments