mcp-proxy-adapter 6.4.29__py3-none-any.whl → 6.4.33__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/user_info_middleware.py +18 -9
- mcp_proxy_adapter/examples/setup_test_environment.py +67 -0
- mcp_proxy_adapter/version.py +1 -1
- {mcp_proxy_adapter-6.4.29.dist-info → mcp_proxy_adapter-6.4.33.dist-info}/METADATA +1 -1
- {mcp_proxy_adapter-6.4.29.dist-info → mcp_proxy_adapter-6.4.33.dist-info}/RECORD +8 -8
- {mcp_proxy_adapter-6.4.29.dist-info → mcp_proxy_adapter-6.4.33.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-6.4.29.dist-info → mcp_proxy_adapter-6.4.33.dist-info}/entry_points.txt +0 -0
- {mcp_proxy_adapter-6.4.29.dist-info → mcp_proxy_adapter-6.4.33.dist-info}/top_level.txt +0 -0
@@ -119,12 +119,16 @@ class UserInfoMiddleware(BaseHTTPMiddleware):
|
|
119
119
|
logger.warning(f"⚠️ Failed to initialize AuthManager: {e}")
|
120
120
|
self._security_available = False
|
121
121
|
|
122
|
+
# Always initialize api_keys for fallback
|
123
|
+
security_config = config.get("security", {})
|
124
|
+
auth_config = security_config.get("auth", {})
|
125
|
+
self.api_keys = auth_config.get("api_keys", {})
|
126
|
+
|
122
127
|
if not self._security_available:
|
123
128
|
# Fallback to basic API key handling
|
124
|
-
security_config = config.get("security", {})
|
125
|
-
auth_config = security_config.get("auth", {})
|
126
|
-
self.api_keys = auth_config.get("api_keys", {})
|
127
129
|
logger.info("ℹ️ User info middleware initialized with basic auth")
|
130
|
+
else:
|
131
|
+
logger.info("ℹ️ User info middleware initialized with mcp_security_framework (fallback enabled)")
|
128
132
|
|
129
133
|
async def dispatch(
|
130
134
|
self, request: Request, call_next: Callable[[Request], Awaitable[Response]]
|
@@ -190,9 +194,15 @@ class UserInfoMiddleware(BaseHTTPMiddleware):
|
|
190
194
|
|
191
195
|
if not self._security_available:
|
192
196
|
# Fallback to basic API key handling
|
193
|
-
|
194
|
-
|
195
|
-
|
197
|
+
api_keys_dict = getattr(self, "api_keys", {})
|
198
|
+
# Find role by API key value (not key)
|
199
|
+
user_role = None
|
200
|
+
for role, key_value in api_keys_dict.items():
|
201
|
+
if key_value == api_key:
|
202
|
+
user_role = role
|
203
|
+
break
|
204
|
+
|
205
|
+
if user_role:
|
196
206
|
# Get permissions for this role from roles file if available
|
197
207
|
role_permissions = ["read"] # default permissions
|
198
208
|
if (
|
@@ -211,10 +221,9 @@ class UserInfoMiddleware(BaseHTTPMiddleware):
|
|
211
221
|
"roles": [user_role],
|
212
222
|
"permissions": role_permissions,
|
213
223
|
}
|
214
|
-
|
215
224
|
logger.debug(
|
216
|
-
f"✅
|
217
|
-
f"{
|
225
|
+
f"✅ User authenticated with API key: "
|
226
|
+
f"{api_key[:8]}..."
|
218
227
|
)
|
219
228
|
else:
|
220
229
|
# API key not found
|
@@ -1220,6 +1220,66 @@ def validate_output_directory(output_dir: Path) -> bool:
|
|
1220
1220
|
return True
|
1221
1221
|
|
1222
1222
|
|
1223
|
+
def check_ports_available() -> bool:
|
1224
|
+
"""
|
1225
|
+
Check if all required test ports are available.
|
1226
|
+
Returns True if all ports are free, False otherwise.
|
1227
|
+
"""
|
1228
|
+
import socket
|
1229
|
+
|
1230
|
+
# Ports used by the test suite
|
1231
|
+
test_ports = [
|
1232
|
+
20000, # basic_http
|
1233
|
+
20001, # http_token
|
1234
|
+
20002, # https_simple
|
1235
|
+
20003, # https_token
|
1236
|
+
20004, # mtls_no_roles
|
1237
|
+
20005, # test_proxy_server
|
1238
|
+
20010, # proxy_port
|
1239
|
+
20020, # base_port (run_security_tests)
|
1240
|
+
20021, # base_port + 1
|
1241
|
+
20022, # base_port + 2
|
1242
|
+
20023, # base_port + 3
|
1243
|
+
20024, # base_port + 4
|
1244
|
+
20025, # base_port + 5
|
1245
|
+
20026, # base_port + 6
|
1246
|
+
20027, # base_port + 7
|
1247
|
+
20028, # base_port + 8
|
1248
|
+
20029, # base_port + 9
|
1249
|
+
3006, # proxy registration
|
1250
|
+
]
|
1251
|
+
|
1252
|
+
occupied_ports = []
|
1253
|
+
|
1254
|
+
print("🔍 Checking port availability...")
|
1255
|
+
for port in test_ports:
|
1256
|
+
try:
|
1257
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
1258
|
+
sock.settimeout(1)
|
1259
|
+
result = sock.connect_ex(('127.0.0.1', port))
|
1260
|
+
if result == 0:
|
1261
|
+
occupied_ports.append(port)
|
1262
|
+
print(f" ❌ Port {port} is occupied")
|
1263
|
+
else:
|
1264
|
+
print(f" ✅ Port {port} is available")
|
1265
|
+
except Exception as e:
|
1266
|
+
print(f" ⚠️ Could not check port {port}: {e}")
|
1267
|
+
occupied_ports.append(port)
|
1268
|
+
|
1269
|
+
if occupied_ports:
|
1270
|
+
print(f"\n❌ CRITICAL: {len(occupied_ports)} ports are occupied: {occupied_ports}")
|
1271
|
+
print("💡 Please free these ports before running the test suite:")
|
1272
|
+
for port in occupied_ports:
|
1273
|
+
print(f" - Port {port}: kill processes using this port")
|
1274
|
+
print("\n🔧 You can use these commands to free ports:")
|
1275
|
+
for port in occupied_ports:
|
1276
|
+
print(f" fuser -k {port}/tcp")
|
1277
|
+
return False
|
1278
|
+
|
1279
|
+
print(f"✅ All {len(test_ports)} required ports are available")
|
1280
|
+
return True
|
1281
|
+
|
1282
|
+
|
1223
1283
|
def main() -> int:
|
1224
1284
|
"""Main function for command line execution."""
|
1225
1285
|
parser = argparse.ArgumentParser(
|
@@ -1243,6 +1303,13 @@ def main() -> int:
|
|
1243
1303
|
)
|
1244
1304
|
args = parser.parse_args()
|
1245
1305
|
|
1306
|
+
# FIRST: Check port availability - if this fails, don't proceed
|
1307
|
+
print("🔍 STEP 1: Port Availability Check")
|
1308
|
+
if not check_ports_available():
|
1309
|
+
print("\n❌ FAILED: Required ports are occupied. Aborting setup.")
|
1310
|
+
print("💡 Please free the occupied ports and try again.")
|
1311
|
+
return 1
|
1312
|
+
|
1246
1313
|
try:
|
1247
1314
|
# Determine target directory
|
1248
1315
|
if args.output_dir is None:
|
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.33
|
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=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=GtHZWT-co51a-_pBWoXT4OwHOOqgr0GLuUVnIggLNo8,75
|
8
8
|
mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
mcp_proxy_adapter/api/app.py,sha256=UQ7_m-LbUzKuuPJPxS_69ahANUQ5rnPwoddQ2MMXNkg,33941
|
10
10
|
mcp_proxy_adapter/api/handlers.py,sha256=iyFGoEuUS1wxbV1ELA0zmaxIyQR7j4zw-4MrD-uIO6E,8294
|
@@ -21,7 +21,7 @@ mcp_proxy_adapter/api/middleware/performance.py,sha256=-EvA7YIcTlxn8RuxlWlScJvX2
|
|
21
21
|
mcp_proxy_adapter/api/middleware/protocol_middleware.py,sha256=lFqGuT5M-USCTIVvZMH6Fgh3hxQNAmAoDeyYOBPpcbk,9161
|
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=qjNPOCusMimXjEtjwyG6CgFieLm2T7O2e2QghqE_s3M,8313
|
24
|
-
mcp_proxy_adapter/api/middleware/user_info_middleware.py,sha256
|
24
|
+
mcp_proxy_adapter/api/middleware/user_info_middleware.py,sha256=-N6cZOc7z6FUE7xRZ8xGgI4PnMyrJq0Jzpde9VNq6Zs,11077
|
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
|
@@ -99,7 +99,7 @@ mcp_proxy_adapter/examples/run_proxy_server.py,sha256=SBLSSY2F_VEBQD3MsCE_Pa9xFE
|
|
99
99
|
mcp_proxy_adapter/examples/run_security_tests.py,sha256=0vjaUdWC-rLyviQuNxM3PtfiU9TzSRuxGxWMehrFA_w,23311
|
100
100
|
mcp_proxy_adapter/examples/run_security_tests_fixed.py,sha256=2BKMT0_-FhmcZA73hdQOt2XR7Cgb9Sq8qBI88BkwAAA,10934
|
101
101
|
mcp_proxy_adapter/examples/security_test_client.py,sha256=K5gEVat1SJS2pBVxqLl5c9-uiiG12k8UT3ULQDXZ2Uc,35713
|
102
|
-
mcp_proxy_adapter/examples/setup_test_environment.py,sha256=
|
102
|
+
mcp_proxy_adapter/examples/setup_test_environment.py,sha256=Y3r8uxzNfo7nLpw9rwHZuzKYWOqMym6UHG5m4SudqXw,45793
|
103
103
|
mcp_proxy_adapter/examples/test_config.py,sha256=ekEoUZe9q484vU_0IxOVhQdNMVJXG3IpmQpP--VmuDI,6491
|
104
104
|
mcp_proxy_adapter/examples/test_config_generator.py,sha256=PBXk1V_awJ-iBlbE66Pme5sQwu6CJDxkmqgm8uPtM58,4091
|
105
105
|
mcp_proxy_adapter/examples/test_examples.py,sha256=CYlVatdHUVC_rwv4NsvxFG3GXiKIyxPDUH43BOJHjrU,12330
|
@@ -121,8 +121,8 @@ mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py,sha25
|
|
121
121
|
mcp_proxy_adapter/examples/scripts/config_generator.py,sha256=SKFlRRCE_pEHGbfjDuzfKpvV2DMwG6lRfK90uJwRlJM,33410
|
122
122
|
mcp_proxy_adapter/examples/scripts/create_certificates_simple.py,sha256=yCWdUIhMSDPwoPhuLR9rhPdf7jLN5hCjzNfYYgVyHnw,27769
|
123
123
|
mcp_proxy_adapter/examples/scripts/generate_certificates_and_tokens.py,sha256=hUCoJH3fy5WeR_YMHj-_W0mR0ZKUWqewH4FVN3yWyrM,17972
|
124
|
-
mcp_proxy_adapter-6.4.
|
125
|
-
mcp_proxy_adapter-6.4.
|
126
|
-
mcp_proxy_adapter-6.4.
|
127
|
-
mcp_proxy_adapter-6.4.
|
128
|
-
mcp_proxy_adapter-6.4.
|
124
|
+
mcp_proxy_adapter-6.4.33.dist-info/METADATA,sha256=mrJve7fFsMkLeo92k7A5-OcOiV7Mb9vzA8_Ydw9puh4,6087
|
125
|
+
mcp_proxy_adapter-6.4.33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
126
|
+
mcp_proxy_adapter-6.4.33.dist-info/entry_points.txt,sha256=J3eV6ID0lt_VSp4lIdIgBFTqLCThgObNNxRCbyfiMHw,70
|
127
|
+
mcp_proxy_adapter-6.4.33.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
|
128
|
+
mcp_proxy_adapter-6.4.33.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|