Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions units/en/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
title: Quiz 2 - MCP SDK
- local: unit1/mcp-clients
title: MCP Clients
- local: unit1/hf-mcp-server
title: Hugging Face MCP Server
- local: unit1/gradio-mcp
title: Gradio MCP Integration
- local: unit1/unit1-recap
Expand Down
10 changes: 10 additions & 0 deletions units/en/unit1/gradio-mcp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ When you set `mcp_server=True` in `launch()`, several things happen:

4. **Hosted MCP Servers on 🤗 Spaces**: You can publish your Gradio application for free on Hugging Face Spaces, which will allow you to have a free hosted MCP server. Here's an example of such a Space: https://huggingface.co/spaces/abidlabs/mcp-tools

## Use MCP-compatible Spaces from your client

You can connect any MCP-compatible Space to your assistant via Hugging Face MCP settings:

1. Explore MCP-compatible Spaces: https://huggingface.co/spaces?search=mcp
2. Open https://huggingface.co/settings/mcp (logged in) and add the Space.
3. Restart or refresh your MCP client so it discovers the new tools.

These Spaces expose their functions as tools with arguments and descriptions, so your assistant can call them directly.

## Troubleshooting Tips

1. **Type Hints and Docstrings**: Ensure you provide type hints and valid docstrings for your functions. The docstring should include an "Args:" block with indented parameter names.
Expand Down
70 changes: 70 additions & 0 deletions units/en/unit1/hf-mcp-server.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Hugging Face MCP Server

The Hugging Face MCP (Model Context Protocol) Server connects your MCP‑compatible AI assistant (for example VS Code, Cursor, 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, chat or CLI.

<Tip>

The main advanatage of the Hugging Face MCP Server is that it provides a built-in tools for the hub as well as community tools based on Gradio Spaces. As we start to build our own MCP servers, we'll see that we can use the Hugging Face MCP Server as a reference for our own MCP servers.

</Tip>

## What you can do

- Search and explore Hub resources: models, datasets, Spaces, and papers.
- Run community tools via MCP‑compatible Gradio apps hosted on [Spaces](https://hf.co/spaces).
- Bring results back into your assistant with metadata, links, and context.

## Built-in tools

The server provides curated tools that work across supported clients:

- Models search and exploration (filter by task, library, downloads, likes)
- Datasets search and exploration (filter by tags, size, modality)
- Spaces semantic search (find apps by capability, e.g., TTS, ASR, OCR)
- Papers semantic search (discover relevant research on the Hub)

## Get started

1. Open your MCP settings: visit https://huggingface.co/settings/mcp while logged in.

2. Pick your client: select your MCP‑compatible client (for example VS Code, Cursor, Zed, Claude Desktop). The page shows client‑specific instructions and a ready‑to‑copy configuration snippet.

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.

<Tip>

The settings page generates the exact configuration your client expects. Use it rather than writing config by hand.

</Tip>

![MCP Settings Example](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hf-mcp-settings.png)

## Using the server

After connecting, ask your assistant to use the Hugging Face tools. Example prompts:

- “Search Hugging Face models for Qwen 3 quantizations.”
- “Find a Space that can transcribe audio files.”
- “Show datasets about weather time‑series.”
- “Create a 1024 × 1024 image of a cat in Ghibli style.”

Your assistant will call MCP tools exposed by the Hugging Face MCP Server (including Spaces) 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.

![HF MCP with Spaces in VS Code](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hf-mcp-vscode.png)

## Add community tools (Spaces)

You can extend your setup with MCP‑compatible Gradio Spaces built by the community:

- Explore Spaces with MCP support [here](https://huggingface.co/spaces?search=mcp).
- Add the relevant space in your MCP settings on Hugging Face [here](https://huggingface.co/settings/mcp).

Gradio MCP apps expose their functions as tools (with arguments and descriptions) so your assistant can call them directly. Please, restart or refresh your client so it picks up new tools you add.

## Learn more

- Settings and client setup: https://huggingface.co/settings/mcp
- Changelog announcement: https://huggingface.co/changelog/hf-mcp-server
- HF MCP Server documentation: https://huggingface.co/docs/hub/en/hf-mcp-server
- Building your own MCP server with Gradio and Hub tools: https://huggingface.co/docs/hub/main/agents

21 changes: 17 additions & 4 deletions units/en/unit1/mcp-clients.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In this section, you will:
* Understand what MCP Clients are and their role in the MCP architecture
* Learn about the key responsibilities of MCP Clients
* Explore the major MCP Client implementations
* Discover how to use Hugging Face's MCP Client implementation
* Discover how to connect to the Hugging Face MCP Server and built-in tools
* See practical examples of MCP Client usage

<Tip>
Expand All @@ -30,13 +30,26 @@ Let's start by exploring the user interface clients that are available for the M

### Chat Interface Clients

Anthropic's Claude Desktop stands as one of the most prominent MCP Clients, providing integration with various MCP Servers.
- Claude Desktop (Anthropic)

### Interactive Development Clients

Cursor's MCP Client implementation enables AI-powered coding assistance through direct integration with code editing capabilities. It supports multiple MCP Server connections and provides real-time tool invocation during coding, making it a powerful tool for developers.
- VS Code extensions with MCP (e.g., Continue)
- Cursor IDE (built-in MCP client)
- Zed editor

Continue.dev is another example of an interactive development client that supports MCP and connects to an MCP server from VS Code.
These clients support connecting to multiple MCP servers and real-time tool invocation.

## Quick connect to Hugging Face MCP Server

Hugging Face provides a hosted MCP server with built-in tools for exploring models, datasets, Spaces, and papers.

1. Visit https://huggingface.co/settings/mcp while logged in.
2. Select your MCP-compatible client (e.g., VS Code, Cursor, Zed, Claude Desktop).
3. Copy the generated configuration snippet into your client's MCP config.
4. Restart or reload your client. You should see “Hugging Face” connected.

Tip: Prefer the generated snippet over hand-written config; it’s tailored per client.

## Configuring MCP Clients

Expand Down
6 changes: 6 additions & 0 deletions units/en/unit1/unit1-recap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ Official SDKs are available in various programming languages for implementing MC

### Gradio Integration
Gradio allows easy creation of web interfaces that expose capabilities to the MCP protocol, making it accessible for both humans and AI models. This integration provides a human-friendly interface alongside AI-accessible tools with minimal code.

### Hugging Face MCP enhancements
- Hosted MCP Server now integrates with more clients (VS Code, Cursor, Zed, Claude Desktop).
- Curated built-in tools for searching models, datasets, Spaces, and papers.
- One-click configuration snippets from `https://huggingface.co/settings/mcp`.
- Add MCP-compatible Gradio Spaces via settings and use them directly from your assistant.