mcp-use 1.2.12__tar.gz → 1.3.0__tar.gz

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.

Files changed (93) hide show
  1. mcp_use-1.2.12/.github/workflows/tests.yml → mcp_use-1.3.0/.github/workflows/unittests.yml +2 -2
  2. {mcp_use-1.2.12 → mcp_use-1.3.0}/PKG-INFO +176 -33
  3. {mcp_use-1.2.12 → mcp_use-1.3.0}/README.md +173 -32
  4. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/api-reference/introduction.mdx +157 -15
  5. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/essentials/configuration.mdx +87 -1
  6. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/essentials/connection-types.mdx +76 -2
  7. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/quickstart.mdx +73 -0
  8. mcp_use-1.3.0/examples/sandbox_everything.py +69 -0
  9. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/adapters/base.py +31 -10
  10. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/adapters/langchain_adapter.py +112 -2
  11. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/agents/mcpagent.py +8 -12
  12. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/client.py +18 -9
  13. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/config.py +30 -4
  14. mcp_use-1.3.0/mcp_use/connectors/__init__.py +20 -0
  15. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/connectors/base.py +83 -20
  16. mcp_use-1.3.0/mcp_use/connectors/sandbox.py +291 -0
  17. mcp_use-1.3.0/mcp_use/connectors/utils.py +13 -0
  18. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/session.py +3 -29
  19. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/task_managers/base.py +3 -5
  20. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/task_managers/sse.py +2 -5
  21. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/task_managers/stdio.py +2 -6
  22. mcp_use-1.3.0/mcp_use/task_managers/websocket.py +63 -0
  23. mcp_use-1.3.0/mcp_use/types/clientoptions.py +23 -0
  24. mcp_use-1.3.0/mcp_use/types/sandbox.py +23 -0
  25. {mcp_use-1.2.12 → mcp_use-1.3.0}/pyproject.toml +4 -1
  26. {mcp_use-1.2.12 → mcp_use-1.3.0}/ruff.toml +1 -1
  27. mcp_use-1.3.0/static/logo_black.svg +8 -0
  28. mcp_use-1.3.0/static/logo_white.svg +8 -0
  29. {mcp_use-1.2.12 → mcp_use-1.3.0}/tests/unit/test_client.py +2 -2
  30. {mcp_use-1.2.12 → mcp_use-1.3.0}/tests/unit/test_config.py +79 -1
  31. {mcp_use-1.2.12 → mcp_use-1.3.0}/tests/unit/test_http_connector.py +69 -27
  32. mcp_use-1.3.0/tests/unit/test_sandbox_connector.py +308 -0
  33. {mcp_use-1.2.12 → mcp_use-1.3.0}/tests/unit/test_session.py +0 -58
  34. {mcp_use-1.2.12 → mcp_use-1.3.0}/tests/unit/test_stdio_connector.py +75 -22
  35. mcp_use-1.2.12/mcp_use/connectors/__init__.py +0 -13
  36. mcp_use-1.2.12/mcp_use/task_managers/websocket.py +0 -63
  37. mcp_use-1.2.12/static/image.jpg +0 -0
  38. {mcp_use-1.2.12 → mcp_use-1.3.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  39. {mcp_use-1.2.12 → mcp_use-1.3.0}/.github/pull_request_template.md +0 -0
  40. {mcp_use-1.2.12 → mcp_use-1.3.0}/.github/workflows/publish.yml +0 -0
  41. {mcp_use-1.2.12 → mcp_use-1.3.0}/.gitignore +0 -0
  42. {mcp_use-1.2.12 → mcp_use-1.3.0}/.pre-commit-config.yaml +0 -0
  43. {mcp_use-1.2.12 → mcp_use-1.3.0}/CONTRIBUTING.md +0 -0
  44. {mcp_use-1.2.12 → mcp_use-1.3.0}/LICENSE +0 -0
  45. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/README.md +0 -0
  46. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/api-reference/mcpagent.mdx +0 -0
  47. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/building-custom-agents.mdx +0 -0
  48. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/development.mdx +0 -0
  49. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/docs.json +0 -0
  50. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/essentials/debugging.mdx +0 -0
  51. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/essentials/llm-integration.mdx +0 -0
  52. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/essentials/server-manager.mdx +0 -0
  53. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/favicon.svg +0 -0
  54. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/images/hero-dark.png +0 -0
  55. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/images/hero-light.png +0 -0
  56. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/introduction.mdx +0 -0
  57. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/logo/dark.svg +0 -0
  58. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/logo/light.svg +0 -0
  59. {mcp_use-1.2.12 → mcp_use-1.3.0}/docs/snippets/snippet-intro.mdx +0 -0
  60. {mcp_use-1.2.12 → mcp_use-1.3.0}/examples/airbnb_mcp.json +0 -0
  61. {mcp_use-1.2.12 → mcp_use-1.3.0}/examples/airbnb_use.py +0 -0
  62. {mcp_use-1.2.12 → mcp_use-1.3.0}/examples/blender_use.py +0 -0
  63. {mcp_use-1.2.12 → mcp_use-1.3.0}/examples/browser_mcp.json +0 -0
  64. {mcp_use-1.2.12 → mcp_use-1.3.0}/examples/browser_use.py +0 -0
  65. {mcp_use-1.2.12 → mcp_use-1.3.0}/examples/chat_example.py +0 -0
  66. {mcp_use-1.2.12 → mcp_use-1.3.0}/examples/filesystem_use.py +0 -0
  67. {mcp_use-1.2.12 → mcp_use-1.3.0}/examples/http_example.py +0 -0
  68. {mcp_use-1.2.12 → mcp_use-1.3.0}/examples/mcp_everything.py +0 -0
  69. {mcp_use-1.2.12 → mcp_use-1.3.0}/examples/multi_server_example.py +0 -0
  70. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/__init__.py +0 -0
  71. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/adapters/__init__.py +0 -0
  72. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/agents/__init__.py +0 -0
  73. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/agents/base.py +0 -0
  74. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/agents/prompts/system_prompt_builder.py +0 -0
  75. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/agents/prompts/templates.py +0 -0
  76. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/connectors/http.py +0 -0
  77. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/connectors/stdio.py +0 -0
  78. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/connectors/websocket.py +0 -0
  79. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/logging.py +0 -0
  80. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/managers/__init__.py +0 -0
  81. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/managers/server_manager.py +0 -0
  82. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/managers/tools/__init__.py +0 -0
  83. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/managers/tools/base_tool.py +0 -0
  84. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/managers/tools/connect_server.py +0 -0
  85. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/managers/tools/disconnect_server.py +0 -0
  86. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/managers/tools/get_active_server.py +0 -0
  87. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/managers/tools/list_servers_tool.py +0 -0
  88. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/managers/tools/search_tools.py +0 -0
  89. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/managers/tools/use_tool.py +0 -0
  90. {mcp_use-1.2.12 → mcp_use-1.3.0}/mcp_use/task_managers/__init__.py +0 -0
  91. {mcp_use-1.2.12 → mcp_use-1.3.0}/pytest.ini +0 -0
  92. {mcp_use-1.2.12 → mcp_use-1.3.0}/tests/conftest.py +0 -0
  93. {mcp_use-1.2.12 → mcp_use-1.3.0}/tests/unit/test_logging.py +0 -0
@@ -22,10 +22,10 @@ jobs:
22
22
  - name: Install dependencies
23
23
  run: |
24
24
  python -m pip install --upgrade pip
25
- pip install .[dev,anthropic,openai,search]
25
+ pip install .[dev,anthropic,openai,search,e2b]
26
26
  - name: Lint with ruff
27
27
  run: |
28
28
  ruff check .
29
29
  - name: Test with pytest
30
30
  run: |
31
- pytest
31
+ pytest tests/unit
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-use
3
- Version: 1.2.12
3
+ Version: 1.3.0
4
4
  Summary: MCP Library for LLMs
5
5
  Author-email: Pietro Zullo <pietro.zullo@gmail.com>
6
6
  License: MIT
@@ -33,48 +33,100 @@ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
33
33
  Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
34
34
  Requires-Dist: pytest>=7.4.0; extra == 'dev'
35
35
  Requires-Dist: ruff>=0.1.0; extra == 'dev'
36
+ Provides-Extra: e2b
37
+ Requires-Dist: e2b-code-interpreter>=1.5.0; extra == 'e2b'
36
38
  Provides-Extra: openai
37
39
  Requires-Dist: openai>=1.10.0; extra == 'openai'
38
40
  Provides-Extra: search
39
41
  Requires-Dist: fastembed>=0.0.1; extra == 'search'
40
42
  Description-Content-Type: text/markdown
41
43
 
42
- <picture>
43
- <img alt="" src="./static/image.jpg" width="full">
44
- </picture>
44
+ <div align="center" style="margin: 0 auto; max-width: 80%;">
45
+ <picture>
46
+ <source media="(prefers-color-scheme: dark)" srcset="static/logo_white.svg">
47
+ <source media="(prefers-color-scheme: light)" srcset="static/logo_black.svg">
48
+ <img alt="mcp use logo" src="./static/logo-white.svg" width="80%" style="margin: 20px auto;">
49
+ </picture>
50
+ </div>
45
51
 
46
52
  <h1 align="center">Unified MCP Client Library </h1>
47
-
48
- [![](https://img.shields.io/pypi/dw/mcp_use.svg)](https://pypi.org/project/mcp_use/)
49
- [![PyPI Downloads](https://img.shields.io/pypi/dm/mcp_use.svg)](https://pypi.org/project/mcp_use/)
50
- [![PyPI Version](https://img.shields.io/pypi/v/mcp_use.svg)](https://pypi.org/project/mcp_use/)
51
- [![Python Versions](https://img.shields.io/pypi/pyversions/mcp_use.svg)](https://pypi.org/project/mcp_use/)
52
- [![Documentation](https://img.shields.io/badge/docs-mcp--use.io-blue)](https://docs.mcp-use.io)
53
- [![Website](https://img.shields.io/badge/website-mcp--use.io-blue)](https://mcp-use.io)
54
- [![License](https://img.shields.io/github/license/pietrozullo/mcp-use)](https://github.com/pietrozullo/mcp-use/blob/main/LICENSE)
55
- [![Code style: Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
56
- [![GitHub stars](https://img.shields.io/github/stars/pietrozullo/mcp-use?style=social)](https://github.com/pietrozullo/mcp-use/stargazers)
57
- [![Twitter Follow](https://img.shields.io/twitter/follow/Pietro?style=social)](https://x.com/pietrozullo)
58
-
53
+ <p align="center">
54
+ <a href="https://pypi.org/project/mcp_use/" alt="PyPI Version">
55
+ <img src="https://img.shields.io/pypi/v/mcp_use.svg"/></a>
56
+ <a href="https://pypi.org/project/mcp_use/" alt="PyPI Downloads">
57
+ <img src="https://static.pepy.tech/badge/mcp-use" /></a>
58
+ <a href="https://pypi.org/project/mcp_use/" alt="Python Versions">
59
+ <img src="https://img.shields.io/pypi/pyversions/mcp_use.svg" /></a>
60
+ <a href="https://docs.mcp-use.io" alt="Documentation">
61
+ <img src="https://img.shields.io/badge/docs-mcp--use.io-blue" /></a>
62
+ <a href="https://mcp-use.io" alt="Website">
63
+ <img src="https://img.shields.io/badge/website-mcp--use.io-blue" /></a>
64
+ <a href="https://github.com/pietrozullo/mcp-use/blob/main/LICENSE" alt="License">
65
+ <img src="https://img.shields.io/github/license/pietrozullo/mcp-use" /></a>
66
+ <a href="https://github.com/astral-sh/ruff" alt="Code style: Ruff">
67
+ <img src="https://img.shields.io/badge/code%20style-ruff-000000.svg" /></a>
68
+ <a href="https://github.com/pietrozullo/mcp-use/stargazers" alt="GitHub stars">
69
+ <img src="https://img.shields.io/github/stars/pietrozullo/mcp-use?style=social" /></a>
70
+ </p>
71
+ <p align="center">
72
+ <a href="https://x.com/pietrozullo" alt="Twitter Follow - Pietro">
73
+ <img src="https://img.shields.io/twitter/follow/Pietro?style=social" /></a>
74
+ <a href="https://x.com/pederzh" alt="Twitter Follow - Luigi">
75
+ <img src="https://img.shields.io/twitter/follow/Luigi?style=social" /></a>
76
+ <a href="https://discord.gg/XkNkSkMz3V" alt="Discord">
77
+ <img src="https://dcbadge.limes.pink/api/server/https://discord.gg/XkNkSkMz3V?style=flat" /></a>
78
+ </p>
59
79
  🌐 MCP-Use is the open source way to connect **any LLM to any MCP server** and build custom agents that have tool access, without using closed source or application clients.
60
80
 
81
+ 💬 Get started quickly - chat with your servers on our <b>hosted version</b>! <b>[Try mcp-use chat *(beta)* ](https://chat.mcp-use.io)</b>.
82
+
61
83
  💡 Let developers easily connect any LLM to tools like web browsing, file operations, and more.
62
84
 
63
85
  # Features
64
86
 
65
87
  ## ✨ Key Features
66
-
67
- | Feature | Description |
68
- |---------|-------------|
69
- | 🔄 [**Ease of use**](#quick-start) | Create your first MCP capable agent you need only 6 lines of code |
70
- | 🤖 [**LLM Flexibility**](#installing-langchain-providers) | Works with any langchain supported LLM that supports tool calling (OpenAI, Anthropic, Groq, LLama etc.) |
71
- | 🌐 [**Code Builder**](https://mcp-use.io/builder) | Explore MCP capabilities and generate starter code with the interactive [code builder](https://mcp-use.io/builder). |
72
- | 🔗 [**HTTP Support**](#http-connection-example) | Direct connection to MCP servers running on specific HTTP ports |
73
- | ⚙️ [**Dynamic Server Selection**](#dynamic-server-selection-server-manager) | Agents can dynamically choose the most appropriate MCP server for a given task from the available pool |
74
- | 🧩 [**Multi-Server Support**](#multi-server-support) | Use multiple MCP servers simultaneously in a single agent |
75
- | 🛡️ [**Tool Restrictions**](#tool-access-control) | Restrict potentially dangerous tools like file system or network access |
76
- | 🔧 [**Custom Agents**](#build-a-custom-agent) | Build your own agents with any framework using the LangChain adapter or create new adapters |
77
-
88
+ <table>
89
+ <tr>
90
+ <th width="400">Feature</th>
91
+ <th>Description</th>
92
+ </tr>
93
+ <tr>
94
+ <td>🔄 <a href="#quick-start"><strong>Ease of use</strong></a></td>
95
+ <td>Create your first MCP capable agent you need only 6 lines of code</td>
96
+ </tr>
97
+ <tr>
98
+ <td>🤖 <a href="#installing-langchain-providers"><strong>LLM Flexibility</strong></a></td>
99
+ <td>Works with any langchain supported LLM that supports tool calling (OpenAI, Anthropic, Groq, LLama etc.)</td>
100
+ </tr>
101
+ <tr>
102
+ <td>🌐 <a href="https://mcp-use.io/builder"><strong>Code Builder</strong></a></td>
103
+ <td>Explore MCP capabilities and generate starter code with the interactive <a href="https://mcp-use.io/builder">code builder</a>.</td>
104
+ </tr>
105
+ <tr>
106
+ <td>🔗 <a href="#http-connection-example"><strong>HTTP Support</strong></a></td>
107
+ <td>Direct connection to MCP servers running on specific HTTP ports</td>
108
+ </tr>
109
+ <tr>
110
+ <td>⚙️ <a href="#dynamic-server-selection-server-manager"><strong>Dynamic Server Selection</strong></a></td>
111
+ <td>Agents can dynamically choose the most appropriate MCP server for a given task from the available pool</td>
112
+ </tr>
113
+ <tr>
114
+ <td>🧩 <a href="#multi-server-support"><strong>Multi-Server Support</strong></a></td>
115
+ <td>Use multiple MCP servers simultaneously in a single agent</td>
116
+ </tr>
117
+ <tr>
118
+ <td>🛡️ <a href="#tool-access-control"><strong>Tool Restrictions</strong></a></td>
119
+ <td>Restrict potentially dangerous tools like file system or network access</td>
120
+ </tr>
121
+ <tr>
122
+ <td>🔧 <a href="#build-a-custom-agent"><strong>Custom Agents</strong></a></td>
123
+ <td>Build your own agents with any framework using the LangChain adapter or create new adapters</td>
124
+ </tr>
125
+ <tr>
126
+ <td>❓ <a href="https://mcp-use.io/what-should-we-build-next"><strong>What should we build next</strong></a></td>
127
+ <td>Let us know what you'd like us to build next</td>
128
+ </tr>
129
+ </table>
78
130
 
79
131
  # Quick start
80
132
 
@@ -102,11 +154,8 @@ pip install langchain-openai
102
154
 
103
155
  # For Anthropic
104
156
  pip install langchain-anthropic
105
-
106
- # For other providers, check the [LangChain chat models documentation](https://python.langchain.com/docs/integrations/chat/)
107
157
  ```
108
-
109
- and add your API keys for the provider you want to use to your `.env` file.
158
+ For other providers, check the [LangChain chat models documentation](https://python.langchain.com/docs/integrations/chat/) and add your API keys for the provider you want to use to your `.env` file.
110
159
 
111
160
  ```bash
112
161
  OPENAI_API_KEY=
@@ -545,6 +594,101 @@ if __name__ == "__main__":
545
594
  asyncio.run(main())
546
595
  ```
547
596
 
597
+ # Sandboxed Execution
598
+
599
+ MCP-Use supports running MCP servers in a sandboxed environment using E2B's cloud infrastructure. This allows you to run MCP servers without having to install dependencies locally, making it easier to use tools that might have complex setups or system requirements.
600
+
601
+ ## Installation
602
+
603
+ To use sandboxed execution, you need to install the E2B dependency:
604
+
605
+ ```bash
606
+ # Install mcp-use with E2B support
607
+ pip install "mcp-use[e2b]"
608
+
609
+ # Or install the dependency directly
610
+ pip install e2b-code-interpreter
611
+ ```
612
+
613
+ You'll also need an E2B API key. You can sign up at [e2b.dev](https://e2b.dev) to get your API key.
614
+
615
+ ## Configuration
616
+
617
+ To enable sandboxed execution, use the `ClientOptions` parameter when creating your `MCPClient`:
618
+
619
+ ```python
620
+ import asyncio
621
+ import os
622
+ from dotenv import load_dotenv
623
+ from langchain_openai import ChatOpenAI
624
+ from mcp_use import MCPAgent, MCPClient
625
+ from mcp_use.types.sandbox import SandboxOptions
626
+ from mcp_use.types.clientoptions import ClientOptions
627
+
628
+ async def main():
629
+ # Load environment variables (needs E2B_API_KEY)
630
+ load_dotenv()
631
+
632
+ # Define MCP server configuration
633
+ server_config = {
634
+ "mcpServers": {
635
+ "everything": {
636
+ "command": "npx",
637
+ "args": ["-y", "@modelcontextprotocol/server-everything"],
638
+ }
639
+ }
640
+ }
641
+
642
+ # Define sandbox options
643
+ sandbox_options: SandboxOptions = {
644
+ "api_key": os.getenv("E2B_API_KEY"), # API key can also be provided directly
645
+ "sandbox_template_id": "base", # Use base template
646
+ }
647
+
648
+ # Create client options for sandboxed mode
649
+ client_options: ClientOptions = {
650
+ "is_sandboxed": True,
651
+ "sandbox_options": sandbox_options
652
+ }
653
+
654
+ # Create client with sandboxed mode enabled
655
+ client = MCPClient(
656
+ config=server_config,
657
+ options=client_options
658
+ )
659
+
660
+ # Create agent with the sandboxed client
661
+ llm = ChatOpenAI(model="gpt-4o")
662
+ agent = MCPAgent(llm=llm, client=client)
663
+
664
+ # Run your agent
665
+ result = await agent.run("Use the command line tools to help me add 1+1")
666
+ print(result)
667
+
668
+ # Clean up
669
+ await client.close_all_sessions()
670
+
671
+ if __name__ == "__main__":
672
+ asyncio.run(main())
673
+ ```
674
+
675
+ ## Sandbox Options
676
+
677
+ The `SandboxOptions` type provides configuration for the sandbox environment:
678
+
679
+ | Option | Description | Default |
680
+ | ---------------------- | ---------------------------------------------------------------------------------------- | --------------------- |
681
+ | `api_key` | E2B API key. Required - can be provided directly or via E2B_API_KEY environment variable | None |
682
+ | `sandbox_template_id` | Template ID for the sandbox environment | "base" |
683
+ | `supergateway_command` | Command to run supergateway | "npx -y supergateway" |
684
+
685
+ ## Benefits of Sandboxed Execution
686
+
687
+ - **No local dependencies**: Run MCP servers without installing dependencies locally
688
+ - **Isolation**: Execute code in a secure, isolated environment
689
+ - **Consistent environment**: Ensure consistent behavior across different systems
690
+ - **Resource efficiency**: Offload resource-intensive tasks to cloud infrastructure
691
+
548
692
  # Build a Custom Agent:
549
693
 
550
694
  You can also build your own custom agent using the LangChain adapter:
@@ -636,7 +780,6 @@ agent = MCPAgent(
636
780
 
637
781
  This is useful when you only need to see the agent's steps and decision-making process without all the low-level debug information from other components.
638
782
 
639
-
640
783
  # Roadmap
641
784
 
642
785
  <ul>
@@ -1,39 +1,89 @@
1
- <picture>
2
- <img alt="" src="./static/image.jpg" width="full">
3
- </picture>
1
+ <div align="center" style="margin: 0 auto; max-width: 80%;">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="static/logo_white.svg">
4
+ <source media="(prefers-color-scheme: light)" srcset="static/logo_black.svg">
5
+ <img alt="mcp use logo" src="./static/logo-white.svg" width="80%" style="margin: 20px auto;">
6
+ </picture>
7
+ </div>
4
8
 
5
9
  <h1 align="center">Unified MCP Client Library </h1>
6
-
7
- [![](https://img.shields.io/pypi/dw/mcp_use.svg)](https://pypi.org/project/mcp_use/)
8
- [![PyPI Downloads](https://img.shields.io/pypi/dm/mcp_use.svg)](https://pypi.org/project/mcp_use/)
9
- [![PyPI Version](https://img.shields.io/pypi/v/mcp_use.svg)](https://pypi.org/project/mcp_use/)
10
- [![Python Versions](https://img.shields.io/pypi/pyversions/mcp_use.svg)](https://pypi.org/project/mcp_use/)
11
- [![Documentation](https://img.shields.io/badge/docs-mcp--use.io-blue)](https://docs.mcp-use.io)
12
- [![Website](https://img.shields.io/badge/website-mcp--use.io-blue)](https://mcp-use.io)
13
- [![License](https://img.shields.io/github/license/pietrozullo/mcp-use)](https://github.com/pietrozullo/mcp-use/blob/main/LICENSE)
14
- [![Code style: Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
15
- [![GitHub stars](https://img.shields.io/github/stars/pietrozullo/mcp-use?style=social)](https://github.com/pietrozullo/mcp-use/stargazers)
16
- [![Twitter Follow](https://img.shields.io/twitter/follow/Pietro?style=social)](https://x.com/pietrozullo)
17
-
10
+ <p align="center">
11
+ <a href="https://pypi.org/project/mcp_use/" alt="PyPI Version">
12
+ <img src="https://img.shields.io/pypi/v/mcp_use.svg"/></a>
13
+ <a href="https://pypi.org/project/mcp_use/" alt="PyPI Downloads">
14
+ <img src="https://static.pepy.tech/badge/mcp-use" /></a>
15
+ <a href="https://pypi.org/project/mcp_use/" alt="Python Versions">
16
+ <img src="https://img.shields.io/pypi/pyversions/mcp_use.svg" /></a>
17
+ <a href="https://docs.mcp-use.io" alt="Documentation">
18
+ <img src="https://img.shields.io/badge/docs-mcp--use.io-blue" /></a>
19
+ <a href="https://mcp-use.io" alt="Website">
20
+ <img src="https://img.shields.io/badge/website-mcp--use.io-blue" /></a>
21
+ <a href="https://github.com/pietrozullo/mcp-use/blob/main/LICENSE" alt="License">
22
+ <img src="https://img.shields.io/github/license/pietrozullo/mcp-use" /></a>
23
+ <a href="https://github.com/astral-sh/ruff" alt="Code style: Ruff">
24
+ <img src="https://img.shields.io/badge/code%20style-ruff-000000.svg" /></a>
25
+ <a href="https://github.com/pietrozullo/mcp-use/stargazers" alt="GitHub stars">
26
+ <img src="https://img.shields.io/github/stars/pietrozullo/mcp-use?style=social" /></a>
27
+ </p>
28
+ <p align="center">
29
+ <a href="https://x.com/pietrozullo" alt="Twitter Follow - Pietro">
30
+ <img src="https://img.shields.io/twitter/follow/Pietro?style=social" /></a>
31
+ <a href="https://x.com/pederzh" alt="Twitter Follow - Luigi">
32
+ <img src="https://img.shields.io/twitter/follow/Luigi?style=social" /></a>
33
+ <a href="https://discord.gg/XkNkSkMz3V" alt="Discord">
34
+ <img src="https://dcbadge.limes.pink/api/server/https://discord.gg/XkNkSkMz3V?style=flat" /></a>
35
+ </p>
18
36
  🌐 MCP-Use is the open source way to connect **any LLM to any MCP server** and build custom agents that have tool access, without using closed source or application clients.
19
37
 
38
+ 💬 Get started quickly - chat with your servers on our <b>hosted version</b>! <b>[Try mcp-use chat *(beta)* ](https://chat.mcp-use.io)</b>.
39
+
20
40
  💡 Let developers easily connect any LLM to tools like web browsing, file operations, and more.
21
41
 
22
42
  # Features
23
43
 
24
44
  ## ✨ Key Features
25
-
26
- | Feature | Description |
27
- |---------|-------------|
28
- | 🔄 [**Ease of use**](#quick-start) | Create your first MCP capable agent you need only 6 lines of code |
29
- | 🤖 [**LLM Flexibility**](#installing-langchain-providers) | Works with any langchain supported LLM that supports tool calling (OpenAI, Anthropic, Groq, LLama etc.) |
30
- | 🌐 [**Code Builder**](https://mcp-use.io/builder) | Explore MCP capabilities and generate starter code with the interactive [code builder](https://mcp-use.io/builder). |
31
- | 🔗 [**HTTP Support**](#http-connection-example) | Direct connection to MCP servers running on specific HTTP ports |
32
- | ⚙️ [**Dynamic Server Selection**](#dynamic-server-selection-server-manager) | Agents can dynamically choose the most appropriate MCP server for a given task from the available pool |
33
- | 🧩 [**Multi-Server Support**](#multi-server-support) | Use multiple MCP servers simultaneously in a single agent |
34
- | 🛡️ [**Tool Restrictions**](#tool-access-control) | Restrict potentially dangerous tools like file system or network access |
35
- | 🔧 [**Custom Agents**](#build-a-custom-agent) | Build your own agents with any framework using the LangChain adapter or create new adapters |
36
-
45
+ <table>
46
+ <tr>
47
+ <th width="400">Feature</th>
48
+ <th>Description</th>
49
+ </tr>
50
+ <tr>
51
+ <td>🔄 <a href="#quick-start"><strong>Ease of use</strong></a></td>
52
+ <td>Create your first MCP capable agent you need only 6 lines of code</td>
53
+ </tr>
54
+ <tr>
55
+ <td>🤖 <a href="#installing-langchain-providers"><strong>LLM Flexibility</strong></a></td>
56
+ <td>Works with any langchain supported LLM that supports tool calling (OpenAI, Anthropic, Groq, LLama etc.)</td>
57
+ </tr>
58
+ <tr>
59
+ <td>🌐 <a href="https://mcp-use.io/builder"><strong>Code Builder</strong></a></td>
60
+ <td>Explore MCP capabilities and generate starter code with the interactive <a href="https://mcp-use.io/builder">code builder</a>.</td>
61
+ </tr>
62
+ <tr>
63
+ <td>🔗 <a href="#http-connection-example"><strong>HTTP Support</strong></a></td>
64
+ <td>Direct connection to MCP servers running on specific HTTP ports</td>
65
+ </tr>
66
+ <tr>
67
+ <td>⚙️ <a href="#dynamic-server-selection-server-manager"><strong>Dynamic Server Selection</strong></a></td>
68
+ <td>Agents can dynamically choose the most appropriate MCP server for a given task from the available pool</td>
69
+ </tr>
70
+ <tr>
71
+ <td>🧩 <a href="#multi-server-support"><strong>Multi-Server Support</strong></a></td>
72
+ <td>Use multiple MCP servers simultaneously in a single agent</td>
73
+ </tr>
74
+ <tr>
75
+ <td>🛡️ <a href="#tool-access-control"><strong>Tool Restrictions</strong></a></td>
76
+ <td>Restrict potentially dangerous tools like file system or network access</td>
77
+ </tr>
78
+ <tr>
79
+ <td>🔧 <a href="#build-a-custom-agent"><strong>Custom Agents</strong></a></td>
80
+ <td>Build your own agents with any framework using the LangChain adapter or create new adapters</td>
81
+ </tr>
82
+ <tr>
83
+ <td>❓ <a href="https://mcp-use.io/what-should-we-build-next"><strong>What should we build next</strong></a></td>
84
+ <td>Let us know what you'd like us to build next</td>
85
+ </tr>
86
+ </table>
37
87
 
38
88
  # Quick start
39
89
 
@@ -61,11 +111,8 @@ pip install langchain-openai
61
111
 
62
112
  # For Anthropic
63
113
  pip install langchain-anthropic
64
-
65
- # For other providers, check the [LangChain chat models documentation](https://python.langchain.com/docs/integrations/chat/)
66
114
  ```
67
-
68
- and add your API keys for the provider you want to use to your `.env` file.
115
+ For other providers, check the [LangChain chat models documentation](https://python.langchain.com/docs/integrations/chat/) and add your API keys for the provider you want to use to your `.env` file.
69
116
 
70
117
  ```bash
71
118
  OPENAI_API_KEY=
@@ -504,6 +551,101 @@ if __name__ == "__main__":
504
551
  asyncio.run(main())
505
552
  ```
506
553
 
554
+ # Sandboxed Execution
555
+
556
+ MCP-Use supports running MCP servers in a sandboxed environment using E2B's cloud infrastructure. This allows you to run MCP servers without having to install dependencies locally, making it easier to use tools that might have complex setups or system requirements.
557
+
558
+ ## Installation
559
+
560
+ To use sandboxed execution, you need to install the E2B dependency:
561
+
562
+ ```bash
563
+ # Install mcp-use with E2B support
564
+ pip install "mcp-use[e2b]"
565
+
566
+ # Or install the dependency directly
567
+ pip install e2b-code-interpreter
568
+ ```
569
+
570
+ You'll also need an E2B API key. You can sign up at [e2b.dev](https://e2b.dev) to get your API key.
571
+
572
+ ## Configuration
573
+
574
+ To enable sandboxed execution, use the `ClientOptions` parameter when creating your `MCPClient`:
575
+
576
+ ```python
577
+ import asyncio
578
+ import os
579
+ from dotenv import load_dotenv
580
+ from langchain_openai import ChatOpenAI
581
+ from mcp_use import MCPAgent, MCPClient
582
+ from mcp_use.types.sandbox import SandboxOptions
583
+ from mcp_use.types.clientoptions import ClientOptions
584
+
585
+ async def main():
586
+ # Load environment variables (needs E2B_API_KEY)
587
+ load_dotenv()
588
+
589
+ # Define MCP server configuration
590
+ server_config = {
591
+ "mcpServers": {
592
+ "everything": {
593
+ "command": "npx",
594
+ "args": ["-y", "@modelcontextprotocol/server-everything"],
595
+ }
596
+ }
597
+ }
598
+
599
+ # Define sandbox options
600
+ sandbox_options: SandboxOptions = {
601
+ "api_key": os.getenv("E2B_API_KEY"), # API key can also be provided directly
602
+ "sandbox_template_id": "base", # Use base template
603
+ }
604
+
605
+ # Create client options for sandboxed mode
606
+ client_options: ClientOptions = {
607
+ "is_sandboxed": True,
608
+ "sandbox_options": sandbox_options
609
+ }
610
+
611
+ # Create client with sandboxed mode enabled
612
+ client = MCPClient(
613
+ config=server_config,
614
+ options=client_options
615
+ )
616
+
617
+ # Create agent with the sandboxed client
618
+ llm = ChatOpenAI(model="gpt-4o")
619
+ agent = MCPAgent(llm=llm, client=client)
620
+
621
+ # Run your agent
622
+ result = await agent.run("Use the command line tools to help me add 1+1")
623
+ print(result)
624
+
625
+ # Clean up
626
+ await client.close_all_sessions()
627
+
628
+ if __name__ == "__main__":
629
+ asyncio.run(main())
630
+ ```
631
+
632
+ ## Sandbox Options
633
+
634
+ The `SandboxOptions` type provides configuration for the sandbox environment:
635
+
636
+ | Option | Description | Default |
637
+ | ---------------------- | ---------------------------------------------------------------------------------------- | --------------------- |
638
+ | `api_key` | E2B API key. Required - can be provided directly or via E2B_API_KEY environment variable | None |
639
+ | `sandbox_template_id` | Template ID for the sandbox environment | "base" |
640
+ | `supergateway_command` | Command to run supergateway | "npx -y supergateway" |
641
+
642
+ ## Benefits of Sandboxed Execution
643
+
644
+ - **No local dependencies**: Run MCP servers without installing dependencies locally
645
+ - **Isolation**: Execute code in a secure, isolated environment
646
+ - **Consistent environment**: Ensure consistent behavior across different systems
647
+ - **Resource efficiency**: Offload resource-intensive tasks to cloud infrastructure
648
+
507
649
  # Build a Custom Agent:
508
650
 
509
651
  You can also build your own custom agent using the LangChain adapter:
@@ -595,7 +737,6 @@ agent = MCPAgent(
595
737
 
596
738
  This is useful when you only need to see the agent's steps and decision-making process without all the low-level debug information from other components.
597
739
 
598
-
599
740
  # Roadmap
600
741
 
601
742
  <ul>