mcp-use 1.1.4__tar.gz → 1.1.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.1.4 → mcp_use-1.1.5}/PKG-INFO +1 -2
- {mcp_use-1.1.4 → mcp_use-1.1.5}/README.md +0 -1
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/agents/langchain_agent.py +3 -3
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/agents/mcpagent.py +7 -7
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/client.py +3 -3
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/connectors/base.py +5 -4
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/connectors/http.py +2 -2
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/connectors/stdio.py +2 -2
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/connectors/websocket.py +6 -6
- {mcp_use-1.1.4 → mcp_use-1.1.5}/pyproject.toml +1 -1
- {mcp_use-1.1.4 → mcp_use-1.1.5}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/.github/workflows/publish.yml +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/.github/workflows/tests.yml +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/.gitignore +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/.pre-commit-config.yaml +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/LICENSE +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/README.md +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/api-reference/introduction.mdx +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/development.mdx +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/docs.json +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/essentials/configuration.mdx +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/essentials/connection-types.mdx +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/essentials/llm-integration.mdx +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/favicon.svg +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/images/hero-dark.png +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/images/hero-light.png +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/introduction.mdx +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/logo/dark.svg +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/logo/light.svg +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/quickstart.mdx +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/docs/snippets/snippet-intro.mdx +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/examples/airbnb_mcp.json +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/examples/airbnb_use.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/examples/blender_use.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/examples/browser_mcp.json +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/examples/browser_use.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/examples/chat_example.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/examples/filesystem_use.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/examples/http_example.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/examples/multi_server_example.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/__init__.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/agents/__init__.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/agents/base.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/agents/prompts/default.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/config.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/connectors/__init__.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/logging.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/session.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/task_managers/__init__.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/task_managers/base.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/task_managers/sse.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/task_managers/stdio.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/mcp_use/task_managers/websocket.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/pytest.ini +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/static/image.jpg +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/tests/conftest.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/tests/unit/test_client.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/tests/unit/test_config.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/tests/unit/test_http_connector.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/tests/unit/test_logging.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/tests/unit/test_session.py +0 -0
- {mcp_use-1.1.4 → mcp_use-1.1.5}/tests/unit/test_stdio_connector.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mcp-use
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.5
|
|
4
4
|
Summary: MCP Library for LLMs
|
|
5
5
|
Author-email: Pietro Zullo <pietro.zullo@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -179,7 +179,6 @@ Example configuration file (`browser_mcp.json`):
|
|
|
179
179
|
|
|
180
180
|
For other settings, models, and more, check out the documentation.
|
|
181
181
|
|
|
182
|
-
# Features
|
|
183
182
|
|
|
184
183
|
# Example Use Cases
|
|
185
184
|
|
|
@@ -112,7 +112,7 @@ class LangChainAgent:
|
|
|
112
112
|
# Recreate the agent with the new system message if it exists
|
|
113
113
|
if self.agent and self.tools:
|
|
114
114
|
self.agent = self._create_agent()
|
|
115
|
-
logger.
|
|
115
|
+
logger.debug("Agent recreated with new system message")
|
|
116
116
|
|
|
117
117
|
async def initialize(self) -> None:
|
|
118
118
|
"""Initialize the agent and its tools."""
|
|
@@ -181,7 +181,7 @@ class LangChainAgent:
|
|
|
181
181
|
Raises:
|
|
182
182
|
ToolException: If tool execution fails.
|
|
183
183
|
"""
|
|
184
|
-
logger.
|
|
184
|
+
logger.debug(f'MCP tool: "{self.name}" received input: {kwargs}')
|
|
185
185
|
|
|
186
186
|
try:
|
|
187
187
|
tool_result: CallToolResult = await self.connector.call_tool(
|
|
@@ -207,7 +207,7 @@ class LangChainAgent:
|
|
|
207
207
|
tools.append(McpToLangChainAdapter())
|
|
208
208
|
|
|
209
209
|
# Log available tools for debugging
|
|
210
|
-
logger.
|
|
210
|
+
logger.debug(f"Available tools: {[tool.name for tool in tools]}")
|
|
211
211
|
return tools
|
|
212
212
|
|
|
213
213
|
def _create_agent(self) -> AgentExecutor:
|
|
@@ -209,7 +209,7 @@ class MCPAgent:
|
|
|
209
209
|
# If the agent is already initialized, we need to reinitialize it
|
|
210
210
|
# to apply the changes to the available tools
|
|
211
211
|
if self._initialized:
|
|
212
|
-
logger.
|
|
212
|
+
logger.debug(
|
|
213
213
|
"Agent already initialized. Changes will take effect on next initialization."
|
|
214
214
|
)
|
|
215
215
|
# We don't automatically reinitialize here as it could be disruptive
|
|
@@ -254,11 +254,11 @@ class MCPAgent:
|
|
|
254
254
|
try:
|
|
255
255
|
# Initialize if needed
|
|
256
256
|
if manage_connector and (not self._initialized or not self._agent):
|
|
257
|
-
logger.
|
|
257
|
+
logger.debug("Initializing agent before running query")
|
|
258
258
|
await self.initialize()
|
|
259
259
|
initialized_here = True
|
|
260
260
|
elif not self._initialized and self.auto_initialize:
|
|
261
|
-
logger.
|
|
261
|
+
logger.debug("Auto-initializing agent before running query")
|
|
262
262
|
await self.initialize()
|
|
263
263
|
initialized_here = True
|
|
264
264
|
|
|
@@ -289,7 +289,7 @@ class MCPAgent:
|
|
|
289
289
|
# Other message types can be handled here if needed
|
|
290
290
|
|
|
291
291
|
# Run the query with the specified max_steps or default
|
|
292
|
-
logger.
|
|
292
|
+
logger.debug(f"Running query with max_steps={max_steps or self.max_steps}")
|
|
293
293
|
result = await self._agent.run(
|
|
294
294
|
query=query,
|
|
295
295
|
max_steps=max_steps,
|
|
@@ -307,7 +307,7 @@ class MCPAgent:
|
|
|
307
307
|
# If we initialized in this method and there was an error,
|
|
308
308
|
# make sure to clean up
|
|
309
309
|
if initialized_here and manage_connector:
|
|
310
|
-
logger.
|
|
310
|
+
logger.debug("Cleaning up resources after initialization error")
|
|
311
311
|
await self.close()
|
|
312
312
|
raise
|
|
313
313
|
|
|
@@ -315,7 +315,7 @@ class MCPAgent:
|
|
|
315
315
|
# Clean up resources if we're managing the connector and
|
|
316
316
|
# we're not using a client that manages sessions
|
|
317
317
|
if manage_connector and not self.client and not initialized_here:
|
|
318
|
-
logger.
|
|
318
|
+
logger.debug("Closing agent after query completion")
|
|
319
319
|
await self.close()
|
|
320
320
|
|
|
321
321
|
async def close(self) -> None:
|
|
@@ -338,7 +338,7 @@ class MCPAgent:
|
|
|
338
338
|
await connector.disconnect()
|
|
339
339
|
|
|
340
340
|
self._initialized = False
|
|
341
|
-
logger.
|
|
341
|
+
logger.debug("Agent closed successfully")
|
|
342
342
|
|
|
343
343
|
except Exception as e:
|
|
344
344
|
logger.error(f"Error during agent closure: {e}")
|
|
@@ -214,7 +214,7 @@ class MCPClient:
|
|
|
214
214
|
|
|
215
215
|
try:
|
|
216
216
|
# Disconnect from the session
|
|
217
|
-
logger.
|
|
217
|
+
logger.debug(f"Closing session for server '{server_name}'")
|
|
218
218
|
await session.disconnect()
|
|
219
219
|
except Exception as e:
|
|
220
220
|
logger.error(f"Error closing session for server '{server_name}': {e}")
|
|
@@ -237,7 +237,7 @@ class MCPClient:
|
|
|
237
237
|
|
|
238
238
|
for server_name in server_names:
|
|
239
239
|
try:
|
|
240
|
-
logger.
|
|
240
|
+
logger.debug(f"Closing session for server '{server_name}'")
|
|
241
241
|
await self.close_session(server_name)
|
|
242
242
|
except Exception as e:
|
|
243
243
|
error_msg = f"Failed to close session for server '{server_name}': {e}"
|
|
@@ -248,4 +248,4 @@ class MCPClient:
|
|
|
248
248
|
if errors:
|
|
249
249
|
logger.error(f"Encountered {len(errors)} errors while closing sessions")
|
|
250
250
|
else:
|
|
251
|
-
logger.
|
|
251
|
+
logger.debug("All sessions closed successfully")
|
|
@@ -39,10 +39,10 @@ class BaseConnector(ABC):
|
|
|
39
39
|
logger.debug("Not connected to MCP implementation")
|
|
40
40
|
return
|
|
41
41
|
|
|
42
|
-
logger.
|
|
42
|
+
logger.debug("Disconnecting from MCP implementation")
|
|
43
43
|
await self._cleanup_resources()
|
|
44
44
|
self._connected = False
|
|
45
|
-
logger.
|
|
45
|
+
logger.debug("Disconnected from MCP implementation")
|
|
46
46
|
|
|
47
47
|
async def _cleanup_resources(self) -> None:
|
|
48
48
|
"""Clean up all resources associated with this connector."""
|
|
@@ -83,7 +83,7 @@ class BaseConnector(ABC):
|
|
|
83
83
|
if not self.client:
|
|
84
84
|
raise RuntimeError("MCP client is not connected")
|
|
85
85
|
|
|
86
|
-
logger.
|
|
86
|
+
logger.debug("Initializing MCP session")
|
|
87
87
|
|
|
88
88
|
# Initialize the session
|
|
89
89
|
result = await self.client.initialize()
|
|
@@ -92,7 +92,7 @@ class BaseConnector(ABC):
|
|
|
92
92
|
tools_result = await self.client.list_tools()
|
|
93
93
|
self._tools = tools_result.tools
|
|
94
94
|
|
|
95
|
-
logger.
|
|
95
|
+
logger.debug(f"MCP session initialized with {len(self._tools)} tools")
|
|
96
96
|
|
|
97
97
|
return result
|
|
98
98
|
|
|
@@ -110,6 +110,7 @@ class BaseConnector(ABC):
|
|
|
110
110
|
|
|
111
111
|
logger.debug(f"Calling tool '{name}' with arguments: {arguments}")
|
|
112
112
|
result = await self.client.call_tool(name, arguments)
|
|
113
|
+
logger.debug(f"Tool '{name}' called with result: {result}")
|
|
113
114
|
return result
|
|
114
115
|
|
|
115
116
|
async def list_resources(self) -> list[dict[str, Any]]:
|
|
@@ -51,7 +51,7 @@ class HttpConnector(BaseConnector):
|
|
|
51
51
|
logger.debug("Already connected to MCP implementation")
|
|
52
52
|
return
|
|
53
53
|
|
|
54
|
-
logger.
|
|
54
|
+
logger.debug(f"Connecting to MCP implementation via HTTP/SSE: {self.base_url}")
|
|
55
55
|
try:
|
|
56
56
|
# Create the SSE connection URL
|
|
57
57
|
sse_url = f"{self.base_url}"
|
|
@@ -68,7 +68,7 @@ class HttpConnector(BaseConnector):
|
|
|
68
68
|
|
|
69
69
|
# Mark as connected
|
|
70
70
|
self._connected = True
|
|
71
|
-
logger.
|
|
71
|
+
logger.debug(
|
|
72
72
|
f"Successfully connected to MCP implementation via HTTP/SSE: {self.base_url}"
|
|
73
73
|
)
|
|
74
74
|
|
|
@@ -49,7 +49,7 @@ class StdioConnector(BaseConnector):
|
|
|
49
49
|
logger.debug("Already connected to MCP implementation")
|
|
50
50
|
return
|
|
51
51
|
|
|
52
|
-
logger.
|
|
52
|
+
logger.debug(f"Connecting to MCP implementation: {self.command}")
|
|
53
53
|
try:
|
|
54
54
|
# Create server parameters
|
|
55
55
|
server_params = StdioServerParameters(
|
|
@@ -66,7 +66,7 @@ class StdioConnector(BaseConnector):
|
|
|
66
66
|
|
|
67
67
|
# Mark as connected
|
|
68
68
|
self._connected = True
|
|
69
|
-
logger.
|
|
69
|
+
logger.debug(f"Successfully connected to MCP implementation: {self.command}")
|
|
70
70
|
|
|
71
71
|
except Exception as e:
|
|
72
72
|
logger.error(f"Failed to connect to MCP implementation: {e}")
|
|
@@ -57,7 +57,7 @@ class WebSocketConnector(BaseConnector):
|
|
|
57
57
|
logger.debug("Already connected to MCP implementation")
|
|
58
58
|
return
|
|
59
59
|
|
|
60
|
-
logger.
|
|
60
|
+
logger.debug(f"Connecting to MCP implementation via WebSocket: {self.url}")
|
|
61
61
|
try:
|
|
62
62
|
# Create and start the connection manager
|
|
63
63
|
self._connection_manager = WebSocketConnectionManager(self.url, self.headers)
|
|
@@ -70,7 +70,7 @@ class WebSocketConnector(BaseConnector):
|
|
|
70
70
|
|
|
71
71
|
# Mark as connected
|
|
72
72
|
self._connected = True
|
|
73
|
-
logger.
|
|
73
|
+
logger.debug(f"Successfully connected to MCP implementation via WebSocket: {self.url}")
|
|
74
74
|
|
|
75
75
|
except Exception as e:
|
|
76
76
|
logger.error(f"Failed to connect to MCP implementation via WebSocket: {e}")
|
|
@@ -117,10 +117,10 @@ class WebSocketConnector(BaseConnector):
|
|
|
117
117
|
logger.debug("Not connected to MCP implementation")
|
|
118
118
|
return
|
|
119
119
|
|
|
120
|
-
logger.
|
|
120
|
+
logger.debug("Disconnecting from MCP implementation")
|
|
121
121
|
await self._cleanup_resources()
|
|
122
122
|
self._connected = False
|
|
123
|
-
logger.
|
|
123
|
+
logger.debug("Disconnected from MCP implementation")
|
|
124
124
|
|
|
125
125
|
async def _cleanup_resources(self) -> None:
|
|
126
126
|
"""Clean up all resources associated with this connector."""
|
|
@@ -199,14 +199,14 @@ class WebSocketConnector(BaseConnector):
|
|
|
199
199
|
|
|
200
200
|
async def initialize(self) -> dict[str, Any]:
|
|
201
201
|
"""Initialize the MCP session and return session information."""
|
|
202
|
-
logger.
|
|
202
|
+
logger.debug("Initializing MCP session")
|
|
203
203
|
result = await self._send_request("initialize")
|
|
204
204
|
|
|
205
205
|
# Get available tools
|
|
206
206
|
tools_result = await self.list_tools()
|
|
207
207
|
self._tools = [Tool(**tool) for tool in tools_result]
|
|
208
208
|
|
|
209
|
-
logger.
|
|
209
|
+
logger.debug(f"MCP session initialized with {len(self._tools)} tools")
|
|
210
210
|
return result
|
|
211
211
|
|
|
212
212
|
async def list_tools(self) -> list[dict[str, Any]]:
|
|
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
|