mcp-use 1.3.8__tar.gz → 1.3.9__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 (171) hide show
  1. {mcp_use-1.3.8 → mcp_use-1.3.9}/.github/release-drafter.yml +2 -2
  2. {mcp_use-1.3.8 → mcp_use-1.3.9}/.github/workflows/tests.yml +1 -1
  3. {mcp_use-1.3.8 → mcp_use-1.3.9}/PKG-INFO +67 -43
  4. {mcp_use-1.3.8 → mcp_use-1.3.9}/README.md +66 -42
  5. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/api-reference/mcpagent.mdx +46 -6
  6. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/client/client-configuration.mdx +12 -105
  7. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/client/connection-types.mdx +2 -21
  8. mcp_use-1.3.9/docs/client/direct-tool-calls.mdx +235 -0
  9. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/client/elicitation.mdx +2 -2
  10. mcp_use-1.3.9/docs/client/logging.mdx +61 -0
  11. mcp_use-1.3.9/docs/client/notifications.mdx +111 -0
  12. mcp_use-1.3.9/docs/client/prompts.mdx +266 -0
  13. mcp_use-1.3.9/docs/client/resources.mdx +229 -0
  14. mcp_use-1.3.9/docs/client/sandbox.mdx +81 -0
  15. mcp_use-1.3.9/docs/client/tools.mdx +160 -0
  16. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/docs.json +23 -4
  17. mcp_use-1.3.9/examples/direct_tool_call.py +59 -0
  18. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/__init__.py +0 -1
  19. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/adapters/base.py +3 -3
  20. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/adapters/langchain_adapter.py +5 -4
  21. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/agents/remote.py +67 -10
  22. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/client.py +15 -1
  23. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/config.py +10 -8
  24. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/connectors/base.py +100 -15
  25. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/connectors/http.py +13 -2
  26. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/connectors/sandbox.py +12 -6
  27. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/connectors/stdio.py +11 -2
  28. mcp_use-1.3.9/mcp_use/errors/__init__.py +1 -0
  29. mcp_use-1.3.9/mcp_use/errors/error_formatting.py +29 -0
  30. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/managers/server_manager.py +1 -7
  31. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/managers/tools/connect_server.py +2 -1
  32. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/managers/tools/disconnect_server.py +2 -1
  33. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/managers/tools/list_servers_tool.py +2 -0
  34. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/session.py +70 -0
  35. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/telemetry/telemetry.py +1 -4
  36. {mcp_use-1.3.8 → mcp_use-1.3.9}/pyproject.toml +1 -1
  37. mcp_use-1.3.9/static/logo-gh.jpg +0 -0
  38. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/others/test_custom_streaming_integration.py +9 -9
  39. mcp_use-1.3.9/tests/integration/primitives/test_discovery.py +70 -0
  40. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/primitives/test_elicitation.py +1 -1
  41. mcp_use-1.3.9/tests/integration/primitives/test_logging.py +21 -0
  42. mcp_use-1.3.9/tests/integration/primitives/test_notifications.py +22 -0
  43. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/primitives/test_prompts.py +1 -1
  44. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/primitives/test_resources.py +3 -3
  45. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/primitives/test_sampling.py +2 -2
  46. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/primitives/test_tools.py +3 -8
  47. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/servers_for_testing/primitive_server.py +71 -0
  48. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/transports/test_sse.py +2 -2
  49. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/transports/test_stdio.py +2 -2
  50. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/transports/test_streamable_http.py +2 -2
  51. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/unit/test_client.py +10 -0
  52. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/unit/test_http_connector.py +2 -0
  53. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/unit/test_sandbox_connector.py +2 -0
  54. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/unit/test_stdio_connector.py +2 -0
  55. {mcp_use-1.3.8 → mcp_use-1.3.9}/.env.example +0 -0
  56. {mcp_use-1.3.8 → mcp_use-1.3.9}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  57. {mcp_use-1.3.8 → mcp_use-1.3.9}/.github/pull_request_template.md +0 -0
  58. {mcp_use-1.3.8 → mcp_use-1.3.9}/.github/workflows/changelog.yml +0 -0
  59. {mcp_use-1.3.8 → mcp_use-1.3.9}/.github/workflows/publish.yml +0 -0
  60. {mcp_use-1.3.8 → mcp_use-1.3.9}/.github/workflows/release-drafter.yml +0 -0
  61. {mcp_use-1.3.8 → mcp_use-1.3.9}/.github/workflows/stale.yml +0 -0
  62. {mcp_use-1.3.8 → mcp_use-1.3.9}/.github/workflows/update-readme.yml +0 -0
  63. {mcp_use-1.3.8 → mcp_use-1.3.9}/.gitignore +0 -0
  64. {mcp_use-1.3.8 → mcp_use-1.3.9}/.pre-commit-config.yaml +0 -0
  65. {mcp_use-1.3.8 → mcp_use-1.3.9}/CHANGELOG.md +0 -0
  66. {mcp_use-1.3.8 → mcp_use-1.3.9}/CLAUDE.md +0 -0
  67. {mcp_use-1.3.8 → mcp_use-1.3.9}/CODE_OF_CONDUCT.md +0 -0
  68. {mcp_use-1.3.8 → mcp_use-1.3.9}/CONTRIBUTING.md +0 -0
  69. {mcp_use-1.3.8 → mcp_use-1.3.9}/LICENSE +0 -0
  70. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/README.md +0 -0
  71. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/advanced/building-custom-agents.mdx +0 -0
  72. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/advanced/logging.mdx +0 -0
  73. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/advanced/multi-server-setup.mdx +0 -0
  74. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/advanced/security.mdx +0 -0
  75. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/agent/agent-configuration.mdx +0 -0
  76. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/agent/llm-integration.mdx +0 -0
  77. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/agent/server-manager.mdx +0 -0
  78. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/agent/streaming.mdx +0 -0
  79. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/agent/structured-output.mdx +0 -0
  80. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/api-reference/adapters.mdx +0 -0
  81. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/api-reference/introduction.mdx +0 -0
  82. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/api-reference/mcpclient.mdx +0 -0
  83. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/changelog.mdx +0 -0
  84. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/client/sampling.mdx +0 -0
  85. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/community/showcase.mdx +0 -0
  86. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/development/observability.mdx +0 -0
  87. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/development/telemetry.mdx +0 -0
  88. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/development.mdx +0 -0
  89. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/favicon.svg +0 -0
  90. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/fonts.css +0 -0
  91. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/getting-started/configuration.mdx +0 -0
  92. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/getting-started/index.mdx +0 -0
  93. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/getting-started/installation.mdx +0 -0
  94. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/getting-started/quickstart.mdx +0 -0
  95. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/01.png +0 -0
  96. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/02.png +0 -0
  97. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/configuration-dark.png +0 -0
  98. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/configuration-light.png +0 -0
  99. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/examples-dark.png +0 -0
  100. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/examples-light.png +0 -0
  101. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/hero-dark.png +0 -0
  102. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/hero-light.png +0 -0
  103. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/installation-dark.png +0 -0
  104. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/installation-light.png +0 -0
  105. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/quickstart-dark.png +0 -0
  106. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/images/quickstart-light.png +0 -0
  107. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/logo/dark.svg +0 -0
  108. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/logo/light.svg +0 -0
  109. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/logo/react.svg +0 -0
  110. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/snippets/snippet-intro.mdx +0 -0
  111. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/snippets/youtube-embed.mdx +0 -0
  112. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/troubleshooting/common-issues.mdx +0 -0
  113. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/troubleshooting/connection-errors.mdx +0 -0
  114. {mcp_use-1.3.8 → mcp_use-1.3.9}/docs/troubleshooting/performance.mdx +0 -0
  115. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/airbnb_mcp.json +0 -0
  116. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/airbnb_use.py +0 -0
  117. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/blender_use.py +0 -0
  118. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/browser_use.py +0 -0
  119. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/chat_example.py +0 -0
  120. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/filesystem_use.py +0 -0
  121. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/http_example.py +0 -0
  122. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/mcp_everything.py +0 -0
  123. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/multi_server_example.py +0 -0
  124. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/sandbox_everything.py +0 -0
  125. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/stream_example.py +0 -0
  126. {mcp_use-1.3.8 → mcp_use-1.3.9}/examples/structured_output.py +0 -0
  127. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/adapters/__init__.py +0 -0
  128. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/agents/__init__.py +0 -0
  129. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/agents/base.py +0 -0
  130. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/agents/mcpagent.py +0 -0
  131. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/agents/prompts/system_prompt_builder.py +0 -0
  132. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/agents/prompts/templates.py +0 -0
  133. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/connectors/__init__.py +0 -0
  134. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/connectors/utils.py +0 -0
  135. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/connectors/websocket.py +0 -0
  136. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/logging.py +0 -0
  137. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/managers/__init__.py +0 -0
  138. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/managers/tools/__init__.py +0 -0
  139. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/managers/tools/base_tool.py +0 -0
  140. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/managers/tools/get_active_server.py +0 -0
  141. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/managers/tools/search_tools.py +0 -0
  142. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/observability/__init__.py +0 -0
  143. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/observability/laminar.py +0 -0
  144. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/observability/langfuse.py +0 -0
  145. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/task_managers/__init__.py +0 -0
  146. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/task_managers/base.py +0 -0
  147. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/task_managers/sse.py +0 -0
  148. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/task_managers/stdio.py +0 -0
  149. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/task_managers/streamable_http.py +0 -0
  150. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/task_managers/websocket.py +0 -0
  151. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/telemetry/__init__.py +0 -0
  152. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/telemetry/events.py +0 -0
  153. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/telemetry/utils.py +0 -0
  154. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/types/sandbox.py +0 -0
  155. {mcp_use-1.3.8 → mcp_use-1.3.9}/mcp_use/utils.py +0 -0
  156. {mcp_use-1.3.8 → mcp_use-1.3.9}/pytest.ini +0 -0
  157. {mcp_use-1.3.8 → mcp_use-1.3.9}/ruff.toml +0 -0
  158. {mcp_use-1.3.8 → mcp_use-1.3.9}/static/logo_black.svg +0 -0
  159. {mcp_use-1.3.8 → mcp_use-1.3.9}/static/logo_white.svg +0 -0
  160. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/conftest.py +0 -0
  161. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/__init__.py +0 -0
  162. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/conftest.py +0 -0
  163. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/servers_for_testing/__init__.py +0 -0
  164. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/servers_for_testing/custom_streaming_server.py +0 -0
  165. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/servers_for_testing/simple_server.py +0 -0
  166. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/integration/servers_for_testing/timeout_test_server.py +0 -0
  167. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/unit/test_config.py +0 -0
  168. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/unit/test_logging.py +0 -0
  169. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/unit/test_search_tools_issue_138.py +0 -0
  170. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/unit/test_session.py +0 -0
  171. {mcp_use-1.3.8 → mcp_use-1.3.9}/tests/unit/test_websocket_connection_manager.py +0 -0
