mcp-use 0.1.0__tar.gz → 1.0.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 (55) hide show
  1. mcp_use-1.0.0/.github/workflows/publish.yml +78 -0
  2. mcp_use-1.0.0/.github/workflows/tests.yml +31 -0
  3. mcp_use-1.0.0/.gitignore +124 -0
  4. mcp_use-1.0.0/.pre-commit-config.yaml +24 -0
  5. mcp_use-1.0.0/PKG-INFO +382 -0
  6. mcp_use-1.0.0/README.md +343 -0
  7. mcp_use-1.0.0/examples/airbnb_mcp.json +8 -0
  8. mcp_use-1.0.0/examples/airbnb_use.py +51 -0
  9. mcp_use-1.0.0/examples/blender_use.py +53 -0
  10. mcp_use-1.0.0/examples/browser_mcp.json +11 -0
  11. mcp_use-1.0.0/examples/browser_use.py +46 -0
  12. mcp_use-1.0.0/examples/chat_example.py +80 -0
  13. mcp_use-1.0.0/examples/filesystem_use.py +58 -0
  14. mcp_use-1.0.0/examples/multi_server_example.py +66 -0
  15. {mcp_use-0.1.0 → mcp_use-1.0.0}/mcp_use/__init__.py +6 -6
  16. {mcp_use-0.1.0 → mcp_use-1.0.0}/mcp_use/agents/langchain_agent.py +88 -64
  17. mcp_use-1.0.0/mcp_use/agents/mcpagent.py +313 -0
  18. mcp_use-1.0.0/mcp_use/agents/prompts/default.py +22 -0
  19. {mcp_use-0.1.0 → mcp_use-1.0.0}/mcp_use/client.py +93 -68
  20. {mcp_use-0.1.0 → mcp_use-1.0.0}/mcp_use/config.py +0 -54
  21. {mcp_use-0.1.0 → mcp_use-1.0.0}/mcp_use/connectors/base.py +1 -3
  22. {mcp_use-0.1.0 → mcp_use-1.0.0}/mcp_use/connectors/http.py +91 -7
  23. mcp_use-1.0.0/mcp_use/connectors/stdio.py +188 -0
  24. mcp_use-1.0.0/mcp_use/connectors/websocket.py +245 -0
  25. {mcp_use-0.1.0 → mcp_use-1.0.0}/mcp_use/session.py +0 -55
  26. mcp_use-1.0.0/mcp_use/task_managers/__init__.py +18 -0
  27. mcp_use-1.0.0/mcp_use/task_managers/base.py +151 -0
  28. mcp_use-1.0.0/mcp_use/task_managers/http.py +62 -0
  29. mcp_use-1.0.0/mcp_use/task_managers/stdio.py +73 -0
  30. mcp_use-1.0.0/mcp_use/task_managers/websocket.py +63 -0
  31. mcp_use-1.0.0/pyproject.toml +83 -0
  32. mcp_use-1.0.0/static/image.jpg +0 -0
  33. mcp_use-1.0.0/tests/unit/test_placeholder.py +16 -0
  34. mcp_use-0.1.0/PKG-INFO +0 -287
  35. mcp_use-0.1.0/README.md +0 -236
  36. mcp_use-0.1.0/mcp_use/agents/mcpagent.py +0 -149
  37. mcp_use-0.1.0/mcp_use/connectors/stdio.py +0 -124
  38. mcp_use-0.1.0/mcp_use/connectors/websocket.py +0 -142
  39. mcp_use-0.1.0/mcp_use/tools/__init__.py +0 -11
  40. mcp_use-0.1.0/mcp_use/tools/converter.py +0 -108
  41. mcp_use-0.1.0/mcp_use/tools/formats.py +0 -181
  42. mcp_use-0.1.0/mcp_use/types.py +0 -33
  43. mcp_use-0.1.0/mcp_use.egg-info/PKG-INFO +0 -287
  44. mcp_use-0.1.0/mcp_use.egg-info/SOURCES.txt +0 -27
  45. mcp_use-0.1.0/mcp_use.egg-info/dependency_links.txt +0 -1
  46. mcp_use-0.1.0/mcp_use.egg-info/requires.txt +0 -24
  47. mcp_use-0.1.0/mcp_use.egg-info/top_level.txt +0 -1
  48. mcp_use-0.1.0/pyproject.toml +0 -31
  49. mcp_use-0.1.0/setup.cfg +0 -4
  50. mcp_use-0.1.0/setup.py +0 -60
  51. {mcp_use-0.1.0 → mcp_use-1.0.0}/LICENSE +0 -0
  52. {mcp_use-0.1.0 → mcp_use-1.0.0}/mcp_use/agents/__init__.py +0 -0
  53. {mcp_use-0.1.0 → mcp_use-1.0.0}/mcp_use/agents/base.py +0 -0
  54. {mcp_use-0.1.0 → mcp_use-1.0.0}/mcp_use/connectors/__init__.py +0 -0
  55. {mcp_use-0.1.0 → mcp_use-1.0.0}/mcp_use/logging.py +0 -0
