mcp-proxy-adapter 6.4.46__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/commands/reload_command.py +1 -1
- mcp_proxy_adapter/core/proxy_registration.py +9 -1
- mcp_proxy_adapter/version.py +1 -1
- {mcp_proxy_adapter-6.4.46.dist-info → mcp_proxy_adapter-6.4.48.dist-info}/METADATA +1 -1
- {mcp_proxy_adapter-6.4.46.dist-info → mcp_proxy_adapter-6.4.48.dist-info}/RECORD +9 -9
- {mcp_proxy_adapter-6.4.46.dist-info → mcp_proxy_adapter-6.4.48.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-6.4.46.dist-info → mcp_proxy_adapter-6.4.48.dist-info}/entry_points.txt +0 -0
- {mcp_proxy_adapter-6.4.46.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
|
|
@@ -164,7 +164,7 @@ class ReloadCommand(Command):
|
|
164
164
|
logger.warning("No config_path provided, using default configuration")
|
165
165
|
|
166
166
|
# Perform reload using unified initialization
|
167
|
-
reload_info = registry.reload_system(config_path=config_path)
|
167
|
+
reload_info = await registry.reload_system(config_path=config_path)
|
168
168
|
|
169
169
|
# Create result
|
170
170
|
result = ReloadResult(
|
@@ -247,6 +247,13 @@ class ProxyRegistrationManager:
|
|
247
247
|
SSL context or None if SSL not needed
|
248
248
|
"""
|
249
249
|
logger.debug("_create_ssl_context called")
|
250
|
+
|
251
|
+
# Check if we're in HTTP mode - if so, don't create SSL context
|
252
|
+
server_config = self.config.get("server", {})
|
253
|
+
if server_config.get("protocol", "http").lower() == "http":
|
254
|
+
logger.debug("HTTP mode detected, skipping SSL context creation")
|
255
|
+
return None
|
256
|
+
|
250
257
|
if not self.client_security:
|
251
258
|
logger.debug("SSL context creation failed: client_security is None")
|
252
259
|
# Try best-effort default CA if available
|
@@ -366,7 +373,8 @@ class ProxyRegistrationManager:
|
|
366
373
|
|
367
374
|
return None
|
368
375
|
except Exception as e:
|
369
|
-
logger.
|
376
|
+
logger.warning(f"Failed to create SSL context: {e}")
|
377
|
+
# Don't fail the entire operation, just return None
|
370
378
|
return None
|
371
379
|
|
372
380
|
async def register_server(self) -> bool:
|
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
|
@@ -42,7 +42,7 @@ mcp_proxy_adapter/commands/load_command.py,sha256=euv9KSeO2zjtQiYfnl4xhZYXARt4x1
|
|
42
42
|
mcp_proxy_adapter/commands/plugins_command.py,sha256=0FazJGI9_wK_Ac_eFfmzhJGRLxMzKdpLqNMu-mwsqMI,8763
|
43
43
|
mcp_proxy_adapter/commands/protocol_management_command.py,sha256=8Uv6WXrj_W1Sl9JCIT6hl8wo_qYuHWZYq-nBMYOQ4qw,8429
|
44
44
|
mcp_proxy_adapter/commands/proxy_registration_command.py,sha256=owKWQRN96vpEBj-yGF-q1T_FiS9wF525bNw08NfVixs,14774
|
45
|
-
mcp_proxy_adapter/commands/reload_command.py,sha256=
|
45
|
+
mcp_proxy_adapter/commands/reload_command.py,sha256=GrdmSRBrN77TaeXJak6csmSi_Wa8wwGSPzFD1NQjTKE,7508
|
46
46
|
mcp_proxy_adapter/commands/result.py,sha256=uWHdLCwwn2_ylXLtIn-yXGiXxWRcbzMSlkgGtpkXQCg,5470
|
47
47
|
mcp_proxy_adapter/commands/role_test_command.py,sha256=3y1pOKwrBFGpfqhQEWEBKxGkuMHa9MqHFlzaqPxM3ik,4181
|
48
48
|
mcp_proxy_adapter/commands/roles_management_command.py,sha256=O6OAHuyJlJGLd654hx377sfv23BBuyRW8sGuR4t76fY,21797
|
@@ -70,7 +70,7 @@ mcp_proxy_adapter/core/mtls_asgi_app.py,sha256=DT_fTUH1RkvBa3ThbyCyNb-XUHyCb4Dqa
|
|
70
70
|
mcp_proxy_adapter/core/mtls_server.py,sha256=_hj6QWuExKX2LRohYvjPGFC2qTutS7ObegpEc09QijM,10117
|
71
71
|
mcp_proxy_adapter/core/protocol_manager.py,sha256=3sWOAiMniQY5nu9CHkitIOGN4CXH28hOTwY92D0yasM,15268
|
72
72
|
mcp_proxy_adapter/core/proxy_client.py,sha256=CB6KBhV3vH2GU5nZ27VZ_xlNbYTAU_tnYFrkuK5He58,6094
|
73
|
-
mcp_proxy_adapter/core/proxy_registration.py,sha256=
|
73
|
+
mcp_proxy_adapter/core/proxy_registration.py,sha256=m58w9iQd5zwXFIpuaDRXKPQ3fhQDBJPkD4w7m742ciY,35200
|
74
74
|
mcp_proxy_adapter/core/role_utils.py,sha256=YwRenGoXI5YrHVbFjKFAH2DJs2miyqhcr9LWF7mxieg,12284
|
75
75
|
mcp_proxy_adapter/core/security_adapter.py,sha256=MAtNthsp7Qj4-oLFzSi7Pr3vWQbWS_uelqa5LGgrXIE,12957
|
76
76
|
mcp_proxy_adapter/core/security_factory.py,sha256=M-1McwUOmuV7Eo-m_P2undtJVNK_KIjDx8o_uRY8rLo,8005
|
@@ -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
|