chuk-tool-processor 0.5.4__tar.gz → 0.6__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.4 → chuk_tool_processor-0.6}/PKG-INFO +2 -2
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/pyproject.toml +2 -2
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/execution/wrappers/retry.py +1 -1
- chuk_tool_processor-0.6/src/chuk_tool_processor/mcp/transport/__init__.py +39 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/transport/http_streamable_transport.py +84 -83
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor.egg-info/PKG-INFO +2 -2
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor.egg-info/requires.txt +1 -1
- chuk_tool_processor-0.5.4/src/chuk_tool_processor/mcp/transport/__init__.py +0 -16
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/README.md +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/setup.cfg +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/core/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/core/exceptions.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/core/processor.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/execution/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/execution/strategies/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/execution/strategies/inprocess_strategy.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/execution/strategies/subprocess_strategy.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/execution/tool_executor.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/execution/wrappers/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/execution/wrappers/caching.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/execution/wrappers/rate_limiting.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/logging/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/logging/context.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/logging/formatter.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/logging/helpers.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/logging/metrics.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/mcp_tool.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/register_mcp_tools.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/setup_mcp_http_streamable.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/setup_mcp_sse.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/setup_mcp_stdio.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/stream_manager.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/transport/base_transport.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/transport/sse_transport.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/transport/stdio_transport.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/models/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/models/execution_strategy.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/models/streaming_tool.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/models/tool_call.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/models/tool_export_mixin.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/models/tool_result.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/models/validated_tool.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/plugins/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/plugins/discovery.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/plugins/parsers/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/plugins/parsers/base.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/plugins/parsers/function_call_tool.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/plugins/parsers/json_tool.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/plugins/parsers/openai_tool.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/plugins/parsers/xml_tool.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/auto_register.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/decorators.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/interface.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/metadata.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/provider.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/providers/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/providers/memory.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/tool_export.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/utils/__init__.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/utils/validation.py +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor.egg-info/SOURCES.txt +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor.egg-info/dependency_links.txt +0 -0
- {chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/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.
|
|
3
|
+
Version: 0.6
|
|
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.
|
|
7
|
+
Requires-Dist: chuk-mcp>=0.5
|
|
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.
|
|
7
|
+
version = "0.6"
|
|
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.
|
|
12
|
+
"chuk-mcp>=0.5",
|
|
13
13
|
"dotenv>=0.9.9",
|
|
14
14
|
"pydantic>=2.11.3",
|
|
15
15
|
"uuid>=1.30",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
Async-native retry wrapper for tool execution.
|
|
4
4
|
|
|
5
|
-
Adds exponential
|
|
5
|
+
Adds exponential-back-off retry logic and *deadline-aware* timeout handling so a
|
|
6
6
|
`timeout=` passed by callers is treated as the **total wall-clock budget** for
|
|
7
7
|
all attempts of a single tool call.
|
|
8
8
|
"""
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# chuk_tool_processor/mcp/transport/__init__.py
|
|
2
|
+
"""
|
|
3
|
+
MCP Transport module providing multiple transport implementations.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .base_transport import MCPBaseTransport
|
|
7
|
+
|
|
8
|
+
# Always available transports
|
|
9
|
+
try:
|
|
10
|
+
from .stdio_transport import StdioTransport
|
|
11
|
+
HAS_STDIO_TRANSPORT = True
|
|
12
|
+
except ImportError:
|
|
13
|
+
StdioTransport = None
|
|
14
|
+
HAS_STDIO_TRANSPORT = False
|
|
15
|
+
|
|
16
|
+
# Conditionally available transports
|
|
17
|
+
try:
|
|
18
|
+
from .sse_transport import SSETransport
|
|
19
|
+
HAS_SSE_TRANSPORT = True
|
|
20
|
+
except ImportError:
|
|
21
|
+
SSETransport = None
|
|
22
|
+
HAS_SSE_TRANSPORT = False
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
from .http_streamable_transport import HTTPStreamableTransport
|
|
26
|
+
HAS_HTTP_STREAMABLE_TRANSPORT = True
|
|
27
|
+
except ImportError:
|
|
28
|
+
HTTPStreamableTransport = None
|
|
29
|
+
HAS_HTTP_STREAMABLE_TRANSPORT = False
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
"MCPBaseTransport",
|
|
33
|
+
"StdioTransport",
|
|
34
|
+
"SSETransport",
|
|
35
|
+
"HTTPStreamableTransport",
|
|
36
|
+
"HAS_STDIO_TRANSPORT",
|
|
37
|
+
"HAS_SSE_TRANSPORT",
|
|
38
|
+
"HAS_HTTP_STREAMABLE_TRANSPORT"
|
|
39
|
+
]
|
|
@@ -9,65 +9,51 @@ import logging
|
|
|
9
9
|
|
|
10
10
|
from .base_transport import MCPBaseTransport
|
|
11
11
|
|
|
12
|
-
# Import
|
|
13
|
-
# Try different possible naming conventions
|
|
14
|
-
try:
|
|
15
|
-
# First try the expected naming
|
|
16
|
-
from chuk_mcp.transports.http_streamable import http_streamable_client
|
|
17
|
-
from chuk_mcp.transports.http_streamable.parameters import HTTPStreamableParameters
|
|
18
|
-
HAS_HTTP_STREAMABLE_SUPPORT = True
|
|
19
|
-
STREAMABLE_CLIENT = http_streamable_client
|
|
20
|
-
STREAMABLE_PARAMS = HTTPStreamableParameters
|
|
21
|
-
except ImportError:
|
|
22
|
-
try:
|
|
23
|
-
# Try alternative naming
|
|
24
|
-
from chuk_mcp.transports.streamable_http import streamable_http_client
|
|
25
|
-
from chuk_mcp.transports.streamable_http.parameters import StreamableHttpParameters
|
|
26
|
-
HAS_HTTP_STREAMABLE_SUPPORT = True
|
|
27
|
-
STREAMABLE_CLIENT = streamable_http_client
|
|
28
|
-
STREAMABLE_PARAMS = StreamableHttpParameters
|
|
29
|
-
except ImportError:
|
|
30
|
-
HAS_HTTP_STREAMABLE_SUPPORT = False
|
|
31
|
-
|
|
32
|
-
# Import protocol messages
|
|
12
|
+
# Import chuk-mcp HTTP transport components
|
|
33
13
|
try:
|
|
14
|
+
from chuk_mcp.transports.http import http_client
|
|
15
|
+
from chuk_mcp.transports.http.parameters import StreamableHTTPParameters
|
|
34
16
|
from chuk_mcp.protocol.messages import (
|
|
17
|
+
send_initialize,
|
|
35
18
|
send_ping,
|
|
36
19
|
send_tools_list,
|
|
37
20
|
send_tools_call,
|
|
21
|
+
)
|
|
22
|
+
HAS_HTTP_SUPPORT = True
|
|
23
|
+
except ImportError:
|
|
24
|
+
HAS_HTTP_SUPPORT = False
|
|
25
|
+
|
|
26
|
+
# Import optional resource and prompt support
|
|
27
|
+
try:
|
|
28
|
+
from chuk_mcp.protocol.messages import (
|
|
38
29
|
send_resources_list,
|
|
30
|
+
send_resources_read,
|
|
39
31
|
send_prompts_list,
|
|
32
|
+
send_prompts_get,
|
|
40
33
|
)
|
|
41
|
-
|
|
34
|
+
HAS_RESOURCES_PROMPTS = True
|
|
42
35
|
except ImportError:
|
|
43
|
-
|
|
36
|
+
HAS_RESOURCES_PROMPTS = False
|
|
44
37
|
|
|
45
38
|
logger = logging.getLogger(__name__)
|
|
46
39
|
|
|
47
40
|
|
|
48
41
|
class HTTPStreamableTransport(MCPBaseTransport):
|
|
49
42
|
"""
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
This implements the modern Streamable HTTP transport (spec 2025-03-26)
|
|
53
|
-
which replaces the deprecated SSE transport with a cleaner, more flexible approach.
|
|
43
|
+
HTTP Streamable transport using chuk-mcp HTTP client.
|
|
54
44
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- Works with standard HTTP infrastructure
|
|
58
|
-
- Supports both immediate and streaming responses
|
|
59
|
-
- Better error handling and retry logic
|
|
60
|
-
- Stateless operation when streaming not needed
|
|
45
|
+
This implements the modern MCP spec (2025-03-26) replacement for SSE transport.
|
|
46
|
+
Follows the same patterns as SSETransport but uses HTTP requests instead of SSE.
|
|
61
47
|
"""
|
|
62
48
|
|
|
63
49
|
def __init__(self, url: str, api_key: Optional[str] = None,
|
|
64
50
|
connection_timeout: float = 30.0, default_timeout: float = 30.0,
|
|
65
51
|
session_id: Optional[str] = None, enable_metrics: bool = True):
|
|
66
52
|
"""
|
|
67
|
-
Initialize HTTP Streamable transport.
|
|
53
|
+
Initialize HTTP Streamable transport with chuk-mcp.
|
|
68
54
|
|
|
69
55
|
Args:
|
|
70
|
-
url:
|
|
56
|
+
url: HTTP server URL (should end with /mcp)
|
|
71
57
|
api_key: Optional API key for authentication
|
|
72
58
|
connection_timeout: Timeout for initial connection
|
|
73
59
|
default_timeout: Default timeout for operations
|
|
@@ -86,13 +72,13 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
86
72
|
self.session_id = session_id
|
|
87
73
|
self.enable_metrics = enable_metrics
|
|
88
74
|
|
|
89
|
-
# State tracking
|
|
90
|
-
self.
|
|
75
|
+
# State tracking (following SSE pattern)
|
|
76
|
+
self._http_context = None
|
|
91
77
|
self._read_stream = None
|
|
92
78
|
self._write_stream = None
|
|
93
79
|
self._initialized = False
|
|
94
80
|
|
|
95
|
-
# Performance metrics
|
|
81
|
+
# Performance metrics (enhanced from SSE version)
|
|
96
82
|
self._metrics = {
|
|
97
83
|
"total_calls": 0,
|
|
98
84
|
"successful_calls": 0,
|
|
@@ -103,15 +89,15 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
103
89
|
"initialization_time": None
|
|
104
90
|
}
|
|
105
91
|
|
|
106
|
-
if not
|
|
92
|
+
if not HAS_HTTP_SUPPORT:
|
|
107
93
|
logger.warning("HTTP Streamable transport not available - operations will fail")
|
|
108
|
-
if not
|
|
109
|
-
logger.
|
|
94
|
+
if not HAS_RESOURCES_PROMPTS:
|
|
95
|
+
logger.debug("Resources/prompts not available in chuk-mcp")
|
|
110
96
|
|
|
111
97
|
async def initialize(self) -> bool:
|
|
112
|
-
"""Initialize using
|
|
113
|
-
if not
|
|
114
|
-
logger.error("HTTP Streamable transport
|
|
98
|
+
"""Initialize using chuk-mcp http_client (following SSE pattern)."""
|
|
99
|
+
if not HAS_HTTP_SUPPORT:
|
|
100
|
+
logger.error("HTTP Streamable transport not available in chuk-mcp")
|
|
115
101
|
return False
|
|
116
102
|
|
|
117
103
|
if self._initialized:
|
|
@@ -123,32 +109,37 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
123
109
|
try:
|
|
124
110
|
logger.info(f"Initializing HTTP Streamable transport to {self.url}")
|
|
125
111
|
|
|
126
|
-
# Create HTTP
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
112
|
+
# Create HTTP parameters for chuk-mcp (following SSE pattern)
|
|
113
|
+
headers = {}
|
|
114
|
+
if self.api_key:
|
|
115
|
+
headers["Authorization"] = f"Bearer {self.api_key}"
|
|
116
|
+
logger.debug("API key configured for authentication")
|
|
131
117
|
|
|
132
|
-
# Add session ID if provided
|
|
133
118
|
if self.session_id:
|
|
134
|
-
|
|
119
|
+
headers["X-Session-ID"] = self.session_id
|
|
135
120
|
logger.debug(f"Using session ID: {self.session_id}")
|
|
136
121
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
122
|
+
http_params = StreamableHTTPParameters(
|
|
123
|
+
url=self.url,
|
|
124
|
+
timeout=self.connection_timeout,
|
|
125
|
+
headers=headers,
|
|
126
|
+
bearer_token=self.api_key,
|
|
127
|
+
session_id=self.session_id,
|
|
128
|
+
enable_streaming=True, # Enable SSE streaming when available
|
|
129
|
+
max_concurrent_requests=10
|
|
130
|
+
)
|
|
141
131
|
|
|
142
|
-
# Create and enter the context
|
|
143
|
-
self.
|
|
132
|
+
# Create and enter the HTTP context (same pattern as SSE)
|
|
133
|
+
self._http_context = http_client(http_params)
|
|
144
134
|
|
|
145
|
-
logger.debug("Establishing HTTP
|
|
135
|
+
logger.debug("Establishing HTTP connection and MCP handshake...")
|
|
146
136
|
self._read_stream, self._write_stream = await asyncio.wait_for(
|
|
147
|
-
self.
|
|
137
|
+
self._http_context.__aenter__(),
|
|
148
138
|
timeout=self.connection_timeout
|
|
149
139
|
)
|
|
150
140
|
|
|
151
|
-
#
|
|
141
|
+
# At this point, chuk-mcp should have established the HTTP connection
|
|
142
|
+
# Verify the connection works with a simple ping (same as SSE)
|
|
152
143
|
logger.debug("Verifying connection with ping...")
|
|
153
144
|
ping_start = time.time()
|
|
154
145
|
ping_success = await asyncio.wait_for(
|
|
@@ -166,14 +157,15 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
166
157
|
logger.info(f"HTTP Streamable transport initialized successfully in {init_time:.3f}s (ping: {ping_time:.3f}s)")
|
|
167
158
|
return True
|
|
168
159
|
else:
|
|
169
|
-
logger.warning("HTTP
|
|
170
|
-
# Still consider it initialized since connection was established
|
|
160
|
+
logger.warning("HTTP connection established but ping failed")
|
|
161
|
+
# Still consider it initialized since connection was established (same as SSE)
|
|
171
162
|
self._initialized = True
|
|
172
163
|
self._metrics["initialization_time"] = time.time() - start_time
|
|
173
164
|
return True
|
|
174
165
|
|
|
175
166
|
except asyncio.TimeoutError:
|
|
176
167
|
logger.error(f"HTTP Streamable initialization timed out after {self.connection_timeout}s")
|
|
168
|
+
logger.error("This may indicate the server is not responding to MCP initialization")
|
|
177
169
|
await self._cleanup()
|
|
178
170
|
return False
|
|
179
171
|
except Exception as e:
|
|
@@ -182,11 +174,11 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
182
174
|
return False
|
|
183
175
|
|
|
184
176
|
async def close(self) -> None:
|
|
185
|
-
"""Close the HTTP Streamable transport properly
|
|
177
|
+
"""Close the HTTP Streamable transport properly (same pattern as SSE)."""
|
|
186
178
|
if not self._initialized:
|
|
187
179
|
return
|
|
188
180
|
|
|
189
|
-
# Log final metrics
|
|
181
|
+
# Log final metrics (enhanced from SSE)
|
|
190
182
|
if self.enable_metrics and self._metrics["total_calls"] > 0:
|
|
191
183
|
logger.info(
|
|
192
184
|
f"HTTP Streamable transport closing - Total calls: {self._metrics['total_calls']}, "
|
|
@@ -195,8 +187,8 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
195
187
|
)
|
|
196
188
|
|
|
197
189
|
try:
|
|
198
|
-
if self.
|
|
199
|
-
await self.
|
|
190
|
+
if self._http_context is not None:
|
|
191
|
+
await self._http_context.__aexit__(None, None, None)
|
|
200
192
|
logger.debug("HTTP Streamable context closed")
|
|
201
193
|
|
|
202
194
|
except Exception as e:
|
|
@@ -205,22 +197,23 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
205
197
|
await self._cleanup()
|
|
206
198
|
|
|
207
199
|
async def _cleanup(self) -> None:
|
|
208
|
-
"""Clean up internal state."""
|
|
209
|
-
self.
|
|
200
|
+
"""Clean up internal state (same as SSE)."""
|
|
201
|
+
self._http_context = None
|
|
210
202
|
self._read_stream = None
|
|
211
203
|
self._write_stream = None
|
|
212
204
|
self._initialized = False
|
|
213
205
|
|
|
214
206
|
async def send_ping(self) -> bool:
|
|
215
|
-
"""Send ping with performance tracking."""
|
|
207
|
+
"""Send ping with performance tracking (enhanced from SSE)."""
|
|
216
208
|
if not self._initialized or not self._read_stream:
|
|
209
|
+
logger.error("Cannot send ping: transport not initialized")
|
|
217
210
|
return False
|
|
218
211
|
|
|
219
212
|
start_time = time.time()
|
|
220
213
|
try:
|
|
221
214
|
result = await asyncio.wait_for(
|
|
222
215
|
send_ping(self._read_stream, self._write_stream),
|
|
223
|
-
timeout=
|
|
216
|
+
timeout=self.default_timeout
|
|
224
217
|
)
|
|
225
218
|
|
|
226
219
|
if self.enable_metrics:
|
|
@@ -237,7 +230,7 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
237
230
|
return False
|
|
238
231
|
|
|
239
232
|
async def get_tools(self) -> List[Dict[str, Any]]:
|
|
240
|
-
"""Get tools list with performance tracking."""
|
|
233
|
+
"""Get tools list with performance tracking (enhanced from SSE)."""
|
|
241
234
|
if not self._initialized:
|
|
242
235
|
logger.error("Cannot get tools: transport not initialized")
|
|
243
236
|
return []
|
|
@@ -249,7 +242,7 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
249
242
|
timeout=self.default_timeout
|
|
250
243
|
)
|
|
251
244
|
|
|
252
|
-
# Normalize response
|
|
245
|
+
# Normalize response (same as SSE)
|
|
253
246
|
if isinstance(tools_response, dict):
|
|
254
247
|
tools = tools_response.get("tools", [])
|
|
255
248
|
elif isinstance(tools_response, list):
|
|
@@ -336,7 +329,7 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
336
329
|
}
|
|
337
330
|
|
|
338
331
|
def _update_metrics(self, response_time: float, success: bool) -> None:
|
|
339
|
-
"""Update performance metrics."""
|
|
332
|
+
"""Update performance metrics (new feature)."""
|
|
340
333
|
if success:
|
|
341
334
|
self._metrics["successful_calls"] += 1
|
|
342
335
|
else:
|
|
@@ -348,7 +341,11 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
348
341
|
)
|
|
349
342
|
|
|
350
343
|
async def list_resources(self) -> Dict[str, Any]:
|
|
351
|
-
"""List resources using
|
|
344
|
+
"""List resources using chuk-mcp (same as SSE)."""
|
|
345
|
+
if not HAS_RESOURCES_PROMPTS:
|
|
346
|
+
logger.debug("Resources/prompts not available in chuk-mcp")
|
|
347
|
+
return {}
|
|
348
|
+
|
|
352
349
|
if not self._initialized:
|
|
353
350
|
return {}
|
|
354
351
|
|
|
@@ -366,7 +363,11 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
366
363
|
return {}
|
|
367
364
|
|
|
368
365
|
async def list_prompts(self) -> Dict[str, Any]:
|
|
369
|
-
"""List prompts using
|
|
366
|
+
"""List prompts using chuk-mcp (same as SSE)."""
|
|
367
|
+
if not HAS_RESOURCES_PROMPTS:
|
|
368
|
+
logger.debug("Resources/prompts not available in chuk-mcp")
|
|
369
|
+
return {}
|
|
370
|
+
|
|
370
371
|
if not self._initialized:
|
|
371
372
|
return {}
|
|
372
373
|
|
|
@@ -384,7 +385,7 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
384
385
|
return {}
|
|
385
386
|
|
|
386
387
|
def _normalize_tool_response(self, raw_response: Dict[str, Any]) -> Dict[str, Any]:
|
|
387
|
-
"""Normalize response for backward compatibility."""
|
|
388
|
+
"""Normalize response for backward compatibility (same as SSE)."""
|
|
388
389
|
# Handle explicit error in response
|
|
389
390
|
if "error" in raw_response:
|
|
390
391
|
error_info = raw_response["error"]
|
|
@@ -427,7 +428,7 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
427
428
|
}
|
|
428
429
|
|
|
429
430
|
def _extract_content(self, content_list: Any) -> Any:
|
|
430
|
-
"""Extract content from MCP content format
|
|
431
|
+
"""Extract content from MCP content format (same as SSE)."""
|
|
431
432
|
if not isinstance(content_list, list) or not content_list:
|
|
432
433
|
return content_list
|
|
433
434
|
|
|
@@ -449,21 +450,21 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
449
450
|
return content_list
|
|
450
451
|
|
|
451
452
|
def get_streams(self) -> List[tuple]:
|
|
452
|
-
"""Provide streams for backward compatibility."""
|
|
453
|
+
"""Provide streams for backward compatibility (same as SSE)."""
|
|
453
454
|
if self._initialized and self._read_stream and self._write_stream:
|
|
454
455
|
return [(self._read_stream, self._write_stream)]
|
|
455
456
|
return []
|
|
456
457
|
|
|
457
458
|
def is_connected(self) -> bool:
|
|
458
|
-
"""Check connection status."""
|
|
459
|
+
"""Check connection status (same as SSE)."""
|
|
459
460
|
return self._initialized and self._read_stream is not None and self._write_stream is not None
|
|
460
461
|
|
|
461
462
|
def get_metrics(self) -> Dict[str, Any]:
|
|
462
|
-
"""Get performance metrics."""
|
|
463
|
+
"""Get performance metrics (new feature)."""
|
|
463
464
|
return self._metrics.copy()
|
|
464
465
|
|
|
465
466
|
def reset_metrics(self) -> None:
|
|
466
|
-
"""Reset performance metrics."""
|
|
467
|
+
"""Reset performance metrics (new feature)."""
|
|
467
468
|
self._metrics = {
|
|
468
469
|
"total_calls": 0,
|
|
469
470
|
"successful_calls": 0,
|
|
@@ -475,14 +476,14 @@ class HTTPStreamableTransport(MCPBaseTransport):
|
|
|
475
476
|
}
|
|
476
477
|
|
|
477
478
|
async def __aenter__(self):
|
|
478
|
-
"""Context manager support."""
|
|
479
|
+
"""Context manager support (same as SSE)."""
|
|
479
480
|
success = await self.initialize()
|
|
480
481
|
if not success:
|
|
481
482
|
raise RuntimeError("Failed to initialize HTTP Streamable transport")
|
|
482
483
|
return self
|
|
483
484
|
|
|
484
485
|
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
485
|
-
"""Context manager cleanup."""
|
|
486
|
+
"""Context manager cleanup (same as SSE)."""
|
|
486
487
|
await self.close()
|
|
487
488
|
|
|
488
489
|
def __repr__(self) -> str:
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor.egg-info/PKG-INFO
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chuk-tool-processor
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6
|
|
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.
|
|
7
|
+
Requires-Dist: chuk-mcp>=0.5
|
|
8
8
|
Requires-Dist: dotenv>=0.9.9
|
|
9
9
|
Requires-Dist: pydantic>=2.11.3
|
|
10
10
|
Requires-Dist: uuid>=1.30
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# chuk_tool_processor/mcp/transport/__init__.py
|
|
2
|
-
"""
|
|
3
|
-
MCP transport implementations.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from .base_transport import MCPBaseTransport
|
|
7
|
-
from .stdio_transport import StdioTransport
|
|
8
|
-
from .sse_transport import SSETransport
|
|
9
|
-
from .http_streamable_transport import HTTPStreamableTransport
|
|
10
|
-
|
|
11
|
-
__all__ = [
|
|
12
|
-
"MCPBaseTransport",
|
|
13
|
-
"StdioTransport",
|
|
14
|
-
"SSETransport",
|
|
15
|
-
"HTTPStreamableTransport"
|
|
16
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/core/__init__.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/core/exceptions.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/core/processor.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/execution/__init__.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
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/logging/__init__.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/logging/context.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/logging/formatter.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/logging/helpers.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/logging/metrics.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/__init__.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/mcp_tool.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/setup_mcp_sse.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/setup_mcp_stdio.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/mcp/stream_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/models/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/models/tool_call.py
RENAMED
|
File without changes
|
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/models/tool_result.py
RENAMED
|
File without changes
|
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/plugins/__init__.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/plugins/discovery.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/decorators.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/interface.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/metadata.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/registry/provider.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/utils/__init__.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor/utils/validation.py
RENAMED
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{chuk_tool_processor-0.5.4 → chuk_tool_processor-0.6}/src/chuk_tool_processor.egg-info/top_level.txt
RENAMED
|
File without changes
|