@@ -0,0 +1,78 @@
1
+ name: Check Version Bump and Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - 'pyproject.toml'
9
+
10
+ # Required for PyPI trusted publishing
11
+ permissions:
12
+ id-token: write
13
+ contents: write # Required for creating tags and releases
14
+
15
+ jobs:
16
+ check-version-and-publish:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ with:
21
+ fetch-depth: 0 # This fetches all history for comparing versions
22
+
23
+ - name: Set up Python
24
+ uses: actions/setup-python@v4
25
+ with:
26
+ python-version: "3.11"
27
+
28
+ - name: Install dependencies
29
+ run: |
30
+ python -m pip install --upgrade pip
31
+ pip install build twine wheel tomli
32
+
33
+ - name: Check for version bump
34
+ id: check-version
35
+ run: |
36
+ # Extract current version directly from pyproject.toml
37
+ # This is more reliable than using importlib.metadata
38
+ CURRENT_VERSION=$(python -c "
39
+ import tomli
40
+ with open('pyproject.toml', 'rb') as f:
41
+ data = tomli.load(f)
42
+ print(data['project']['version'])
43
+ ")
44
+
45
+ echo "Current version: $CURRENT_VERSION"
46
+
47
+ # Check if this version already has a tag
48
+ if git rev-parse "v$CURRENT_VERSION" >/dev/null 2>&1; then
49
+ echo "Version $CURRENT_VERSION already has a tag. Skipping release."
50
+ echo "is_new_version=false" >> $GITHUB_OUTPUT
51
+ else
52
+ echo "New version detected: $CURRENT_VERSION"
53
+ echo "is_new_version=true" >> $GITHUB_OUTPUT
54
+ echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
55
+ fi
56
+
57
+ - name: Build package
58
+ if: steps.check-version.outputs.is_new_version == 'true'
59
+ run: |
60
+ python -m build
61
+
62
+ - name: Create Release
63
+ if: steps.check-version.outputs.is_new_version == 'true'
64
+ id: create_release
65
+ uses: actions/create-release@v1
66
+ env:
67
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68
+ with:
69
+ tag_name: v${{ steps.check-version.outputs.new_version }}
70
+ release_name: Release v${{ steps.check-version.outputs.new_version }}
71
+ draft: false
72
+ prerelease: false
73
+
74
+ - name: Publish to PyPI
75
+ if: steps.check-version.outputs.is_new_version == 'true'
76
+ uses: pypa/gh-action-pypi-publish@release/v1
77
+ with:
78
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,31 @@
1
+ name: Python Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v3
18
+ - name: Set up Python ${{ matrix.python-version }}
19
+ uses: actions/setup-python@v4
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+ - name: Install dependencies
23
+ run: |
24
+ python -m pip install --upgrade pip
25
+ pip install .[dev,anthropic,openai]
26
+ - name: Lint with ruff
27
+ run: |
28
+ ruff check .
29
+ - name: Test with pytest
30
+ run: |
31
+ pytest
@@ -0,0 +1,124 @@
1
+
2
+ # Byte-compiled / optimized / DLL files
3
+ __pycache__/
4
+ *.py[cod]
5
+ *$py.class
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+
28
+ # PyInstaller
29
+ *.manifest
30
+ *.spec
31
+
32
+ # Installer logs
33
+ pip-log.txt
34
+ pip-delete-this-directory.txt
35
+
36
+ # Unit test / coverage reports
37
+ htmlcov/
38
+ .tox/
39
+ .nox/
40
+ .coverage
41
+ .coverage.*
42
+ .cache
43
+ nosetests.xml
44
+ coverage.xml
45
+ *.cover
46
+ .hypothesis/
47
+ .pytest_cache/
48
+
49
+ # Translations
50
+ *.mo
51
+ *.pot
52
+
53
+ # Django stuff:
54
+ *.log
55
+ local_settings.py
56
+ db.sqlite3
57
+ db.sqlite3-journal
58
+
59
+ # Flask stuff:
60
+ instance/
61
+ .webassets-cache
62
+
63
+ # Scrapy stuff:
64
+ .scrapy
65
+
66
+ # Sphinx documentation
67
+ docs/_build/
68
+
69
+ # PyBuilder
70
+ target/
71
+
72
+ # Jupyter Notebook
73
+ .ipynb_checkpoints
74
+
75
+ # IPython
76
+ profile_default/
77
+ ipython_config.py
78
+
79
+ # pyenv
80
+ .python-version
81
+
82
+ # pipenv
83
+ Pipfile.lock
84
+
85
+ # poetry
86
+ poetry.lock
87
+
88
+ # Environment variables
89
+ .env
90
+ .venv
91
+ env/
92
+ venv/
93
+ ENV/
94
+ env.bak/
95
+ venv.bak/
96
+
97
+ # Spyder project settings
98
+ .spyderproject
99
+ .spyproject
100
+
101
+ # Rope project settings
102
+ .ropeproject
103
+
104
+ # mkdocs documentation
105
+ /site
106
+
107
+ # mypy
108
+ .mypy_cache/
109
+ .dmypy.json
110
+ dmypy.json
111
+
112
+ # Pyre type checker
113
+ .pyre/
114
+
115
+ # VS Code
116
+ .vscode/
117
+ *.code-workspace
118
+
119
+ # PyCharm
120
+ .idea/
121
+ *.iml
122
+
123
+ # macOS
124
+ .DS_Store
@@ -0,0 +1,24 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ # Ruff version.
4
+ rev: v0.3.2
5
+ hooks:
6
+ - id: ruff
7
+ args: [--fix, --exit-non-zero-on-fix, --config=pyproject.toml]
8
+ types: [python]
9
+ - id: ruff-format
10
+ args: [--config=pyproject.toml]
11
+ types: [python]
12
+
13
+ - repo: https://github.com/pre-commit/pre-commit-hooks
14
+ rev: v4.5.0
15
+ hooks:
16
+ - id: trailing-whitespace
17
+ - id: end-of-file-fixer
18
+ - id: check-yaml
19
+ - id: check-added-large-files
20
+ - id: debug-statements
21
+
22
+ # Define configuration for the Python checks
23
+ default_language_version:
24
+ python: python3.11
mcp_use-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,382 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-use
3
+ Version: 1.0.0
4
+ Summary: MCP Library for LLMs
5
+ Author-email: Pietro Zullo <pietro.zullo@gmail.com>
6
+ License: MIT
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Requires-Python: >=3.11
17
+ Requires-Dist: aiohttp>=3.9.0
18
+ Requires-Dist: jsonschema-pydantic>=0.1.0
19
+ Requires-Dist: langchain-community>=0.0.10
20
+ Requires-Dist: langchain>=0.1.0
21
+ Requires-Dist: mcp
22
+ Requires-Dist: pydantic>=2.0.0
23
+ Requires-Dist: python-dotenv>=1.0.0
24
+ Requires-Dist: typing-extensions>=4.8.0
25
+ Requires-Dist: websockets>=12.0
26
+ Provides-Extra: anthropic
27
+ Requires-Dist: anthropic>=0.15.0; extra == 'anthropic'
28
+ Provides-Extra: dev
29
+ Requires-Dist: black>=23.9.0; extra == 'dev'
30
+ Requires-Dist: isort>=5.12.0; extra == 'dev'
31
+ Requires-Dist: mypy>=1.5.0; extra == 'dev'
32
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
34
+ Requires-Dist: pytest>=7.4.0; extra == 'dev'
35
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
36
+ Provides-Extra: openai
37
+ Requires-Dist: openai>=1.10.0; extra == 'openai'
38
+ Description-Content-Type: text/markdown
39
+
40
+ <picture>
41
+ <img alt="" src="./static/mcpusegrass.png" width="full">
42
+ </picture>
43
+
44
+ <h1 align="center">Open Source MCP CLient Library </h1>
45
+
46
+ [![](https://img.shields.io/pypi/dd/mcp_use.svg)](https://pypi.org/project/mcp_use/)
47
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/mcp_use.svg)](https://pypi.org/project/mcp_use/)
48
+ [![PyPI Version](https://img.shields.io/pypi/v/mcp_use.svg)](https://pypi.org/project/mcp_use/)
49
+ [![Python Versions](https://img.shields.io/pypi/pyversions/mcp_use.svg)](https://pypi.org/project/mcp_use/)
50
+ [![License](https://img.shields.io/github/license/pietrozullo/mcp-use)](https://github.com/pietrozullo/mcp-use/blob/main/LICENSE)
51
+ [![Code style: Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
52
+ [![GitHub stars](https://img.shields.io/github/stars/pietrozullo/mcp-use?style=social)](https://github.com/pietrozullo/mcp-use/stargazers)
53
+
54
+ 🌐 MCP-Use is the open source way to connect any LLM to MCP tools and build custom agents that have tool access, without using closed source or application clients.
55
+
56
+ 💡 Let developers easily connect any LLM to tools like web browsing, file operations, and more.
57
+
58
+ # Quick start
59
+
60
+ With pip:
61
+
62
+ ```bash
63
+ pip install mcp-use
64
+ ```
65
+
66
+ Or install from source:
67
+
68
+ ```bash
69
+ git clone https://github.com/pietrozullo/mcp-use.git
70
+ cd mcp-use
71
+ pip install -e .
72
+ ```
73
+
74
+ Spin up your agent:
75
+
76
+ ```python
77
+ import asyncio
78
+ import os
79
+ from dotenv import load_dotenv
80
+ from langchain_openai import ChatOpenAI
81
+ from mcp_use import MCPAgent, MCPClient
82
+
83
+ async def main():
84
+ # Load environment variables
85
+ load_dotenv()
86
+
87
+ # Create MCPClient from config file
88
+ client = MCPClient.from_config_file("browser_mcp.json")
89
+
90
+ # Create LLM
91
+ llm = ChatOpenAI(model="gpt-4o")
92
+
93
+ # Create agent with the client
94
+ agent = MCPAgent(llm=llm, client=client, max_steps=30)
95
+
96
+ # Run the query
97
+ result = await agent.run(
98
+ "Find the best restaurant in San Francisco USING GOOGLE SEARCH",
99
+ )
100
+ print(f"\nResult: {result}")
101
+
102
+ if __name__ == "__main__":
103
+ asyncio.run(main())
104
+ ```
105
+
106
+ Example configuration file (`browser_mcp.json`):
107
+
108
+ ```json
109
+ {
110
+ "mcpServers": {
111
+ "playwright": {
112
+ "command": "npx",
113
+ "args": ["@playwright/mcp@latest"],
114
+ "env": {
115
+ "DISPLAY": ":1"
116
+ }
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ Add your API keys for the provider you want to use to your `.env` file.
123
+
124
+ ```bash
125
+ OPENAI_API_KEY=
126
+ ANTHROPIC_API_KEY=
127
+ ```
128
+
129
+ For other settings, models, and more, check out the documentation.
130
+
131
+ # Example Use Cases
132
+
133
+ ## Web Browsing with Playwright
134
+
135
+ ```python
136
+ import asyncio
137
+ import os
138
+ from dotenv import load_dotenv
139
+ from langchain_openai import ChatOpenAI
140
+ from mcp_use import MCPAgent, MCPClient
141
+
142
+ async def main():
143
+ # Load environment variables
144
+ load_dotenv()
145
+
146
+ # Create MCPClient from config file
147
+ client = MCPClient.from_config_file(
148
+ os.path.join(os.path.dirname(__file__), "browser_mcp.json")
149
+ )
150
+
151
+ # Create LLM
152
+ llm = ChatOpenAI(model="gpt-4o")
153
+ # Alternative models:
154
+ # llm = ChatAnthropic(model="claude-3-5-sonnet-20240620")
155
+ # llm = ChatGroq(model="llama3-8b-8192")
156
+
157
+ # Create agent with the client
158
+ agent = MCPAgent(llm=llm, client=client, max_steps=30)
159
+
160
+ # Run the query
161
+ result = await agent.run(
162
+ "Find the best restaurant in San Francisco USING GOOGLE SEARCH",
163
+ max_steps=30,
164
+ )
165
+ print(f"\nResult: {result}")
166
+
167
+ if __name__ == "__main__":
168
+ asyncio.run(main())
169
+ ```
170
+
171
+ ## Airbnb Search
172
+
173
+ ```python
174
+ import asyncio
175
+ import os
176
+ from dotenv import load_dotenv
177
+ from langchain_anthropic import ChatAnthropic
178
+ from mcp_use import MCPAgent, MCPClient
179
+
180
+ async def run_airbnb_example():
181
+ # Load environment variables
182
+ load_dotenv()
183
+
184
+ # Create MCPClient with Airbnb configuration
185
+ client = MCPClient.from_config_file(
186
+ os.path.join(os.path.dirname(__file__), "airbnb_mcp.json")
187
+ )
188
+
189
+ # Create LLM - you can choose between different models
190
+ llm = ChatAnthropic(model="claude-3-5-sonnet-20240620")
191
+
192
+ # Create agent with the client
193
+ agent = MCPAgent(llm=llm, client=client, max_steps=30)
194
+
195
+ try:
196
+ # Run a query to search for accommodations
197
+ result = await agent.run(
198
+ "Find me a nice place to stay in Barcelona for 2 adults "
199
+ "for a week in August. I prefer places with a pool and "
200
+ "good reviews. Show me the top 3 options.",
201
+ max_steps=30,
202
+ )
203
+ print(f"\nResult: {result}")
204
+ finally:
205
+ # Ensure we clean up resources properly
206
+ if client.sessions:
207
+ await client.close_all_sessions()
208
+
209
+ if __name__ == "__main__":
210
+ asyncio.run(run_airbnb_example())
211
+ ```
212
+
213
+ Example configuration file (`airbnb_mcp.json`):
214
+
215
+ ```json
216
+ {
217
+ "mcpServers": {
218
+ "airbnb": {
219
+ "command": "npx",
220
+ "args": ["-y", "@openbnb/mcp-server-airbnb"]
221
+ }
222
+ }
223
+ }
224
+ ```
225
+
226
+ ## Blender 3D Creation
227
+
228
+ ```python
229
+ import asyncio
230
+ from dotenv import load_dotenv
231
+ from langchain_anthropic import ChatAnthropic
232
+ from mcp_use import MCPAgent, MCPClient
233
+
234
+ async def run_blender_example():
235
+ # Load environment variables
236
+ load_dotenv()
237
+
238
+ # Create MCPClient with Blender MCP configuration
239
+ config = {"mcpServers": {"blender": {"command": "uvx", "args": ["blender-mcp"]}}}
240
+ client = MCPClient.from_dict(config)
241
+
242
+ # Create LLM
243
+ llm = ChatAnthropic(model="claude-3-5-sonnet-20240620")
244
+
245
+ # Create agent with the client
246
+ agent = MCPAgent(llm=llm, client=client, max_steps=30)
247
+
248
+ try:
249
+ # Run the query
250
+ result = await agent.run(
251
+ "Create an inflatable cube with soft material and a plane as ground.",
252
+ max_steps=30,
253
+ )
254
+ print(f"\nResult: {result}")
255
+ finally:
256
+ # Ensure we clean up resources properly
257
+ if client.sessions:
258
+ await client.close_all_sessions()
259
+
260
+ if __name__ == "__main__":
261
+ asyncio.run(run_blender_example())
262
+ ```
263
+
264
+ # Configuration File Support
265
+
266
+ MCP-Use supports initialization from configuration files, making it easy to manage and switch between different MCP server setups:
267
+
268
+ ```python
269
+ import asyncio
270
+ from mcp_use import create_session_from_config
271
+
272
+ async def main():
273
+ # Create an MCP session from a config file
274
+ session = create_session_from_config("mcp-config.json")
275
+
276
+ # Initialize the session
277
+ await session.initialize()
278
+
279
+ # Use the session...
280
+
281
+ # Disconnect when done
282
+ await session.disconnect()
283
+
284
+ if __name__ == "__main__":
285
+ asyncio.run(main())
286
+ ```
287
+
288
+ # Multi-Server Support
289
+
290
+ MCP-Use supports working with multiple MCP servers simultaneously, allowing you to combine tools from different servers in a single agent. This is useful for complex tasks that require multiple capabilities, such as web browsing combined with file operations or 3D modeling.
291
+
292
+ ## Configuration
293
+
294
+ You can configure multiple servers in your configuration file:
295
+
296
+ ```json
297
+ {
298
+ "mcpServers": {
299
+ "airbnb": {
300
+ "command": "npx",
301
+ "args": ["-y", "@openbnb/mcp-server-airbnb", "--ignore-robots-txt"]
302
+ },
303
+ "playwright": {
304
+ "command": "npx",
305
+ "args": ["@playwright/mcp@latest"],
306
+ "env": {
307
+ "DISPLAY": ":1"
308
+ }
309
+ }
310
+ }
311
+ }
312
+ ```
313
+
314
+ ## Usage
315
+
316
+ The `MCPClient` class provides several methods for managing multiple servers:
317
+
318
+ ```python
319
+ import asyncio
320
+ from mcp_use import MCPClient, MCPAgent
321
+ from langchain_anthropic import ChatAnthropic
322
+
323
+ async def main():
324
+ # Create client with multiple servers
325
+ client = MCPClient.from_config_file("multi_server_config.json")
326
+
327
+ # Create agent with the client
328
+ agent = MCPAgent(
329
+ llm=ChatAnthropic(model="claude-3-5-sonnet-20240620"),
330
+ client=client
331
+ )
332
+
333
+ try:
334
+ # Run a query that uses tools from multiple servers
335
+ result = await agent.run(
336
+ "Search for a nice place to stay in Barcelona on Airbnb, "
337
+ "then use Google to find nearby restaurants and attractions."
338
+ )
339
+ print(result)
340
+ finally:
341
+ # Clean up all sessions
342
+ await client.close_all_sessions()
343
+
344
+ if __name__ == "__main__":
345
+ asyncio.run(main())
346
+ ```
347
+
348
+ ## Roadmap
349
+
350
+ <ul>
351
+ <li>[x] Multiple Servers at once </li>
352
+ <li>[ ] Test remote connectors (http, ws)</li>
353
+ <li>[ ] ... </li>
354
+ </ul>
355
+
356
+ ## Contributing
357
+
358
+ We love contributions! Feel free to open issues for bugs or feature requests.
359
+
360
+ ## Requirements
361
+
362
+ - Python 3.11+
363
+ - MCP implementation (like Playwright MCP)
364
+ - LangChain and appropriate model libraries (OpenAI, Anthropic, etc.)
365
+
366
+ ## Citation
367
+
368
+ If you use MCP-Use in your research or project, please cite:
369
+
370
+ ```bibtex
371
+ @software{mcp_use2025,
372
+ author = {Zullo, Pietro},
373
+ title = {MCP-Use: MCP Library for Python},
374
+ year = {2025},
375
+ publisher = {GitHub},
376
+ url = {https://github.com/pietrozullo/mcp-use}
377
+ }
378
+ ```
379
+
380
+ ## License
381
+
382
+ MIT