chuk-tool-processor 0.5.2__tar.gz → 0.5.4__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 chuk-tool-processor might be problematic. Click here for more details.
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/PKG-INFO +2 -2
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/pyproject.toml +2 -2
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/mcp/__init__.py +16 -3
- chuk_tool_processor-0.5.4/src/chuk_tool_processor/mcp/setup_mcp_http_streamable.py +119 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/mcp/setup_mcp_sse.py +35 -36
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/mcp/setup_mcp_stdio.py +3 -1
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/mcp/stream_manager.py +157 -130
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/mcp/transport/__init__.py +4 -2
- chuk_tool_processor-0.5.4/src/chuk_tool_processor/mcp/transport/http_streamable_transport.py +496 -0
- chuk_tool_processor-0.5.4/src/chuk_tool_processor/mcp/transport/sse_transport.py +377 -0
- chuk_tool_processor-0.5.4/src/chuk_tool_processor/mcp/transport/stdio_transport.py +236 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor.egg-info/PKG-INFO +2 -2
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor.egg-info/SOURCES.txt +2 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor.egg-info/requires.txt +1 -1
- chuk_tool_processor-0.5.2/src/chuk_tool_processor/mcp/transport/sse_transport.py +0 -496
- chuk_tool_processor-0.5.2/src/chuk_tool_processor/mcp/transport/stdio_transport.py +0 -393
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/README.md +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/setup.cfg +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/core/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/core/exceptions.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/core/processor.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/execution/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/execution/strategies/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/execution/strategies/inprocess_strategy.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/execution/strategies/subprocess_strategy.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/execution/tool_executor.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/execution/wrappers/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/execution/wrappers/caching.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/execution/wrappers/rate_limiting.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/execution/wrappers/retry.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/logging/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/logging/context.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/logging/formatter.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/logging/helpers.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/logging/metrics.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/mcp/mcp_tool.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/mcp/register_mcp_tools.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/mcp/transport/base_transport.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/models/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/models/execution_strategy.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/models/streaming_tool.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/models/tool_call.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/models/tool_export_mixin.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/models/tool_result.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/models/validated_tool.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/plugins/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/plugins/discovery.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/plugins/parsers/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/plugins/parsers/base.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/plugins/parsers/function_call_tool.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/plugins/parsers/json_tool.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/plugins/parsers/openai_tool.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/plugins/parsers/xml_tool.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/registry/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/registry/auto_register.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/registry/decorators.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/registry/interface.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/registry/metadata.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/registry/provider.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/registry/providers/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/registry/providers/memory.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/registry/tool_export.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/utils/__init__.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/utils/validation.py +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor.egg-info/dependency_links.txt +0 -0
- {chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor.egg-info/top_level.txt +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chuk-tool-processor
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: chuk-mcp>=0.2.
|
|
7
|
+
Requires-Dist: chuk-mcp>=0.2.4
|
|
8
8
|
Requires-Dist: dotenv>=0.9.9
|
|
9
9
|
Requires-Dist: pydantic>=2.11.3
|
|
10
10
|
Requires-Dist: uuid>=1.30
|
|
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "chuk-tool-processor"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.4"
|
|
8
8
|
description = "Add your description here"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"chuk-mcp>=0.2.
|
|
12
|
+
"chuk-mcp>=0.2.4",
|
|
13
13
|
"dotenv>=0.9.9",
|
|
14
14
|
"pydantic>=2.11.3",
|
|
15
15
|
"uuid>=1.30",
|
{chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/mcp/__init__.py
RENAMED
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
# chuk_tool_processor/mcp/__init__.py
|
|
2
2
|
"""
|
|
3
3
|
MCP integration for CHUK Tool Processor.
|
|
4
|
+
|
|
5
|
+
Updated to support the latest MCP transports:
|
|
6
|
+
- STDIO (process-based)
|
|
7
|
+
- SSE (Server-Sent Events)
|
|
8
|
+
- HTTP Streamable (modern replacement for SSE, spec 2025-03-26)
|
|
4
9
|
"""
|
|
5
|
-
from chuk_tool_processor.mcp.transport import
|
|
10
|
+
from chuk_tool_processor.mcp.transport import (
|
|
11
|
+
MCPBaseTransport,
|
|
12
|
+
StdioTransport,
|
|
13
|
+
SSETransport,
|
|
14
|
+
HTTPStreamableTransport
|
|
15
|
+
)
|
|
6
16
|
from chuk_tool_processor.mcp.stream_manager import StreamManager
|
|
7
17
|
from chuk_tool_processor.mcp.mcp_tool import MCPTool
|
|
8
18
|
from chuk_tool_processor.mcp.register_mcp_tools import register_mcp_tools
|
|
9
19
|
from chuk_tool_processor.mcp.setup_mcp_stdio import setup_mcp_stdio
|
|
10
20
|
from chuk_tool_processor.mcp.setup_mcp_sse import setup_mcp_sse
|
|
21
|
+
from chuk_tool_processor.mcp.setup_mcp_http_streamable import setup_mcp_http_streamable
|
|
11
22
|
|
|
12
23
|
__all__ = [
|
|
13
24
|
"MCPBaseTransport",
|
|
14
|
-
"StdioTransport",
|
|
25
|
+
"StdioTransport",
|
|
15
26
|
"SSETransport",
|
|
27
|
+
"HTTPStreamableTransport",
|
|
16
28
|
"StreamManager",
|
|
17
29
|
"MCPTool",
|
|
18
30
|
"register_mcp_tools",
|
|
19
31
|
"setup_mcp_stdio",
|
|
20
|
-
"setup_mcp_sse"
|
|
32
|
+
"setup_mcp_sse",
|
|
33
|
+
"setup_mcp_http_streamable"
|
|
21
34
|
]
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# chuk_tool_processor/mcp/setup_mcp_http_streamable.py
|
|
3
|
+
"""
|
|
4
|
+
Bootstrap helper for MCP over **HTTP Streamable** transport.
|
|
5
|
+
|
|
6
|
+
The HTTP Streamable transport is the modern replacement for SSE transport
|
|
7
|
+
as of MCP spec 2025-03-26, providing better infrastructure compatibility
|
|
8
|
+
and more flexible response handling.
|
|
9
|
+
|
|
10
|
+
It:
|
|
11
|
+
|
|
12
|
+
1. spins up :class:`~chuk_tool_processor.mcp.stream_manager.StreamManager`
|
|
13
|
+
with the `"http_streamable"` transport,
|
|
14
|
+
2. discovers & registers the remote MCP tools locally, and
|
|
15
|
+
3. returns a ready-to-use :class:`~chuk_tool_processor.core.processor.ToolProcessor`.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from typing import Dict, List, Optional, Tuple
|
|
21
|
+
|
|
22
|
+
from chuk_tool_processor.core.processor import ToolProcessor
|
|
23
|
+
from chuk_tool_processor.logging import get_logger
|
|
24
|
+
from chuk_tool_processor.mcp.register_mcp_tools import register_mcp_tools
|
|
25
|
+
from chuk_tool_processor.mcp.stream_manager import StreamManager
|
|
26
|
+
|
|
27
|
+
logger = get_logger("chuk_tool_processor.mcp.setup_http_streamable")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# --------------------------------------------------------------------------- #
|
|
31
|
+
# public helper
|
|
32
|
+
# --------------------------------------------------------------------------- #
|
|
33
|
+
async def setup_mcp_http_streamable(
|
|
34
|
+
*,
|
|
35
|
+
servers: List[Dict[str, str]],
|
|
36
|
+
server_names: Optional[Dict[int, str]] = None,
|
|
37
|
+
connection_timeout: float = 30.0,
|
|
38
|
+
default_timeout: float = 30.0,
|
|
39
|
+
max_concurrency: Optional[int] = None,
|
|
40
|
+
enable_caching: bool = True,
|
|
41
|
+
cache_ttl: int = 300,
|
|
42
|
+
enable_rate_limiting: bool = False,
|
|
43
|
+
global_rate_limit: Optional[int] = None,
|
|
44
|
+
tool_rate_limits: Optional[Dict[str, tuple]] = None,
|
|
45
|
+
enable_retries: bool = True,
|
|
46
|
+
max_retries: int = 3,
|
|
47
|
+
namespace: str = "http",
|
|
48
|
+
) -> Tuple[ToolProcessor, StreamManager]:
|
|
49
|
+
"""
|
|
50
|
+
Initialize HTTP Streamable transport MCP + a :class:`ToolProcessor`.
|
|
51
|
+
|
|
52
|
+
This uses the modern HTTP Streamable transport (spec 2025-03-26) which
|
|
53
|
+
provides better infrastructure compatibility and more flexible response
|
|
54
|
+
handling compared to the deprecated SSE transport.
|
|
55
|
+
|
|
56
|
+
Call with ``await`` from your async context.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
servers: List of server configurations with 'name', 'url', and optionally 'api_key' keys
|
|
60
|
+
server_names: Optional mapping of server indices to names
|
|
61
|
+
connection_timeout: Timeout for initial HTTP connection setup
|
|
62
|
+
default_timeout: Default timeout for tool execution
|
|
63
|
+
max_concurrency: Maximum concurrent operations
|
|
64
|
+
enable_caching: Whether to enable response caching
|
|
65
|
+
cache_ttl: Cache time-to-live in seconds
|
|
66
|
+
enable_rate_limiting: Whether to enable rate limiting
|
|
67
|
+
global_rate_limit: Global rate limit (requests per minute)
|
|
68
|
+
tool_rate_limits: Per-tool rate limits
|
|
69
|
+
enable_retries: Whether to enable automatic retries
|
|
70
|
+
max_retries: Maximum retry attempts
|
|
71
|
+
namespace: Namespace for registered tools
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
Tuple of (ToolProcessor, StreamManager)
|
|
75
|
+
|
|
76
|
+
Example:
|
|
77
|
+
>>> servers = [
|
|
78
|
+
... {
|
|
79
|
+
... "name": "my_server",
|
|
80
|
+
... "url": "http://localhost:8000",
|
|
81
|
+
... "api_key": "optional-api-key"
|
|
82
|
+
... }
|
|
83
|
+
... ]
|
|
84
|
+
>>> processor, stream_manager = await setup_mcp_http_streamable(
|
|
85
|
+
... servers=servers,
|
|
86
|
+
... namespace="mytools"
|
|
87
|
+
... )
|
|
88
|
+
"""
|
|
89
|
+
# 1️⃣ create & connect the stream-manager with HTTP Streamable transport
|
|
90
|
+
stream_manager = await StreamManager.create_with_http_streamable(
|
|
91
|
+
servers=servers,
|
|
92
|
+
server_names=server_names,
|
|
93
|
+
connection_timeout=connection_timeout,
|
|
94
|
+
default_timeout=default_timeout,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# 2️⃣ pull the remote tool list and register each one locally
|
|
98
|
+
registered = await register_mcp_tools(stream_manager, namespace=namespace)
|
|
99
|
+
|
|
100
|
+
# 3️⃣ build a processor instance configured to your taste
|
|
101
|
+
processor = ToolProcessor(
|
|
102
|
+
default_timeout=default_timeout,
|
|
103
|
+
max_concurrency=max_concurrency,
|
|
104
|
+
enable_caching=enable_caching,
|
|
105
|
+
cache_ttl=cache_ttl,
|
|
106
|
+
enable_rate_limiting=enable_rate_limiting,
|
|
107
|
+
global_rate_limit=global_rate_limit,
|
|
108
|
+
tool_rate_limits=tool_rate_limits,
|
|
109
|
+
enable_retries=enable_retries,
|
|
110
|
+
max_retries=max_retries,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
logger.info(
|
|
114
|
+
"MCP (HTTP Streamable) initialised - %s tool%s registered into namespace '%s'",
|
|
115
|
+
len(registered),
|
|
116
|
+
"" if len(registered) == 1 else "s",
|
|
117
|
+
namespace,
|
|
118
|
+
)
|
|
119
|
+
return processor, stream_manager
|
{chuk_tool_processor-0.5.2 → chuk_tool_processor-0.5.4}/src/chuk_tool_processor/mcp/setup_mcp_sse.py
RENAMED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# chuk_tool_processor/mcp/setup_mcp_sse.py
|
|
3
3
|
"""
|
|
4
|
-
|
|
4
|
+
Bootstrap helper for MCP over **SSE** transport.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
rate-limiting, retries, etc.
|
|
6
|
+
It:
|
|
7
|
+
|
|
8
|
+
1. spins up :class:`~chuk_tool_processor.mcp.stream_manager.StreamManager`
|
|
9
|
+
with the `"sse"` transport,
|
|
10
|
+
2. discovers & registers the remote MCP tools locally, and
|
|
11
|
+
3. returns a ready-to-use :class:`~chuk_tool_processor.core.processor.ToolProcessor`.
|
|
13
12
|
"""
|
|
14
13
|
|
|
15
14
|
from __future__ import annotations
|
|
16
15
|
|
|
17
|
-
import os
|
|
18
16
|
from typing import Dict, List, Optional, Tuple
|
|
19
17
|
|
|
20
18
|
from chuk_tool_processor.core.processor import ToolProcessor
|
|
@@ -28,11 +26,12 @@ logger = get_logger("chuk_tool_processor.mcp.setup_sse")
|
|
|
28
26
|
# --------------------------------------------------------------------------- #
|
|
29
27
|
# public helper
|
|
30
28
|
# --------------------------------------------------------------------------- #
|
|
31
|
-
async def setup_mcp_sse( # noqa: C901 - long
|
|
29
|
+
async def setup_mcp_sse( # noqa: C901 - long but just a config facade
|
|
32
30
|
*,
|
|
33
31
|
servers: List[Dict[str, str]],
|
|
34
32
|
server_names: Optional[Dict[int, str]] = None,
|
|
35
|
-
|
|
33
|
+
connection_timeout: float = 30.0, # 🔧 INCREASED DEFAULT: was 10.0
|
|
34
|
+
default_timeout: float = 30.0, # 🔧 INCREASED DEFAULT: was 10.0
|
|
36
35
|
max_concurrency: Optional[int] = None,
|
|
37
36
|
enable_caching: bool = True,
|
|
38
37
|
cache_ttl: int = 300,
|
|
@@ -41,43 +40,43 @@ async def setup_mcp_sse( # noqa: C901 - long, but just a config wrapper
|
|
|
41
40
|
tool_rate_limits: Optional[Dict[str, tuple]] = None,
|
|
42
41
|
enable_retries: bool = True,
|
|
43
42
|
max_retries: int = 3,
|
|
44
|
-
namespace: str = "
|
|
43
|
+
namespace: str = "sse",
|
|
45
44
|
) -> Tuple[ToolProcessor, StreamManager]:
|
|
46
45
|
"""
|
|
47
|
-
|
|
48
|
-
and return a ready-to-go :class:`ToolProcessor`.
|
|
46
|
+
Initialise SSE-transport MCP + a :class:`ToolProcessor`.
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
NEW: Automatically detects and adds bearer token from MCP_BEARER_TOKEN
|
|
53
|
-
environment variable if not explicitly provided in server config.
|
|
54
|
-
"""
|
|
48
|
+
Call with ``await`` from your async context.
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
Args:
|
|
51
|
+
servers: List of server configurations with 'name' and 'url' keys
|
|
52
|
+
server_names: Optional mapping of server indices to names
|
|
53
|
+
connection_timeout: Timeout for initial SSE connection setup
|
|
54
|
+
default_timeout: Default timeout for tool execution
|
|
55
|
+
max_concurrency: Maximum concurrent operations
|
|
56
|
+
enable_caching: Whether to enable response caching
|
|
57
|
+
cache_ttl: Cache time-to-live in seconds
|
|
58
|
+
enable_rate_limiting: Whether to enable rate limiting
|
|
59
|
+
global_rate_limit: Global rate limit (requests per minute)
|
|
60
|
+
tool_rate_limits: Per-tool rate limits
|
|
61
|
+
enable_retries: Whether to enable automatic retries
|
|
62
|
+
max_retries: Maximum retry attempts
|
|
63
|
+
namespace: Namespace for registered tools
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if "api_key" not in enhanced_server and bearer_token:
|
|
66
|
-
enhanced_server["api_key"] = bearer_token
|
|
67
|
-
logger.info("Added bearer token to server: %s", enhanced_server.get("name", "unnamed"))
|
|
68
|
-
enhanced_servers.append(enhanced_server)
|
|
69
|
-
servers = enhanced_servers
|
|
70
|
-
|
|
71
|
-
# 1️⃣ connect to the remote MCP servers
|
|
65
|
+
Returns:
|
|
66
|
+
Tuple of (ToolProcessor, StreamManager)
|
|
67
|
+
"""
|
|
68
|
+
# 1️⃣ create & connect the stream-manager with BOTH timeout parameters
|
|
72
69
|
stream_manager = await StreamManager.create_with_sse(
|
|
73
70
|
servers=servers,
|
|
74
71
|
server_names=server_names,
|
|
72
|
+
connection_timeout=connection_timeout, # 🔧 ADD THIS LINE
|
|
73
|
+
default_timeout=default_timeout, # 🔧 ADD THIS LINE
|
|
75
74
|
)
|
|
76
75
|
|
|
77
|
-
# 2️⃣
|
|
76
|
+
# 2️⃣ pull the remote tool list and register each one locally
|
|
78
77
|
registered = await register_mcp_tools(stream_manager, namespace=namespace)
|
|
79
78
|
|
|
80
|
-
# 3️⃣ build a processor configured to your
|
|
79
|
+
# 3️⃣ build a processor instance configured to your taste
|
|
81
80
|
processor = ToolProcessor(
|
|
82
81
|
default_timeout=default_timeout,
|
|
83
82
|
max_concurrency=max_concurrency,
|
|
@@ -48,11 +48,13 @@ async def setup_mcp_stdio( # noqa: C901 - long but just a config facade
|
|
|
48
48
|
Call with ``await`` from your async context.
|
|
49
49
|
"""
|
|
50
50
|
# 1️⃣ create & connect the stream-manager
|
|
51
|
+
# FIXED: Pass the default_timeout parameter to StreamManager.create
|
|
51
52
|
stream_manager = await StreamManager.create(
|
|
52
53
|
config_file=config_file,
|
|
53
54
|
servers=servers,
|
|
54
55
|
server_names=server_names,
|
|
55
56
|
transport_type="stdio",
|
|
57
|
+
default_timeout=default_timeout, # 🔧 ADD THIS LINE
|
|
56
58
|
)
|
|
57
59
|
|
|
58
60
|
# 2️⃣ pull the remote tool list and register each one locally
|
|
@@ -77,4 +79,4 @@ async def setup_mcp_stdio( # noqa: C901 - long but just a config facade
|
|
|
77
79
|
"" if len(registered) == 1 else "s",
|
|
78
80
|
namespace,
|
|
79
81
|
)
|
|
80
|
-
return processor, stream_manager
|
|
82
|
+
return processor, stream_manager
|