Skip to content

Commit 431089c

Browse files
authored
Merge branch 'main' into patch-1
2 parents ed54818 + 70e5d87 commit 431089c

File tree

11 files changed

+146
-50
lines changed

11 files changed

+146
-50
lines changed

units/en/_toctree.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
title: Quiz 2 - MCP SDK
2424
- local: unit1/mcp-clients
2525
title: MCP Clients
26+
- local: unit1/hf-mcp-server
27+
title: Hugging Face MCP Server
2628
- local: unit1/gradio-mcp
2729
title: Gradio MCP Integration
2830
- local: unit1/unit1-recap

units/en/unit1/gradio-mcp.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ When you set `mcp_server=True` in `launch()`, several things happen:
114114

115115
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
116116

117+
## Use MCP-compatible Spaces from your client
118+
119+
You can connect any MCP-compatible Space to your assistant via Hugging Face MCP settings:
120+
121+
1. Explore MCP-compatible Spaces: https://huggingface.co/spaces?search=mcp
122+
2. Open https://huggingface.co/settings/mcp (logged in) and add the Space.
123+
3. Restart or refresh your MCP client so it discovers the new tools.
124+
125+
These Spaces expose their functions as tools with arguments and descriptions, so your assistant can call them directly.
126+
117127
## Troubleshooting Tips
118128

119129
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.

