mcp-use 1.3.6__tar.gz → 1.3.8__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 (167) hide show
  1. mcp_use-1.3.8/.github/workflows/publish.yml +81 -0
  2. mcp_use-1.3.8/.github/workflows/tests.yml +115 -0
  3. {mcp_use-1.3.6 → mcp_use-1.3.8}/.github/workflows/update-readme.yml +3 -1
  4. {mcp_use-1.3.6 → mcp_use-1.3.8}/PKG-INFO +29 -25
  5. {mcp_use-1.3.6 → mcp_use-1.3.8}/README.md +26 -22
  6. {mcp_use-1.3.6/docs/guides → mcp_use-1.3.8/docs/advanced}/multi-server-setup.mdx +2 -2
  7. {mcp_use-1.3.6/docs/guides → mcp_use-1.3.8/docs/advanced}/security.mdx +1 -1
  8. {mcp_use-1.3.6/docs/essentials → mcp_use-1.3.8/docs/agent}/agent-configuration.mdx +1 -1
  9. mcp_use-1.3.8/docs/agent/server-manager.mdx +215 -0
  10. {mcp_use-1.3.6/docs/guides → mcp_use-1.3.8/docs/agent}/streaming.mdx +2 -2
  11. mcp_use-1.3.8/docs/agent/structured-output.mdx +61 -0
  12. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/api-reference/mcpclient.mdx +2 -2
  13. {mcp_use-1.3.6/docs/essentials → mcp_use-1.3.8/docs/client}/client-configuration.mdx +1 -1
  14. mcp_use-1.3.8/docs/client/elicitation.mdx +363 -0
  15. mcp_use-1.3.8/docs/client/sampling.mdx +86 -0
  16. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/community/showcase.mdx +2 -2
  17. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/docs.json +45 -22
  18. {mcp_use-1.3.6/docs/essentials → mcp_use-1.3.8/docs/getting-started}/configuration.mdx +7 -7
  19. {mcp_use-1.3.6/docs → mcp_use-1.3.8/docs/getting-started}/index.mdx +14 -14
  20. {mcp_use-1.3.6/docs → mcp_use-1.3.8/docs/getting-started}/installation.mdx +3 -3
  21. {mcp_use-1.3.6/docs → mcp_use-1.3.8/docs/getting-started}/quickstart.mdx +3 -3
  22. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/troubleshooting/performance.mdx +2 -2
  23. {mcp_use-1.3.6 → mcp_use-1.3.8}/examples/airbnb_use.py +10 -15
  24. {mcp_use-1.3.6 → mcp_use-1.3.8}/examples/browser_use.py +4 -5
  25. {mcp_use-1.3.6 → mcp_use-1.3.8}/examples/stream_example.py +5 -2
  26. mcp_use-1.3.8/examples/structured_output.py +78 -0
  27. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/agents/__init__.py +2 -2
  28. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/agents/mcpagent.py +257 -31
  29. mcp_use-1.3.8/mcp_use/agents/prompts/templates.py +41 -0
  30. mcp_use-1.3.8/mcp_use/agents/remote.py +239 -0
  31. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/client.py +43 -7
  32. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/config.py +13 -1
  33. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/connectors/base.py +46 -11
  34. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/connectors/http.py +21 -12
  35. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/connectors/sandbox.py +13 -2
  36. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/connectors/stdio.py +13 -2
  37. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/managers/__init__.py +3 -5
  38. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/managers/server_manager.py +45 -6
  39. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/managers/tools/__init__.py +2 -4
  40. {mcp_use-1.3.6 → mcp_use-1.3.8}/pyproject.toml +3 -3
  41. mcp_use-1.3.8/tests/integration/conftest.py +38 -0
  42. {mcp_use-1.3.6/tests/integration/transports/customStreaming → mcp_use-1.3.8/tests/integration/others}/test_custom_streaming_integration.py +1 -1
  43. mcp_use-1.3.8/tests/integration/primitives/test_elicitation.py +26 -0
  44. mcp_use-1.3.8/tests/integration/primitives/test_prompts.py +20 -0
  45. mcp_use-1.3.8/tests/integration/primitives/test_resources.py +42 -0
  46. mcp_use-1.3.8/tests/integration/primitives/test_sampling.py +48 -0
  47. mcp_use-1.3.8/tests/integration/primitives/test_tools.py +28 -0
  48. mcp_use-1.3.8/tests/integration/servers_for_testing/primitive_server.py +72 -0
  49. mcp_use-1.3.6/tests/integration/transports/sse/test_sse_integration.py → mcp_use-1.3.8/tests/integration/transports/test_sse.py +1 -1
  50. mcp_use-1.3.6/tests/integration/transports/stdio/test_stdio_integration.py → mcp_use-1.3.8/tests/integration/transports/test_stdio.py +1 -1
  51. mcp_use-1.3.6/tests/integration/transports/streamableHttp/test_streamable_http_integration.py → mcp_use-1.3.8/tests/integration/transports/test_streamable_http.py +1 -1
  52. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/unit/test_client.py +81 -7
  53. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/unit/test_http_connector.py +9 -3
  54. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/unit/test_sandbox_connector.py +8 -2
  55. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/unit/test_stdio_connector.py +9 -3
  56. mcp_use-1.3.6/.github/workflows/claude.yml +0 -36
  57. mcp_use-1.3.6/.github/workflows/publish.yml +0 -80
  58. mcp_use-1.3.6/.github/workflows/transportstests.yml +0 -41
  59. mcp_use-1.3.6/.github/workflows/unittests.yml +0 -31
  60. mcp_use-1.3.6/docs/essentials/server-manager.mdx +0 -344
  61. mcp_use-1.3.6/examples/browser_mcp.json +0 -11
  62. mcp_use-1.3.6/mcp_use/agents/prompts/templates.py +0 -43
  63. mcp_use-1.3.6/mcp_use/managers/tools/use_tool.py +0 -154
  64. mcp_use-1.3.6/tests/integration/transports/customStreaming/__init__.py +0 -1
  65. mcp_use-1.3.6/tests/integration/transports/sse/test_connection_state_tracking.py +0 -297
  66. {mcp_use-1.3.6 → mcp_use-1.3.8}/.env.example +0 -0
  67. {mcp_use-1.3.6 → mcp_use-1.3.8}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  68. {mcp_use-1.3.6 → mcp_use-1.3.8}/.github/pull_request_template.md +0 -0
  69. {mcp_use-1.3.6 → mcp_use-1.3.8}/.github/release-drafter.yml +0 -0
  70. {mcp_use-1.3.6 → mcp_use-1.3.8}/.github/workflows/changelog.yml +0 -0
  71. {mcp_use-1.3.6 → mcp_use-1.3.8}/.github/workflows/release-drafter.yml +0 -0
  72. {mcp_use-1.3.6 → mcp_use-1.3.8}/.github/workflows/stale.yml +0 -0
  73. {mcp_use-1.3.6 → mcp_use-1.3.8}/.gitignore +0 -0
  74. {mcp_use-1.3.6 → mcp_use-1.3.8}/.pre-commit-config.yaml +0 -0
  75. {mcp_use-1.3.6 → mcp_use-1.3.8}/CHANGELOG.md +0 -0
  76. {mcp_use-1.3.6 → mcp_use-1.3.8}/CLAUDE.md +0 -0
  77. {mcp_use-1.3.6 → mcp_use-1.3.8}/CODE_OF_CONDUCT.md +0 -0
  78. {mcp_use-1.3.6 → mcp_use-1.3.8}/CONTRIBUTING.md +0 -0
  79. {mcp_use-1.3.6 → mcp_use-1.3.8}/LICENSE +0 -0
  80. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/README.md +0 -0
  81. {mcp_use-1.3.6/docs/guides → mcp_use-1.3.8/docs/advanced}/building-custom-agents.mdx +0 -0
  82. {mcp_use-1.3.6/docs/guides → mcp_use-1.3.8/docs/advanced}/logging.mdx +0 -0
  83. {mcp_use-1.3.6/docs/essentials → mcp_use-1.3.8/docs/agent}/llm-integration.mdx +0 -0
  84. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/api-reference/adapters.mdx +0 -0
  85. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/api-reference/introduction.mdx +0 -0
  86. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/api-reference/mcpagent.mdx +0 -0
  87. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/changelog.mdx +0 -0
  88. {mcp_use-1.3.6/docs/essentials → mcp_use-1.3.8/docs/client}/connection-types.mdx +0 -0
  89. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/development/observability.mdx +0 -0
  90. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/development/telemetry.mdx +0 -0
  91. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/development.mdx +0 -0
  92. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/favicon.svg +0 -0
  93. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/fonts.css +0 -0
  94. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/01.png +0 -0
  95. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/02.png +0 -0
  96. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/configuration-dark.png +0 -0
  97. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/configuration-light.png +0 -0
  98. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/examples-dark.png +0 -0
  99. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/examples-light.png +0 -0
  100. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/hero-dark.png +0 -0
  101. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/hero-light.png +0 -0
  102. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/installation-dark.png +0 -0
  103. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/installation-light.png +0 -0
  104. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/quickstart-dark.png +0 -0
  105. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/images/quickstart-light.png +0 -0
  106. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/logo/dark.svg +0 -0
  107. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/logo/light.svg +0 -0
  108. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/logo/react.svg +0 -0
  109. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/snippets/snippet-intro.mdx +0 -0
  110. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/snippets/youtube-embed.mdx +0 -0
  111. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/troubleshooting/common-issues.mdx +0 -0
  112. {mcp_use-1.3.6 → mcp_use-1.3.8}/docs/troubleshooting/connection-errors.mdx +0 -0
  113. {mcp_use-1.3.6 → mcp_use-1.3.8}/examples/airbnb_mcp.json +0 -0
  114. {mcp_use-1.3.6 → mcp_use-1.3.8}/examples/blender_use.py +0 -0
  115. {mcp_use-1.3.6 → mcp_use-1.3.8}/examples/chat_example.py +0 -0
  116. {mcp_use-1.3.6 → mcp_use-1.3.8}/examples/filesystem_use.py +0 -0
  117. {mcp_use-1.3.6 → mcp_use-1.3.8}/examples/http_example.py +0 -0
  118. {mcp_use-1.3.6 → mcp_use-1.3.8}/examples/mcp_everything.py +0 -0
  119. {mcp_use-1.3.6 → mcp_use-1.3.8}/examples/multi_server_example.py +0 -0
  120. {mcp_use-1.3.6 → mcp_use-1.3.8}/examples/sandbox_everything.py +0 -0
  121. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/__init__.py +0 -0
  122. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/adapters/__init__.py +0 -0
  123. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/adapters/base.py +0 -0
  124. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/adapters/langchain_adapter.py +0 -0
  125. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/agents/base.py +0 -0
  126. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/agents/prompts/system_prompt_builder.py +0 -0
  127. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/connectors/__init__.py +0 -0
  128. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/connectors/utils.py +0 -0
  129. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/connectors/websocket.py +0 -0
  130. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/logging.py +0 -0
  131. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/managers/tools/base_tool.py +0 -0
  132. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/managers/tools/connect_server.py +0 -0
  133. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/managers/tools/disconnect_server.py +0 -0
  134. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/managers/tools/get_active_server.py +0 -0
  135. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/managers/tools/list_servers_tool.py +0 -0
  136. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/managers/tools/search_tools.py +0 -0
  137. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/observability/__init__.py +0 -0
  138. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/observability/laminar.py +0 -0
  139. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/observability/langfuse.py +0 -0
  140. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/session.py +0 -0
  141. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/task_managers/__init__.py +0 -0
  142. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/task_managers/base.py +0 -0
  143. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/task_managers/sse.py +0 -0
  144. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/task_managers/stdio.py +0 -0
  145. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/task_managers/streamable_http.py +0 -0
  146. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/task_managers/websocket.py +0 -0
  147. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/telemetry/__init__.py +0 -0
  148. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/telemetry/events.py +0 -0
  149. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/telemetry/telemetry.py +0 -0
  150. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/telemetry/utils.py +0 -0
  151. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/types/sandbox.py +0 -0
  152. {mcp_use-1.3.6 → mcp_use-1.3.8}/mcp_use/utils.py +0 -0
  153. {mcp_use-1.3.6 → mcp_use-1.3.8}/pytest.ini +0 -0
  154. {mcp_use-1.3.6 → mcp_use-1.3.8}/ruff.toml +0 -0
  155. {mcp_use-1.3.6 → mcp_use-1.3.8}/static/logo_black.svg +0 -0
  156. {mcp_use-1.3.6 → mcp_use-1.3.8}/static/logo_white.svg +0 -0
  157. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/conftest.py +0 -0
  158. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/integration/__init__.py +0 -0
  159. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/integration/servers_for_testing/__init__.py +0 -0
  160. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/integration/servers_for_testing/custom_streaming_server.py +0 -0
  161. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/integration/servers_for_testing/simple_server.py +0 -0
  162. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/integration/servers_for_testing/timeout_test_server.py +0 -0
  163. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/unit/test_config.py +0 -0
  164. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/unit/test_logging.py +0 -0
  165. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/unit/test_search_tools_issue_138.py +0 -0
  166. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/unit/test_session.py +0 -0
  167. {mcp_use-1.3.6 → mcp_use-1.3.8}/tests/unit/test_websocket_connection_manager.py +0 -0
@@ -0,0 +1,81 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ # Required for PyPI trusted publishing
8
+ permissions:
9
+ id-token: write
10
+ contents: read
11
+
12
+ jobs:
13
+ check-version-and-publish:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ with:
18
+ fetch-depth: 0
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v4
22
+ with:
23
+ python-version: "3.11"
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install build twine wheel tomli
29
+
30
+ - name: Verify version match
31
+ id: check-version
32
+ run: |
33
+ # Extract current version from pyproject.toml
34
+ PYPROJECT_VERSION=$(python -c "
35
+ import tomli
36
+ with open('pyproject.toml', 'rb') as f:
37
+ data = tomli.load(f)
38
+ print(data['project']['version'])
39
+ ")
40
+
41
+ # Get release tag version (remove 'v' prefix if present)
42
+ RELEASE_VERSION="${{ github.event.release.tag_name }}"
43
+ RELEASE_VERSION=${RELEASE_VERSION#v}
44
+
45
+ echo "PyProject version: $PYPROJECT_VERSION"
46
+ echo "Release version: $RELEASE_VERSION"
47
+
48
+ if [ "$PYPROJECT_VERSION" = "$RELEASE_VERSION" ]; then
49
+ echo "✅ Versions match! Proceeding with PyPI publish"
50
+ echo "should_publish=true" >> $GITHUB_OUTPUT
51
+ echo "version=$PYPROJECT_VERSION" >> $GITHUB_OUTPUT
52
+ else
53
+ echo "❌ Version mismatch! PyProject: $PYPROJECT_VERSION, Release: $RELEASE_VERSION"
54
+ echo "should_publish=false" >> $GITHUB_OUTPUT
55
+ exit 1
56
+ fi
57
+
58
+ - name: Build package
59
+ if: steps.check-version.outputs.should_publish == 'true'
60
+ run: |
61
+ python -m build
62
+
63
+ - name: Check if already published to PyPI
64
+ if: steps.check-version.outputs.should_publish == 'true'
65
+ id: check-pypi
66
+ run: |
67
+ # Check if this version exists on PyPI
68
+ VERSION="${{ steps.check-version.outputs.version }}"
69
+ if pip index versions mcp-use | grep -q "Available versions: .*$VERSION"; then
70
+ echo "Version $VERSION already exists on PyPI"
71
+ echo "publish_needed=false" >> $GITHUB_OUTPUT
72
+ else
73
+ echo "Version $VERSION not found on PyPI, will publish"
74
+ echo "publish_needed=true" >> $GITHUB_OUTPUT
75
+ fi
76
+
77
+ - name: Publish to PyPI
78
+ if: steps.check-pypi.outputs.publish_needed == 'true'
79
+ uses: pypa/gh-action-pypi-publish@release/v1
80
+ with:
81
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,115 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - name: Set up Python 3.11
15
+ uses: actions/setup-python@v4
16
+ with:
17
+ python-version: "3.11"
18
+ - name: Install dependencies
19
+ run: |
20
+ python -m pip install --upgrade pip
21
+ pip install ruff
22
+ - name: Lint with ruff
23
+ run: |
24
+ ruff check .
25
+ - name: Format check with ruff
26
+ run: |
27
+ ruff format --check .
28
+
29
+ unit-tests:
30
+ needs: lint
31
+ runs-on: ubuntu-latest
32
+ strategy:
33
+ matrix:
34
+ python-version: ["3.11", "3.12"]
35
+ steps:
36
+ - uses: actions/checkout@v3
37
+ - name: Set up Python ${{ matrix.python-version }}
38
+ uses: actions/setup-python@v4
39
+ with:
40
+ python-version: ${{ matrix.python-version }}
41
+ - name: Install dependencies
42
+ run: |
43
+ python -m pip install --upgrade pip
44
+ pip install .[dev,anthropic,openai,search,e2b]
45
+ - name: Test with pytest
46
+ run: |
47
+ pytest tests/unit
48
+
49
+ transport-tests:
50
+ needs: lint
51
+ name: "transport/${{ matrix.transport }}"
52
+ runs-on: ubuntu-latest
53
+ strategy:
54
+ fail-fast: false
55
+ matrix:
56
+ transport: [stdio, sse, streamable_http]
57
+ steps:
58
+ - uses: actions/checkout@v3
59
+ - name: Set up Python 3.11
60
+ uses: actions/setup-python@v4
61
+ with:
62
+ python-version: "3.11"
63
+ - name: Install uv
64
+ run: |
65
+ pip install uv
66
+ - name: Install dependencies
67
+ run: |
68
+ uv pip install --system .[dev,anthropic,openai,search,e2b]
69
+ - name: Run integration tests for ${{ matrix.transport }} transport
70
+ run: |
71
+ pytest tests/integration/transports/test_${{ matrix.transport }}.py
72
+
73
+ primitive-tests:
74
+ needs: lint
75
+ name: "primitive/${{ matrix.primitive }}"
76
+ runs-on: ubuntu-latest
77
+ strategy:
78
+ fail-fast: false
79
+ matrix:
80
+ primitive: [sampling, tools, resources, prompts, elicitation]
81
+ steps:
82
+ - uses: actions/checkout@v3
83
+ - name: Set up Python 3.11
84
+ uses: actions/setup-python@v4
85
+ with:
86
+ python-version: "3.11"
87
+ - name: Install uv
88
+ run: |
89
+ pip install uv
90
+ - name: Install dependencies
91
+ run: |
92
+ uv pip install --system .[dev,anthropic,openai,search,e2b]
93
+ - name: Run integration tests for ${{ matrix.primitive }} primitive
94
+ run: |
95
+ pytest tests/integration/primitives/test_${{ matrix.primitive }}.py
96
+
97
+ integration-tests:
98
+ needs: lint
99
+ name: "Integration"
100
+ runs-on: ubuntu-latest
101
+ steps:
102
+ - uses: actions/checkout@v3
103
+ - name: Set up Python 3.11
104
+ uses: actions/setup-python@v4
105
+ with:
106
+ python-version: "3.11"
107
+ - name: Install uv
108
+ run: |
109
+ pip install uv
110
+ - name: Install dependencies
111
+ run: |
112
+ uv pip install --system .[dev,anthropic,openai,search,e2b]
113
+ - name: Run other integration tests
114
+ run: |
115
+ pytest tests/integration/others/
@@ -7,7 +7,9 @@ on:
7
7
  schedule:
8
8
  - cron: "0 0 * * 0" # Every sunday at midnight
9
9
 
10
- permissions: read-all
10
+ permissions:
11
+ contents: write
12
+ pull-requests: write
11
13
 
12
14
  concurrency:
13
15
  group: ${{ github.ref }}-${{ github.workflow }}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-use
3
- Version: 1.3.6
3
+ Version: 1.3.8
4
4
  Summary: MCP Library for LLMs
5
5
  Author-email: Pietro Zullo <pietro.zullo@gmail.com>
6
6
  License: MIT
@@ -17,7 +17,7 @@ Requires-Python: >=3.11
17
17
  Requires-Dist: aiohttp>=3.9.0
18
18
  Requires-Dist: jsonschema-pydantic>=0.1.0
19
19
  Requires-Dist: langchain>=0.1.0
20
- Requires-Dist: mcp>=1.9.3
20
+ Requires-Dist: mcp>=1.10.0
21
21
  Requires-Dist: posthog>=4.8.0
22
22
  Requires-Dist: pydantic>=2.0.0
23
23
  Requires-Dist: python-dotenv>=1.0.0
@@ -28,7 +28,7 @@ Requires-Dist: langchain-anthropic; extra == 'anthropic'
28
28
  Provides-Extra: dev
29
29
  Requires-Dist: black>=23.9.0; extra == 'dev'
30
30
  Requires-Dist: fastapi; extra == 'dev'
31
- Requires-Dist: fastmcp==2.8.0; extra == 'dev'
31
+ Requires-Dist: fastmcp==2.10.5; extra == 'dev'
32
32
  Requires-Dist: isort>=5.12.0; extra == 'dev'
33
33
  Requires-Dist: mypy>=1.5.0; extra == 'dev'
34
34
  Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
@@ -84,12 +84,16 @@ Description-Content-Type: text/markdown
84
84
 
85
85
  💡 Let developers easily connect any LLM to tools like web browsing, file operations, and more.
86
86
 
87
- - Visit the [mcp-use.com website](https://mcp-use.com/) to know how to build and deploy MCP agents.
87
+ - If you want to get started quickly check out [mcp-use.com website](https://mcp-use.com/) to build and deploy agents with your favorite MCP servers.
88
88
  - Visit the [mcp-use docs](https://docs.mcp-use.com/) to get started with mcp-use library
89
+ - For the TypeScript version, visit [mcp-use-ts](https://github.com/mcp-use/mcp-use-ts)
89
90
 
90
- 💬 Get started quickly - chat with your servers on our <b>hosted version</b>! [Try mcp-use chat (beta)](https://chat.mcp-use.com).
91
+ | Supports | |
92
+ | :--- | :--- |
93
+ | **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) |
91
95
 
92
- # Features
96
+ ## Features
93
97
 
94
98
  <table>
95
99
  <tr>
@@ -807,45 +811,45 @@ Thanks to all our amazing contributors!
807
811
  <th width="400">Repository</th>
808
812
  <th>Stars</th>
809
813
  </tr>
814
+ <tr>
815
+ <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>
817
+ </tr>
810
818
  <tr>
811
819
  <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>
812
- <td>⭐ 112</td>
820
+ <td>⭐ 129</td>
821
+ </tr>
822
+ <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>
813
825
  </tr>
814
826
  <tr>
815
827
  <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>
816
- <td>⭐ 37</td>
828
+ <td>⭐ 58</td>
829
+ </tr>
830
+ <tr>
831
+ <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>
817
833
  </tr>
818
834
  <tr>
819
835
  <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>
820
- <td>⭐ 29</td>
836
+ <td>⭐ 30</td>
821
837
  </tr>
822
838
  <tr>
823
839
  <td><img src="https://avatars.githubusercontent.com/u/8344498?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/schogini/techietalksai"><strong>schogini/techietalksai</strong></a></td>
824
- <td>⭐ 21</td>
840
+ <td>⭐ 24</td>
825
841
  </tr>
826
842
  <tr>
827
843
  <td><img src="https://avatars.githubusercontent.com/u/201161342?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/autometa-dev/whatsapp-mcp-voice-agent"><strong>autometa-dev/whatsapp-mcp-voice-agent</strong></a></td>
828
- <td>⭐ 18</td>
844
+ <td>⭐ 22</td>
829
845
  </tr>
830
846
  <tr>
831
847
  <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>
832
- <td>⭐ 17</td>
833
- </tr>
834
- <tr>
835
- <td><img src="https://avatars.githubusercontent.com/u/6764390?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/elastic/genai-workshops"><strong>elastic/genai-workshops</strong></a></td>
836
- <td>⭐ 9</td>
848
+ <td>⭐ 18</td>
837
849
  </tr>
838
850
  <tr>
839
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>
840
- <td>⭐ 6</td>
841
- </tr>
842
- <tr>
843
- <td><img src="https://avatars.githubusercontent.com/u/205593730?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/Qingyon-AI/Revornix"><strong>Qingyon-AI/Revornix</strong></a></td>
844
- <td>⭐ 5</td>
845
- </tr>
846
- <tr>
847
- <td><img src="https://avatars.githubusercontent.com/u/68845761?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/entbappy/MCP-Tutorials"><strong>entbappy/MCP-Tutorials</strong></a></td>
848
- <td>⭐ 5</td>
852
+ <td>⭐ 15</td>
849
853
  </tr>
850
854
  </table>
851
855
 
@@ -39,12 +39,16 @@
39
39
 
40
40
  💡 Let developers easily connect any LLM to tools like web browsing, file operations, and more.
41
41
 
42
- - Visit the [mcp-use.com website](https://mcp-use.com/) to know how to build and deploy MCP agents.
42
+ - If you want to get started quickly check out [mcp-use.com website](https://mcp-use.com/) to build and deploy agents with your favorite MCP servers.
43
43
  - Visit the [mcp-use docs](https://docs.mcp-use.com/) to get started with mcp-use library
44
+ - For the TypeScript version, visit [mcp-use-ts](https://github.com/mcp-use/mcp-use-ts)
44
45
 
45
- 💬 Get started quickly - chat with your servers on our <b>hosted version</b>! [Try mcp-use chat (beta)](https://chat.mcp-use.com).
46
+ | Supports | |
47
+ | :--- | :--- |
48
+ | **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) |
46
50
 
47
- # Features
51
+ ## Features
48
52
 
49
53
  <table>
50
54
  <tr>
@@ -762,45 +766,45 @@ Thanks to all our amazing contributors!
762
766
  <th width="400">Repository</th>
763
767
  <th>Stars</th>
764
768
  </tr>
769
+ <tr>
770
+ <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>
772
+ </tr>
765
773
  <tr>
766
774
  <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>
767
- <td>⭐ 112</td>
775
+ <td>⭐ 129</td>
776
+ </tr>
777
+ <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>
768
780
  </tr>
769
781
  <tr>
770
782
  <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>
771
- <td>⭐ 37</td>
783
+ <td>⭐ 58</td>
784
+ </tr>
785
+ <tr>
786
+ <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>
772
788
  </tr>
773
789
  <tr>
774
790
  <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>
775
- <td>⭐ 29</td>
791
+ <td>⭐ 30</td>
776
792
  </tr>
777
793
  <tr>
778
794
  <td><img src="https://avatars.githubusercontent.com/u/8344498?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/schogini/techietalksai"><strong>schogini/techietalksai</strong></a></td>
779
- <td>⭐ 21</td>
795
+ <td>⭐ 24</td>
780
796
  </tr>
781
797
  <tr>
782
798
  <td><img src="https://avatars.githubusercontent.com/u/201161342?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/autometa-dev/whatsapp-mcp-voice-agent"><strong>autometa-dev/whatsapp-mcp-voice-agent</strong></a></td>
783
- <td>⭐ 18</td>
799
+ <td>⭐ 22</td>
784
800
  </tr>
785
801
  <tr>
786
802
  <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>
787
- <td>⭐ 17</td>
788
- </tr>
789
- <tr>
790
- <td><img src="https://avatars.githubusercontent.com/u/6764390?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/elastic/genai-workshops"><strong>elastic/genai-workshops</strong></a></td>
791
- <td>⭐ 9</td>
803
+ <td>⭐ 18</td>
792
804
  </tr>
793
805
  <tr>
794
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>
795
- <td>⭐ 6</td>
796
- </tr>
797
- <tr>
798
- <td><img src="https://avatars.githubusercontent.com/u/205593730?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/Qingyon-AI/Revornix"><strong>Qingyon-AI/Revornix</strong></a></td>
799
- <td>⭐ 5</td>
800
- </tr>
801
- <tr>
802
- <td><img src="https://avatars.githubusercontent.com/u/68845761?s=40&v=4" width="20" height="20" style="vertical-align: middle; margin-right: 8px;"> <a href="https://github.com/entbappy/MCP-Tutorials"><strong>entbappy/MCP-Tutorials</strong></a></td>
803
- <td>⭐ 5</td>
807
+ <td>⭐ 15</td>
804
808
  </tr>
805
809
  </table>
806
810
 
@@ -439,10 +439,10 @@ agent = MCPAgent(
439
439
  ## Next Steps
440
440
 
441
441
  <CardGroup cols={3}>
442
- <Card title="Server Manager" icon="server" href="/essentials/server-manager">
442
+ <Card title="Server Manager" icon="server" href="/agent/server-manager">
443
443
  Learn more about dynamic server selection and management
444
444
  </Card>
445
- <Card title="Security Guide" icon="shield" href="/guides/security">
445
+ <Card title="Security Guide" icon="shield" href="/advanced/security">
446
446
  Best practices for secure multi-server configurations
447
447
  </Card>
448
448
  <Card title="Performance" icon="zap" href="/troubleshooting/performance">
@@ -580,7 +580,7 @@ def secure_command_args(command: str, args: List[str]) -> List[str]:
580
580
  ## Next Steps
581
581
 
582
582
  <CardGroup cols={3}>
583
- <Card title="Configuration Guide" icon="gear" href="/essentials/configuration">
583
+ <Card title="Configuration Guide" icon="gear" href="/getting-started/configuration">
584
584
  Learn secure configuration practices for MCP servers
585
585
  </Card>
586
586
  <Card title="Deployment Guide" icon="rocket" href="/development">
@@ -7,7 +7,7 @@ icon: "brain"
7
7
  # Agent Configuration
8
8
 
9
9
  <Info>
10
- This guide covers MCPAgent configuration options for customizing agent behavior and LLM integration. For client configuration, see the [Client Configuration](/essentials/client-configuration) guide.
10
+ This guide covers MCPAgent configuration options for customizing agent behavior and LLM integration. For client configuration, see the [Client Configuration](/client/client-configuration) guide.
11
11
  </Info>
12
12
 
13
13
  ## API Keys
@@ -0,0 +1,215 @@
1
+ ---
2
+ title: 'Server Manager'
3
+ description: 'Intelligent management of multiple MCP servers and dynamic tool discovery'
4
+ icon: 'server-cog'
5
+ ---
6
+
7
+ # Server Manager: Dynamic Multi-Server Intelligence
8
+
9
+ The Server Manager is the brain behind intelligent MCP server orchestration. It transforms your agent from a static tool user into a dynamic, adaptive assistant that can discover, connect to, and intelligently utilize tools from multiple MCP servers on-demand.
10
+
11
+ ## 🎯 What Makes It Special
12
+
13
+ Instead of overwhelming your agent with hundreds of tools from all servers at once, the Server Manager:
14
+
15
+ - **Dynamically loads tools** only when needed, with full schemas
16
+ - **Intelligently discovers** the right server for each task
17
+ - **Automatically updates** available tools as connections change
18
+ - **Provides semantic search** across all server tools
19
+ - **Manages connection lifecycle** efficiently
20
+
21
+ ## 🏗️ Architecture Overview
22
+
23
+ ```mermaid
24
+ graph TB
25
+ Agent[MCPAgent] --> SM[ServerManager]
26
+ SM --> S1[Web Server]
27
+ SM --> S2[File Server]
28
+ SM --> S3[Database Server]
29
+
30
+ SM --> Tools[Dynamic Tools]
31
+ ```
32
+
33
+ ## 🔄 Dynamic Tool Loading Process
34
+
35
+ ```mermaid
36
+ sequenceDiagram
37
+ Agent->>ServerManager: Connect to server
38
+ ServerManager->>Server: Get tools
39
+ Server->>ServerManager: Return tools
40
+ ServerManager->>Agent: Tools now available
41
+ Agent->>Server: Use tools directly
42
+ ```
43
+
44
+ ## 🚀 Getting Started
45
+
46
+ Enable the Server Manager in your agent:
47
+
48
+ ```python
49
+ from mcp_use import MCPClient, MCPAgent
50
+ from langchain_openai import ChatOpenAI
51
+
52
+ # Create client with multiple servers
53
+ client = MCPClient.from_dict({
54
+ "mcpServers": {
55
+ "playwright": {
56
+ "command": "npx",
57
+ "args": ["@playwright/mcp@latest"]
58
+ },
59
+ "filesystem": {
60
+ "command": "uvx",
61
+ "args": ["mcp-server-filesystem", "/tmp"]
62
+ }
63
+ }
64
+ })
65
+
66
+ # 🎯 Enable Server Manager
67
+ agent = MCPAgent(
68
+ llm=ChatOpenAI(model="gpt-4"),
69
+ client=client,
70
+ use_server_manager=True # ✨ This is the magic switch!
71
+ )
72
+ ```
73
+
74
+ ## 🔍 Tool Discovery Flow
75
+
76
+
77
+
78
+
79
+ ## 🛠️ Management Tools Deep Dive
80
+
81
+ ### Core Server Management
82
+
83
+ | Tool | Purpose | Example |
84
+ |------|---------|---------|
85
+ | `list_mcp_servers` | Discovery of available servers and their tools | "What servers do I have access to?" |
86
+ | `connect_to_mcp_server` | Activate a server and load its tools | "Connect to the filesystem server" |
87
+ | `get_active_mcp_server` | Check current connection status | "Which server am I currently using?" |
88
+ | `disconnect_from_mcp_server` | Deactivate server and remove its tools | "Disconnect from current server" |
89
+ | `search_mcp_tools` | Semantic search across all server tools | "Find tools for image processing" |
90
+
91
+ ### Smart Tool Search Example
92
+
93
+ ```python
94
+ # Agent automatically discovers and uses the right tools
95
+ result = await agent.run("""
96
+ I need to:
97
+ 1. Find tools for web scraping
98
+ 2. Connect to the right server
99
+ 3. Scrape data from https://example.com
100
+ 4. Save it to a file
101
+
102
+ Start by searching for relevant tools.
103
+ """)
104
+ ```
105
+
106
+ **Agent Process:**
107
+ ```mermaid
108
+ graph LR
109
+ Search[Search Tools] --> Connect[Connect Server]
110
+ Connect --> Use[Use Tools]
111
+ ```
112
+
113
+ ## 🎭 Real-World Use Cases
114
+
115
+ ### 1. Multi-Server Data Pipeline
116
+
117
+ ```python
118
+ result = await agent.run("""
119
+ Create a data pipeline that:
120
+ 1. Scrapes product data from an e-commerce site
121
+ 2. Processes and cleans the data
122
+ 3. Saves it to a CSV file
123
+ 4. Loads it into a SQLite database
124
+
125
+ Figure out which servers and tools you need.
126
+ """)
127
+ ```
128
+
129
+ **Server Flow:**
130
+ ```
131
+ playwright → filesystem → database
132
+ ↓ ↓ ↓
133
+ scraping → save CSV → load data
134
+ ```
135
+
136
+ ### 2. Content Creation Workflow
137
+
138
+ ```python
139
+ result = await agent.run("""
140
+ I want to:
141
+ 1. Search for trending topics online
142
+ 2. Generate an image based on the topic
143
+ 3. Write a blog post about it
144
+ 4. Save everything to files
145
+
146
+ What tools do I need for this?
147
+ """)
148
+ ```
149
+
150
+ ## 🚀 Performance Benefits
151
+
152
+ The Server Manager provides focused tool access:
153
+
154
+ - **Without Server Manager**: All 100+ tools from all servers loaded at once, overwhelming the model
155
+ - **With Server Manager**: Only 5-15 relevant tools from the active server, providing clear focus
156
+
157
+ ## Core Features
158
+
159
+ The Server Manager provides these powerful capabilities:
160
+
161
+ - **🔗 Dynamic Tool Addition**: Server tools automatically added with full schemas
162
+ - **⚡ Real-time Updates**: Tool list updates immediately when connecting/disconnecting
163
+ - **🧹 Clean Architecture**: Direct tool access with proper schemas
164
+ - **🎯 Model Understanding**: Tools come with native schemas and validation
165
+ - **📊 Smart Logging**: Detailed insights into tool changes and server status
166
+
167
+ ## 🏁 Complete Example
168
+
169
+ ```python
170
+ import asyncio
171
+ from mcp_use import MCPClient, MCPAgent
172
+ from langchain_openai import ChatOpenAI
173
+
174
+ async def demo_server_manager():
175
+ # Multi-server configuration
176
+ client = MCPClient.from_dict({
177
+ "mcpServers": {
178
+ "web": {"command": "npx", "args": ["@playwright/mcp@latest"]},
179
+ "files": {"command": "uvx", "args": ["mcp-server-filesystem", "/tmp"]},
180
+ "database": {"command": "uvx", "args": ["mcp-server-sqlite"]}
181
+ }
182
+ })
183
+
184
+ # Agent with Server Manager
185
+ agent = MCPAgent(
186
+ llm=ChatOpenAI(model="gpt-4"),
187
+ client=client,
188
+ use_server_manager=True,
189
+ verbose=True # See the magic happen!
190
+ )
191
+
192
+ # Complex multi-server task
193
+ result = await agent.run("""
194
+ I need to build a complete data collection system:
195
+
196
+ 1. First, show me what servers and tools are available
197
+ 2. Scrape product information from https://example-store.com
198
+ 3. Clean and structure the data
199
+ 4. Save it as both JSON and CSV files
200
+ 5. Load the data into a SQLite database
201
+ 6. Generate a summary report
202
+
203
+ Guide me through each step and show me how you discover and use the right tools.
204
+ """)
205
+
206
+ print("🎉 Task completed!")
207
+ print(result)
208
+
209
+ await agent.close()
210
+
211
+ if __name__ == "__main__":
212
+ asyncio.run(demo_server_manager())
213
+ ```
214
+
215
+ The Server Manager transforms your MCP agent from a static tool user into an intelligent, adaptive assistant that can dynamically discover and utilize the perfect tools for any task! 🚀