Skip to content

Commit ac747b9

Browse files
authored
Merge branch 'main' into patch-3
2 parents 740f317 + 2787f19 commit ac747b9

File tree

13 files changed

+578
-66
lines changed

13 files changed

+578
-66
lines changed

units/en/_toctree.yml

Lines changed: 4 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
@@ -44,6 +46,8 @@
4446
title: Building an MCP Client with Gradio
4547
- local: unit2/tiny-agents
4648
title: Building Tiny Agents with MCP and the Hugging Face Hub
49+
- local: unit2/lemonade-server
50+
title: Local Tiny Agents with AMD NPU and iGPU Acceleration
4751

4852
- title: "3. Advanced MCP Development: Custom Workflow Servers"
4953
sections:

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/key-concepts.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ MCP transforms this into an M+N problem by providing a standard interface: each
3131

3232
![With MCP](https://huggingface.co/datasets/mcp-course/images/resolve/main/unit1/2.png)
3333

34-
Each AI application implements the client side of MCP once, and each tool/data source implements the server side once.
35-
3634
## Core MCP Terminology
3735

3836
Now that we understand the problem that MCP solves, let's dive into the core terminology and concepts that make up the MCP protocol.

units/en/unit1/mcp-clients.mdx

Lines changed: 30 additions & 19 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,15 +280,15 @@ 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": [
273288
{
274289
"type": "stdio",
275-
"config": {
276-
"command": "npx",
277-
"args": ["@playwright/mcp@latest"]
278-
}
290+
"command": "npx",
291+
"args": ["@playwright/mcp@latest"]
279292
}
280293
]
281294
}
@@ -310,17 +323,15 @@ Create an agent configuration file at `my-agent/agent.json`:
310323

311324
```json
312325
{
313-
"model": "Qwen/Qwen2.5-72B-Instruct",
314-
"provider": "nebius",
315-
"servers": [
316-
{
317-
"type": "stdio",
318-
"config": {
319-
"command": "npx",
320-
"args": ["@playwright/mcp@latest"]
321-
}
322-
}
323-
]
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+
]
324335
}
325336
```
326337

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/clients.mdx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Cursor provides built-in MCP support, allowing you to connect your deployed MCP
8484

8585
### Configuration
8686

87-
Open Cursor settings (`Ctrl + Shift + J` / `Cmd + Shift + J`) → **MCP** tab → **Add new global MCP server**:
87+
Open Cursor settings (`Ctrl + Shift + J` / `Cmd + Shift + J`) → **Tools & Integrations** tab → **Add Custom MCP**:
8888

8989
**macOS:**
9090
```json
@@ -124,13 +124,28 @@ Open Cursor settings (`Ctrl + Shift + J` / `Cmd + Shift + J`) → **MCP** tab
124124
}
125125
```
126126

127-
### Why We Use mcp-remote
127+
### Why We Use `mcp-remote`
128128

129-
Most MCP clients, including Cursor, currently only support local servers via stdio transport and don't yet support remote servers with OAuth authentication. The `mcp-remote` tool serves as a bridge solution that:
129+
> **Note**: As of mid-2025, Cursor supports direct remote MCP connections via HTTP+SSE and OAuth. You may not need `mcp-remote` unless working with legacy setups or encountering specific compatibility issues.
130130
131-
- Runs locally on your machine
132-
- Forwards requests from Cursor to the remote MCP server
131+
Earlier versions of MCP clients, including Cursor, only supported local servers via `stdio` transport and lacked support for remote servers with authentication. The `mcp-remote` tool was introduced as a workaround that:
132+
133+
- Runs locally on your machine
134+
- Bridges Cursor with remote MCP servers
135+
- Handles transport and authentication implicitly
133136
- Uses the familiar configuration file format
134137

135-
Once configured, you can ask Cursor to use your sentiment analysis tool for tasks like analyzing code comments, user feedback, or pull request descriptions.
138+
While this is still useful in some edge cases, Cursor now supports native remote MCP integration. You can directly configure a remote server like this:
136139

140+
```json
141+
{
142+
"mcpServers": {
143+
"my-server": {
144+
"url": "https://your-mcp-server.hf.space/gradio_api/mcp/sse"
145+
}
146+
}
147+
}
148+
```
149+
> See [Cursor’s official documentation](https://docs.cursor.com/context/mcp) for up-to-date setup instructions.
150+
151+
Once configured, you can ask Cursor to use your sentiment analysis tool for tasks like analyzing code comments, user feedback, or pull request descriptions.

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+
![move-to-right-sidebar](https://mintlify.s3.us-west-1.amazonaws.com/continue-docs/images/move-to-right-sidebar-b2d315296198e41046fc174d8178f30a.gif)
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", "transport": "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: 5 additions & 4 deletions
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
@@ -157,10 +157,11 @@ You can test the server in two ways:
157157
To make your server available to others, you can deploy it to Hugging Face Spaces:
158158

159159
1. Create a new Space on Hugging Face:
160-
- Go to huggingface.co/spaces
161-
- Click "Create new Space"
162-
- Choose "Gradio" as the SDK
160+
- Go to [huggingface.co/spaces](https://huggingface.co/spaces)
161+
- Click "New Space"
163162
- Name your space (e.g., "mcp-sentiment")
163+
- Choose "Gradio" as the SDK
164+
- Click "Create Space"
164165

165166
2. Create a `requirements.txt` file:
166167
```txt

0 commit comments

Comments
 (0)