You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a continuous weird referencing mentioning that we have built this MCP server in a previous section, which didn't happen, the MCP server built in the previous section is a simple sentiment analysis, so I removed this reference, to make things less confusing.
Copy file name to clipboardExpand all lines: units/en/unit2/gradio-client.mdx
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,13 +8,13 @@ Gradio is best suited to the creation of UI clients and MCP servers, but it is a
8
8
9
9
</Tip>
10
10
11
-
We'll connect to the MCP server we created in the previous section and use it to answer questions.
11
+
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.
12
12
13
13
## MCP Client in Gradio
14
14
15
15
### Connect to an example MCP Server
16
16
17
-
Let's connect to an example MCP Server that is already running on Hugging Face. We'll use [this one](https://huggingface.co/spaces/abidlabs/mcp-tools2) for this example. It's a space that contains a collection of MCP tools.
17
+
Let's connect to an example MCP Server that is already running on Hugging Face. We'll use [this one](https://huggingface.co/spaces/abidlabs/mcp-tool-http) for this example. It's a space that contains a collection of MCP tools.
18
18
19
19
```python
20
20
from smolagents.mcp_client import MCPClient
@@ -39,9 +39,9 @@ sepia: Apply a sepia filter to the input image.
39
39
</pre>
40
40
</details>
41
41
42
-
### Connect to your MCP Server from Gradio
42
+
### Connect to the MCP Server from Gradio
43
43
44
-
Great, now that you've connected to an example MCP Server, let's connect to your own MCP Server from Gradio.
44
+
Great, now that you've connected to an example MCP Server. Now, you need to use it in an example application.
45
45
46
46
First, we need to install the `smolagents`, Gradio and mcp-client libraries, if we haven't already:
47
47
@@ -64,7 +64,7 @@ Next, we'll connect to the MCP Server and get the tools that we can use to answe
64
64
65
65
```python
66
66
mcp_client = MCPClient(
67
-
{"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse"} # This is the MCP Server we created in the previous section
67
+
{"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse"} # This is the MCP Client we created in the previous section
68
68
)
69
69
tools = mcp_client.get_tools()
70
70
```
@@ -104,7 +104,7 @@ And that's it! We've created a simple Gradio interface that uses the MCP Client
104
104
105
105
## Complete Example
106
106
107
-
Here's the complete example of the MCP Client in Gradio:
107
+
Here's the complete example of the usage of an MCP Client in Gradio:
0 commit comments