mcp-proxy-adapter 6.4.47__py3-none-any.whl → 6.4.48__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.
- mcp_proxy_adapter/api/handlers.py +58 -22
- mcp_proxy_adapter/version.py +1 -1
- {mcp_proxy_adapter-6.4.47.dist-info → mcp_proxy_adapter-6.4.48.dist-info}/METADATA +1 -1
- {mcp_proxy_adapter-6.4.47.dist-info → mcp_proxy_adapter-6.4.48.dist-info}/RECORD +7 -7
- {mcp_proxy_adapter-6.4.47.dist-info → mcp_proxy_adapter-6.4.48.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-6.4.47.dist-info → mcp_proxy_adapter-6.4.48.dist-info}/entry_points.txt +0 -0
- {mcp_proxy_adapter-6.4.47.dist-info → mcp_proxy_adapter-6.4.48.dist-info}/top_level.txt +0 -0
@@ -2,6 +2,7 @@
|
|
2
2
|
Module with API request handlers.
|
3
3
|
"""
|
4
4
|
|
5
|
+
import asyncio
|
5
6
|
import json
|
6
7
|
import time
|
7
8
|
from typing import Any, Dict, List, Optional, Union
|
@@ -75,7 +76,16 @@ async def execute_command(
|
|
75
76
|
"permissions": getattr(request.state, "user_permissions", ["read"]),
|
76
77
|
}
|
77
78
|
|
78
|
-
|
79
|
+
# Add timeout to prevent hanging commands
|
80
|
+
try:
|
81
|
+
result = await asyncio.wait_for(
|
82
|
+
command_class.run(**params, context=context),
|
83
|
+
timeout=10.0 # 10 seconds timeout
|
84
|
+
)
|
85
|
+
except asyncio.TimeoutError:
|
86
|
+
execution_time = time.time() - start_time
|
87
|
+
log.error(f"⏰ Command '{command_name}' timed out after {execution_time:.3f} sec")
|
88
|
+
raise InternalError(f"Command execution timed out after 10 seconds")
|
79
89
|
|
80
90
|
execution_time = time.time() - start_time
|
81
91
|
|
@@ -136,7 +146,7 @@ async def handle_json_rpc(
|
|
136
146
|
request: Optional[Request] = None,
|
137
147
|
) -> Dict[str, Any]:
|
138
148
|
"""
|
139
|
-
Handles JSON-RPC request.
|
149
|
+
Handles JSON-RPC request with support for both standard JSON-RPC and simplified formats.
|
140
150
|
|
141
151
|
Args:
|
142
152
|
request_data: JSON-RPC request data.
|
@@ -148,40 +158,66 @@ async def handle_json_rpc(
|
|
148
158
|
# Create request logger if request_id is provided
|
149
159
|
log = RequestLogger(__name__, request_id) if request_id else logger
|
150
160
|
|
151
|
-
#
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
)
|
161
|
+
# Support both standard JSON-RPC and simplified formats
|
162
|
+
method = None
|
163
|
+
params = {}
|
164
|
+
json_rpc_id = None
|
165
|
+
|
166
|
+
# Check if it's a standard JSON-RPC request
|
167
|
+
if "jsonrpc" in request_data:
|
168
|
+
# Standard JSON-RPC format
|
169
|
+
if request_data.get("jsonrpc") != "2.0":
|
170
|
+
return _create_error_response(
|
171
|
+
InvalidRequestError("Invalid Request. Expected jsonrpc: 2.0"),
|
172
|
+
request_data.get("id"),
|
173
|
+
)
|
174
|
+
|
175
|
+
method = request_data.get("method")
|
176
|
+
params = request_data.get("params", {})
|
177
|
+
json_rpc_id = request_data.get("id")
|
178
|
+
|
179
|
+
if not method:
|
180
|
+
return _create_error_response(
|
181
|
+
InvalidRequestError("Invalid Request. Method is required"), json_rpc_id
|
182
|
+
)
|
183
|
+
else:
|
184
|
+
# Simplified format: {"command": "help"} or {"command": "echo", "params": {...}}
|
185
|
+
method = request_data.get("command")
|
186
|
+
params = request_data.get("params", {})
|
187
|
+
json_rpc_id = request_data.get("id", 1) # Default ID for simplified format
|
188
|
+
|
189
|
+
if not method:
|
190
|
+
return _create_error_response(
|
191
|
+
InvalidRequestError("Invalid Request. Command is required"), json_rpc_id
|
192
|
+
)
|
193
|
+
|
194
|
+
log.info(f"Using simplified format for command: {method}")
|
167
195
|
|
168
196
|
log.info(f"Executing JSON-RPC method: {method}")
|
169
197
|
|
170
198
|
try:
|
171
|
-
# Execute command
|
199
|
+
# Execute command with detailed logging
|
200
|
+
log.info(f"🔍 Starting command execution: {method}")
|
201
|
+
log.debug(f"📋 Command params: {params}")
|
202
|
+
|
172
203
|
result = await execute_command(method, params, request_id, request)
|
173
204
|
|
205
|
+
log.info(f"✅ Command {method} completed successfully")
|
206
|
+
|
174
207
|
# Form successful response
|
175
208
|
return {"jsonrpc": "2.0", "result": result, "id": json_rpc_id}
|
176
209
|
except MicroserviceError as e:
|
177
210
|
# Method execution error
|
178
|
-
log.error(f"Method execution error: {str(e)}")
|
211
|
+
log.error(f"❌ Method execution error: {str(e)}")
|
212
|
+
log.error(f"📊 Error type: {type(e).__name__}")
|
179
213
|
return _create_error_response(e, json_rpc_id)
|
180
214
|
except Exception as e:
|
181
215
|
# Internal server error
|
182
|
-
log.exception(f"Unhandled error in JSON-RPC handler: {e}")
|
216
|
+
log.exception(f"❌ Unhandled error in JSON-RPC handler: {e}")
|
217
|
+
log.error(f"📊 Exception type: {type(e).__name__}")
|
218
|
+
log.error(f"📊 Exception details: {repr(e)}")
|
183
219
|
return _create_error_response(
|
184
|
-
InternalError("Internal error", data={"error": str(e)}), json_rpc_id
|
220
|
+
InternalError("Internal error", data={"error": str(e), "error_type": type(e).__name__}), json_rpc_id
|
185
221
|
)
|
186
222
|
|
187
223
|
|
mcp_proxy_adapter/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-proxy-adapter
|
3
|
-
Version: 6.4.
|
3
|
+
Version: 6.4.48
|
4
4
|
Summary: Powerful JSON-RPC microservices framework with built-in security, authentication, and proxy registration
|
5
5
|
Home-page: https://github.com/maverikod/mcp-proxy-adapter
|
6
6
|
Author: Vasiliy Zdanovskiy
|
@@ -4,10 +4,10 @@ mcp_proxy_adapter/config.py,sha256=-7iVS0mUWWKNeao7nqTAFlUD6FcMwRlDkchN7OwYsr0,2
|
|
4
4
|
mcp_proxy_adapter/custom_openapi.py,sha256=XRviX-C-ZkSKdBhORhDTdeN_1FWyEfXZADiASft3t9I,28149
|
5
5
|
mcp_proxy_adapter/main.py,sha256=idp3KUR7CT7kTXLVPvvclJlNnt8d_HYl8_jY98uknmo,4677
|
6
6
|
mcp_proxy_adapter/openapi.py,sha256=2UZOI09ZDRJuBYBjKbMyb2U4uASszoCMD5o_4ktRpvg,13480
|
7
|
-
mcp_proxy_adapter/version.py,sha256=
|
7
|
+
mcp_proxy_adapter/version.py,sha256=Qsn1lO8hzs3Z5wG56326GM6FBBR72I5vBZv3h8BXVcI,75
|
8
8
|
mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
mcp_proxy_adapter/api/app.py,sha256=cxjavhNTtaYg2ea-UeHSDnKh8edKVNQ2NbXUDYbufFU,34183
|
10
|
-
mcp_proxy_adapter/api/handlers.py,sha256=
|
10
|
+
mcp_proxy_adapter/api/handlers.py,sha256=X-hcMNVeTAu4yVkKJEChEsj2bFptUS6sLNN-Wysjkow,10011
|
11
11
|
mcp_proxy_adapter/api/schemas.py,sha256=mevUvQnYgWQfkJAs3-vq3HalBzh6-Saa-Au1VVf0peE,12377
|
12
12
|
mcp_proxy_adapter/api/tool_integration.py,sha256=AeUyvJVN-c3FrX5fHdagHL51saRH5d1ZKqc2YEx0rTE,10147
|
13
13
|
mcp_proxy_adapter/api/tools.py,sha256=nDQkxwgn11e1tR7kNfdYWsLAUogKmkEv8cVOYUtOq9U,8025
|
@@ -130,8 +130,8 @@ mcp_proxy_adapter/schemas/base_schema.json,sha256=v9G9cGMd4dRhCZsOQ_FMqOi5VFyVbI
|
|
130
130
|
mcp_proxy_adapter/schemas/openapi_schema.json,sha256=C3yLkwmDsvnLW9B5gnKKdBGl4zxkeU-rEmjTrNVsQU0,8405
|
131
131
|
mcp_proxy_adapter/schemas/roles.json,sha256=pgf_ZyqKyXbfGUxvobpiLiSJz9zzxrMuoVWEkEpz3N8,764
|
132
132
|
mcp_proxy_adapter/schemas/roles_schema.json,sha256=deHgI7L6GwfBXacOlNtDgDJelDThppClC3Ti4Eh8rJY,5659
|
133
|
-
mcp_proxy_adapter-6.4.
|
134
|
-
mcp_proxy_adapter-6.4.
|
135
|
-
mcp_proxy_adapter-6.4.
|
136
|
-
mcp_proxy_adapter-6.4.
|
137
|
-
mcp_proxy_adapter-6.4.
|
133
|
+
mcp_proxy_adapter-6.4.48.dist-info/METADATA,sha256=-oqVyOxCI_0i_8ZIvZcpFMPvwJI1dnGgnvVsef0AGII,8511
|
134
|
+
mcp_proxy_adapter-6.4.48.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
135
|
+
mcp_proxy_adapter-6.4.48.dist-info/entry_points.txt,sha256=Bf-O5Aq80n22Ayu9fI9BgidzWqwzIVaqextAddTuHZw,563
|
136
|
+
mcp_proxy_adapter-6.4.48.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
|
137
|
+
mcp_proxy_adapter-6.4.48.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|