mcp-use 1.3.5__py3-none-any.whl → 1.3.7__py3-none-any.whl
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/agents/mcpagent.py +4 -0
- mcp_use/client.py +38 -5
- mcp_use/config.py +11 -1
- mcp_use/connectors/base.py +46 -11
- mcp_use/connectors/http.py +21 -12
- mcp_use/connectors/sandbox.py +13 -2
- mcp_use/connectors/stdio.py +13 -2
- {mcp_use-1.3.5.dist-info → mcp_use-1.3.7.dist-info}/METADATA +8 -3
- {mcp_use-1.3.5.dist-info → mcp_use-1.3.7.dist-info}/RECORD +11 -11
- {mcp_use-1.3.5.dist-info → mcp_use-1.3.7.dist-info}/WHEEL +0 -0
- {mcp_use-1.3.5.dist-info → mcp_use-1.3.7.dist-info}/licenses/LICENSE +0 -0
mcp_use/agents/mcpagent.py
CHANGED
|
@@ -589,6 +589,10 @@ class MCPAgent:
|
|
|
589
589
|
success = True
|
|
590
590
|
start_time = time.time()
|
|
591
591
|
generator = self.stream(query, max_steps, manage_connector, external_history, track_execution=False)
|
|
592
|
+
error = None
|
|
593
|
+
steps_taken = 0
|
|
594
|
+
tools_used_names = []
|
|
595
|
+
result = None
|
|
592
596
|
try:
|
|
593
597
|
result, steps_taken, tools_used_names = await self._consume_and_return(generator)
|
|
594
598
|
except Exception as e:
|
mcp_use/client.py
CHANGED
|
@@ -9,6 +9,8 @@ import json
|
|
|
9
9
|
import warnings
|
|
10
10
|
from typing import Any
|
|
11
11
|
|
|
12
|
+
from mcp.client.session import ElicitationFnT, SamplingFnT
|
|
13
|
+
|
|
12
14
|
from mcp_use.types.sandbox import SandboxOptions
|
|
13
15
|
|
|
14
16
|
from .config import create_connector_from_config, load_config_file
|
|
@@ -28,6 +30,8 @@ class MCPClient:
|
|
|
28
30
|
config: str | dict[str, Any] | None = None,
|
|
29
31
|
sandbox: bool = False,
|
|
30
32
|
sandbox_options: SandboxOptions | None = None,
|
|
33
|
+
sampling_callback: SamplingFnT | None = None,
|
|
34
|
+
elicitation_callback: ElicitationFnT | None = None,
|
|
31
35
|
) -> None:
|
|
32
36
|
"""Initialize a new MCP client.
|
|
33
37
|
|
|
@@ -36,13 +40,15 @@ class MCPClient:
|
|
|
36
40
|
If None, an empty configuration is used.
|
|
37
41
|
sandbox: Whether to use sandboxed execution mode for running MCP servers.
|
|
38
42
|
sandbox_options: Optional sandbox configuration options.
|
|
43
|
+
sampling_callback: Optional sampling callback function.
|
|
39
44
|
"""
|
|
40
45
|
self.config: dict[str, Any] = {}
|
|
41
46
|
self.sandbox = sandbox
|
|
42
47
|
self.sandbox_options = sandbox_options
|
|
43
48
|
self.sessions: dict[str, MCPSession] = {}
|
|
44
49
|
self.active_sessions: list[str] = []
|
|
45
|
-
|
|
50
|
+
self.sampling_callback = sampling_callback
|
|
51
|
+
self.elicitation_callback = elicitation_callback
|
|
46
52
|
# Load configuration if provided
|
|
47
53
|
if config is not None:
|
|
48
54
|
if isinstance(config, str):
|
|
@@ -56,6 +62,8 @@ class MCPClient:
|
|
|
56
62
|
config: dict[str, Any],
|
|
57
63
|
sandbox: bool = False,
|
|
58
64
|
sandbox_options: SandboxOptions | None = None,
|
|
65
|
+
sampling_callback: SamplingFnT | None = None,
|
|
66
|
+
elicitation_callback: ElicitationFnT | None = None,
|
|
59
67
|
) -> "MCPClient":
|
|
60
68
|
"""Create a MCPClient from a dictionary.
|
|
61
69
|
|
|
@@ -63,12 +71,25 @@ class MCPClient:
|
|
|
63
71
|
config: The configuration dictionary.
|
|
64
72
|
sandbox: Whether to use sandboxed execution mode for running MCP servers.
|
|
65
73
|
sandbox_options: Optional sandbox configuration options.
|
|
74
|
+
sampling_callback: Optional sampling callback function.
|
|
75
|
+
elicitation_callback: Optional elicitation callback function.
|
|
66
76
|
"""
|
|
67
|
-
return cls(
|
|
77
|
+
return cls(
|
|
78
|
+
config=config,
|
|
79
|
+
sandbox=sandbox,
|
|
80
|
+
sandbox_options=sandbox_options,
|
|
81
|
+
sampling_callback=sampling_callback,
|
|
82
|
+
elicitation_callback=elicitation_callback,
|
|
83
|
+
)
|
|
68
84
|
|
|
69
85
|
@classmethod
|
|
70
86
|
def from_config_file(
|
|
71
|
-
cls,
|
|
87
|
+
cls,
|
|
88
|
+
filepath: str,
|
|
89
|
+
sandbox: bool = False,
|
|
90
|
+
sandbox_options: SandboxOptions | None = None,
|
|
91
|
+
sampling_callback: SamplingFnT | None = None,
|
|
92
|
+
elicitation_callback: ElicitationFnT | None = None,
|
|
72
93
|
) -> "MCPClient":
|
|
73
94
|
"""Create a MCPClient from a configuration file.
|
|
74
95
|
|
|
@@ -76,8 +97,16 @@ class MCPClient:
|
|
|
76
97
|
filepath: The path to the configuration file.
|
|
77
98
|
sandbox: Whether to use sandboxed execution mode for running MCP servers.
|
|
78
99
|
sandbox_options: Optional sandbox configuration options.
|
|
100
|
+
sampling_callback: Optional sampling callback function.
|
|
101
|
+
elicitation_callback: Optional elicitation callback function.
|
|
79
102
|
"""
|
|
80
|
-
return cls(
|
|
103
|
+
return cls(
|
|
104
|
+
config=load_config_file(filepath),
|
|
105
|
+
sandbox=sandbox,
|
|
106
|
+
sandbox_options=sandbox_options,
|
|
107
|
+
sampling_callback=sampling_callback,
|
|
108
|
+
elicitation_callback=elicitation_callback,
|
|
109
|
+
)
|
|
81
110
|
|
|
82
111
|
def add_server(
|
|
83
112
|
self,
|
|
@@ -151,7 +180,11 @@ class MCPClient:
|
|
|
151
180
|
|
|
152
181
|
# Create connector with options
|
|
153
182
|
connector = create_connector_from_config(
|
|
154
|
-
server_config,
|
|
183
|
+
server_config,
|
|
184
|
+
sandbox=self.sandbox,
|
|
185
|
+
sandbox_options=self.sandbox_options,
|
|
186
|
+
sampling_callback=self.sampling_callback,
|
|
187
|
+
elicitation_callback=self.elicitation_callback,
|
|
155
188
|
)
|
|
156
189
|
|
|
157
190
|
# Create the session
|
mcp_use/config.py
CHANGED
|
@@ -7,6 +7,8 @@ This module provides functionality to load MCP configuration from JSON files.
|
|
|
7
7
|
import json
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
10
|
+
from mcp.client.session import ElicitationFnT, SamplingFnT
|
|
11
|
+
|
|
10
12
|
from mcp_use.types.sandbox import SandboxOptions
|
|
11
13
|
|
|
12
14
|
from .connectors import (
|
|
@@ -36,6 +38,8 @@ def create_connector_from_config(
|
|
|
36
38
|
server_config: dict[str, Any],
|
|
37
39
|
sandbox: bool = False,
|
|
38
40
|
sandbox_options: SandboxOptions | None = None,
|
|
41
|
+
sampling_callback: SamplingFnT | None = None,
|
|
42
|
+
elicitation_callback: ElicitationFnT | None = None,
|
|
39
43
|
) -> BaseConnector:
|
|
40
44
|
"""Create a connector based on server configuration.
|
|
41
45
|
This function can be called with just the server_config parameter:
|
|
@@ -44,7 +48,7 @@ def create_connector_from_config(
|
|
|
44
48
|
server_config: The server configuration section
|
|
45
49
|
sandbox: Whether to use sandboxed execution mode for running MCP servers.
|
|
46
50
|
sandbox_options: Optional sandbox configuration options.
|
|
47
|
-
|
|
51
|
+
sampling_callback: Optional sampling callback function.
|
|
48
52
|
Returns:
|
|
49
53
|
A configured connector instance
|
|
50
54
|
"""
|
|
@@ -55,6 +59,8 @@ def create_connector_from_config(
|
|
|
55
59
|
command=server_config["command"],
|
|
56
60
|
args=server_config["args"],
|
|
57
61
|
env=server_config.get("env", None),
|
|
62
|
+
sampling_callback=sampling_callback,
|
|
63
|
+
elicitation_callback=elicitation_callback,
|
|
58
64
|
)
|
|
59
65
|
|
|
60
66
|
# Sandboxed connector
|
|
@@ -64,6 +70,8 @@ def create_connector_from_config(
|
|
|
64
70
|
args=server_config["args"],
|
|
65
71
|
env=server_config.get("env", None),
|
|
66
72
|
e2b_options=sandbox_options,
|
|
73
|
+
sampling_callback=sampling_callback,
|
|
74
|
+
elicitation_callback=elicitation_callback,
|
|
67
75
|
)
|
|
68
76
|
|
|
69
77
|
# HTTP connector
|
|
@@ -72,6 +80,8 @@ def create_connector_from_config(
|
|
|
72
80
|
base_url=server_config["url"],
|
|
73
81
|
headers=server_config.get("headers", None),
|
|
74
82
|
auth_token=server_config.get("auth_token", None),
|
|
83
|
+
sampling_callback=sampling_callback,
|
|
84
|
+
elicitation_callback=elicitation_callback,
|
|
75
85
|
)
|
|
76
86
|
|
|
77
87
|
# WebSocket connector
|
mcp_use/connectors/base.py
CHANGED
|
@@ -6,13 +6,17 @@ must implement.
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
from abc import ABC, abstractmethod
|
|
9
|
+
from datetime import timedelta
|
|
9
10
|
from typing import Any
|
|
10
11
|
|
|
11
|
-
from mcp import ClientSession
|
|
12
|
+
from mcp import ClientSession, Implementation
|
|
13
|
+
from mcp.client.session import ElicitationFnT, SamplingFnT
|
|
12
14
|
from mcp.shared.exceptions import McpError
|
|
13
15
|
from mcp.types import CallToolResult, GetPromptResult, Prompt, ReadResourceResult, Resource, Tool
|
|
14
16
|
from pydantic import AnyUrl
|
|
15
17
|
|
|
18
|
+
import mcp_use
|
|
19
|
+
|
|
16
20
|
from ..logging import logger
|
|
17
21
|
from ..task_managers import ConnectionManager
|
|
18
22
|
|
|
@@ -23,7 +27,11 @@ class BaseConnector(ABC):
|
|
|
23
27
|
This class defines the interface that all MCP connectors must implement.
|
|
24
28
|
"""
|
|
25
29
|
|
|
26
|
-
def __init__(
|
|
30
|
+
def __init__(
|
|
31
|
+
self,
|
|
32
|
+
sampling_callback: SamplingFnT | None = None,
|
|
33
|
+
elicitation_callback: ElicitationFnT | None = None,
|
|
34
|
+
):
|
|
27
35
|
"""Initialize base connector with common attributes."""
|
|
28
36
|
self.client_session: ClientSession | None = None
|
|
29
37
|
self._connection_manager: ConnectionManager | None = None
|
|
@@ -33,6 +41,17 @@ class BaseConnector(ABC):
|
|
|
33
41
|
self._connected = False
|
|
34
42
|
self._initialized = False # Track if client_session.initialize() has been called
|
|
35
43
|
self.auto_reconnect = True # Whether to automatically reconnect on connection loss (not configurable for now)
|
|
44
|
+
self.sampling_callback = sampling_callback
|
|
45
|
+
self.elicitation_callback = elicitation_callback
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def client_info(self) -> Implementation:
|
|
49
|
+
"""Get the client info for the connector."""
|
|
50
|
+
return Implementation(
|
|
51
|
+
name="mcp-use",
|
|
52
|
+
version=mcp_use.__version__,
|
|
53
|
+
url="https://github.com/mcp-use/mcp-use",
|
|
54
|
+
)
|
|
36
55
|
|
|
37
56
|
@abstractmethod
|
|
38
57
|
async def connect(self) -> None:
|
|
@@ -110,28 +129,41 @@ class BaseConnector(ABC):
|
|
|
110
129
|
|
|
111
130
|
if server_capabilities.tools:
|
|
112
131
|
# Get available tools directly from client session
|
|
113
|
-
|
|
114
|
-
|
|
132
|
+
try:
|
|
133
|
+
tools_result = await self.client_session.list_tools()
|
|
134
|
+
self._tools = tools_result.tools if tools_result else []
|
|
135
|
+
except Exception as e:
|
|
136
|
+
logger.error(f"Error listing tools: {e}")
|
|
137
|
+
self._tools = []
|
|
115
138
|
else:
|
|
116
139
|
self._tools = []
|
|
117
140
|
|
|
118
141
|
if server_capabilities.resources:
|
|
119
142
|
# Get available resources directly from client session
|
|
120
|
-
|
|
121
|
-
|
|
143
|
+
try:
|
|
144
|
+
resources_result = await self.client_session.list_resources()
|
|
145
|
+
self._resources = resources_result.resources if resources_result else []
|
|
146
|
+
except Exception as e:
|
|
147
|
+
logger.error(f"Error listing resources: {e}")
|
|
148
|
+
self._resources = []
|
|
122
149
|
else:
|
|
123
150
|
self._resources = []
|
|
124
151
|
|
|
125
152
|
if server_capabilities.prompts:
|
|
126
153
|
# Get available prompts directly from client session
|
|
127
|
-
|
|
128
|
-
|
|
154
|
+
try:
|
|
155
|
+
prompts_result = await self.client_session.list_prompts()
|
|
156
|
+
self._prompts = prompts_result.prompts if prompts_result else []
|
|
157
|
+
except Exception as e:
|
|
158
|
+
logger.error(f"Error listing prompts: {e}")
|
|
159
|
+
self._prompts = []
|
|
129
160
|
else:
|
|
130
161
|
self._prompts = []
|
|
131
162
|
|
|
132
163
|
logger.debug(
|
|
133
164
|
f"MCP session initialized with {len(self._tools)} tools, "
|
|
134
|
-
"{len(self._resources)} resources,
|
|
165
|
+
f"{len(self._resources)} resources, "
|
|
166
|
+
f"and {len(self._prompts)} prompts"
|
|
135
167
|
)
|
|
136
168
|
|
|
137
169
|
return result
|
|
@@ -235,12 +267,15 @@ class BaseConnector(ABC):
|
|
|
235
267
|
"Connection to MCP server has been lost. Auto-reconnection is disabled. Please reconnect manually."
|
|
236
268
|
)
|
|
237
269
|
|
|
238
|
-
async def call_tool(
|
|
270
|
+
async def call_tool(
|
|
271
|
+
self, name: str, arguments: dict[str, Any], read_timeout_seconds: timedelta | None = None
|
|
272
|
+
) -> CallToolResult:
|
|
239
273
|
"""Call an MCP tool with automatic reconnection handling.
|
|
240
274
|
|
|
241
275
|
Args:
|
|
242
276
|
name: The name of the tool to call.
|
|
243
277
|
arguments: The arguments to pass to the tool.
|
|
278
|
+
read_timeout_seconds: timeout seconds when calling tool
|
|
244
279
|
|
|
245
280
|
Returns:
|
|
246
281
|
The result of the tool call.
|
|
@@ -254,7 +289,7 @@ class BaseConnector(ABC):
|
|
|
254
289
|
|
|
255
290
|
logger.debug(f"Calling tool '{name}' with arguments: {arguments}")
|
|
256
291
|
try:
|
|
257
|
-
result = await self.client_session.call_tool(name, arguments)
|
|
292
|
+
result = await self.client_session.call_tool(name, arguments, read_timeout_seconds)
|
|
258
293
|
logger.debug(f"Tool '{name}' called with result: {result}")
|
|
259
294
|
return result
|
|
260
295
|
except Exception as e:
|
mcp_use/connectors/http.py
CHANGED
|
@@ -7,9 +7,10 @@ through HTTP APIs with SSE or Streamable HTTP for transport.
|
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
from mcp import ClientSession
|
|
10
|
+
from mcp.client.session import ElicitationFnT, SamplingFnT
|
|
10
11
|
|
|
11
12
|
from ..logging import logger
|
|
12
|
-
from ..task_managers import
|
|
13
|
+
from ..task_managers import SseConnectionManager, StreamableHttpConnectionManager
|
|
13
14
|
from .base import BaseConnector
|
|
14
15
|
|
|
15
16
|
|
|
@@ -27,6 +28,8 @@ class HttpConnector(BaseConnector):
|
|
|
27
28
|
headers: dict[str, str] | None = None,
|
|
28
29
|
timeout: float = 5,
|
|
29
30
|
sse_read_timeout: float = 60 * 5,
|
|
31
|
+
sampling_callback: SamplingFnT | None = None,
|
|
32
|
+
elicitation_callback: ElicitationFnT | None = None,
|
|
30
33
|
):
|
|
31
34
|
"""Initialize a new HTTP connector.
|
|
32
35
|
|
|
@@ -36,8 +39,10 @@ class HttpConnector(BaseConnector):
|
|
|
36
39
|
headers: Optional additional headers.
|
|
37
40
|
timeout: Timeout for HTTP operations in seconds.
|
|
38
41
|
sse_read_timeout: Timeout for SSE read operations in seconds.
|
|
42
|
+
sampling_callback: Optional sampling callback.
|
|
43
|
+
elicitation_callback: Optional elicitation callback.
|
|
39
44
|
"""
|
|
40
|
-
super().__init__()
|
|
45
|
+
super().__init__(sampling_callback=sampling_callback, elicitation_callback=elicitation_callback)
|
|
41
46
|
self.base_url = base_url.rstrip("/")
|
|
42
47
|
self.auth_token = auth_token
|
|
43
48
|
self.headers = headers or {}
|
|
@@ -46,14 +51,6 @@ class HttpConnector(BaseConnector):
|
|
|
46
51
|
self.timeout = timeout
|
|
47
52
|
self.sse_read_timeout = sse_read_timeout
|
|
48
53
|
|
|
49
|
-
async def _setup_client(self, connection_manager: ConnectionManager) -> None:
|
|
50
|
-
"""Set up the client session with the provided connection manager."""
|
|
51
|
-
|
|
52
|
-
self._connection_manager = connection_manager
|
|
53
|
-
read_stream, write_stream = await self._connection_manager.start()
|
|
54
|
-
self.client_session = ClientSession(read_stream, write_stream, sampling_callback=None)
|
|
55
|
-
await self.client_session.__aenter__()
|
|
56
|
-
|
|
57
54
|
async def connect(self) -> None:
|
|
58
55
|
"""Establish a connection to the MCP implementation."""
|
|
59
56
|
if self._connected:
|
|
@@ -76,7 +73,13 @@ class HttpConnector(BaseConnector):
|
|
|
76
73
|
read_stream, write_stream = await connection_manager.start()
|
|
77
74
|
|
|
78
75
|
# Test if this actually works by trying to create a client session and initialize it
|
|
79
|
-
test_client = ClientSession(
|
|
76
|
+
test_client = ClientSession(
|
|
77
|
+
read_stream,
|
|
78
|
+
write_stream,
|
|
79
|
+
sampling_callback=self.sampling_callback,
|
|
80
|
+
elicitation_callback=self.elicitation_callback,
|
|
81
|
+
client_info=self.client_info,
|
|
82
|
+
)
|
|
80
83
|
await test_client.__aenter__()
|
|
81
84
|
|
|
82
85
|
try:
|
|
@@ -154,7 +157,13 @@ class HttpConnector(BaseConnector):
|
|
|
154
157
|
read_stream, write_stream = await connection_manager.start()
|
|
155
158
|
|
|
156
159
|
# Create the client session for SSE
|
|
157
|
-
self.client_session = ClientSession(
|
|
160
|
+
self.client_session = ClientSession(
|
|
161
|
+
read_stream,
|
|
162
|
+
write_stream,
|
|
163
|
+
sampling_callback=self.sampling_callback,
|
|
164
|
+
elicitation_callback=self.elicitation_callback,
|
|
165
|
+
client_info=self.client_info,
|
|
166
|
+
)
|
|
158
167
|
await self.client_session.__aenter__()
|
|
159
168
|
self.transport_type = "SSE"
|
|
160
169
|
|
mcp_use/connectors/sandbox.py
CHANGED
|
@@ -12,6 +12,7 @@ import time
|
|
|
12
12
|
|
|
13
13
|
import aiohttp
|
|
14
14
|
from mcp import ClientSession
|
|
15
|
+
from mcp.client.session import ElicitationFnT, SamplingFnT
|
|
15
16
|
|
|
16
17
|
from ..logging import logger
|
|
17
18
|
from ..task_managers import SseConnectionManager
|
|
@@ -50,6 +51,8 @@ class SandboxConnector(BaseConnector):
|
|
|
50
51
|
e2b_options: SandboxOptions | None = None,
|
|
51
52
|
timeout: float = 5,
|
|
52
53
|
sse_read_timeout: float = 60 * 5,
|
|
54
|
+
sampling_callback: SamplingFnT | None = None,
|
|
55
|
+
elicitation_callback: ElicitationFnT | None = None,
|
|
53
56
|
):
|
|
54
57
|
"""Initialize a new sandbox connector.
|
|
55
58
|
|
|
@@ -61,8 +64,10 @@ class SandboxConnector(BaseConnector):
|
|
|
61
64
|
See SandboxOptions for available options and defaults.
|
|
62
65
|
timeout: Timeout for the sandbox process in seconds.
|
|
63
66
|
sse_read_timeout: Timeout for the SSE connection in seconds.
|
|
67
|
+
sampling_callback: Optional sampling callback.
|
|
68
|
+
elicitation_callback: Optional elicitation callback.
|
|
64
69
|
"""
|
|
65
|
-
super().__init__()
|
|
70
|
+
super().__init__(sampling_callback=sampling_callback, elicitation_callback=elicitation_callback)
|
|
66
71
|
if Sandbox is None:
|
|
67
72
|
raise ImportError(
|
|
68
73
|
"E2B SDK (e2b-code-interpreter) not found. Please install it with "
|
|
@@ -217,7 +222,13 @@ class SandboxConnector(BaseConnector):
|
|
|
217
222
|
read_stream, write_stream = await self._connection_manager.start()
|
|
218
223
|
|
|
219
224
|
# Create the client session
|
|
220
|
-
self.client_session = ClientSession(
|
|
225
|
+
self.client_session = ClientSession(
|
|
226
|
+
read_stream,
|
|
227
|
+
write_stream,
|
|
228
|
+
sampling_callback=self.sampling_callback,
|
|
229
|
+
elicitation_callback=self.elicitation_callback,
|
|
230
|
+
client_info=self.client_info,
|
|
231
|
+
)
|
|
221
232
|
await self.client_session.__aenter__()
|
|
222
233
|
|
|
223
234
|
# Mark as connected
|
mcp_use/connectors/stdio.py
CHANGED
|
@@ -8,6 +8,7 @@ through the standard input/output streams.
|
|
|
8
8
|
import sys
|
|
9
9
|
|
|
10
10
|
from mcp import ClientSession, StdioServerParameters
|
|
11
|
+
from mcp.client.session import ElicitationFnT, SamplingFnT
|
|
11
12
|
|
|
12
13
|
from ..logging import logger
|
|
13
14
|
from ..task_managers import StdioConnectionManager
|
|
@@ -28,6 +29,8 @@ class StdioConnector(BaseConnector):
|
|
|
28
29
|
args: list[str] | None = None,
|
|
29
30
|
env: dict[str, str] | None = None,
|
|
30
31
|
errlog=sys.stderr,
|
|
32
|
+
sampling_callback: SamplingFnT | None = None,
|
|
33
|
+
elicitation_callback: ElicitationFnT | None = None,
|
|
31
34
|
):
|
|
32
35
|
"""Initialize a new stdio connector.
|
|
33
36
|
|
|
@@ -36,8 +39,10 @@ class StdioConnector(BaseConnector):
|
|
|
36
39
|
args: Optional command line arguments.
|
|
37
40
|
env: Optional environment variables.
|
|
38
41
|
errlog: Stream to write error output to.
|
|
42
|
+
sampling_callback: Optional callback to sample the client.
|
|
43
|
+
elicitation_callback: Optional callback to elicit the client.
|
|
39
44
|
"""
|
|
40
|
-
super().__init__()
|
|
45
|
+
super().__init__(sampling_callback=sampling_callback, elicitation_callback=elicitation_callback)
|
|
41
46
|
self.command = command
|
|
42
47
|
self.args = args or [] # Ensure args is never None
|
|
43
48
|
self.env = env
|
|
@@ -59,7 +64,13 @@ class StdioConnector(BaseConnector):
|
|
|
59
64
|
read_stream, write_stream = await self._connection_manager.start()
|
|
60
65
|
|
|
61
66
|
# Create the client session
|
|
62
|
-
self.client_session = ClientSession(
|
|
67
|
+
self.client_session = ClientSession(
|
|
68
|
+
read_stream,
|
|
69
|
+
write_stream,
|
|
70
|
+
sampling_callback=self.sampling_callback,
|
|
71
|
+
elicitation_callback=self.elicitation_callback,
|
|
72
|
+
client_info=self.client_info,
|
|
73
|
+
)
|
|
63
74
|
await self.client_session.__aenter__()
|
|
64
75
|
|
|
65
76
|
# Mark as connected
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mcp-use
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.7
|
|
4
4
|
Summary: MCP Library for LLMs
|
|
5
5
|
Author-email: Pietro Zullo <pietro.zullo@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -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.
|
|
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'
|
|
@@ -89,7 +89,12 @@ Description-Content-Type: text/markdown
|
|
|
89
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
91
|
|
|
92
|
-
|
|
92
|
+
| Supports | |
|
|
93
|
+
| :--- | :--- |
|
|
94
|
+
| **Primitives** | [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) |
|
|
95
|
+
| **Transports** | [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) [](https://github.com/pietrozullo/mcp-use/actions/workflows/tests.yml) |
|
|
96
|
+
|
|
97
|
+
## Features
|
|
93
98
|
|
|
94
99
|
<table>
|
|
95
100
|
<tr>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
mcp_use/__init__.py,sha256=I3gFxw6Id45RksUBIZS1kxBW3ItjFXuAfoReJabpnW0,1055
|
|
2
|
-
mcp_use/client.py,sha256=
|
|
3
|
-
mcp_use/config.py,sha256=
|
|
2
|
+
mcp_use/client.py,sha256=ka9gE_GQj9a1fcWfz-hrAzYwSN5I1Y1JXo2Tq0uRCOU,10718
|
|
3
|
+
mcp_use/config.py,sha256=zLw8F9bBi4hMmKmjxMIS47GIlHWmP4r35A-_K5c7Kqk,2974
|
|
4
4
|
mcp_use/logging.py,sha256=CRtkPwR-bkXK_kQ0QOL86RikMWOHzEOi7A8VRHkNsZw,4270
|
|
5
5
|
mcp_use/session.py,sha256=4kwcB_IkTt_3FiBSTI1H17KhL1W_6N5oai3HTxFrTH4,2496
|
|
6
6
|
mcp_use/utils.py,sha256=QavJcVq2WxUUUCCpPCUeOB5bqIS0FFmpK-RAZkGc6aA,720
|
|
@@ -9,14 +9,14 @@ mcp_use/adapters/base.py,sha256=U1z_UzojC-bytb4ZuKTRpEgEp-2F_BVBgqEXbUqLYB4,6901
|
|
|
9
9
|
mcp_use/adapters/langchain_adapter.py,sha256=LdlpRyLORhl8NZvtAmisgPelXkhEbBErSNdGHb8SF18,10860
|
|
10
10
|
mcp_use/agents/__init__.py,sha256=N3eVYP2PxqNO2KcQv5fY8UMUX2W3eLTNkkzuFIJ1DUA,261
|
|
11
11
|
mcp_use/agents/base.py,sha256=EN-dRbwOi9vIqofFg3jmi5yT2VKlwEr9Cwi1DZgB3eE,1591
|
|
12
|
-
mcp_use/agents/mcpagent.py,sha256=
|
|
12
|
+
mcp_use/agents/mcpagent.py,sha256=K3gKlPvqIPiniifi46Xs82_D2YKNO-Vn4BTTH55LPbI,35753
|
|
13
13
|
mcp_use/agents/prompts/system_prompt_builder.py,sha256=E86STmxcl2Ic763_114awNqFB2RyLrQlbvgRmJajQjI,4116
|
|
14
14
|
mcp_use/agents/prompts/templates.py,sha256=AZKrGWuI516C-PmyOPvxDBibNdqJtN24sOHTGR06bi4,1933
|
|
15
15
|
mcp_use/connectors/__init__.py,sha256=cUF4yT0bNr8qeLkSzg28SHueiV5qDaHEB1l1GZ2K0dc,536
|
|
16
|
-
mcp_use/connectors/base.py,sha256=
|
|
17
|
-
mcp_use/connectors/http.py,sha256=
|
|
18
|
-
mcp_use/connectors/sandbox.py,sha256=
|
|
19
|
-
mcp_use/connectors/stdio.py,sha256=
|
|
16
|
+
mcp_use/connectors/base.py,sha256=bCPOrSb3xzuxQRFpcLf7tCG1UmMFtr9IVM7br8JlbzI,13878
|
|
17
|
+
mcp_use/connectors/http.py,sha256=8LVzXtVtdLVQH9xMIqPzKfPEmaO_cxzMIu4g4oGIung,7912
|
|
18
|
+
mcp_use/connectors/sandbox.py,sha256=RX8xssn0cIObW6CjOqY7ZrO_D9lTzCZKdRcJ5lQSmQg,11441
|
|
19
|
+
mcp_use/connectors/stdio.py,sha256=jTNhrsHxkRgSI9uAnj4bbFsBwe6zooc-oNcMXV_s9Xk,3378
|
|
20
20
|
mcp_use/connectors/utils.py,sha256=zQ8GdNQx0Twz3by90BoU1RsWPf9wODGof4K3-NxPXeA,366
|
|
21
21
|
mcp_use/connectors/websocket.py,sha256=G7ZeLJNPVl9AG6kCmiNJz1N2Ing_QxT7pSswigTKi8Y,9650
|
|
22
22
|
mcp_use/managers/__init__.py,sha256=rzsJbOhtlmxNQLGcdmtmHaiExEXmiQiUuzPrAgKhAJw,439
|
|
@@ -43,7 +43,7 @@ mcp_use/telemetry/events.py,sha256=K5xqbmkum30r4gM2PWtTiUWGF8oZzGZw2DYwco1RfOQ,3
|
|
|
43
43
|
mcp_use/telemetry/telemetry.py,sha256=ck2MDFMtooafriR1W_zi41dWq-0O-ucF89pCkdkyc9E,11724
|
|
44
44
|
mcp_use/telemetry/utils.py,sha256=kDVTqt2oSeWNJbnTOlXOehr2yFO0PMyx2UGkrWkfJiw,1769
|
|
45
45
|
mcp_use/types/sandbox.py,sha256=opJ9r56F1FvaqVvPovfAj5jZbsOexgwYx5wLgSlN8_U,712
|
|
46
|
-
mcp_use-1.3.
|
|
47
|
-
mcp_use-1.3.
|
|
48
|
-
mcp_use-1.3.
|
|
49
|
-
mcp_use-1.3.
|
|
46
|
+
mcp_use-1.3.7.dist-info/METADATA,sha256=ZElQuSVQ92ph2WHTWsEPPPIFGpwHjMHa4MZ6gDNp-KY,30337
|
|
47
|
+
mcp_use-1.3.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
48
|
+
mcp_use-1.3.7.dist-info/licenses/LICENSE,sha256=7Pw7dbwJSBw8zH-WE03JnR5uXvitRtaGTP9QWPcexcs,1068
|
|
49
|
+
mcp_use-1.3.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|