burtenshaw commited on
Commit
ecf6369
·
1 Parent(s): 9c81d0f
Files changed (2) hide show
  1. app.py +32 -0
  2. requirements.txt +70 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from mcp.client.stdio import StdioServerParameters
4
+ from smolagents import ToolCollection, CodeAgent
5
+ from smolagents import CodeAgent, InferenceClientModel
6
+ from smolagents.mcp_client import MCPClient
7
+
8
+ model = InferenceClientModel()
9
+
10
+ try:
11
+ mcp_client = MCPClient(
12
+ {"url": "https://abidlabs-mcp-tools.hf.space/gradio_api/mcp/sse"}
13
+ )
14
+
15
+ tools = mcp_client.get_tools()
16
+ agent = CodeAgent(tools=[*tools], model=model)
17
+
18
+ def call_agent(message, history):
19
+ return str(agent.run(message))
20
+
21
+ demo = gr.ChatInterface(
22
+ fn=call_agent,
23
+ type="messages",
24
+ examples=["Prime factorization of 68"],
25
+ title="Agent with MCP Tools",
26
+ description="This is a simple agent that uses MCP tools to answer questions.",
27
+ messages=[],
28
+ )
29
+
30
+ demo.launch()
31
+ finally:
32
+ mcp_client.stop()
requirements.txt ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file was autogenerated by uv via the following command:
2
+ # uv export --no-hashes
3
+ aiofiles==24.1.0
4
+ annotated-types==0.7.0
5
+ anyio==4.9.0
6
+ audioop-lts==0.2.1 ; python_full_version >= '3.13'
7
+ certifi==2025.4.26
8
+ charset-normalizer==3.4.2
9
+ click==8.1.8
10
+ colorama==0.4.6 ; platform_system == 'Windows'
11
+ fastapi==0.115.12
12
+ ffmpy==0.5.0
13
+ filelock==3.18.0
14
+ fsspec==2025.3.2
15
+ gradio==5.29.0
16
+ gradio-client==1.10.0
17
+ groovy==0.1.2
18
+ h11==0.16.0
19
+ hf-xet==1.1.0 ; platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'
20
+ httpcore==1.0.9
21
+ httpx==0.28.1
22
+ httpx-sse==0.4.0
23
+ huggingface-hub==0.31.1
24
+ idna==3.10
25
+ jinja2==3.1.6
26
+ joblib==1.5.0
27
+ jsonref==1.1.0
28
+ markdown-it-py==3.0.0
29
+ markupsafe==3.0.2
30
+ mcp==1.7.1
31
+ mcpadapt==0.1.4
32
+ mdurl==0.1.2
33
+ nltk==3.9.1
34
+ numpy==2.2.5
35
+ orjson==3.10.18
36
+ packaging==25.0
37
+ pandas==2.2.3
38
+ pillow==11.2.1
39
+ pydantic==2.11.4
40
+ pydantic-core==2.33.2
41
+ pydantic-settings==2.9.1
42
+ pydub==0.25.1
43
+ pygments==2.19.1
44
+ python-dateutil==2.9.0.post0
45
+ python-dotenv==1.1.0
46
+ python-multipart==0.0.20
47
+ pytz==2025.2
48
+ pyyaml==6.0.2
49
+ regex==2024.11.6
50
+ requests==2.32.3
51
+ rich==14.0.0
52
+ ruff==0.11.8 ; sys_platform != 'emscripten'
53
+ safehttpx==0.1.6
54
+ semantic-version==2.10.0
55
+ shellingham==1.5.4
56
+ six==1.17.0
57
+ smolagents==1.15.0
58
+ sniffio==1.3.1
59
+ sse-starlette==2.3.4
60
+ starlette==0.46.2
61
+ textblob==0.19.0
62
+ tomlkit==0.13.2
63
+ tqdm==4.67.1
64
+ typer==0.15.3
65
+ typing-extensions==4.13.2
66
+ typing-inspection==0.4.0
67
+ tzdata==2025.2
68
+ urllib3==2.4.0
69
+ uvicorn==0.34.2
70
+ websockets==15.0.1