units/en/unit1/hf-mcp-server.mdx

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Hugging Face MCP Server
2+
3+
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.
4+
5+
<Tip>
6+
7+
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.
8+
9+
</Tip>
10+
11+
## What you can do
12+
13+
- Search and explore Hub resources: models, datasets, Spaces, and papers.
14+
- Run community tools via MCP‑compatible Gradio apps hosted on [Spaces](https://hf.co/spaces).
15+
- Bring results back into your assistant with metadata, links, and context.
16+
17+
## Built-in tools
18+
19+
The server provides curated tools that work across supported clients:
20+
21+
- Models search and exploration (filter by task, library, downloads, likes)
22+
- Datasets search and exploration (filter by tags, size, modality)
23+
- Spaces semantic search (find apps by capability, e.g., TTS, ASR, OCR)
24+
- Papers semantic search (discover relevant research on the Hub)
25+
26+
## Get started
27+
28+
1. Open your MCP settings: visit https://huggingface.co/settings/mcp while logged in.
29+
30+
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.
31+
32+
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.
33+
34+
<Tip>
35+
36+
The settings page generates the exact configuration your client expects. Use it rather than writing config by hand.
37+
38+
</Tip>
39+
40+
![MCP Settings Example](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hf-mcp-settings.png)
41+
42+
## Using the server
43+
44+
After connecting, ask your assistant to use the Hugging Face tools. Example prompts:
45+
46+
- “Search Hugging Face models for Qwen 3 quantizations.”
47+
- “Find a Space that can transcribe audio files.”
48+
- “Show datasets about weather time‑series.”
49+
- “Create a 1024 × 1024 image of a cat in Ghibli style.”
50+
51+
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.
52+
53+
![HF MCP with Spaces in VS Code](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hf-mcp-vscode.png)
54+
55+
## Add community tools (Spaces)
56+
57+
You can extend your setup with MCP‑compatible Gradio Spaces built by the community:
58+
59+
- Explore Spaces with MCP support [here](https://huggingface.co/spaces?search=mcp).
60+
- Add the relevant space in your MCP settings on Hugging Face [here](https://huggingface.co/settings/mcp).
61+
62+
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.
63+
64+
## Learn more
65+
66+
- Settings and client setup: https://huggingface.co/settings/mcp
67+
- Changelog announcement: https://huggingface.co/changelog/hf-mcp-server
68+
- HF MCP Server documentation: https://huggingface.co/docs/hub/en/hf-mcp-server
69+
- Building your own MCP server with Gradio and Hub tools: https://huggingface.co/docs/hub/main/agents
70+

units/en/unit1/mcp-clients.mdx

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ In this section, you will:
99
* Understand what MCP Clients are and their role in the MCP architecture
1010
* Learn about the key responsibilities of MCP Clients
1111
* Explore the major MCP Client implementations
12-
* Discover how to use Hugging Face's MCP Client implementation
12+
* Discover how to connect to the Hugging Face MCP Server and built-in tools
1313
* See practical examples of MCP Client usage
1414

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

3131
### Chat Interface Clients
3232

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

3535
### Interactive Development Clients
3636

37-
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.
37+
- VS Code extensions with MCP (e.g., Continue)
38+
- Cursor IDE (built-in MCP client)
39+
- Zed editor
3840

39-
Continue.dev is another example of an interactive development client that supports MCP and connects to an MCP server from VS Code.
41+
These clients support connecting to multiple MCP servers and real-time tool invocation.
42+
43+
## Quick connect to Hugging Face MCP Server
44+
45+
Hugging Face provides a hosted MCP server with built-in tools for exploring models, datasets, Spaces, and papers.
46+
47+
1. Visit https://huggingface.co/settings/mcp while logged in.
48+
2. Select your MCP-compatible client (e.g., VS Code, Cursor, Zed, Claude Desktop).
49+
3. Copy the generated configuration snippet into your client's MCP config.
50+
4. Restart or reload your client. You should see “Hugging Face” connected.
51+
52+
Tip: Prefer the generated snippet over hand-written config; it’s tailored per client.
4053

4154
## Configuring MCP Clients
4255

@@ -267,6 +280,8 @@ Now, let's create an agent configuration file `agent.json`.
267280

268281
```json
269282
{
283+
"name": "playwright-agent",
284+
"description": "Agent with Playwright MCP server",
270285
"model": "Qwen/Qwen2.5-72B-Instruct",
271286
"provider": "nebius",
272287
"servers": [
@@ -308,15 +323,15 @@ Create an agent configuration file at `my-agent/agent.json`:
308323

309324
```json
310325
{
311-
"model": "Qwen/Qwen2.5-72B-Instruct",
312-
"provider": "nebius",
313-
"servers": [
314-
{
315-
"type": "stdio",
316-
"command": "npx",
317-
"args": ["@playwright/mcp@latest"]
318-
}
319-
]
326+
"model": "Qwen/Qwen2.5-72B-Instruct",
327+
"provider": "nebius",
328+
"servers": [
329+
{
330+
"type": "stdio",
331+
"command": "npx",
332+
"args": ["@playwright/mcp@latest"]
333+
}
334+
]
320335
}
321336
```
322337

units/en/unit1/unit1-recap.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,9 @@ Official SDKs are available in various programming languages for implementing MC
4343

4444
### Gradio Integration
4545
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.
46+
47+
### Hugging Face MCP enhancements
48+
- Hosted MCP Server now integrates with more clients (VS Code, Cursor, Zed, Claude Desktop).
49+
- Curated built-in tools for searching models, datasets, Spaces, and papers.
50+
- One-click configuration snippets from `https://huggingface.co/settings/mcp`.
51+
- Add MCP-compatible Gradio Spaces via settings and use them directly from your assistant.

units/en/unit2/continue-client.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You can install Continue from the VS Code marketplace.
2020
2. This will open the Continue extension page in VS Code, where you will need to click `Install` again
2121
3. The Continue logo will appear on the left sidebar. For a better experience, move Continue to the right sidebar
2222

23-
![sidebar vs code demo](https://docs.continue.dev/assets/images/move-to-right-sidebar-b2d315296198e41046fc174d8178f30a.gif)
23+
![sidebar vs code demo](https://mintcdn.com/continue-docs/bpNErLbBON28HbZ-/images/move-to-right-sidebar-b2d315296198e41046fc174d8178f30a.gif?w=1100&fit=max&auto=format&n=bpNErLbBON28HbZ-&q=85&s=952730d96fde54e4899b157537008cbd)
2424

2525
With Continue configured, we'll move on to setting up Ollama to pull local models.
2626

@@ -208,4 +208,4 @@ specialized tools, from web automation to file management, all running entirely
208208
on your local machine. Ready to take your development workflow to the next
209209
level? Start by experimenting with different MCP servers from the [Continue Hub
210210
MCP explore page](https://hub.continue.dev/explore/mcp) and discover how
211-
local AI can transform your coding experience.
211+
local AI can transform your coding experience.

units/en/unit2/gradio-client.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Let's connect to an example MCP Server that is already running on Hugging Face.
2020
from smolagents.mcp_client import MCPClient
2121

2222
with MCPClient(
23-
{"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse"}
23+
{"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse", "transport": "sse",}
2424
) as tools:
2525
# Tools from the remote server are available
2626
print("\n".join(f"{t.name}: {t.description}" for t in tools))
@@ -64,7 +64,7 @@ Next, we'll connect to the MCP Server and get the tools that we can use to answe
6464

6565
```python
6666
mcp_client = MCPClient(
67-
{"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse"} # This is the MCP Client we created in the previous section
67+
{"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse", "transport": "sse",} # This is the MCP Client we created in the previous section
6868
)
6969
tools = mcp_client.get_tools()
7070
```
@@ -115,7 +115,7 @@ from smolagents import InferenceClientModel, CodeAgent, MCPClient
115115

116116
try:
117117
mcp_client = MCPClient(
118-
{"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse"}
118+
{"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse", "transport": "sse",}
119119
)
120120
tools = mcp_client.get_tools()
121121

@@ -152,7 +152,7 @@ To deploy your Gradio MCP client to Hugging Face Spaces:
152152

153153
```python
154154
mcp_client = MCPClient(
155-
{"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse"}
155+
{"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse", "transport": "sse"}
156156
)
157157
```
158158

units/en/unit2/gradio-server.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ if __name__ == "__main__":
7575
Let's break down the key components:
7676

7777
1. **Function Definition**:
78-
- The `sentiment_analysis` function takes a text input and returns a dictionary
78+
- The `sentiment_analysis` function takes a text input and returns the string representation of a JSON dictionary
7979
- It uses TextBlob to analyze the sentiment
8080
- The docstring is crucial as it helps Gradio generate the MCP tool schema
8181
- Type hints (`str` and `dict`) help define the input/output schema

units/en/unit2/lemonade-server.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ Now let's provide the asistant with some info to get started.
330330
» Read the contents of C:\Users\your_username\file-assistant\job_description.md
331331
```
332332

333-
You should see the an output similar to the following:
333+
You should see an output similar to the following:
334334

335335
```
336336
<Tool iNtxGmOuXHqZVBWmKnfxsc61xsJbsoAM>read_file {"path":"C:\\Users\\your_username\\file-assistant\\job_description.md","length":23}

units/en/unit2/tiny-agents.mdx

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Let's setup a project with a basic Tiny Agent.
6565
```bash
6666
mkdir my-agent
6767
touch my-agent/agent.json
68+
cd my-agent
6869
```
6970

7071
The JSON file will look like this:
@@ -76,13 +77,11 @@ The JSON file will look like this:
7677
"servers": [
7778
{
7879
"type": "stdio",
79-
"config": {
80-
"command": "npx",
81-
"args": [
82-
"mcp-remote",
83-
"http://localhost:7860/gradio_api/mcp/sse" // This is the MCP Server we created in the previous section
84-
]
85-
}
80+
"command": "npx",
81+
"args": [
82+
"mcp-remote",
83+
"http://localhost:7860/gradio_api/mcp/sse"
84+
]
8685
}
8786
]
8887
}
@@ -91,7 +90,7 @@ The JSON file will look like this:
9190
We can then run the agent with the following command:
9291

9392
```bash
94-
npx @huggingface/tiny-agents run ./my-agent
93+
npx @huggingface/tiny-agents run agent.json
9594
```
9695

9796
</hfoption>
@@ -114,13 +113,11 @@ The JSON file will look like this:
114113
"servers": [
115114
{
116115
"type": "stdio",
117-
"config": {
118-
"command": "npx",
119-
"args": [
120-
"mcp-remote",
121-
"http://localhost:7860/gradio_api/mcp/sse"
122-
]
123-
}
116+
"command": "npx",
117+
"args": [
118+
"mcp-remote",
119+
"http://localhost:7860/gradio_api/mcp/sse"
120+
]
124121
}
125122
]
126123
}
@@ -154,13 +151,11 @@ We could also use an open source model running locally with Tiny Agents. If we s
154151
"servers": [
155152
{
156153
"type": "stdio",
157-
"config": {
158-
"command": "npx",
159-
"args": [
160-
"mcp-remote",
161-
"http://localhost:1234/v1/mcp/sse"
162-
]
163-
}
154+
"command": "npx",
155+
"args": [
156+
"mcp-remote",
157+
"http://localhost:1234/v1/mcp/sse"
158+
]
164159
}
165160
]
166161
}
@@ -271,4 +266,4 @@ This modular approach is what makes MCP so powerful for building flexible AI app
271266

272267
- Check out the Tiny Agents blog posts in [Python](https://huggingface.co/blog/python-tiny-agents) and [TypeScript](https://huggingface.co/blog/tiny-agents)
273268
- Review the [Tiny Agents documentation](https://huggingface.co/docs/huggingface.js/main/en/tiny-agents/README)
274-
- Build something with Tiny Agents!
269+
- Build something with Tiny Agents!

0 commit comments

Comments
 (0)