mcp-use 1.3.12__py3-none-any.whl → 1.4.0__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/__init__.py +1 -1
- mcp_use/adapters/.deprecated +0 -0
- mcp_use/adapters/__init__.py +18 -7
- mcp_use/adapters/base.py +12 -185
- mcp_use/adapters/langchain_adapter.py +12 -219
- mcp_use/agents/adapters/__init__.py +17 -0
- mcp_use/agents/adapters/anthropic.py +93 -0
- mcp_use/agents/adapters/base.py +316 -0
- mcp_use/agents/adapters/google.py +103 -0
- mcp_use/agents/adapters/langchain_adapter.py +212 -0
- mcp_use/agents/adapters/openai.py +111 -0
- mcp_use/agents/base.py +1 -1
- mcp_use/agents/managers/__init__.py +19 -0
- mcp_use/agents/managers/base.py +36 -0
- mcp_use/agents/managers/server_manager.py +131 -0
- mcp_use/agents/managers/tools/__init__.py +15 -0
- mcp_use/agents/managers/tools/base_tool.py +19 -0
- mcp_use/agents/managers/tools/connect_server.py +69 -0
- mcp_use/agents/managers/tools/disconnect_server.py +43 -0
- mcp_use/agents/managers/tools/get_active_server.py +29 -0
- mcp_use/agents/managers/tools/list_servers_tool.py +53 -0
- mcp_use/agents/managers/tools/search_tools.py +328 -0
- mcp_use/agents/mcpagent.py +386 -485
- mcp_use/agents/prompts/system_prompt_builder.py +1 -1
- mcp_use/agents/remote.py +15 -2
- mcp_use/auth/.deprecated +0 -0
- mcp_use/auth/__init__.py +19 -4
- mcp_use/auth/bearer.py +11 -12
- mcp_use/auth/oauth.py +11 -620
- mcp_use/auth/oauth_callback.py +16 -207
- mcp_use/client/__init__.py +1 -0
- mcp_use/client/auth/__init__.py +6 -0
- mcp_use/client/auth/bearer.py +23 -0
- mcp_use/client/auth/oauth.py +629 -0
- mcp_use/client/auth/oauth_callback.py +215 -0
- mcp_use/client/client.py +356 -0
- mcp_use/client/config.py +106 -0
- mcp_use/client/connectors/__init__.py +20 -0
- mcp_use/client/connectors/base.py +470 -0
- mcp_use/client/connectors/http.py +304 -0
- mcp_use/client/connectors/sandbox.py +332 -0
- mcp_use/client/connectors/stdio.py +109 -0
- mcp_use/client/connectors/utils.py +13 -0
- mcp_use/client/connectors/websocket.py +257 -0
- mcp_use/client/exceptions.py +31 -0
- mcp_use/client/middleware/__init__.py +50 -0
- mcp_use/client/middleware/logging.py +31 -0
- mcp_use/client/middleware/metrics.py +314 -0
- mcp_use/client/middleware/middleware.py +266 -0
- mcp_use/client/session.py +162 -0
- mcp_use/client/task_managers/__init__.py +20 -0
- mcp_use/client/task_managers/base.py +145 -0
- mcp_use/client/task_managers/sse.py +84 -0
- mcp_use/client/task_managers/stdio.py +69 -0
- mcp_use/client/task_managers/streamable_http.py +86 -0
- mcp_use/client/task_managers/websocket.py +68 -0
- mcp_use/client.py +12 -344
- mcp_use/config.py +20 -97
- mcp_use/connectors/.deprecated +0 -0
- mcp_use/connectors/__init__.py +46 -20
- mcp_use/connectors/base.py +12 -455
- mcp_use/connectors/http.py +13 -300
- mcp_use/connectors/sandbox.py +13 -306
- mcp_use/connectors/stdio.py +13 -104
- mcp_use/connectors/utils.py +15 -8
- mcp_use/connectors/websocket.py +13 -252
- mcp_use/exceptions.py +33 -18
- mcp_use/logging.py +1 -1
- mcp_use/managers/.deprecated +0 -0
- mcp_use/managers/__init__.py +56 -17
- mcp_use/managers/base.py +13 -31
- mcp_use/managers/server_manager.py +13 -119
- mcp_use/managers/tools/__init__.py +45 -15
- mcp_use/managers/tools/base_tool.py +5 -16
- mcp_use/managers/tools/connect_server.py +5 -67
- mcp_use/managers/tools/disconnect_server.py +5 -41
- mcp_use/managers/tools/get_active_server.py +5 -26
- mcp_use/managers/tools/list_servers_tool.py +5 -51
- mcp_use/managers/tools/search_tools.py +17 -321
- mcp_use/middleware/.deprecated +0 -0
- mcp_use/middleware/__init__.py +89 -50
- mcp_use/middleware/logging.py +14 -26
- mcp_use/middleware/metrics.py +30 -303
- mcp_use/middleware/middleware.py +39 -246
- mcp_use/session.py +13 -149
- mcp_use/task_managers/.deprecated +0 -0
- mcp_use/task_managers/__init__.py +48 -20
- mcp_use/task_managers/base.py +13 -140
- mcp_use/task_managers/sse.py +13 -79
- mcp_use/task_managers/stdio.py +13 -64
- mcp_use/task_managers/streamable_http.py +15 -81
- mcp_use/task_managers/websocket.py +13 -63
- mcp_use/telemetry/events.py +58 -0
- mcp_use/telemetry/telemetry.py +71 -1
- mcp_use/telemetry/utils.py +1 -1
- mcp_use/types/.deprecated +0 -0
- mcp_use/types/sandbox.py +13 -18
- {mcp_use-1.3.12.dist-info → mcp_use-1.4.0.dist-info}/METADATA +68 -43
- mcp_use-1.4.0.dist-info/RECORD +111 -0
- mcp_use/cli.py +0 -581
- mcp_use-1.3.12.dist-info/RECORD +0 -64
- mcp_use-1.3.12.dist-info/licenses/LICENSE +0 -21
- /mcp_use/{observability → agents/observability}/__init__.py +0 -0
- /mcp_use/{observability → agents/observability}/callbacks_manager.py +0 -0
- /mcp_use/{observability → agents/observability}/laminar.py +0 -0
- /mcp_use/{observability → agents/observability}/langfuse.py +0 -0
- {mcp_use-1.3.12.dist-info → mcp_use-1.4.0.dist-info}/WHEEL +0 -0
- {mcp_use-1.3.12.dist-info → mcp_use-1.4.0.dist-info}/entry_points.txt +0 -0
mcp_use/agents/remote.py
CHANGED
|
@@ -9,10 +9,10 @@ from typing import Any, TypeVar
|
|
|
9
9
|
from uuid import UUID
|
|
10
10
|
|
|
11
11
|
import httpx
|
|
12
|
-
from
|
|
12
|
+
from langchain_core.messages import BaseMessage
|
|
13
13
|
from pydantic import BaseModel
|
|
14
14
|
|
|
15
|
-
from
|
|
15
|
+
from mcp_use.logging import logger
|
|
16
16
|
|
|
17
17
|
T = TypeVar("T", bound=BaseModel)
|
|
18
18
|
|
|
@@ -282,6 +282,7 @@ class RemoteAgent:
|
|
|
282
282
|
if event.startswith("0:"): # Text event
|
|
283
283
|
try:
|
|
284
284
|
text_data = json.loads(event[2:]) # Remove "0:" prefix
|
|
285
|
+
# Normal text accumulation
|
|
285
286
|
if final_result is None:
|
|
286
287
|
final_result = ""
|
|
287
288
|
final_result += text_data
|
|
@@ -308,6 +309,18 @@ class RemoteAgent:
|
|
|
308
309
|
except json.JSONDecodeError as e:
|
|
309
310
|
raise RuntimeError("Agent execution failed with unknown error") from e
|
|
310
311
|
|
|
312
|
+
elif event.startswith("f:"): # Structured final event
|
|
313
|
+
try:
|
|
314
|
+
structured_data = json.loads(event[2:]) # Remove "f:" prefix
|
|
315
|
+
logger.info(f"📋 [{self.chat_id}] Received structured final event")
|
|
316
|
+
|
|
317
|
+
# Replace accumulated text with structured output
|
|
318
|
+
final_result = structured_data
|
|
319
|
+
logger.info(f"📋 [{self.chat_id}] Replaced accumulated text with structured output")
|
|
320
|
+
except json.JSONDecodeError:
|
|
321
|
+
logger.warning(f"Failed to parse structured final event: {event[:100]}")
|
|
322
|
+
continue
|
|
323
|
+
|
|
311
324
|
# Log completion of stream consumption
|
|
312
325
|
logger.info(f"Stream consumption complete. Finished: {finished}, Steps taken: {steps_taken}")
|
|
313
326
|
|
mcp_use/auth/.deprecated
ADDED
|
File without changes
|
mcp_use/auth/__init__.py
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
# mcp_use/auth/__init__.py
|
|
2
|
+
import warnings
|
|
2
3
|
|
|
3
|
-
from
|
|
4
|
-
from .oauth import OAuth
|
|
4
|
+
from typing_extensions import deprecated
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
from mcp_use.client.auth import BearerAuth as _BearerAuth
|
|
7
|
+
from mcp_use.client.auth import OAuth as _OAuth
|
|
8
|
+
|
|
9
|
+
warnings.warn(
|
|
10
|
+
"mcp_use.auth is deprecated. Use mcp_use.client.auth. This import will be removed in version 1.4.0",
|
|
11
|
+
DeprecationWarning,
|
|
12
|
+
stacklevel=2,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@deprecated("Use mcp_use.client.auth.BearerAuth")
|
|
17
|
+
class BearerAuth(_BearerAuth): ...
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@deprecated("Use mcp_use.client.auth.OAuth")
|
|
21
|
+
class OAuth(_OAuth): ...
|
mcp_use/auth/bearer.py
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
# mcp_use/auth/bearer.py
|
|
2
|
+
import warnings
|
|
2
3
|
|
|
3
|
-
from
|
|
4
|
+
from typing_extensions import deprecated
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
-
from pydantic import BaseModel, SecretStr
|
|
6
|
+
from mcp_use.client.auth.bearer import BearerAuth as _BearerAuth
|
|
7
7
|
|
|
8
|
+
warnings.warn(
|
|
9
|
+
"mcp_use.auth.bearer is deprecated. Use mcp_use.client.auth.bearer. This import will be removed in version 1.4.0",
|
|
10
|
+
DeprecationWarning,
|
|
11
|
+
stacklevel=2,
|
|
12
|
+
)
|
|
8
13
|
|
|
9
|
-
class BearerAuth(httpx.Auth, BaseModel):
|
|
10
|
-
"""Bearer token authentication for HTTP requests."""
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def auth_flow(self, request: httpx.Request) -> Generator[httpx.Request, httpx.Response, None]:
|
|
15
|
-
"""Apply bearer token authentication to the request."""
|
|
16
|
-
request.headers["Authorization"] = f"Bearer {self.token.get_secret_value()}"
|
|
17
|
-
yield request
|
|
15
|
+
@deprecated("Use mcp_use.client.auth.bearer.BearerAuth")
|
|
16
|
+
class BearerAuth(_BearerAuth): ...
|