Skip to content

Commit 4b5ad67

Browse files
authored
Merge branch 'main' into add-python-tiny-agents
2 parents f8a8dd3 + cd5d92e commit 4b5ad67

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ To cite this repository in publications:
4848

4949
```
5050
@misc{mcp-course,
51-
author = {Your Name},
51+
author = Burtenshaw, Ben,
5252
title = {The Model Context Protocol Course},
5353
year = {2025},
54-
howpublished = {\url{https://github.com/yourusername/mcp-course}},
54+
howpublished = {\url{https://github.com/huggingface/mcp-course}},
5555
note = {GitHub repository},
5656
}
5757
```

units/en/unit1/mcp-clients.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ In the next section, we'll explore the ecosystem of MCP servers available on Hug
219219

220220
## Code Clients
221221

222-
You can also use the MCP Client in within code so that the tools are available to the LLM. Let's explore some examples in `smolagents`.
222+
You can also use the MCP Client within code so that the tools are available to the LLM. Let's explore some examples in `smolagents`. To run these examples you will need to add `mcp[cli]`, `smolagents[toolkit]`, and `smolagents[mcp]` to your `uv` virtual environment.
223223

224224
First, let's explore our weather server from the previous page. In `smolagents`, we can use the `ToolCollection` class to automatically discover and register tools from an MCP server. This is done by passing the `StdioServerParameters` or `SSEServerParameters` to the `ToolCollection.from_mcp` method. We can then print the tools to the console.
225225

@@ -307,17 +307,19 @@ We can also connect to an MCP package. Here's an example of connecting to the `p
307307

308308
```python
309309
import os
310-
from smolagents import ToolCollection, CodeAgent
311-
from mcp import StdioServerParameters
310+
from smolagents import ToolCollection, CodeAgent, InferenceClientModel
311+
from mcp.client.stdio import StdioServerParameters
312+
313+
model = InferenceClientModel()
312314

313315
server_parameters = StdioServerParameters(
314-
command="uv",
316+
command="uvx",
315317
args=["--quiet", "[email protected]"],
316318
env={"UV_PYTHON": "3.12", **os.environ},
317319
)
318320

319321
with ToolCollection.from_mcp(server_parameters, trust_remote_code=True) as tool_collection:
320-
agent = CodeAgent(tools=[*tool_collection.tools], add_base_tools=True)
322+
agent = CodeAgent(tools=[*tool_collection.tools], add_base_tools=True, model=model)
321323
agent.run("Please find a remedy for hangover.")
322324
```
323325

units/en/unit2/tiny-agents.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pnpm add @huggingface/tiny-agents
3131
Then, we need to install the `mcp-remote` package.
3232

3333
```bash
34-
npm install mcp-remote
34+
npm i mcp-remote
3535
# or
3636
pnpm add mcp-remote
3737
```

0 commit comments

Comments
 (0)