@@ -1,5 +1,5 @@
1
- name-template: 'Release v$RESOLVED_VERSION 🌈'
2
- tag-template: 'Releasev$RESOLVED_VERSION'
1
+ name-template: '$RESOLVED_VERSION 🌈'
2
+ tag-template: '$RESOLVED_VERSION'
3
3
  categories:
4
4
  - title: '🚀 Features'
5
5
  labels:
@@ -77,7 +77,7 @@ jobs:
77
77
  strategy:
78
78
  fail-fast: false
79
79
  matrix:
80
- primitive: [sampling, tools, resources, prompts, elicitation]
80
+ primitive: [sampling, tools, resources, prompts, elicitation, notifications]
81
81
  steps:
82
82
  - uses: actions/checkout@v3
83
83
  - name: Set up Python 3.11
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-use
3
- Version: 1.3.8
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
@@ -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/logo_white.svg">
50
- <source media="(prefers-color-scheme: light)" srcset="static/logo_black.svg">
51
- <img alt="mcp use logo" src="./static/logo-white.svg" width="80%" style="margin: 20px auto;">
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
- # Connect any LLM to any MCP server
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&#0045;use" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1002629&theme=neutral&t=1754609432704" alt="mcp&#0045;use - Open&#0032;source&#0032;SDK&#0032;and&#0032;infra&#0032;for&#0032;MCP&#0032;servers&#0032;&#0038;&#0032;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">
@@ -88,10 +93,10 @@ Description-Content-Type: text/markdown
88
93
  - Visit the [mcp-use docs](https://docs.mcp-use.com/) to get started with mcp-use library
89
94
  - For the TypeScript version, visit [mcp-use-ts](https://github.com/mcp-use/mcp-use-ts)
90
95
 
91
- | Supports | |
92
- | :--- | :--- |
96
+ | Supports | |
97
+ | :------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
93
98
  | **Primitives** | [![Tools](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=primitive-tools&label=Tools&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Resources](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=primitive-resources&label=Resources&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Prompts](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=primitive-prompts&label=Prompts&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Sampling](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=primitive-sampling&label=Sampling&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Elicitation](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=primitive-elicitation&label=Elicitation&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) |
94
- | **Transports** | [![Stdio](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-stdio&label=Stdio&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![SSE](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-sse&label=SSE&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Streamable HTTP](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-streamableHttp&label=Streamable%20HTTP&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) |
99
+ | **Transports** | [![Stdio](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-stdio&label=Stdio&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![SSE](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-sse&label=SSE&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Streamable HTTP](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-streamableHttp&label=Streamable%20HTTP&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) |
95
100
 
96
101
  ## Features
97
102
 
@@ -417,29 +422,7 @@ if __name__ == "__main__":
417
422
  asyncio.run(run_blender_example())
418
423
  ```
419
424
 
420
- # Configuration File Support
421
-
422
- MCP-Use supports initialization from configuration files, making it easy to manage and switch between different MCP server setups:
423
-
424
- ```python
425
- import asyncio
426
- from mcp_use import create_session_from_config
427
-
428
- async def main():
429
- # Create an MCP session from a config file
430
- session = create_session_from_config("mcp-config.json")
431
-
432
- # Initialize the session
433
- await session.initialize()
434
-
435
- # Use the session...
436
-
437
- # Disconnect when done
438
- await session.disconnect()
439
-
440
- if __name__ == "__main__":
441
- asyncio.run(main())
442
- ```
425
+ # Configuration Support
443
426
 
444
427
  ## HTTP Connection Example
445
428
 
@@ -695,6 +678,47 @@ The `SandboxOptions` type provides configuration for the sandbox environment:
695
678
  - **Consistent environment**: Ensure consistent behavior across different systems
696
679
  - **Resource efficiency**: Offload resource-intensive tasks to cloud infrastructure
697
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
+
698
722
  # Build a Custom Agent:
699
723
 
700
724
  You can also build your own custom agent using the LangChain adapter:
@@ -813,23 +837,27 @@ Thanks to all our amazing contributors!
813
837
  </tr>
814
838
  <tr>
815
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>
816
- <td>⭐ 15189</td>
840
+ <td>⭐ 15920</td>
817
841
  </tr>
818
842
  <tr>
819
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>
820
844
  <td>⭐ 129</td>
821
845
  </tr>
822
846
  <tr>
823
- <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-sdk"><strong>hud-evals/hud-sdk</strong></a></td>
824
- <td>⭐ 75</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>
849
+ </tr>
850
+ <tr>
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>
825
853
  </tr>
826
854
  <tr>
827
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>
828
- <td>⭐ 58</td>
856
+ <td>⭐ 61</td>
829
857
  </tr>
830
858
  <tr>
831
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>
832
- <td>⭐ 31</td>
860
+ <td>⭐ 35</td>
833
861
  </tr>
834
862
  <tr>
835
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>
@@ -845,11 +873,7 @@ Thanks to all our amazing contributors!
845
873
  </tr>
846
874
  <tr>
847
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>
848
- <td>⭐ 18</td>
849
- </tr>
850
- <tr>
851
- <td><img src="https://avatars.githubusercontent.com/u/6688805?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/innovaccer/Healthcare-MCP"><strong>innovaccer/Healthcare-MCP</strong></a></td>
852
- <td>⭐ 15</td>
876
+ <td>⭐ 19</td>
853
877
  </tr>
854
878
  </table>
855
879
 
@@ -1,25 +1,30 @@
1
1
  <div align="center">
2
2
  <div align="center" style="margin: 0 auto; max-width: 80%;">
3
3
  <picture>
4
- <source media="(prefers-color-scheme: dark)" srcset="static/logo_white.svg">
5
- <source media="(prefers-color-scheme: light)" srcset="static/logo_black.svg">
6
- <img alt="mcp use logo" src="./static/logo-white.svg" width="80%" style="margin: 20px auto;">
4
+ <source media="(prefers-color-scheme: dark)" srcset="static/logo-gh.jpg">
5
+ <source media="(prefers-color-scheme: light)" srcset="static/logo-gh.jpg">
6
+ <img alt="mcp use logo" src="./static/logo-gh.jpg" width="80%" style="margin: 20px auto;">
7
7
  </picture>
8
8
  </div>
9
9
 
10
10
  <br>
11
11
 
12
- # Connect any LLM to any MCP server
12
+ # Create MCP Clients and Agents
13
13
 
14
+ <p align="center">
15
+ <a href="https://www.producthunt.com/products/mcp-use?embed=true&utm_source=badge-featured&utm_medium=badge&utm_source=badge-mcp&#0045;use" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1002629&theme=neutral&t=1754609432704" alt="mcp&#0045;use - Open&#0032;source&#0032;SDK&#0032;and&#0032;infra&#0032;for&#0032;MCP&#0032;servers&#0032;&#0038;&#0032;agents | Product Hunt" style="width: 150px; height: 32px;" width="150" height="32" /></a>
16
+ </p>
14
17
  <p align="center">
15
18
  <a href="https://github.com/pietrozullo/mcp-use/stargazers" alt="GitHub stars">
16
19
  <img src="https://img.shields.io/github/stars/pietrozullo/mcp-use?style=social" /></a>
20
+ <a href="https://pypi.org/project/mcp_use/" alt="PyPI Downloads">
21
+ <img src="https://static.pepy.tech/badge/mcp-use" /></a>
17
22
  <a href="https://pypi.org/project/mcp_use/" alt="PyPI Version">
18
23
  <img src="https://img.shields.io/pypi/v/mcp_use.svg"/></a>
24
+ <a href="https://github.com/mcp-use/mcp-use-ts" alt="TypeScript">
25
+ <img src="https://img.shields.io/badge/TypeScript-mcp--use-3178C6?logo=typescript&logoColor=white" /></a>
19
26
  <a href="https://github.com/pietrozullo/mcp-use/blob/main/LICENSE" alt="License">
20
27
  <img src="https://img.shields.io/github/license/pietrozullo/mcp-use" /></a>
21
- <a href="https://pypi.org/project/mcp_use/" alt="PyPI Downloads">
22
- <img src="https://static.pepy.tech/badge/mcp-use" /></a>
23
28
  <a href="https://docs.mcp-use.com" alt="Documentation">
24
29
  <img src="https://img.shields.io/badge/docs-mcp--use.com-blue" /></a>
25
30
  <a href="https://mcp-use.com" alt="Website">
@@ -43,10 +48,10 @@
43
48
  - Visit the [mcp-use docs](https://docs.mcp-use.com/) to get started with mcp-use library
44
49
  - For the TypeScript version, visit [mcp-use-ts](https://github.com/mcp-use/mcp-use-ts)
45
50
 
46
- | Supports | |
47
- | :--- | :--- |
51
+ | Supports | |
52
+ | :------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
48
53
  | **Primitives** | [![Tools](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=primitive-tools&label=Tools&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Resources](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=primitive-resources&label=Resources&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Prompts](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=primitive-prompts&label=Prompts&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Sampling](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=primitive-sampling&label=Sampling&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Elicitation](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=primitive-elicitation&label=Elicitation&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) |
49
- | **Transports** | [![Stdio](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-stdio&label=Stdio&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![SSE](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-sse&label=SSE&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Streamable HTTP](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-streamableHttp&label=Streamable%20HTTP&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) |
54
+ | **Transports** | [![Stdio](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-stdio&label=Stdio&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![SSE](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-sse&label=SSE&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [![Streamable HTTP](https://img.shields.io/github/actions/workflow/status/pietrozullo/mcp-use/tests.yml?job=transport-streamableHttp&label=Streamable%20HTTP&style=flat)](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) |
50
55
 
51
56
  ## Features
52
57
 
@@ -372,29 +377,7 @@ if __name__ == "__main__":
372
377
  asyncio.run(run_blender_example())
373
378
  ```
374
379
 
375
- # Configuration File Support
376
-
377
- MCP-Use supports initialization from configuration files, making it easy to manage and switch between different MCP server setups:
378
-
379
- ```python
380
- import asyncio
381
- from mcp_use import create_session_from_config
382
-
383
- async def main():
384
- # Create an MCP session from a config file
385
- session = create_session_from_config("mcp-config.json")
386
-
387
- # Initialize the session
388
- await session.initialize()
389
-
390
- # Use the session...
391
-
392
- # Disconnect when done
393
- await session.disconnect()
394
-
395
- if __name__ == "__main__":
396
- asyncio.run(main())
397
- ```
380
+ # Configuration Support
398
381
 
399
382
  ## HTTP Connection Example
400
383
 
@@ -650,6 +633,47 @@ The `SandboxOptions` type provides configuration for the sandbox environment:
650
633
  - **Consistent environment**: Ensure consistent behavior across different systems
651
634
  - **Resource efficiency**: Offload resource-intensive tasks to cloud infrastructure
652
635
 
636
+ # Direct Tool Calls (Without LLM)
637
+
638
+ You can call MCP server tools directly without an LLM when you need programmatic control:
639
+
640
+ ```python
641
+ import asyncio
642
+ from mcp_use import MCPClient
643
+
644
+ async def call_tool_example():
645
+ config = {
646
+ "mcpServers": {
647
+ "everything": {
648
+ "command": "npx",
649
+ "args": ["-y", "@modelcontextprotocol/server-everything"],
650
+ }
651
+ }
652
+ }
653
+
654
+ client = MCPClient.from_dict(config)
655
+
656
+ try:
657
+ await client.create_all_sessions()
658
+ session = client.get_session("everything")
659
+
660
+ # Call tool directly
661
+ result = await session.call_tool(
662
+ name="add",
663
+ arguments={"a": 1, "b": 2}
664
+ )
665
+
666
+ print(f"Result: {result.content[0].text}") # Output: 3
667
+
668
+ finally:
669
+ await client.close_all_sessions()
670
+
671
+ if __name__ == "__main__":
672
+ asyncio.run(call_tool_example())
673
+ ```
674
+
675
+ See the complete example: [examples/direct_tool_call.py](examples/direct_tool_call.py)
676
+
653
677
  # Build a Custom Agent:
654
678
 
655
679
  You can also build your own custom agent using the LangChain adapter:
@@ -768,23 +792,27 @@ Thanks to all our amazing contributors!
768
792
  </tr>
769
793
  <tr>
770
794
  <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>
771
- <td>⭐ 15189</td>
795
+ <td>⭐ 15920</td>
772
796
  </tr>
773
797
  <tr>
774
798
  <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>
775
799
  <td>⭐ 129</td>
776
800
  </tr>
777
801
  <tr>
778
- <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-sdk"><strong>hud-evals/hud-sdk</strong></a></td>
779
- <td>⭐ 75</td>
802
+ <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>
803
+ <td>⭐ 93</td>
804
+ </tr>
805
+ <tr>
806
+ <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>
807
+ <td>⭐ 76</td>
780
808
  </tr>
781
809
  <tr>
782
810
  <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>
783
- <td>⭐ 58</td>
811
+ <td>⭐ 61</td>
784
812
  </tr>
785
813
  <tr>
786
814
  <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>
787
- <td>⭐ 31</td>
815
+ <td>⭐ 35</td>
788
816
  </tr>
789
817
  <tr>
790
818
  <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>
@@ -800,11 +828,7 @@ Thanks to all our amazing contributors!
800
828
  </tr>
801
829
  <tr>
802
830
  <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>
803
- <td>⭐ 18</td>
804
- </tr>
805
- <tr>
806
- <td><img src="https://avatars.githubusercontent.com/u/6688805?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/innovaccer/Healthcare-MCP"><strong>innovaccer/Healthcare-MCP</strong></a></td>
807
- <td>⭐ 15</td>
831
+ <td>⭐ 19</td>
808
832
  </tr>
809
833
  </table>
810
834
 
@@ -48,7 +48,8 @@ async def run(
48
48
  max_steps: int | None = None,
49
49
  manage_connector: bool = True,
50
50
  external_history: list[BaseMessage] | None = None,
51
- ) -> str:
51
+ output_schema: type[T] | None = None,
52
+ ) -> str | T:
52
53
  ```
53
54
 
54
55
  Run agent execution and return the final result. Uses the streaming implementation internally.
@@ -58,17 +59,34 @@ Run agent execution and return the final result. Uses the streaming implementati
58
59
  - `max_steps` (int, optional): Maximum number of steps to take
59
60
  - `manage_connector` (bool): Whether to handle connector lifecycle
60
61
  - `external_history` (list[BaseMessage], optional): External conversation history
62
+ - `output_schema` (type[T], optional): Pydantic model for structured output. If provided, the agent will return an instance of this model.
61
63
 
62
64
  **Returns:**
63
- - `str`: The final result
65
+ - `str` | `T`: The final result as a string, or a Pydantic model instance if `output_schema` is provided.
64
66
 
65
- **Example:**
67
+ **Examples:**
66
68
 
69
+ **Basic Usage**
67
70
  ```python
68
71
  result = await agent.run("What's the weather like?")
69
72
  print(result)
70
73
  ```
71
74
 
75
+ **Structured Output**
76
+ ```python
77
+ from pydantic import BaseModel, Field
78
+
79
+ class WeatherInfo(BaseModel):
80
+ temperature: float = Field(description="Temperature in Celsius")
81
+ condition: str = Field(description="Weather condition")
82
+
83
+ weather: WeatherInfo = await agent.run(
84
+ "What's the weather like in London?",
85
+ output_schema=WeatherInfo
86
+ )
87
+ print(f"Temperature: {weather.temperature}°C, Condition: {weather.condition}")
88
+ ```
89
+
72
90
  ## astream
73
91
 
74
92
  ```python
@@ -106,7 +124,9 @@ async for chunk in agent.astream("hello"):
106
124
  | `run()` | Simple execution | Final result only | Complete |
107
125
  | `astream()` | Real-time chat interfaces | Streaming chunks | Token-level |
108
126
 
109
- ## Configuration Methods
127
+ ## Conversation Memory
128
+
129
+ Methods for managing the agent's conversation history.
110
130
 
111
131
  ### get_conversation_history
112
132
 
@@ -114,7 +134,10 @@ async for chunk in agent.astream("hello"):
114
134
  def get_conversation_history() -> list[BaseMessage]:
115
135
  ```
116
136
 
117
- Get the current conversation history.
137
+ Retrieves the current conversation history, which is a list of LangChain `BaseMessage` objects. This is useful for inspecting the agent's memory or for passing it to another agent.
138
+
139
+ **Returns:**
140
+ - `list[BaseMessage]`: The list of messages in the conversation history.
118
141
 
119
142
  ### clear_conversation_history
120
143
 
@@ -122,7 +145,24 @@ Get the current conversation history.
122
145
  def clear_conversation_history() -> None:
123
146
  ```
124
147
 
125
- Clear the conversation history.
148
+ Clears the agent's conversation history. This is useful for starting a new conversation without creating a new agent instance. The system message is preserved.
149
+
150
+ **Example:**
151
+ ```python
152
+ # Run a query, which populates the history
153
+ await agent.run("What is the capital of France?")
154
+
155
+ # Clear the history
156
+ agent.clear_conversation_history()
157
+
158
+ # The next query will not have the context of the first one
159
+ await agent.run("What was the last question I asked?")
160
+ # Assistant: I'm sorry, I don't have access to our previous conversation.
161
+ ```
162
+
163
+ ## Agent Management
164
+
165
+ Methods for managing the agent's lifecycle and configuration.
126
166
 
127
167
  ### set_system_message
128
168
 
@@ -100,115 +100,11 @@ You can configure multiple MCP servers in a single configuration file, allowing
100
100
 
101
101
  For a complete example of using multiple servers, see the [multi-server example](https://github.com/mcp-use/mcp-use/blob/main/examples/multi_server_example.py) in our repository.
102
102
 
103
- ### Working with Multiple Servers
104
-
105
- The `MCPClient` can be configured with multiple MCP servers, allowing your agent to access tools from different sources. This capability enables complex workflows spanning various domains (e.g., web browsing and API interaction).
106
-
107
- When an `MCPClient` with multiple servers is passed to an `MCPAgent`, the agent gains access to tools from all configured servers. By default, you might need to guide the agent or explicitly specify which server to use for a given task using the `server_name` parameter in the `agent.run()` method.
108
-
109
- ```python
110
- # Assuming MCPClient is initialized with the multi_server_config.json
111
- client = MCPClient.from_config_file("multi_server_config.json")
112
- agent = MCPAgent(llm=llm, client=client) # Server manager not enabled by default
113
-
114
- # Manually specify the server if needed
115
- result = await agent.run(
116
- "Search for Airbnb listings in Barcelona",
117
- server_name="airbnb"
118
- )
119
- ```
120
-
121
-
122
- ## Sandboxed Execution
123
-
124
- mcp_use supports running MCP servers in a sandboxed cloud environment using E2B. This is useful when you want to run MCP servers without having to install their dependencies locally.
125
-
126
- ### Installation
127
-
128
- To use sandboxed execution, you need to install the E2B dependency:
129
-
130
- ```bash
131
- # Install mcp-use with E2B support
132
- pip install "mcp-use[e2b]"
133
-
134
- # Or install the dependency directly
135
- pip install e2b-code-interpreter
136
- ```
137
-
138
- You'll also need an E2B API key. You can sign up at [e2b.dev](https://e2b.dev) to get your API key.
139
-
140
- ### Configuration Example
141
-
142
- To enable sandboxed execution, use the sandbox parameter when creating the MCPClient:
143
-
144
- ```python
145
- from mcp_use import MCPClient
146
- from mcp_use.types.sandbox import SandboxOptions
147
-
148
- # Define sandbox options
149
- sandbox_options: SandboxOptions = {
150
- "api_key": "your_e2b_api_key", # Or use E2B_API_KEY environment variable
151
- "sandbox_template_id": "code-interpreter-v1",
152
- "supergateway_command": "npx -y supergateway" # Optional, this is the default
153
- }
154
-
155
- # Create client with sandboxed execution enabled
156
- client = MCPClient.from_dict(
157
- {
158
- "mcpServers": {
159
- "command_line": {
160
- "command": "npx",
161
- "args": ["-y", "@modelcontextprotocol/server-everything"]
162
- }
163
- }
164
- },
165
- sandbox=True,
166
- sandbox_options=sandbox_options
167
- )
168
- ```
169
-
170
- ### Available Sandbox Options
171
-
172
- The `SandboxOptions` type provides the following configuration options:
173
-
174
- | Option | Description | Default |
175
- | ---------------------- | ---------------------------------------------------------------------------------------- | --------------------- |
176
- | `api_key` | E2B API key. Required - can be provided directly or via E2B_API_KEY environment variable | None |
177
- | `sandbox_template_id` | Template ID for the sandbox environment | "base" |
178
- | `supergateway_command` | Command to run supergateway | "npx -y supergateway" |
179
-
180
- ### E2B API Key
181
-
182
- To use sandboxed execution, you need an E2B API key. You can provide it in two ways:
183
-
184
- 1. Directly in the sandbox options:
185
-
186
- ```python
187
- sandbox_options = {"api_key": "your_e2b_api_key"}
188
- ```
189
-
190
- 2. Through the environment variable:
191
- ```bash
192
- # In your .env file or environment
193
- E2B_API_KEY=your_e2b_api_key
194
- ```
195
-
196
- For more details on connection types and sandbox configuration, see the [Connection Types](./connection-types) guide.
197
103
 
198
104
  ## Client Creation Methods
199
105
 
200
106
  There are several ways to create an MCPClient:
201
107
 
202
- ### From Configuration File
203
-
204
- Load configuration from a JSON file:
205
-
206
- ```python
207
- from mcp_use import MCPClient
208
-
209
- client = MCPClient.from_config_file("config.json")
210
- ```
211
-
212
108
  ### From Dictionary
213
109
 
214
110
  Create configuration programmatically:
@@ -226,9 +122,20 @@ config = {
226
122
  }
227
123
  }
228
124
 
229
- client = MCPClient.from_dict(config)
125
+ client = MCPClient(config)
230
126
  ```
231
127
 
128
+ ### From Configuration File
129
+
130
+ Load configuration from a JSON file:
131
+
132
+ ```python
133
+ from mcp_use import MCPClient
134
+
135
+ client = MCPClient.from_config_file("config.json")
136
+ ```
137
+
138
+
232
139
  ### With Sandbox Options
233
140
 
234
141
  Enable sandboxed execution: