mcp-use 1.3.4__tar.gz → 1.3.5__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.
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.github/release-drafter.yml +2 -2
- {mcp_use-1.3.4 → mcp_use-1.3.5}/PKG-INFO +1 -1
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/client.py +1 -3
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/connectors/base.py +16 -12
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/connectors/http.py +26 -1
- {mcp_use-1.3.4 → mcp_use-1.3.5}/pyproject.toml +1 -1
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/unit/test_client.py +3 -4
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/unit/test_http_connector.py +34 -4
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.env.example +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.github/pull_request_template.md +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.github/workflows/changelog.yml +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.github/workflows/claude.yml +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.github/workflows/publish.yml +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.github/workflows/release-drafter.yml +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.github/workflows/stale.yml +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.github/workflows/transportstests.yml +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.github/workflows/unittests.yml +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.github/workflows/update-readme.yml +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.gitignore +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/.pre-commit-config.yaml +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/CHANGELOG.md +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/CLAUDE.md +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/CODE_OF_CONDUCT.md +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/CONTRIBUTING.md +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/LICENSE +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/README.md +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/README.md +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/api-reference/adapters.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/api-reference/introduction.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/api-reference/mcpagent.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/api-reference/mcpclient.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/changelog.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/community/showcase.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/development/observability.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/development/telemetry.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/development.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/docs.json +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/essentials/agent-configuration.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/essentials/client-configuration.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/essentials/configuration.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/essentials/connection-types.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/essentials/llm-integration.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/essentials/server-manager.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/favicon.svg +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/fonts.css +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/guides/building-custom-agents.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/guides/logging.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/guides/multi-server-setup.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/guides/security.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/guides/streaming.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/01.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/02.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/configuration-dark.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/configuration-light.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/examples-dark.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/examples-light.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/hero-dark.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/hero-light.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/installation-dark.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/installation-light.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/quickstart-dark.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/images/quickstart-light.png +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/index.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/installation.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/logo/dark.svg +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/logo/light.svg +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/logo/react.svg +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/quickstart.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/snippets/snippet-intro.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/snippets/youtube-embed.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/troubleshooting/common-issues.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/troubleshooting/connection-errors.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/docs/troubleshooting/performance.mdx +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/airbnb_mcp.json +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/airbnb_use.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/blender_use.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/browser_mcp.json +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/browser_use.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/chat_example.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/filesystem_use.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/http_example.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/mcp_everything.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/multi_server_example.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/sandbox_everything.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/examples/stream_example.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/adapters/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/adapters/base.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/adapters/langchain_adapter.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/agents/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/agents/base.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/agents/mcpagent.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/agents/prompts/system_prompt_builder.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/agents/prompts/templates.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/config.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/connectors/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/connectors/sandbox.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/connectors/stdio.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/connectors/utils.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/connectors/websocket.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/logging.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/managers/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/managers/server_manager.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/managers/tools/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/managers/tools/base_tool.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/managers/tools/connect_server.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/managers/tools/disconnect_server.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/managers/tools/get_active_server.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/managers/tools/list_servers_tool.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/managers/tools/search_tools.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/managers/tools/use_tool.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/observability/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/observability/laminar.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/observability/langfuse.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/session.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/task_managers/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/task_managers/base.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/task_managers/sse.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/task_managers/stdio.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/task_managers/streamable_http.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/task_managers/websocket.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/telemetry/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/telemetry/events.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/telemetry/telemetry.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/telemetry/utils.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/types/sandbox.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/mcp_use/utils.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/pytest.ini +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/ruff.toml +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/static/logo_black.svg +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/static/logo_white.svg +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/conftest.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/servers_for_testing/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/servers_for_testing/custom_streaming_server.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/servers_for_testing/simple_server.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/servers_for_testing/timeout_test_server.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/transports/customStreaming/__init__.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/transports/customStreaming/test_custom_streaming_integration.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/transports/sse/test_connection_state_tracking.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/transports/sse/test_sse_integration.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/transports/stdio/test_stdio_integration.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/transports/streamableHttp/test_streamable_http_integration.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/unit/test_config.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/unit/test_logging.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/unit/test_sandbox_connector.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/unit/test_search_tools_issue_138.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/unit/test_session.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/unit/test_stdio_connector.py +0 -0
- {mcp_use-1.3.4 → mcp_use-1.3.5}/tests/unit/test_websocket_connection_manager.py +0 -0
|
@@ -189,9 +189,7 @@ class MCPClient:
|
|
|
189
189
|
|
|
190
190
|
# Create sessions for all servers
|
|
191
191
|
for name in servers:
|
|
192
|
-
|
|
193
|
-
if auto_initialize:
|
|
194
|
-
await session.initialize()
|
|
192
|
+
await self.create_session(name, auto_initialize)
|
|
195
193
|
|
|
196
194
|
return self.sessions
|
|
197
195
|
|
|
@@ -31,6 +31,7 @@ class BaseConnector(ABC):
|
|
|
31
31
|
self._resources: list[Resource] | None = None
|
|
32
32
|
self._prompts: list[Prompt] | None = None
|
|
33
33
|
self._connected = False
|
|
34
|
+
self._initialized = False # Track if client_session.initialize() has been called
|
|
34
35
|
self.auto_reconnect = True # Whether to automatically reconnect on connection loss (not configurable for now)
|
|
35
36
|
|
|
36
37
|
@abstractmethod
|
|
@@ -87,6 +88,7 @@ class BaseConnector(ABC):
|
|
|
87
88
|
self._tools = None
|
|
88
89
|
self._resources = None
|
|
89
90
|
self._prompts = None
|
|
91
|
+
self._initialized = False # Reset initialization flag
|
|
90
92
|
|
|
91
93
|
if errors:
|
|
92
94
|
logger.warning(f"Encountered {len(errors)} errors during resource cleanup")
|
|
@@ -96,38 +98,40 @@ class BaseConnector(ABC):
|
|
|
96
98
|
if not self.client_session:
|
|
97
99
|
raise RuntimeError("MCP client is not connected")
|
|
98
100
|
|
|
99
|
-
|
|
101
|
+
# Check if already initialized
|
|
102
|
+
if self._initialized:
|
|
103
|
+
return {"status": "already_initialized"}
|
|
100
104
|
|
|
101
105
|
# Initialize the session
|
|
102
106
|
result = await self.client_session.initialize()
|
|
107
|
+
self._initialized = True # Mark as initialized
|
|
103
108
|
|
|
104
109
|
server_capabilities = result.capabilities
|
|
105
110
|
|
|
106
111
|
if server_capabilities.tools:
|
|
107
|
-
# Get available tools
|
|
108
|
-
tools_result = await self.list_tools()
|
|
109
|
-
self._tools = tools_result
|
|
112
|
+
# Get available tools directly from client session
|
|
113
|
+
tools_result = await self.client_session.list_tools()
|
|
114
|
+
self._tools = tools_result.tools if tools_result else []
|
|
110
115
|
else:
|
|
111
116
|
self._tools = []
|
|
112
117
|
|
|
113
118
|
if server_capabilities.resources:
|
|
114
|
-
# Get available resources
|
|
115
|
-
resources_result = await self.list_resources()
|
|
116
|
-
self._resources = resources_result
|
|
119
|
+
# Get available resources directly from client session
|
|
120
|
+
resources_result = await self.client_session.list_resources()
|
|
121
|
+
self._resources = resources_result.resources if resources_result else []
|
|
117
122
|
else:
|
|
118
123
|
self._resources = []
|
|
119
124
|
|
|
120
125
|
if server_capabilities.prompts:
|
|
121
|
-
# Get available prompts
|
|
122
|
-
prompts_result = await self.list_prompts()
|
|
123
|
-
self._prompts = prompts_result
|
|
126
|
+
# Get available prompts directly from client session
|
|
127
|
+
prompts_result = await self.client_session.list_prompts()
|
|
128
|
+
self._prompts = prompts_result.prompts if prompts_result else []
|
|
124
129
|
else:
|
|
125
130
|
self._prompts = []
|
|
126
131
|
|
|
127
132
|
logger.debug(
|
|
128
133
|
f"MCP session initialized with {len(self._tools)} tools, "
|
|
129
|
-
|
|
130
|
-
f"and {len(self._prompts)} prompts"
|
|
134
|
+
"{len(self._resources)} resources, and {len(self._prompts)} prompts"
|
|
131
135
|
)
|
|
132
136
|
|
|
133
137
|
return result
|
|
@@ -81,12 +81,37 @@ class HttpConnector(BaseConnector):
|
|
|
81
81
|
|
|
82
82
|
try:
|
|
83
83
|
# Try to initialize - this is where streamable HTTP vs SSE difference should show up
|
|
84
|
-
await test_client.initialize()
|
|
84
|
+
result = await test_client.initialize()
|
|
85
85
|
|
|
86
86
|
# If we get here, streamable HTTP works
|
|
87
87
|
|
|
88
88
|
self.client_session = test_client
|
|
89
89
|
self.transport_type = "streamable HTTP"
|
|
90
|
+
self._initialized = True # Mark as initialized since we just called initialize()
|
|
91
|
+
|
|
92
|
+
# Populate tools, resources, and prompts since we've initialized
|
|
93
|
+
server_capabilities = result.capabilities
|
|
94
|
+
|
|
95
|
+
if server_capabilities.tools:
|
|
96
|
+
# Get available tools directly from client session
|
|
97
|
+
tools_result = await self.client_session.list_tools()
|
|
98
|
+
self._tools = tools_result.tools if tools_result else []
|
|
99
|
+
else:
|
|
100
|
+
self._tools = []
|
|
101
|
+
|
|
102
|
+
if server_capabilities.resources:
|
|
103
|
+
# Get available resources directly from client session
|
|
104
|
+
resources_result = await self.client_session.list_resources()
|
|
105
|
+
self._resources = resources_result.resources if resources_result else []
|
|
106
|
+
else:
|
|
107
|
+
self._resources = []
|
|
108
|
+
|
|
109
|
+
if server_capabilities.prompts:
|
|
110
|
+
# Get available prompts directly from client session
|
|
111
|
+
prompts_result = await self.client_session.list_prompts()
|
|
112
|
+
self._prompts = prompts_result.prompts if prompts_result else []
|
|
113
|
+
else:
|
|
114
|
+
self._prompts = []
|
|
90
115
|
|
|
91
116
|
except Exception as init_error:
|
|
92
117
|
# Clean up the test client
|
|
@@ -456,10 +456,9 @@ class TestMCPClientSessionManagement:
|
|
|
456
456
|
assert mock_create_connector.call_count == 2
|
|
457
457
|
assert mock_session_class.call_count == 2
|
|
458
458
|
|
|
459
|
-
#
|
|
460
|
-
|
|
461
|
-
assert
|
|
462
|
-
assert mock_session2.initialize.call_count == 2
|
|
459
|
+
# Initialize is called once per session during create_session
|
|
460
|
+
assert mock_session1.initialize.call_count == 1
|
|
461
|
+
assert mock_session2.initialize.call_count == 1
|
|
463
462
|
|
|
464
463
|
# Verify state changes
|
|
465
464
|
assert len(client.sessions) == 2
|
|
@@ -128,7 +128,17 @@ class TestHttpConnectorConnection(IsolatedAsyncioTestCase):
|
|
|
128
128
|
mock_instance.initialize.side_effect = McpError(ErrorData(code=1, message="Connection closed"))
|
|
129
129
|
else:
|
|
130
130
|
# Second call (SSE) - succeeds
|
|
131
|
-
|
|
131
|
+
mock_init_result = MagicMock()
|
|
132
|
+
mock_init_result.capabilities = MagicMock(tools=True, resources=True, prompts=True)
|
|
133
|
+
mock_instance.initialize.return_value = mock_init_result
|
|
134
|
+
|
|
135
|
+
# Add mocks for list_tools, list_resources, and list_prompts since HttpConnector calls these
|
|
136
|
+
mock_instance.list_tools = AsyncMock()
|
|
137
|
+
mock_instance.list_tools.return_value = MagicMock(tools=[MagicMock(spec=Tool)])
|
|
138
|
+
mock_instance.list_resources = AsyncMock()
|
|
139
|
+
mock_instance.list_resources.return_value = MagicMock(resources=[MagicMock(spec=Resource)])
|
|
140
|
+
mock_instance.list_prompts = AsyncMock()
|
|
141
|
+
mock_instance.list_prompts.return_value = MagicMock(prompts=[MagicMock(spec=Prompt)])
|
|
132
142
|
|
|
133
143
|
return mock_instance
|
|
134
144
|
|
|
@@ -163,7 +173,18 @@ class TestHttpConnectorConnection(IsolatedAsyncioTestCase):
|
|
|
163
173
|
mock_client_session_instance = MagicMock()
|
|
164
174
|
mock_client_session_instance.__aenter__ = AsyncMock()
|
|
165
175
|
mock_client_session_instance.initialize = AsyncMock()
|
|
166
|
-
|
|
176
|
+
mock_init_result = MagicMock()
|
|
177
|
+
mock_init_result.capabilities = MagicMock(tools=True, resources=True, prompts=True)
|
|
178
|
+
mock_client_session_instance.initialize.return_value = mock_init_result
|
|
179
|
+
|
|
180
|
+
# Add mocks for list_tools, list_resources, and list_prompts since HttpConnector calls these
|
|
181
|
+
mock_client_session_instance.list_tools = AsyncMock()
|
|
182
|
+
mock_client_session_instance.list_tools.return_value = MagicMock(tools=[MagicMock(spec=Tool)])
|
|
183
|
+
mock_client_session_instance.list_resources = AsyncMock()
|
|
184
|
+
mock_client_session_instance.list_resources.return_value = MagicMock(resources=[MagicMock(spec=Resource)])
|
|
185
|
+
mock_client_session_instance.list_prompts = AsyncMock()
|
|
186
|
+
mock_client_session_instance.list_prompts.return_value = MagicMock(prompts=[MagicMock(spec=Prompt)])
|
|
187
|
+
|
|
167
188
|
mock_client_session_class.return_value = mock_client_session_instance
|
|
168
189
|
|
|
169
190
|
# Test connect with streamable HTTP
|
|
@@ -178,10 +199,19 @@ class TestHttpConnectorConnection(IsolatedAsyncioTestCase):
|
|
|
178
199
|
mock_client_session_instance.__aenter__.assert_called_once()
|
|
179
200
|
mock_client_session_instance.initialize.assert_called_once()
|
|
180
201
|
|
|
202
|
+
# Verify tools/resources/prompts were populated during connect
|
|
203
|
+
mock_client_session_instance.list_tools.assert_called_once()
|
|
204
|
+
mock_client_session_instance.list_resources.assert_called_once()
|
|
205
|
+
mock_client_session_instance.list_prompts.assert_called_once()
|
|
206
|
+
|
|
181
207
|
# Verify final state
|
|
182
208
|
self.assertEqual(self.connector.client_session, mock_client_session_instance)
|
|
183
209
|
self.assertEqual(self.connector._connection_manager, mock_cm_instance)
|
|
184
210
|
self.assertTrue(self.connector._connected)
|
|
211
|
+
self.assertTrue(self.connector._initialized)
|
|
212
|
+
self.assertEqual(len(self.connector._tools), 1)
|
|
213
|
+
self.assertEqual(len(self.connector._resources), 1)
|
|
214
|
+
self.assertEqual(len(self.connector._prompts), 1)
|
|
185
215
|
|
|
186
216
|
@patch("mcp_use.connectors.http.StreamableHttpConnectionManager")
|
|
187
217
|
async def test_sse_connect_already_connected(self, mock_cm_class, _):
|
|
@@ -300,7 +330,7 @@ class TestHttpConnectorOperations(IsolatedAsyncioTestCase):
|
|
|
300
330
|
mock_init_result.capabilities = MagicMock(tools=True, resources=True, prompts=True)
|
|
301
331
|
self.connector.client_session.initialize.return_value = mock_init_result
|
|
302
332
|
|
|
303
|
-
# Setup mocks for
|
|
333
|
+
# Setup mocks for client session methods directly (not connector wrapper methods)
|
|
304
334
|
self.connector.client_session.list_tools.return_value = MagicMock(tools=[MagicMock(spec=Tool)])
|
|
305
335
|
self.connector.client_session.list_resources.return_value = MagicMock(resources=[MagicMock(spec=Resource)])
|
|
306
336
|
self.connector.client_session.list_prompts.return_value = MagicMock(prompts=[MagicMock(spec=Prompt)])
|
|
@@ -308,7 +338,7 @@ class TestHttpConnectorOperations(IsolatedAsyncioTestCase):
|
|
|
308
338
|
# Initialize
|
|
309
339
|
result_session_info = await self.connector.initialize()
|
|
310
340
|
|
|
311
|
-
# Verify calls
|
|
341
|
+
# Verify calls to client session methods directly
|
|
312
342
|
self.connector.client_session.initialize.assert_called_once()
|
|
313
343
|
self.connector.client_session.list_tools.assert_called_once()
|
|
314
344
|
self.connector.client_session.list_resources.assert_called_once()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/servers_for_testing/custom_streaming_server.py
RENAMED
|
File without changes
|
|
File without changes
|
{mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/servers_for_testing/timeout_test_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/transports/sse/test_connection_state_tracking.py
RENAMED
|
File without changes
|
|
File without changes
|
{mcp_use-1.3.4 → mcp_use-1.3.5}/tests/integration/transports/stdio/test_stdio_integration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|