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
7 changes: 2 additions & 5 deletions units/en/unit0/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,8 @@ If you don't have any of these, don't worry! Here are some resources that can he
* [LLM Course](https://huggingface.co/learn/llm-course/) will guide you through the basics of using and building with LLMs.
* [Agents Course](https://huggingface.co/learn/agents-course/) will guide you through building AI agents with LLMs.

<Tip>

The above courses are not prerequisites in themselves, so if you understand the concepts of LLMs and agents, you can start the course now!

</Tip>
> [!TIP]
> The above courses are not prerequisites in themselves, so if you understand the concepts of LLMs and agents, you can start the course now!

## What tools do I need?

Expand Down
14 changes: 4 additions & 10 deletions units/en/unit1/architectural-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,8 @@ The **Server** is an external program or service that exposes capabilities to AI

Let's examine how these components interact in a typical MCP workflow:

<Tip>

In the next section, we'll dive deeper into the communication protocol that enables these components with practical examples.

</Tip>
> [!TIP]
> In the next section, we'll dive deeper into the communication protocol that enables these components with practical examples.

1. **User Interaction**: The user interacts with the **Host** application, expressing an intent or query.

Expand All @@ -70,11 +67,8 @@ In the next section, we'll dive deeper into the communication protocol that enab

A key advantage of this architecture is its modularity. A single **Host** can connect to multiple **Servers** simultaneously via different **Clients**. New **Servers** can be added to the ecosystem without requiring changes to existing **Hosts**. Capabilities can be easily composed across different **Servers**.

<Tip>

As we discussed in the previous section, this modularity transforms the traditional M×N integration problem (M AI applications connecting to N tools/services) into a more manageable M+N problem, where each Host and Server needs to implement the MCP standard only once.

</Tip>
> [!TIP]
> As we discussed in the previous section, this modularity transforms the traditional M×N integration problem (M AI applications connecting to N tools/services) into a more manageable M+N problem, where each Host and Server needs to implement the MCP standard only once.

The architecture might appear simple, but its power lies in the standardization of the communication protocol and the clear separation of responsibilities between components. This design allows for a cohesive ecosystem where AI models can seamlessly connect with an ever-growing array of external tools and data sources.

Expand Down
18 changes: 6 additions & 12 deletions units/en/unit1/capabilities.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

MCP Servers expose a variety of capabilities to Clients through the communication protocol. These capabilities fall into four main categories, each with distinct characteristics and use cases. Let's explore these core primitives that form the foundation of MCP's functionality.

<Tip>

In this section, we'll show examples as framework agnostic functions in each language. This is to focus on the concepts and how they work together, rather than the complexities of any framework.

In the coming units, we'll show how these concepts are implemented in MCP specific code.

</Tip>
> [!TIP]
> In this section, we'll show examples as framework agnostic functions in each language. This is to focus on the concepts and how they work together, rather than the complexities of any framework.
>
> In the coming units, we'll show how these concepts are implemented in MCP specific code.

## Tools

Expand Down Expand Up @@ -200,11 +197,8 @@ The sampling flow follows these steps:
4. Client reviews the completion
5. Client returns the result to the server

<Tip>

This human-in-the-loop design ensures users maintain control over what the LLM sees and generates. When implementing sampling, it's important to provide clear, well-structured prompts and include relevant context.

</Tip>
> [!TIP]
> This human-in-the-loop design ensures users maintain control over what the LLM sees and generates. When implementing sampling, it's important to provide clear, well-structured prompts and include relevant context.

## How Capabilities Work Together

Expand Down
7 changes: 2 additions & 5 deletions units/en/unit1/certificate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ Below is a quiz to check your understanding of the unit.
height="450"
></iframe>

<Tip>

If you're struggling to use the quiz above, go to the space directly [on the Hugging Face Hub](https://huggingface.co/spaces/mcp-course/unit_1_quiz). If you find errors, you can report them in the space's [Community tab](https://huggingface.co/spaces/mcp-course/unit_1_quiz/discussions).

</Tip>
> [!TIP]
> If you're struggling to use the quiz above, go to the space directly [on the Hugging Face Hub](https://huggingface.co/spaces/mcp-course/unit_1_quiz). If you find errors, you can report them in the space's [Community tab](https://huggingface.co/spaces/mcp-course/unit_1_quiz/discussions).

21 changes: 6 additions & 15 deletions units/en/unit1/communication-protocol.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

MCP defines a standardized communication protocol that enables Clients and Servers to exchange messages in a consistent, predictable way. This standardization is critical for interoperability across the community. In this section, we'll explore the protocol structure and transport mechanisms used in MCP.

<Tip warning={true}>

We're getting down to the nitty-gritty details of the MCP protocol. You won't need to know all of this to build with MCP, but it's good to know that it exists and how it works.

</Tip>
> [!WARNING]
> We're getting down to the nitty-gritty details of the MCP protocol. You won't need to know all of this to build with MCP, but it's good to know that it exists and how it works.

## JSON-RPC: The Foundation

Expand Down Expand Up @@ -99,11 +96,8 @@ The stdio transport is used for local communication, where the Client and Server

The Host application launches the Server as a subprocess and communicates with it by writing to its standard input (stdin) and reading from its standard output (stdout).

<Tip>

**Use cases** for this transport are local tools like file system access or running local scripts.

</Tip>
> [!TIP]
> **Use cases** for this transport are local tools like file system access or running local scripts.

The main **Advantages** of this transport are that it's simple, no network configuration required, and securely sandboxed by the operating system.

Expand All @@ -113,11 +107,8 @@ The HTTP+SSE transport is used for remote communication, where the Client and Se

Communication happens over HTTP, with the Server using Server-Sent Events (SSE) to push updates to the Client over a persistent connection.

<Tip>

**Use cases** for this transport are connecting to remote APIs, cloud services, or shared resources.

</Tip>
> [!TIP]
> **Use cases** for this transport are connecting to remote APIs, cloud services, or shared resources.

The main **Advantages** of this transport are that it works across networks, enables integration with web services, and is compatible with serverless environments.

Expand Down
7 changes: 2 additions & 5 deletions units/en/unit1/gradio-mcp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

We've now explored the core concepts of the MCP protocol and how to implement MCP Servers and Clients. In this section, we're going to make things slightly easier by using Gradio to create an MCP Server!

<Tip>

Gradio is a popular Python library for quickly creating customizable web interfaces for machine learning models.

</Tip>
> [!TIP]
> Gradio is a popular Python library for quickly creating customizable web interfaces for machine learning models.

## Introduction to Gradio

Expand Down
14 changes: 4 additions & 10 deletions units/en/unit1/hf-mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

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>
> [!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.

## What you can do

Expand All @@ -31,11 +28,8 @@ The server provides curated tools that work across supported clients:

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>
> [!TIP]
> The settings page generates the exact configuration your client expects. Use it rather than writing config by hand.

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

Expand Down
18 changes: 6 additions & 12 deletions units/en/unit1/key-concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ MCP transforms this into an M+N problem by providing a standard interface: each

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

<Tip>

MCP is a standard like HTTP or USB-C, and is a protocol for connecting AI applications to external tools and data sources. Therefore, using standard terminology is crucial to making the MCP work effectively.

When documenting our applications and communicating with the community, we should use the following terminology.

</Tip>
> [!TIP]
> MCP is a standard like HTTP or USB-C, and is a protocol for connecting AI applications to external tools and data sources. Therefore, using standard terminology is crucial to making the MCP work effectively.
>
> When documenting our applications and communicating with the community, we should use the following terminology.

### Components

Expand All @@ -55,11 +52,8 @@ Just like client server relationships in HTTP, MCP has a client and a server.

- **Server**: An external program or service that exposes capabilities (Tools, Resources, Prompts) via the MCP protocol.

<Tip warning={true}>

A lot of content uses 'Client' and 'Host' interchangeably. Technically speaking, the host is the user-facing application, and the client is the component within the host application that manages communication with a specific MCP Server.

</Tip>
> [!WARNING]
> A lot of content uses 'Client' and 'Host' interchangeably. Technically speaking, the host is the user-facing application, and the client is the component within the host application that manages communication with a specific MCP Server.

### Capabilities

Expand Down
25 changes: 8 additions & 17 deletions units/en/unit1/mcp-clients.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@ In this section, you will:
* Discover how to connect to the Hugging Face MCP Server and built-in tools
* See practical examples of MCP Client usage

<Tip>

In this page we're going to show examples of how to set up MCP Clients in a few different ways using the JSON notation. For now, we will use *examples* like `path/to/server.py` to represent the path to the MCP Server. In the next unit, we'll implement this with real MCP Servers.

For now, focus on understanding the MCP Client notation. We'll implement the MCP Servers in the next unit.

</Tip>
> [!TIP]
> In this page we're going to show examples of how to set up MCP Clients in a few different ways using the JSON notation. For now, we will use *examples* like `path/to/server.py` to represent the path to the MCP Server. In the next unit, we'll implement this with real MCP Servers.
>
> For now, focus on understanding the MCP Client notation. We'll implement the MCP Servers in the next unit.

## Understanding MCP Clients

Expand Down Expand Up @@ -57,11 +54,8 @@ Now that we've covered the core of the MCP protocol, let's look at how to config

Effective deployment of MCP servers and clients requires proper configuration.

<Tip>

The MCP specification is still evolving, so the configuration methods are subject to evolution. We'll focus on the current best practices for configuration.

</Tip>
> [!TIP]
> The MCP specification is still evolving, so the configuration methods are subject to evolution. We'll focus on the current best practices for configuration.

### MCP Configuration Files

Expand Down Expand Up @@ -274,11 +268,8 @@ huggingface-cli login

After creating your Hugging Face access token and logging in, you need to ensure your token has the proper permissions to work with inference providers.

<Tip warning={true}>

**Important:** If you skip this step, you may encounter authentication errors when running tiny agents with hosted models.

</Tip>
> [!WARNING]
> **Important:** If you skip this step, you may encounter authentication errors when running tiny agents with hosted models.

1. Go to your [Hugging Face Access Tokens page](https://huggingface.co/settings/tokens)
2. Find your MCP token and click the three dots (⋮) next to it
Expand Down
7 changes: 2 additions & 5 deletions units/en/unit2/clients.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ The standard configuration file for MCP is named `mcp.json`. Here's the basic st

In this example, we have a single server configured to use SSE transport, connecting to a local Gradio server running on port 7860.

<Tip>

We've connected to the Gradio app via SSE transport because we assume that the gradio app is running on a remote server. However, if you want to connect to a local script, `stdio` transport instead of `sse` transport is a better option.

</Tip>
> [!TIP]
> We've connected to the Gradio app via SSE transport because we assume that the gradio app is running on a remote server. However, if you want to connect to a local script, `stdio` transport instead of `sse` transport is a better option.

#### Configuration for HTTP+SSE Transport

Expand Down
14 changes: 4 additions & 10 deletions units/en/unit2/continue-client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ like Ollama.

You can install Continue from the VS Code marketplace.

<Tip>

*Continue also has an extension for [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue).*

</Tip>
> [!TIP]
> *Continue also has an extension for [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue).*

### VS Code extension

Expand Down Expand Up @@ -63,11 +60,8 @@ This model is around 14GB in size, so you need to ensure that the machine you ar
</hfoption>
</hfoptions>

<Tip>

Continue supports various local model providers. Besides Ollama, Llama.cpp, and LM Studio you can also use other providers. For a complete list of supported providers and detailed configuration options, please refer to the [Continue documentation](https://docs.continue.dev/customize/model-providers).

</Tip>
> [!TIP]
> Continue supports various local model providers. Besides Ollama, Llama.cpp, and LM Studio you can also use other providers. For a complete list of supported providers and detailed configuration options, please refer to the [Continue documentation](https://docs.continue.dev/customize/model-providers).

It is important that we use models that have tool calling as a built-in feature, i.e. Codestral Qwen and Llama 3.1x.

Expand Down
7 changes: 2 additions & 5 deletions units/en/unit2/gradio-client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

In the previous section, we explored how to create an MCP Server using Gradio and connect to it using an MCP Client. In this section, we're going to explore how to use Gradio as an MCP Client to connect to an MCP Server.

<Tip>

Gradio is best suited to the creation of UI clients and MCP servers, but it is also possible to use it as an MCP Client and expose that as a UI.

</Tip>
> [!TIP]
> Gradio is best suited to the creation of UI clients and MCP servers, but it is also possible to use it as an MCP Client and expose that as a UI.

We'll connect to an MCP server similar to the one we created in the previous section but with additional features, and use it to answer questions.

Expand Down
7 changes: 2 additions & 5 deletions units/en/unit2/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ Welcome to Unit 2 of the MCP Course!

In this unit, we'll build a complete MCP application from scratch, focusing on creating a server with Gradio and connecting it with multiple clients. This hands-on approach will give you practical experience with the entire MCP ecosystem.

<Tip>

In this unit, we're going to build a simple MCP server and client using Gradio and the HuggingFace hub. In the next unit, we'll build a more complex server that tackles a real-world use case.

</Tip>
> [!TIP]
> In this unit, we're going to build a simple MCP server and client using Gradio and the HuggingFace hub. In the next unit, we'll build a more complex server that tackles a real-world use case.

## What You'll Learn

Expand Down
21 changes: 6 additions & 15 deletions units/en/unit2/lemonade-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ Once you have installed Lemonade Server, you can launch it by clicking the `Lemo

To install Lemonade on Linux, first create and activate a venv:

<Tip>

If you don't have `uv` installed, you can install it following the instructions [here](https://docs.astral.sh/uv/getting-started/installation/).

</Tip>
> [!TIP]
> If you don't have `uv` installed, you can install it following the instructions [here](https://docs.astral.sh/uv/getting-started/installation/).

```bash
uv venv --python 3.11
Expand All @@ -54,11 +51,8 @@ lemonade-server-dev serve

Lemonade Server supports CPU inference across all platforms and engines on Windows x86/x64. For GPU acceleration is enabled through llamacpp engine (Vulkan), with a focus on AMD Ryzen™ AI 7000/8000/300 series and Radeon™ 7000/9000 series.

<Tip>

*NPU acceleration is only available for AMD Ryzen™ AI 300 series on Windows.*

</Tip>
> [!TIP]
> *NPU acceleration is only available for AMD Ryzen™ AI 300 series on Windows.*

</hfoption>
</hfoptions>
Expand Down Expand Up @@ -343,11 +337,8 @@ Tool iNtxGmOuXHqZVBWmKnfxsc61xsJbsoAM
The job description for the Senior Food Technology Engineer position emphasizes the need for a candidate who can bridge the gap between food science and artificial intelligence (...). Candidates are also expected to attend conferences and publish research on algorithmic cooking optimization.
```

<Tip>

We are using the default system prompt, which may cause the assistant to call some tools multiple times. To create a more assertive assistant, you can provide a custom `PROMPT.md` file in the same directory as your `agent.json`.

</Tip>
> [!TIP]
> We are using the default system prompt, which may cause the assistant to call some tools multiple times. To create a more assertive assistant, you can provide a custom `PROMPT.md` file in the same directory as your `agent.json`.

Great! Now let's read the candidate's resume.

Expand Down
Loading