mcp-use 1.3.7__py3-none-any.whl → 1.3.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mcp-use might be problematic. Click here for more details.
- mcp_use/__init__.py +0 -1
- mcp_use/adapters/base.py +3 -3
- mcp_use/adapters/langchain_adapter.py +5 -4
- mcp_use/agents/__init__.py +2 -2
- mcp_use/agents/mcpagent.py +257 -31
- mcp_use/agents/prompts/templates.py +20 -22
- mcp_use/agents/remote.py +296 -0
- mcp_use/client.py +20 -3
- mcp_use/config.py +12 -8
- mcp_use/connectors/base.py +100 -15
- mcp_use/connectors/http.py +13 -2
- mcp_use/connectors/sandbox.py +12 -6
- mcp_use/connectors/stdio.py +11 -2
- mcp_use/errors/__init__.py +1 -0
- mcp_use/errors/error_formatting.py +29 -0
- mcp_use/managers/__init__.py +3 -5
- mcp_use/managers/server_manager.py +46 -13
- mcp_use/managers/tools/__init__.py +2 -4
- mcp_use/managers/tools/connect_server.py +2 -1
- mcp_use/managers/tools/disconnect_server.py +2 -1
- mcp_use/managers/tools/list_servers_tool.py +2 -0
- mcp_use/session.py +70 -0
- mcp_use/telemetry/telemetry.py +1 -4
- {mcp_use-1.3.7.dist-info → mcp_use-1.3.9.dist-info}/METADATA +80 -57
- mcp_use-1.3.9.dist-info/RECORD +51 -0
- mcp_use/managers/tools/use_tool.py +0 -154
- mcp_use-1.3.7.dist-info/RECORD +0 -49
- {mcp_use-1.3.7.dist-info → mcp_use-1.3.9.dist-info}/WHEEL +0 -0
- {mcp_use-1.3.7.dist-info → mcp_use-1.3.9.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mcp-use
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.9
|
|
4
4
|
Summary: MCP Library for LLMs
|
|
5
5
|
Author-email: Pietro Zullo <pietro.zullo@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -17,7 +17,7 @@ Requires-Python: >=3.11
|
|
|
17
17
|
Requires-Dist: aiohttp>=3.9.0
|
|
18
18
|
Requires-Dist: jsonschema-pydantic>=0.1.0
|
|
19
19
|
Requires-Dist: langchain>=0.1.0
|
|
20
|
-
Requires-Dist: mcp>=1.
|
|
20
|
+
Requires-Dist: mcp>=1.10.0
|
|
21
21
|
Requires-Dist: posthog>=4.8.0
|
|
22
22
|
Requires-Dist: pydantic>=2.0.0
|
|
23
23
|
Requires-Dist: python-dotenv>=1.0.0
|
|
@@ -46,25 +46,30 @@ Description-Content-Type: text/markdown
|
|
|
46
46
|
<div align="center">
|
|
47
47
|
<div align="center" style="margin: 0 auto; max-width: 80%;">
|
|
48
48
|
<picture>
|
|
49
|
-
<source media="(prefers-color-scheme: dark)" srcset="static/
|
|
50
|
-
<source media="(prefers-color-scheme: light)" srcset="static/
|
|
51
|
-
<img alt="mcp use logo" src="./static/logo-
|
|
49
|
+
<source media="(prefers-color-scheme: dark)" srcset="static/logo-gh.jpg">
|
|
50
|
+
<source media="(prefers-color-scheme: light)" srcset="static/logo-gh.jpg">
|
|
51
|
+
<img alt="mcp use logo" src="./static/logo-gh.jpg" width="80%" style="margin: 20px auto;">
|
|
52
52
|
</picture>
|
|
53
53
|
</div>
|
|
54
54
|
|
|
55
55
|
<br>
|
|
56
56
|
|
|
57
|
-
#
|
|
57
|
+
# Create MCP Clients and Agents
|
|
58
58
|
|
|
59
|
+
<p align="center">
|
|
60
|
+
<a href="https://www.producthunt.com/products/mcp-use?embed=true&utm_source=badge-featured&utm_medium=badge&utm_source=badge-mcp-use" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1002629&theme=neutral&t=1754609432704" alt="mcp-use - Open source SDK and infra for MCP servers & agents | Product Hunt" style="width: 150px; height: 32px;" width="150" height="32" /></a>
|
|
61
|
+
</p>
|
|
59
62
|
<p align="center">
|
|
60
63
|
<a href="https://github.com/pietrozullo/mcp-use/stargazers" alt="GitHub stars">
|
|
61
64
|
<img src="https://img.shields.io/github/stars/pietrozullo/mcp-use?style=social" /></a>
|
|
65
|
+
<a href="https://pypi.org/project/mcp_use/" alt="PyPI Downloads">
|
|
66
|
+
<img src="https://static.pepy.tech/badge/mcp-use" /></a>
|
|
62
67
|
<a href="https://pypi.org/project/mcp_use/" alt="PyPI Version">
|
|
63
68
|
<img src="https://img.shields.io/pypi/v/mcp_use.svg"/></a>
|
|
69
|
+
<a href="https://github.com/mcp-use/mcp-use-ts" alt="TypeScript">
|
|
70
|
+
<img src="https://img.shields.io/badge/TypeScript-mcp--use-3178C6?logo=typescript&logoColor=white" /></a>
|
|
64
71
|
<a href="https://github.com/pietrozullo/mcp-use/blob/main/LICENSE" alt="License">
|
|
65
72
|
<img src="https://img.shields.io/github/license/pietrozullo/mcp-use" /></a>
|
|
66
|
-
<a href="https://pypi.org/project/mcp_use/" alt="PyPI Downloads">
|
|
67
|
-
<img src="https://static.pepy.tech/badge/mcp-use" /></a>
|
|
68
73
|
<a href="https://docs.mcp-use.com" alt="Documentation">
|
|
69
74
|
<img src="https://img.shields.io/badge/docs-mcp--use.com-blue" /></a>
|
|
70
75
|
<a href="https://mcp-use.com" alt="Website">
|
|
@@ -84,15 +89,14 @@ Description-Content-Type: text/markdown
|
|
|
84
89
|
|
|
85
90
|
💡 Let developers easily connect any LLM to tools like web browsing, file operations, and more.
|
|
86
91
|
|
|
87
|
-
-
|
|
92
|
+
- If you want to get started quickly check out [mcp-use.com website](https://mcp-use.com/) to build and deploy agents with your favorite MCP servers.
|
|
88
93
|
- Visit the [mcp-use docs](https://docs.mcp-use.com/) to get started with mcp-use library
|
|
94
|
+
- For the TypeScript version, visit [mcp-use-ts](https://github.com/mcp-use/mcp-use-ts)
|
|
89
95
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
| Supports | |
|
|
93
|
-
| :--- | :--- |
|
|
96
|
+
| Supports | |
|
|
97
|
+
| :------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
94
98
|
| **Primitives** | [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) |
|
|
95
|
-
| **Transports** | [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml)
|
|
99
|
+
| **Transports** | [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) |
|
|
96
100
|
|
|
97
101
|
## Features
|
|
98
102
|
|
|
@@ -418,29 +422,7 @@ if __name__ == "__main__":
|
|
|
418
422
|
asyncio.run(run_blender_example())
|
|
419
423
|
```
|
|
420
424
|
|
|
421
|
-
# Configuration
|
|
422
|
-
|
|
423
|
-
MCP-Use supports initialization from configuration files, making it easy to manage and switch between different MCP server setups:
|
|
424
|
-
|
|
425
|
-
```python
|
|
426
|
-
import asyncio
|
|
427
|
-
from mcp_use import create_session_from_config
|
|
428
|
-
|
|
429
|
-
async def main():
|
|
430
|
-
# Create an MCP session from a config file
|
|
431
|
-
session = create_session_from_config("mcp-config.json")
|
|
432
|
-
|
|
433
|
-
# Initialize the session
|
|
434
|
-
await session.initialize()
|
|
435
|
-
|
|
436
|
-
# Use the session...
|
|
437
|
-
|
|
438
|
-
# Disconnect when done
|
|
439
|
-
await session.disconnect()
|
|
440
|
-
|
|
441
|
-
if __name__ == "__main__":
|
|
442
|
-
asyncio.run(main())
|
|
443
|
-
```
|
|
425
|
+
# Configuration Support
|
|
444
426
|
|
|
445
427
|
## HTTP Connection Example
|
|
446
428
|
|
|
@@ -696,6 +678,47 @@ The `SandboxOptions` type provides configuration for the sandbox environment:
|
|
|
696
678
|
- **Consistent environment**: Ensure consistent behavior across different systems
|
|
697
679
|
- **Resource efficiency**: Offload resource-intensive tasks to cloud infrastructure
|
|
698
680
|
|
|
681
|
+
# Direct Tool Calls (Without LLM)
|
|
682
|
+
|
|
683
|
+
You can call MCP server tools directly without an LLM when you need programmatic control:
|
|
684
|
+
|
|
685
|
+
```python
|
|
686
|
+
import asyncio
|
|
687
|
+
from mcp_use import MCPClient
|
|
688
|
+
|
|
689
|
+
async def call_tool_example():
|
|
690
|
+
config = {
|
|
691
|
+
"mcpServers": {
|
|
692
|
+
"everything": {
|
|
693
|
+
"command": "npx",
|
|
694
|
+
"args": ["-y", "@modelcontextprotocol/server-everything"],
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
client = MCPClient.from_dict(config)
|
|
700
|
+
|
|
701
|
+
try:
|
|
702
|
+
await client.create_all_sessions()
|
|
703
|
+
session = client.get_session("everything")
|
|
704
|
+
|
|
705
|
+
# Call tool directly
|
|
706
|
+
result = await session.call_tool(
|
|
707
|
+
name="add",
|
|
708
|
+
arguments={"a": 1, "b": 2}
|
|
709
|
+
)
|
|
710
|
+
|
|
711
|
+
print(f"Result: {result.content[0].text}") # Output: 3
|
|
712
|
+
|
|
713
|
+
finally:
|
|
714
|
+
await client.close_all_sessions()
|
|
715
|
+
|
|
716
|
+
if __name__ == "__main__":
|
|
717
|
+
asyncio.run(call_tool_example())
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
See the complete example: [examples/direct_tool_call.py](examples/direct_tool_call.py)
|
|
721
|
+
|
|
699
722
|
# Build a Custom Agent:
|
|
700
723
|
|
|
701
724
|
You can also build your own custom agent using the LangChain adapter:
|
|
@@ -813,44 +836,44 @@ Thanks to all our amazing contributors!
|
|
|
813
836
|
<th>Stars</th>
|
|
814
837
|
</tr>
|
|
815
838
|
<tr>
|
|
816
|
-
<td><img src="https://avatars.githubusercontent.com/u/
|
|
817
|
-
<td>⭐
|
|
839
|
+
<td><img src="https://avatars.githubusercontent.com/u/38653995?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/patchy631/ai-engineering-hub"><strong>patchy631/ai-engineering-hub</strong></a></td>
|
|
840
|
+
<td>⭐ 15920</td>
|
|
818
841
|
</tr>
|
|
819
842
|
<tr>
|
|
820
|
-
<td><img src="https://avatars.githubusercontent.com/u/
|
|
821
|
-
<td>⭐
|
|
843
|
+
<td><img src="https://avatars.githubusercontent.com/u/170207473?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/tavily-ai/meeting-prep-agent"><strong>tavily-ai/meeting-prep-agent</strong></a></td>
|
|
844
|
+
<td>⭐ 129</td>
|
|
822
845
|
</tr>
|
|
823
846
|
<tr>
|
|
824
|
-
<td><img src="https://avatars.githubusercontent.com/u/
|
|
825
|
-
<td>⭐
|
|
847
|
+
<td><img src="https://avatars.githubusercontent.com/u/164294848?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/buildfastwithai/gen-ai-experiments"><strong>buildfastwithai/gen-ai-experiments</strong></a></td>
|
|
848
|
+
<td>⭐ 93</td>
|
|
826
849
|
</tr>
|
|
827
850
|
<tr>
|
|
828
|
-
<td><img src="https://avatars.githubusercontent.com/u/
|
|
829
|
-
<td>⭐
|
|
851
|
+
<td><img src="https://avatars.githubusercontent.com/u/187057607?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/hud-evals/hud-python"><strong>hud-evals/hud-python</strong></a></td>
|
|
852
|
+
<td>⭐ 76</td>
|
|
830
853
|
</tr>
|
|
831
854
|
<tr>
|
|
832
|
-
<td><img src="https://avatars.githubusercontent.com/u/
|
|
833
|
-
<td>⭐
|
|
855
|
+
<td><img src="https://avatars.githubusercontent.com/u/20041231?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/krishnaik06/MCP-CRASH-Course"><strong>krishnaik06/MCP-CRASH-Course</strong></a></td>
|
|
856
|
+
<td>⭐ 61</td>
|
|
834
857
|
</tr>
|
|
835
858
|
<tr>
|
|
836
|
-
<td><img src="https://avatars.githubusercontent.com/u/
|
|
837
|
-
<td>⭐
|
|
859
|
+
<td><img src="https://avatars.githubusercontent.com/u/54944174?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/larksuite/lark-samples"><strong>larksuite/lark-samples</strong></a></td>
|
|
860
|
+
<td>⭐ 35</td>
|
|
838
861
|
</tr>
|
|
839
862
|
<tr>
|
|
840
|
-
<td><img src="https://avatars.githubusercontent.com/u/
|
|
841
|
-
<td>⭐
|
|
863
|
+
<td><img src="https://avatars.githubusercontent.com/u/892404?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/truemagic-coder/solana-agent-app"><strong>truemagic-coder/solana-agent-app</strong></a></td>
|
|
864
|
+
<td>⭐ 30</td>
|
|
842
865
|
</tr>
|
|
843
866
|
<tr>
|
|
844
|
-
<td><img src="https://avatars.githubusercontent.com/u/
|
|
845
|
-
<td>⭐
|
|
867
|
+
<td><img src="https://avatars.githubusercontent.com/u/8344498?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/schogini/techietalksai"><strong>schogini/techietalksai</strong></a></td>
|
|
868
|
+
<td>⭐ 24</td>
|
|
846
869
|
</tr>
|
|
847
870
|
<tr>
|
|
848
|
-
<td><img src="https://avatars.githubusercontent.com/u/
|
|
849
|
-
<td>⭐
|
|
871
|
+
<td><img src="https://avatars.githubusercontent.com/u/201161342?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/autometa-dev/whatsapp-mcp-voice-agent"><strong>autometa-dev/whatsapp-mcp-voice-agent</strong></a></td>
|
|
872
|
+
<td>⭐ 22</td>
|
|
850
873
|
</tr>
|
|
851
874
|
<tr>
|
|
852
|
-
<td><img src="https://avatars.githubusercontent.com/u/
|
|
853
|
-
<td>⭐
|
|
875
|
+
<td><img src="https://avatars.githubusercontent.com/u/100749943?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/Deniscartin/mcp-cli"><strong>Deniscartin/mcp-cli</strong></a></td>
|
|
876
|
+
<td>⭐ 19</td>
|
|
854
877
|
</tr>
|
|
855
878
|
</table>
|
|
856
879
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
mcp_use/__init__.py,sha256=vyjxKmfVDtkbJ6sthDEH_m-uJGXxkYdUBMwBpCt72zA,1021
|
|
2
|
+
mcp_use/client.py,sha256=4WnFrbBBa3YX3brfBgZrhb_OgAT8mMfVzLUHwnnKi8o,11701
|
|
3
|
+
mcp_use/config.py,sha256=yRgUPCMUzkFqROyccG2wjuhGxneCcbgnrHWHQ6z_hoc,3487
|
|
4
|
+
mcp_use/logging.py,sha256=CRtkPwR-bkXK_kQ0QOL86RikMWOHzEOi7A8VRHkNsZw,4270
|
|
5
|
+
mcp_use/session.py,sha256=DpH_z0a3xYemV9yWzlrf-IPZtpR27CI2S-gAm2jbCAc,4700
|
|
6
|
+
mcp_use/utils.py,sha256=QavJcVq2WxUUUCCpPCUeOB5bqIS0FFmpK-RAZkGc6aA,720
|
|
7
|
+
mcp_use/adapters/__init__.py,sha256=-xCrgPThuX7x0PHGFDdjb7M-mgw6QV3sKu5PM7ShnRg,275
|
|
8
|
+
mcp_use/adapters/base.py,sha256=8XB3xWZ6nJPhhmHwVtHT8-HO0D_9nnxzOkbVDP-fI3k,6940
|
|
9
|
+
mcp_use/adapters/langchain_adapter.py,sha256=zGEVMXLj_jpSXUMHOh5u-fxkkrK2zpSibOSGCy_VMr0,11033
|
|
10
|
+
mcp_use/agents/__init__.py,sha256=FzkntihbAqzixWdWe99zIrrcIfd4N3YWltNniutG9VA,267
|
|
11
|
+
mcp_use/agents/base.py,sha256=EN-dRbwOi9vIqofFg3jmi5yT2VKlwEr9Cwi1DZgB3eE,1591
|
|
12
|
+
mcp_use/agents/mcpagent.py,sha256=Vh4VOxxh-6sJwK1tTtJgUWZcp1bd3hb_JnATc7x9sKk,46698
|
|
13
|
+
mcp_use/agents/remote.py,sha256=peSw3aixybneTWgrGlSZedUvo_FuISSiWqFgySZSwEM,13011
|
|
14
|
+
mcp_use/agents/prompts/system_prompt_builder.py,sha256=E86STmxcl2Ic763_114awNqFB2RyLrQlbvgRmJajQjI,4116
|
|
15
|
+
mcp_use/agents/prompts/templates.py,sha256=acg2Q-_uQDL-3q5ZUwwwFrP7wqqf-SEyq0XWDDHt69s,1906
|
|
16
|
+
mcp_use/connectors/__init__.py,sha256=cUF4yT0bNr8qeLkSzg28SHueiV5qDaHEB1l1GZ2K0dc,536
|
|
17
|
+
mcp_use/connectors/base.py,sha256=R1Qh9D6btullQUGiMBVZewP3M7d-0VrsIt4bSw3bHxI,17482
|
|
18
|
+
mcp_use/connectors/http.py,sha256=eiX5NAsT9mnzqWRAoxb6qG3nWxPiVyw5MVcwRY8D6lE,8436
|
|
19
|
+
mcp_use/connectors/sandbox.py,sha256=oXs4Q_1bQJ10XOrJLjFUBKvFy2VmWmyzLhotczl44Po,11804
|
|
20
|
+
mcp_use/connectors/stdio.py,sha256=4gXdXyaeA3B-ywAjPmbEEbHxP2Gg5cWsXNC2kHkubDA,3766
|
|
21
|
+
mcp_use/connectors/utils.py,sha256=zQ8GdNQx0Twz3by90BoU1RsWPf9wODGof4K3-NxPXeA,366
|
|
22
|
+
mcp_use/connectors/websocket.py,sha256=G7ZeLJNPVl9AG6kCmiNJz1N2Ing_QxT7pSswigTKi8Y,9650
|
|
23
|
+
mcp_use/errors/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
24
|
+
mcp_use/errors/error_formatting.py,sha256=17lhj5goGHuTbJ5oLCUXyJ2SuIbzsuSM1Wk8LPeqY9k,911
|
|
25
|
+
mcp_use/managers/__init__.py,sha256=FRTuJw5kYtY1Eo7wN9Aeqeqo1euiR5slvrx5Fl_SGvk,383
|
|
26
|
+
mcp_use/managers/server_manager.py,sha256=eWxiuP0yL3HWSyCWdHqNZ1isZfa3IZDWVEjWSfYOs_A,5253
|
|
27
|
+
mcp_use/managers/tools/__init__.py,sha256=zcpm4HXsp8NUMRJeyT6DdB8cgIMDs46pBfoTD-odhGU,437
|
|
28
|
+
mcp_use/managers/tools/base_tool.py,sha256=Jbbp7SwmHKDk8jT_6yVIv7iNsn6KaV_PljWuhhLcbXg,509
|
|
29
|
+
mcp_use/managers/tools/connect_server.py,sha256=-PlqgJDSMzairK90aDg1WTDjpqrFMoTiyekwoPDWNrw,2964
|
|
30
|
+
mcp_use/managers/tools/disconnect_server.py,sha256=dLa5PH-QZ30Dw3n5lzqilyHA8PuQ6xvMkXd-T5EwpU8,1622
|
|
31
|
+
mcp_use/managers/tools/get_active_server.py,sha256=tCaib76gYU3L5G82tEOTq4Io2cuCXWjOjPselb-92i8,964
|
|
32
|
+
mcp_use/managers/tools/list_servers_tool.py,sha256=P_Z96Ab8ELLyo3GQfTMfyemTPJwt0VR1s_iMnWE1GCg,2037
|
|
33
|
+
mcp_use/managers/tools/search_tools.py,sha256=4vso7ln-AfG6lQAMq9FA_CyeVtSEDYEWlHtdHtfnLps,12911
|
|
34
|
+
mcp_use/observability/__init__.py,sha256=kTUcP0d6L5_3ktfldhdAk-3AWckzVHs7ztG-R6cye64,186
|
|
35
|
+
mcp_use/observability/laminar.py,sha256=WWjmVXP55yCfAlqlayeuJmym1gdrv8is7UyrIp4Tbn0,839
|
|
36
|
+
mcp_use/observability/langfuse.py,sha256=9vgJgnGtVpv_CbCyJqyRkzq2ELqPfYFIUGnpSbm2RCo,1334
|
|
37
|
+
mcp_use/task_managers/__init__.py,sha256=LkXOjiDq5JcyB2tNJuSzyjbxZTl1Ordr_NKKD77Nb7g,557
|
|
38
|
+
mcp_use/task_managers/base.py,sha256=mvLFTVyOfvBWFmkx5l8DZVZUezbhsRARDDfMS2AuFLE,5031
|
|
39
|
+
mcp_use/task_managers/sse.py,sha256=nLKt99OiqoJxFT62zCeNwSZUmdPPg4SD7M1pCEPOa3c,2391
|
|
40
|
+
mcp_use/task_managers/stdio.py,sha256=MJcW03lUZUs_HEUxwFPaqy7m8QLbmdn6LagpcfZdjc8,2130
|
|
41
|
+
mcp_use/task_managers/streamable_http.py,sha256=Zky821Ston5CX0DQVyeRxc2uUqALD8soonRSe09cHcE,2683
|
|
42
|
+
mcp_use/task_managers/websocket.py,sha256=9JTw705rhYbP6x2xAPF6PwtNgF5yEWTQhx-dYSPMoaI,2154
|
|
43
|
+
mcp_use/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
+
mcp_use/telemetry/events.py,sha256=K5xqbmkum30r4gM2PWtTiUWGF8oZzGZw2DYwco1RfOQ,3113
|
|
45
|
+
mcp_use/telemetry/telemetry.py,sha256=oM_QAbZwOStKkeccvEfKmJLKhL2neFkPn5yM5rL2qHc,11711
|
|
46
|
+
mcp_use/telemetry/utils.py,sha256=kDVTqt2oSeWNJbnTOlXOehr2yFO0PMyx2UGkrWkfJiw,1769
|
|
47
|
+
mcp_use/types/sandbox.py,sha256=opJ9r56F1FvaqVvPovfAj5jZbsOexgwYx5wLgSlN8_U,712
|
|
48
|
+
mcp_use-1.3.9.dist-info/METADATA,sha256=U-uwkjLkdcK1IkliQ6UGY_jKRUJEgN1K_2xQEHTB9Yk,34122
|
|
49
|
+
mcp_use-1.3.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
50
|
+
mcp_use-1.3.9.dist-info/licenses/LICENSE,sha256=7Pw7dbwJSBw8zH-WE03JnR5uXvitRtaGTP9QWPcexcs,1068
|
|
51
|
+
mcp_use-1.3.9.dist-info/RECORD,,
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from typing import Any, ClassVar
|
|
3
|
-
|
|
4
|
-
from langchain_core.tools import BaseTool
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
6
|
-
|
|
7
|
-
from mcp_use.logging import logger
|
|
8
|
-
|
|
9
|
-
from .base_tool import MCPServerTool
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class UseToolInput(BaseModel):
|
|
13
|
-
"""Input for using a tool from a specific server"""
|
|
14
|
-
|
|
15
|
-
server_name: str = Field(description="The name of the MCP server containing the tool")
|
|
16
|
-
tool_name: str = Field(description="The name of the tool to execute")
|
|
17
|
-
tool_input: dict[str, Any] | str = Field(
|
|
18
|
-
description="The input to pass to the tool. Can be a dictionary of parameters or a string"
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class UseToolFromServerTool(MCPServerTool):
|
|
23
|
-
"""Tool for directly executing a tool from a specific server."""
|
|
24
|
-
|
|
25
|
-
name: ClassVar[str] = "use_tool_from_server"
|
|
26
|
-
description: ClassVar[str] = (
|
|
27
|
-
"Execute a specific tool on a specific server without first connecting to it. "
|
|
28
|
-
"This is a direct execution shortcut that combines connection and tool execution "
|
|
29
|
-
"into a single step. Specify the server name, tool name, and the input to the tool."
|
|
30
|
-
)
|
|
31
|
-
args_schema: ClassVar[type[BaseModel]] = UseToolInput
|
|
32
|
-
|
|
33
|
-
async def _arun(self, server_name: str, tool_name: str, tool_input: dict[str, Any] | str) -> str:
|
|
34
|
-
"""Execute a tool from a specific server."""
|
|
35
|
-
# Check if server exists
|
|
36
|
-
servers = self.server_manager.client.get_server_names()
|
|
37
|
-
if server_name not in servers:
|
|
38
|
-
available = ", ".join(servers) if servers else "none"
|
|
39
|
-
return f"Server '{server_name}' not found. Available servers: {available}"
|
|
40
|
-
|
|
41
|
-
# Connect to the server if not already connected or not the active server
|
|
42
|
-
is_connected = server_name == self.server_manager.active_server
|
|
43
|
-
|
|
44
|
-
if not is_connected:
|
|
45
|
-
try:
|
|
46
|
-
# Create or get session for this server
|
|
47
|
-
try:
|
|
48
|
-
session = self.server_manager.client.get_session(server_name)
|
|
49
|
-
logger.debug(f"Using existing session for server '{server_name}'")
|
|
50
|
-
except ValueError:
|
|
51
|
-
logger.debug(f"Creating new session for server '{server_name}' for tool use")
|
|
52
|
-
session = await self.server_manager.client.create_session(server_name)
|
|
53
|
-
|
|
54
|
-
# Check if we have tools for this server, if not get them
|
|
55
|
-
if server_name not in self.server_manager._server_tools:
|
|
56
|
-
connector = session.connector
|
|
57
|
-
self.server_manager._server_tools[
|
|
58
|
-
server_name
|
|
59
|
-
] = await self.server_manager.adapter._create_tools_from_connectors([connector])
|
|
60
|
-
self.server_manager.initialized_servers[server_name] = True
|
|
61
|
-
except Exception as e:
|
|
62
|
-
logger.error(f"Error connecting to server '{server_name}' for tool use: {e}")
|
|
63
|
-
return f"Failed to connect to server '{server_name}': {str(e)}"
|
|
64
|
-
|
|
65
|
-
# Get tools for the server
|
|
66
|
-
server_tools = self.server_manager._server_tools.get(server_name, [])
|
|
67
|
-
if not server_tools:
|
|
68
|
-
return f"No tools found for server '{server_name}'"
|
|
69
|
-
|
|
70
|
-
# Find the requested tool
|
|
71
|
-
target_tool = None
|
|
72
|
-
for tool in server_tools:
|
|
73
|
-
if tool.name == tool_name:
|
|
74
|
-
target_tool = tool
|
|
75
|
-
break
|
|
76
|
-
|
|
77
|
-
if not target_tool:
|
|
78
|
-
tool_names = [t.name for t in server_tools]
|
|
79
|
-
return f"Tool '{tool_name}' not found on server '{server_name}'. Available tools: {', '.join(tool_names)}"
|
|
80
|
-
|
|
81
|
-
# Execute the tool with the provided input
|
|
82
|
-
try:
|
|
83
|
-
# Parse the input based on target tool's schema
|
|
84
|
-
structured_input = self._parse_tool_input(target_tool, tool_input)
|
|
85
|
-
if structured_input is None:
|
|
86
|
-
return f"Could not parse input for tool '{tool_name}'. Please check the input format and try again."
|
|
87
|
-
|
|
88
|
-
# Store the previous active server
|
|
89
|
-
previous_active = self.server_manager.active_server
|
|
90
|
-
|
|
91
|
-
# Temporarily set this server as active
|
|
92
|
-
self.server_manager.active_server = server_name
|
|
93
|
-
|
|
94
|
-
# Execute the tool
|
|
95
|
-
logger.info(f"Executing tool '{tool_name}' on server '{server_name}'with input: {{structured_input}}")
|
|
96
|
-
result = await target_tool._arun(**structured_input)
|
|
97
|
-
|
|
98
|
-
# Restore the previous active server
|
|
99
|
-
self.server_manager.active_server = previous_active
|
|
100
|
-
|
|
101
|
-
return result
|
|
102
|
-
|
|
103
|
-
except Exception as e:
|
|
104
|
-
logger.error(f"Error executing tool '{tool_name}' on server '{server_name}': {e}")
|
|
105
|
-
return (
|
|
106
|
-
f"Error executing tool '{tool_name}' on server '{server_name}': {str(e)}. "
|
|
107
|
-
f"Make sure the input format is correct for this tool."
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
def _parse_tool_input(self, tool: BaseTool, input_data: dict[str, Any] | str) -> dict[str, Any]:
|
|
111
|
-
"""
|
|
112
|
-
Parse the input data according to the tool's schema.
|
|
113
|
-
|
|
114
|
-
Args:
|
|
115
|
-
tool: The target tool
|
|
116
|
-
input_data: The input data, either a dictionary or a string
|
|
117
|
-
|
|
118
|
-
Returns:
|
|
119
|
-
A dictionary with properly structured input for the tool
|
|
120
|
-
"""
|
|
121
|
-
# If input is already a dict, use it directly
|
|
122
|
-
if isinstance(input_data, dict):
|
|
123
|
-
return input_data
|
|
124
|
-
|
|
125
|
-
# Try to parse as JSON first
|
|
126
|
-
if isinstance(input_data, str):
|
|
127
|
-
try:
|
|
128
|
-
return json.loads(input_data)
|
|
129
|
-
except json.JSONDecodeError:
|
|
130
|
-
pass
|
|
131
|
-
|
|
132
|
-
# For string input, we need to determine which parameter name to use
|
|
133
|
-
if hasattr(tool, "args_schema") and tool.args_schema:
|
|
134
|
-
schema_cls = tool.args_schema
|
|
135
|
-
field_names = list(schema_cls.__fields__.keys())
|
|
136
|
-
|
|
137
|
-
# If schema has only one field, use that
|
|
138
|
-
if len(field_names) == 1:
|
|
139
|
-
return {field_names[0]: input_data}
|
|
140
|
-
|
|
141
|
-
# Look for common input field names
|
|
142
|
-
for name in field_names:
|
|
143
|
-
if name.lower() in ["input", "query", "url", tool.name.lower()]:
|
|
144
|
-
return {name: input_data}
|
|
145
|
-
|
|
146
|
-
# Default to first field if we can't determine
|
|
147
|
-
return {field_names[0]: input_data}
|
|
148
|
-
|
|
149
|
-
# If we get here something went wrong
|
|
150
|
-
return None
|
|
151
|
-
|
|
152
|
-
def _run(self, server_name: str, tool_name: str, tool_input: dict[str, Any] | str) -> str:
|
|
153
|
-
"""Synchronous version that raises a NotImplementedError."""
|
|
154
|
-
raise NotImplementedError("UseToolFromServerTool requires async execution. Use _arun instead.")
|
mcp_use-1.3.7.dist-info/RECORD
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
mcp_use/__init__.py,sha256=I3gFxw6Id45RksUBIZS1kxBW3ItjFXuAfoReJabpnW0,1055
|
|
2
|
-
mcp_use/client.py,sha256=ka9gE_GQj9a1fcWfz-hrAzYwSN5I1Y1JXo2Tq0uRCOU,10718
|
|
3
|
-
mcp_use/config.py,sha256=zLw8F9bBi4hMmKmjxMIS47GIlHWmP4r35A-_K5c7Kqk,2974
|
|
4
|
-
mcp_use/logging.py,sha256=CRtkPwR-bkXK_kQ0QOL86RikMWOHzEOi7A8VRHkNsZw,4270
|
|
5
|
-
mcp_use/session.py,sha256=4kwcB_IkTt_3FiBSTI1H17KhL1W_6N5oai3HTxFrTH4,2496
|
|
6
|
-
mcp_use/utils.py,sha256=QavJcVq2WxUUUCCpPCUeOB5bqIS0FFmpK-RAZkGc6aA,720
|
|
7
|
-
mcp_use/adapters/__init__.py,sha256=-xCrgPThuX7x0PHGFDdjb7M-mgw6QV3sKu5PM7ShnRg,275
|
|
8
|
-
mcp_use/adapters/base.py,sha256=U1z_UzojC-bytb4ZuKTRpEgEp-2F_BVBgqEXbUqLYB4,6901
|
|
9
|
-
mcp_use/adapters/langchain_adapter.py,sha256=LdlpRyLORhl8NZvtAmisgPelXkhEbBErSNdGHb8SF18,10860
|
|
10
|
-
mcp_use/agents/__init__.py,sha256=N3eVYP2PxqNO2KcQv5fY8UMUX2W3eLTNkkzuFIJ1DUA,261
|
|
11
|
-
mcp_use/agents/base.py,sha256=EN-dRbwOi9vIqofFg3jmi5yT2VKlwEr9Cwi1DZgB3eE,1591
|
|
12
|
-
mcp_use/agents/mcpagent.py,sha256=K3gKlPvqIPiniifi46Xs82_D2YKNO-Vn4BTTH55LPbI,35753
|
|
13
|
-
mcp_use/agents/prompts/system_prompt_builder.py,sha256=E86STmxcl2Ic763_114awNqFB2RyLrQlbvgRmJajQjI,4116
|
|
14
|
-
mcp_use/agents/prompts/templates.py,sha256=AZKrGWuI516C-PmyOPvxDBibNdqJtN24sOHTGR06bi4,1933
|
|
15
|
-
mcp_use/connectors/__init__.py,sha256=cUF4yT0bNr8qeLkSzg28SHueiV5qDaHEB1l1GZ2K0dc,536
|
|
16
|
-
mcp_use/connectors/base.py,sha256=bCPOrSb3xzuxQRFpcLf7tCG1UmMFtr9IVM7br8JlbzI,13878
|
|
17
|
-
mcp_use/connectors/http.py,sha256=8LVzXtVtdLVQH9xMIqPzKfPEmaO_cxzMIu4g4oGIung,7912
|
|
18
|
-
mcp_use/connectors/sandbox.py,sha256=RX8xssn0cIObW6CjOqY7ZrO_D9lTzCZKdRcJ5lQSmQg,11441
|
|
19
|
-
mcp_use/connectors/stdio.py,sha256=jTNhrsHxkRgSI9uAnj4bbFsBwe6zooc-oNcMXV_s9Xk,3378
|
|
20
|
-
mcp_use/connectors/utils.py,sha256=zQ8GdNQx0Twz3by90BoU1RsWPf9wODGof4K3-NxPXeA,366
|
|
21
|
-
mcp_use/connectors/websocket.py,sha256=G7ZeLJNPVl9AG6kCmiNJz1N2Ing_QxT7pSswigTKi8Y,9650
|
|
22
|
-
mcp_use/managers/__init__.py,sha256=rzsJbOhtlmxNQLGcdmtmHaiExEXmiQiUuzPrAgKhAJw,439
|
|
23
|
-
mcp_use/managers/server_manager.py,sha256=Ag1EUSxkG6-UG004vcvaZarPoDnUUMMX7BUeKReUWRI,3704
|
|
24
|
-
mcp_use/managers/tools/__init__.py,sha256=JrA5iTRdtbgwROJE8pQ7GH1sYnqBRcgj4NzFVADKbQ4,510
|
|
25
|
-
mcp_use/managers/tools/base_tool.py,sha256=Jbbp7SwmHKDk8jT_6yVIv7iNsn6KaV_PljWuhhLcbXg,509
|
|
26
|
-
mcp_use/managers/tools/connect_server.py,sha256=MGYQCl11q-w6gSIYuT44dDk7ILV3Oh7kGAJ4fsNXbso,2923
|
|
27
|
-
mcp_use/managers/tools/disconnect_server.py,sha256=Y3kJN31efzsjfJwxUhpBxS-bgU21DCfGbn_LgEbzyvI,1586
|
|
28
|
-
mcp_use/managers/tools/get_active_server.py,sha256=tCaib76gYU3L5G82tEOTq4Io2cuCXWjOjPselb-92i8,964
|
|
29
|
-
mcp_use/managers/tools/list_servers_tool.py,sha256=OPDSMNe-VuAhlUyhDnR4CiuZFpoMhnhWpAablwO5S0k,1897
|
|
30
|
-
mcp_use/managers/tools/search_tools.py,sha256=4vso7ln-AfG6lQAMq9FA_CyeVtSEDYEWlHtdHtfnLps,12911
|
|
31
|
-
mcp_use/managers/tools/use_tool.py,sha256=gMNjgJrI9XDitPyJglcJcAvowbEWkO5z57yt4DT2Lpc,6626
|
|
32
|
-
mcp_use/observability/__init__.py,sha256=kTUcP0d6L5_3ktfldhdAk-3AWckzVHs7ztG-R6cye64,186
|
|
33
|
-
mcp_use/observability/laminar.py,sha256=WWjmVXP55yCfAlqlayeuJmym1gdrv8is7UyrIp4Tbn0,839
|
|
34
|
-
mcp_use/observability/langfuse.py,sha256=9vgJgnGtVpv_CbCyJqyRkzq2ELqPfYFIUGnpSbm2RCo,1334
|
|
35
|
-
mcp_use/task_managers/__init__.py,sha256=LkXOjiDq5JcyB2tNJuSzyjbxZTl1Ordr_NKKD77Nb7g,557
|
|
36
|
-
mcp_use/task_managers/base.py,sha256=mvLFTVyOfvBWFmkx5l8DZVZUezbhsRARDDfMS2AuFLE,5031
|
|
37
|
-
mcp_use/task_managers/sse.py,sha256=nLKt99OiqoJxFT62zCeNwSZUmdPPg4SD7M1pCEPOa3c,2391
|
|
38
|
-
mcp_use/task_managers/stdio.py,sha256=MJcW03lUZUs_HEUxwFPaqy7m8QLbmdn6LagpcfZdjc8,2130
|
|
39
|
-
mcp_use/task_managers/streamable_http.py,sha256=Zky821Ston5CX0DQVyeRxc2uUqALD8soonRSe09cHcE,2683
|
|
40
|
-
mcp_use/task_managers/websocket.py,sha256=9JTw705rhYbP6x2xAPF6PwtNgF5yEWTQhx-dYSPMoaI,2154
|
|
41
|
-
mcp_use/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
|
-
mcp_use/telemetry/events.py,sha256=K5xqbmkum30r4gM2PWtTiUWGF8oZzGZw2DYwco1RfOQ,3113
|
|
43
|
-
mcp_use/telemetry/telemetry.py,sha256=ck2MDFMtooafriR1W_zi41dWq-0O-ucF89pCkdkyc9E,11724
|
|
44
|
-
mcp_use/telemetry/utils.py,sha256=kDVTqt2oSeWNJbnTOlXOehr2yFO0PMyx2UGkrWkfJiw,1769
|
|
45
|
-
mcp_use/types/sandbox.py,sha256=opJ9r56F1FvaqVvPovfAj5jZbsOexgwYx5wLgSlN8_U,712
|
|
46
|
-
mcp_use-1.3.7.dist-info/METADATA,sha256=ZElQuSVQ92ph2WHTWsEPPPIFGpwHjMHa4MZ6gDNp-KY,30337
|
|
47
|
-
mcp_use-1.3.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
48
|
-
mcp_use-1.3.7.dist-info/licenses/LICENSE,sha256=7Pw7dbwJSBw8zH-WE03JnR5uXvitRtaGTP9QWPcexcs,1068
|
|
49
|
-
mcp_use-1.3.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|