mcp-proxy-adapter 6.3.15__py3-none-any.whl → 6.3.17__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/middleware/protocol_middleware.py +63 -48
- mcp_proxy_adapter/api/middleware/user_info_middleware.py +6 -1
- mcp_proxy_adapter/commands/command_registry.py +5 -2
- mcp_proxy_adapter/version.py +1 -1
- {mcp_proxy_adapter-6.3.15.dist-info → mcp_proxy_adapter-6.3.17.dist-info}/METADATA +1 -1
- {mcp_proxy_adapter-6.3.15.dist-info → mcp_proxy_adapter-6.3.17.dist-info}/RECORD +9 -9
- {mcp_proxy_adapter-6.3.15.dist-info → mcp_proxy_adapter-6.3.17.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-6.3.15.dist-info → mcp_proxy_adapter-6.3.17.dist-info}/entry_points.txt +0 -0
- {mcp_proxy_adapter-6.3.15.dist-info → mcp_proxy_adapter-6.3.17.dist-info}/top_level.txt +0 -0
@@ -144,56 +144,71 @@ class ProtocolMiddleware(BaseHTTPMiddleware):
|
|
144
144
|
Returns:
|
145
145
|
Protocol name (http, https, mtls)
|
146
146
|
"""
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
if ssl_object:
|
147
|
+
try:
|
148
|
+
# Check if request is secure (HTTPS)
|
149
|
+
if request.url.scheme:
|
150
|
+
scheme = request.url.scheme.lower()
|
151
|
+
|
152
|
+
# If HTTPS, check if client certificate is provided (MTLS)
|
153
|
+
if scheme == "https":
|
154
|
+
# Check for client certificate in ASGI scope
|
155
|
+
try:
|
156
|
+
# Method 1: Check transport info in ASGI scope
|
157
|
+
if hasattr(request, "scope") and request.scope:
|
158
|
+
# Check for client certificate in transport layer
|
159
|
+
transport = request.scope.get("transport")
|
160
|
+
if transport and hasattr(transport, "get_extra_info"):
|
162
161
|
try:
|
163
|
-
|
164
|
-
if
|
165
|
-
|
166
|
-
|
162
|
+
ssl_object = transport.get_extra_info("ssl_object")
|
163
|
+
if ssl_object:
|
164
|
+
try:
|
165
|
+
cert = ssl_object.getpeercert()
|
166
|
+
if cert:
|
167
|
+
logger.debug(f"mTLS client certificate detected: {cert.get('subject', 'unknown')}")
|
168
|
+
return "mtls"
|
169
|
+
except Exception as e:
|
170
|
+
logger.debug(f"Error checking client certificate: {e}")
|
167
171
|
except Exception as e:
|
168
|
-
logger.debug(f"Error
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
172
|
+
logger.debug(f"Error getting SSL object from transport: {e}")
|
173
|
+
|
174
|
+
# Method 2: Check client info in ASGI scope
|
175
|
+
try:
|
176
|
+
client_info = request.scope.get("client")
|
177
|
+
if client_info and len(client_info) > 2:
|
178
|
+
# client_info format: (host, port, additional_info...)
|
179
|
+
# Additional info might contain certificate information
|
180
|
+
logger.debug(f"Client info detected, might be mTLS: {client_info}")
|
181
|
+
except Exception as e:
|
182
|
+
logger.debug(f"Error checking client info: {e}")
|
183
|
+
except Exception as e:
|
184
|
+
logger.debug(f"Error checking ASGI scope for mTLS: {e}")
|
185
|
+
|
186
|
+
# Check for client certificate in headers (proxy forwarded)
|
187
|
+
try:
|
188
|
+
if (request.headers.get("ssl-client-cert") or
|
189
|
+
request.headers.get("x-client-cert") or
|
190
|
+
request.headers.get("x-ssl-cert") or
|
191
|
+
request.headers.get("x-forwarded-client-cert")):
|
192
|
+
logger.debug("mTLS client certificate detected in headers")
|
193
|
+
return "mtls"
|
194
|
+
except Exception as e:
|
195
|
+
logger.debug(f"Error checking headers for mTLS: {e}")
|
196
|
+
|
197
|
+
return "https"
|
198
|
+
|
199
|
+
return scheme
|
200
|
+
|
201
|
+
# Fallback to checking headers
|
202
|
+
if request.headers.get("x-forwarded-proto"):
|
203
|
+
return request.headers.get("x-forwarded-proto").lower()
|
204
|
+
|
205
|
+
# Default to HTTP
|
206
|
+
return "http"
|
207
|
+
|
208
|
+
except Exception as e:
|
209
|
+
logger.error(f"Error in _get_request_protocol: {e}", exc_info=True)
|
210
|
+
# Fallback to HTTP if there's any error
|
211
|
+
return "http"
|
197
212
|
|
198
213
|
|
199
214
|
def setup_protocol_middleware(app, app_config: Optional[Dict[str, Any]] = None):
|
@@ -69,8 +69,13 @@ class UserInfoMiddleware(BaseHTTPMiddleware):
|
|
69
69
|
# Initialize PermissionManager only if permissions are enabled
|
70
70
|
if permissions_enabled:
|
71
71
|
# Create PermissionConfig for mcp_security_framework
|
72
|
+
roles_file = permissions_config.get("roles_file")
|
73
|
+
if roles_file is None:
|
74
|
+
logger.warning("⚠️ Permissions enabled but no roles_file specified, using default configuration")
|
75
|
+
roles_file = None
|
76
|
+
|
72
77
|
mcp_permission_config = PermissionConfig(
|
73
|
-
roles_file=
|
78
|
+
roles_file=roles_file,
|
74
79
|
default_role=permissions_config.get("default_role", "guest"),
|
75
80
|
admin_role=permissions_config.get("admin_role", "admin"),
|
76
81
|
role_hierarchy=permissions_config.get("role_hierarchy", {}),
|
@@ -701,8 +701,11 @@ class CommandRegistry:
|
|
701
701
|
try:
|
702
702
|
from mcp_proxy_adapter.core.protocol_manager import protocol_manager
|
703
703
|
|
704
|
-
protocol_manager
|
705
|
-
|
704
|
+
if protocol_manager is not None:
|
705
|
+
protocol_manager.reload_config()
|
706
|
+
logger.info("✅ Protocol manager configuration reloaded")
|
707
|
+
else:
|
708
|
+
logger.debug("ℹ️ Protocol manager is None, skipping reload")
|
706
709
|
except Exception as e:
|
707
710
|
logger.error(f"❌ Failed to reload protocol manager: {e}")
|
708
711
|
|
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.3.
|
3
|
+
Version: 6.3.17
|
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,7 +4,7 @@ mcp_proxy_adapter/config.py,sha256=-7iVS0mUWWKNeao7nqTAFlUD6FcMwRlDkchN7OwYsr0,2
|
|
4
4
|
mcp_proxy_adapter/custom_openapi.py,sha256=yLle4CntYK9wpivgn9NflZyJhy-YNrmWjJzt0ai5nP0,14672
|
5
5
|
mcp_proxy_adapter/main.py,sha256=qDkQTXnCvf8u0I3b8PRrguOoVdjd8YRr90ZooOqeOto,3401
|
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=7s-m3bl78elkxdrre9mOD4a3U_658vsNYHd4baGv7QY,75
|
8
8
|
mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
mcp_proxy_adapter/api/app.py,sha256=22NIDGo6pGkOZnvBWeKv_-RIRye4YaYkIskVGIsCCMs,28600
|
10
10
|
mcp_proxy_adapter/api/handlers.py,sha256=iyFGoEuUS1wxbV1ELA0zmaxIyQR7j4zw-4MrD-uIO6E,8294
|
@@ -18,10 +18,10 @@ mcp_proxy_adapter/api/middleware/error_handling.py,sha256=i3oghY1VdjHppFa7bTIx87
|
|
18
18
|
mcp_proxy_adapter/api/middleware/factory.py,sha256=r0BXntUOxF6DiCVqqmAUb3JjargdR28aj2d9X5z-zX4,7987
|
19
19
|
mcp_proxy_adapter/api/middleware/logging.py,sha256=AGv9lqfkTOCVJxYKflLghe1cd4kVPMLO1ni5E2FQBlk,4840
|
20
20
|
mcp_proxy_adapter/api/middleware/performance.py,sha256=-EvA7YIcTlxn8RuxlWlScJvX2EIoeEp3P5dKVWZHYRY,2357
|
21
|
-
mcp_proxy_adapter/api/middleware/protocol_middleware.py,sha256=
|
21
|
+
mcp_proxy_adapter/api/middleware/protocol_middleware.py,sha256=zm-Q0KnCzbAB3ue8dwnEkb-OyCuIbqu01s2_GE2rtH0,11094
|
22
22
|
mcp_proxy_adapter/api/middleware/transport_middleware.py,sha256=VG1rWyuh-O2pdc0kQ3SADFvyh286o5Wrnkt8OFQ0WQw,4274
|
23
23
|
mcp_proxy_adapter/api/middleware/unified_security.py,sha256=PMbJxVzGNlb-IPAqvIeEo1st-jykYX9Mns6lXIfdtAE,7764
|
24
|
-
mcp_proxy_adapter/api/middleware/user_info_middleware.py,sha256=
|
24
|
+
mcp_proxy_adapter/api/middleware/user_info_middleware.py,sha256=ttqXM5fVJsW72-ShZxer5rq1g8Qw0NJUOptOItqHvUs,9606
|
25
25
|
mcp_proxy_adapter/commands/__init__.py,sha256=eStfu2UrLfMvMTY6x20GD8sMPmPB1so-0QZQYV53nqo,1565
|
26
26
|
mcp_proxy_adapter/commands/auth_validation_command.py,sha256=p4UrAaHyoCxMy98G1BUUlFJWjoelEJzX3OAWIiQaGls,14593
|
27
27
|
mcp_proxy_adapter/commands/base.py,sha256=0_hu8t89-2vWBPFpEMokr27A-IifKI32rkQwZfc2Grk,15162
|
@@ -29,7 +29,7 @@ mcp_proxy_adapter/commands/builtin_commands.py,sha256=8kYLWIr4JvhZtqaVM9Jhqr_-yS
|
|
29
29
|
mcp_proxy_adapter/commands/catalog_manager.py,sha256=1DLvjt9RVMmeNZyynd-frk8gYkdgGJYyBXg6uWTJ16k,34873
|
30
30
|
mcp_proxy_adapter/commands/cert_monitor_command.py,sha256=phSms8EYOn1RqSp7na6jw0S1bLRrilmYZIFXVepVFyU,23687
|
31
31
|
mcp_proxy_adapter/commands/certificate_management_command.py,sha256=TDoGV2mnEz1HaJiHsxAO_IvtSinVwp0s_av5oIgmRqk,23225
|
32
|
-
mcp_proxy_adapter/commands/command_registry.py,sha256=
|
32
|
+
mcp_proxy_adapter/commands/command_registry.py,sha256=abQPOAzS_zIj4SPsOxsZeQS9pjLxyzlMUt9kI_AYT7E,35288
|
33
33
|
mcp_proxy_adapter/commands/config_command.py,sha256=PWX1OhKAmjlc8CSy4-sImdvGeSNgDNyv30Y-P5iZp9g,3767
|
34
34
|
mcp_proxy_adapter/commands/dependency_container.py,sha256=mvPob62lQ-mKRbAA9aL3L5gOT9_4V2Vy2cGoup2S840,3239
|
35
35
|
mcp_proxy_adapter/commands/dependency_manager.py,sha256=JWdmQ0de6rQAv8GYDToFIlpomBBXqT61XMygWcggYSQ,7366
|
@@ -137,8 +137,8 @@ mcp_proxy_adapter/schemas/base_schema.json,sha256=v9G9cGMd4dRhCZsOQ_FMqOi5VFyVbI
|
|
137
137
|
mcp_proxy_adapter/schemas/openapi_schema.json,sha256=C3yLkwmDsvnLW9B5gnKKdBGl4zxkeU-rEmjTrNVsQU0,8405
|
138
138
|
mcp_proxy_adapter/utils/config_generator.py,sha256=UXxuxxAyKTesAS3DOofQ26e20v771inA7EfBV8PZD1c,47543
|
139
139
|
mcp_proxy_adapter_issue_package/demonstrate_issue.py,sha256=O54fwWQvUAjEGiHhQGm1JLnARkhVCwAqjBk_89HyRbY,7894
|
140
|
-
mcp_proxy_adapter-6.3.
|
141
|
-
mcp_proxy_adapter-6.3.
|
142
|
-
mcp_proxy_adapter-6.3.
|
143
|
-
mcp_proxy_adapter-6.3.
|
144
|
-
mcp_proxy_adapter-6.3.
|
140
|
+
mcp_proxy_adapter-6.3.17.dist-info/METADATA,sha256=RSVotDjUk4ak77PfaUnNeJSh0JUb9dG2NlHaUIrCyBo,22266
|
141
|
+
mcp_proxy_adapter-6.3.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
142
|
+
mcp_proxy_adapter-6.3.17.dist-info/entry_points.txt,sha256=J3eV6ID0lt_VSp4lIdIgBFTqLCThgObNNxRCbyfiMHw,70
|
143
|
+
mcp_proxy_adapter-6.3.17.dist-info/top_level.txt,sha256=CHk-Mc-AxjO-tRheegA2qLiQnU4vZRnxuTF81So6SAc,50
|
144
|
+
mcp_proxy_adapter-6.3.17.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|