mcp-proxy-adapter 6.9.17__py3-none-any.whl → 6.9.18__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.
Files changed (86) hide show
  1. mcp_proxy_adapter/api/app.py +52 -52
  2. mcp_proxy_adapter/api/handlers.py +5 -5
  3. mcp_proxy_adapter/api/middleware/__init__.py +8 -8
  4. mcp_proxy_adapter/api/middleware/base.py +14 -14
  5. mcp_proxy_adapter/api/middleware/command_permission_middleware.py +7 -7
  6. mcp_proxy_adapter/api/middleware/error_handling.py +9 -9
  7. mcp_proxy_adapter/api/middleware/factory.py +17 -17
  8. mcp_proxy_adapter/api/middleware/logging.py +6 -6
  9. mcp_proxy_adapter/api/middleware/performance.py +3 -3
  10. mcp_proxy_adapter/api/middleware/protocol_middleware.py +19 -19
  11. mcp_proxy_adapter/api/middleware/transport_middleware.py +3 -3
  12. mcp_proxy_adapter/api/middleware/unified_security.py +11 -11
  13. mcp_proxy_adapter/api/middleware/user_info_middleware.py +21 -21
  14. mcp_proxy_adapter/api/tool_integration.py +3 -2
  15. mcp_proxy_adapter/api/tools.py +4 -3
  16. mcp_proxy_adapter/commands/auth_validation_command.py +6 -5
  17. mcp_proxy_adapter/commands/base.py +10 -10
  18. mcp_proxy_adapter/commands/builtin_commands.py +6 -6
  19. mcp_proxy_adapter/commands/catalog_manager.py +74 -74
  20. mcp_proxy_adapter/commands/cert_monitor_command.py +13 -12
  21. mcp_proxy_adapter/commands/certificate_management_command.py +20 -19
  22. mcp_proxy_adapter/commands/command_registry.py +68 -67
  23. mcp_proxy_adapter/commands/config_command.py +3 -1
  24. mcp_proxy_adapter/commands/dependency_manager.py +10 -10
  25. mcp_proxy_adapter/commands/help_command.py +21 -20
  26. mcp_proxy_adapter/commands/hooks.py +27 -27
  27. mcp_proxy_adapter/commands/key_management_command.py +19 -18
  28. mcp_proxy_adapter/commands/plugins_command.py +2 -1
  29. mcp_proxy_adapter/commands/protocol_management_command.py +6 -6
  30. mcp_proxy_adapter/commands/proxy_registration_command.py +9 -9
  31. mcp_proxy_adapter/commands/registration_status_command.py +4 -4
  32. mcp_proxy_adapter/commands/reload_command.py +5 -5
  33. mcp_proxy_adapter/commands/role_test_command.py +2 -1
  34. mcp_proxy_adapter/commands/roles_management_command.py +9 -8
  35. mcp_proxy_adapter/commands/security_command.py +3 -2
  36. mcp_proxy_adapter/commands/ssl_setup_command.py +7 -6
  37. mcp_proxy_adapter/commands/token_management_command.py +12 -11
  38. mcp_proxy_adapter/commands/transport_management_command.py +2 -2
  39. mcp_proxy_adapter/config.py +3 -3
  40. mcp_proxy_adapter/core/__init__.py +1 -1
  41. mcp_proxy_adapter/core/app_runner.py +3 -3
  42. mcp_proxy_adapter/core/auth_validator.py +9 -9
  43. mcp_proxy_adapter/core/certificate_utils.py +27 -27
  44. mcp_proxy_adapter/core/client_manager.py +13 -13
  45. mcp_proxy_adapter/core/client_security.py +26 -26
  46. mcp_proxy_adapter/core/config_converter.py +18 -18
  47. mcp_proxy_adapter/core/config_validator.py +5 -1
  48. mcp_proxy_adapter/core/crl_utils.py +22 -22
  49. mcp_proxy_adapter/core/logging.py +21 -13
  50. mcp_proxy_adapter/core/mtls_asgi.py +7 -7
  51. mcp_proxy_adapter/core/mtls_asgi_app.py +9 -9
  52. mcp_proxy_adapter/core/mtls_proxy.py +9 -9
  53. mcp_proxy_adapter/core/mtls_server.py +18 -18
  54. mcp_proxy_adapter/core/protocol_manager.py +29 -29
  55. mcp_proxy_adapter/core/proxy_registration.py +67 -67
  56. mcp_proxy_adapter/core/security_adapter.py +18 -18
  57. mcp_proxy_adapter/core/security_factory.py +16 -16
  58. mcp_proxy_adapter/core/security_integration.py +6 -6
  59. mcp_proxy_adapter/core/server_adapter.py +12 -12
  60. mcp_proxy_adapter/core/server_engine.py +17 -17
  61. mcp_proxy_adapter/core/signal_handler.py +12 -12
  62. mcp_proxy_adapter/core/ssl_utils.py +12 -12
  63. mcp_proxy_adapter/core/transport_manager.py +14 -14
  64. mcp_proxy_adapter/core/unified_config_adapter.py +6 -6
  65. mcp_proxy_adapter/core/utils.py +5 -5
  66. mcp_proxy_adapter/custom_openapi.py +7 -7
  67. mcp_proxy_adapter/examples/cert_manager_bugfix.py +2 -2
  68. mcp_proxy_adapter/examples/full_application/commands/__init__.py +6 -5
  69. mcp_proxy_adapter/examples/full_application/commands/echo_command.py +44 -0
  70. mcp_proxy_adapter/examples/full_application/commands/help_command.py +66 -0
  71. mcp_proxy_adapter/examples/full_application/commands/list_command.py +64 -0
  72. mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py +21 -21
  73. mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py +6 -6
  74. mcp_proxy_adapter/examples/full_application/main.py +28 -0
  75. mcp_proxy_adapter/examples/proxy_registration_example.py +38 -38
  76. mcp_proxy_adapter/examples/test_framework_complete.py +35 -35
  77. mcp_proxy_adapter/examples/test_mcp_server.py +2 -2
  78. mcp_proxy_adapter/examples/validate_generator_compatibility.py +386 -0
  79. mcp_proxy_adapter/examples/validate_generator_compatibility_simple.py +248 -0
  80. mcp_proxy_adapter/version.py +1 -1
  81. {mcp_proxy_adapter-6.9.17.dist-info → mcp_proxy_adapter-6.9.18.dist-info}/METADATA +1 -1
  82. mcp_proxy_adapter-6.9.18.dist-info/RECORD +149 -0
  83. mcp_proxy_adapter-6.9.17.dist-info/RECORD +0 -144
  84. {mcp_proxy_adapter-6.9.17.dist-info → mcp_proxy_adapter-6.9.18.dist-info}/WHEEL +0 -0
  85. {mcp_proxy_adapter-6.9.17.dist-info → mcp_proxy_adapter-6.9.18.dist-info}/entry_points.txt +0 -0
  86. {mcp_proxy_adapter-6.9.17.dist-info → mcp_proxy_adapter-6.9.18.dist-info}/top_level.txt +0 -0
@@ -20,6 +20,7 @@ from .result import CommandResult, SuccessResult, ErrorResult
20
20
  from ..core.certificate_utils import CertificateUtils
21
21
  from ..core.auth_validator import AuthValidator
22
22
 
23
+ from mcp_proxy_adapter.core.logging import get_global_logger
23
24
  logger = logging.getLogger(__name__)
24
25
 
25
26
 
@@ -216,7 +217,7 @@ class CertMonitorCommand(Command):
216
217
  CommandResult with expiry check results
217
218
  """
218
219
  try:
219
- logger.info(f"Performing certificate expiry check for {cert_path}")
220
+ get_global_logger().info(f"Performing certificate expiry check for {cert_path}")
220
221
 
221
222
  # Check if certificate file exists
222
223
  if not os.path.exists(cert_path):
@@ -255,7 +256,7 @@ class CertMonitorCommand(Command):
255
256
  else:
256
257
  health_status = "healthy"
257
258
 
258
- logger.info(
259
+ get_global_logger().info(
259
260
  f"Certificate expiry check completed: {health_status} ({days_until_expiry} days)"
260
261
  )
261
262
 
@@ -273,7 +274,7 @@ class CertMonitorCommand(Command):
273
274
  )
274
275
 
275
276
  except Exception as e:
276
- logger.error(f"Certificate expiry check failed: {e}")
277
+ get_global_logger().error(f"Certificate expiry check failed: {e}")
277
278
  return ErrorResult(message=f"Certificate expiry check failed: {str(e)}")
278
279
 
279
280
  async def cert_health_check(self, cert_path: str) -> CommandResult:
@@ -287,7 +288,7 @@ class CertMonitorCommand(Command):
287
288
  CommandResult with health check results
288
289
  """
289
290
  try:
290
- logger.info(f"Performing certificate health check for {cert_path}")
291
+ get_global_logger().info(f"Performing certificate health check for {cert_path}")
291
292
 
292
293
  # Check if certificate file exists
293
294
  if not os.path.exists(cert_path):
@@ -356,7 +357,7 @@ class CertMonitorCommand(Command):
356
357
  else:
357
358
  overall_status = "critical"
358
359
 
359
- logger.info(
360
+ get_global_logger().info(
360
361
  f"Certificate health check completed: {overall_status} (score: {health_score})"
361
362
  )
362
363
 
@@ -373,7 +374,7 @@ class CertMonitorCommand(Command):
373
374
  )
374
375
 
375
376
  except Exception as e:
376
- logger.error(f"Certificate health check failed: {e}")
377
+ get_global_logger().error(f"Certificate health check failed: {e}")
377
378
  return ErrorResult(message=f"Certificate health check failed: {str(e)}")
378
379
 
379
380
  async def cert_alert_setup(
@@ -390,7 +391,7 @@ class CertMonitorCommand(Command):
390
391
  CommandResult with alert setup status
391
392
  """
392
393
  try:
393
- logger.info(f"Setting up certificate monitoring alerts for {cert_path}")
394
+ get_global_logger().info(f"Setting up certificate monitoring alerts for {cert_path}")
394
395
 
395
396
  # Check if certificate file exists
396
397
  if not os.path.exists(cert_path):
@@ -444,7 +445,7 @@ class CertMonitorCommand(Command):
444
445
  with open(config_path, "w") as f:
445
446
  json.dump(alert_config, f, indent=2)
446
447
 
447
- logger.info(f"Alert configuration saved to {config_path}")
448
+ get_global_logger().info(f"Alert configuration saved to {config_path}")
448
449
 
449
450
  return SuccessResult(
450
451
  data={
@@ -457,7 +458,7 @@ class CertMonitorCommand(Command):
457
458
  )
458
459
 
459
460
  except Exception as e:
460
- logger.error(f"Alert setup failed: {e}")
461
+ get_global_logger().error(f"Alert setup failed: {e}")
461
462
  return ErrorResult(message=f"Alert setup failed: {str(e)}")
462
463
 
463
464
  async def cert_auto_renew(
@@ -474,7 +475,7 @@ class CertMonitorCommand(Command):
474
475
  CommandResult with auto-renewal setup status
475
476
  """
476
477
  try:
477
- logger.info(f"Setting up certificate auto-renewal for {cert_path}")
478
+ get_global_logger().info(f"Setting up certificate auto-renewal for {cert_path}")
478
479
 
479
480
  # Check if certificate file exists
480
481
  if not os.path.exists(cert_path):
@@ -533,7 +534,7 @@ class CertMonitorCommand(Command):
533
534
  with open(config_path, "w") as f:
534
535
  json.dump(auto_renew_config, f, indent=2)
535
536
 
536
- logger.info(f"Auto-renewal configuration saved to {config_path}")
537
+ get_global_logger().info(f"Auto-renewal configuration saved to {config_path}")
537
538
 
538
539
  return SuccessResult(
539
540
  data={
@@ -546,7 +547,7 @@ class CertMonitorCommand(Command):
546
547
  )
547
548
 
548
549
  except Exception as e:
549
- logger.error(f"Auto-renewal setup failed: {e}")
550
+ get_global_logger().error(f"Auto-renewal setup failed: {e}")
550
551
  return ErrorResult(message=f"Auto-renewal setup failed: {str(e)}")
551
552
 
552
553
  def _find_certificates(self, directory: str) -> List[str]:
@@ -19,6 +19,7 @@ from ..core.certificate_utils import CertificateUtils
19
19
  from ..core.auth_validator import AuthValidator
20
20
  from ..core.role_utils import RoleUtils
21
21
 
22
+ from mcp_proxy_adapter.core.logging import get_global_logger
22
23
  logger = logging.getLogger(__name__)
23
24
 
24
25
 
@@ -236,7 +237,7 @@ class CertificateManagementCommand(Command):
236
237
  CommandResult with CA certificate creation status
237
238
  """
238
239
  try:
239
- logger.info(f"Creating CA certificate: {common_name}")
240
+ get_global_logger().info(f"Creating CA certificate: {common_name}")
240
241
 
241
242
  # Validate parameters
242
243
  if not common_name or not common_name.strip():
@@ -276,7 +277,7 @@ class CertificateManagementCommand(Command):
276
277
  status="valid",
277
278
  )
278
279
 
279
- logger.info(
280
+ get_global_logger().info(
280
281
  f"CA certificate created successfully: {result.get('cert_path')}"
281
282
  )
282
283
  return SuccessResult(
@@ -284,7 +285,7 @@ class CertificateManagementCommand(Command):
284
285
  )
285
286
 
286
287
  except Exception as e:
287
- logger.error(f"CA certificate creation failed: {e}")
288
+ get_global_logger().error(f"CA certificate creation failed: {e}")
288
289
  return ErrorResult(message=f"CA certificate creation failed: {str(e)}")
289
290
 
290
291
  async def cert_create_server(
@@ -311,7 +312,7 @@ class CertificateManagementCommand(Command):
311
312
  CommandResult with server certificate creation status
312
313
  """
313
314
  try:
314
- logger.info(f"Creating server certificate: {common_name}")
315
+ get_global_logger().info(f"Creating server certificate: {common_name}")
315
316
 
316
317
  # Validate parameters
317
318
  if not common_name or not common_name.strip():
@@ -353,7 +354,7 @@ class CertificateManagementCommand(Command):
353
354
  status="valid",
354
355
  )
355
356
 
356
- logger.info(
357
+ get_global_logger().info(
357
358
  f"Server certificate created successfully: {result.get('cert_path')}"
358
359
  )
359
360
  return SuccessResult(
@@ -361,7 +362,7 @@ class CertificateManagementCommand(Command):
361
362
  )
362
363
 
363
364
  except Exception as e:
364
- logger.error(f"Server certificate creation failed: {e}")
365
+ get_global_logger().error(f"Server certificate creation failed: {e}")
365
366
  return ErrorResult(message=f"Server certificate creation failed: {str(e)}")
366
367
 
367
368
  async def cert_create_client(
@@ -388,7 +389,7 @@ class CertificateManagementCommand(Command):
388
389
  CommandResult with client certificate creation status
389
390
  """
390
391
  try:
391
- logger.info(f"Creating client certificate: {common_name}")
392
+ get_global_logger().info(f"Creating client certificate: {common_name}")
392
393
 
393
394
  # Validate parameters
394
395
  if not common_name or not common_name.strip():
@@ -430,7 +431,7 @@ class CertificateManagementCommand(Command):
430
431
  status="valid",
431
432
  )
432
433
 
433
- logger.info(
434
+ get_global_logger().info(
434
435
  f"Client certificate created successfully: {result.get('cert_path')}"
435
436
  )
436
437
  return SuccessResult(
@@ -438,7 +439,7 @@ class CertificateManagementCommand(Command):
438
439
  )
439
440
 
440
441
  except Exception as e:
441
- logger.error(f"Client certificate creation failed: {e}")
442
+ get_global_logger().error(f"Client certificate creation failed: {e}")
442
443
  return ErrorResult(message=f"Client certificate creation failed: {str(e)}")
443
444
 
444
445
  async def cert_revoke(self, cert_path: str) -> CommandResult:
@@ -452,7 +453,7 @@ class CertificateManagementCommand(Command):
452
453
  CommandResult with revocation status
453
454
  """
454
455
  try:
455
- logger.info(f"Revoking certificate: {cert_path}")
456
+ get_global_logger().info(f"Revoking certificate: {cert_path}")
456
457
 
457
458
  # Validate parameters
458
459
  if not cert_path or not os.path.exists(cert_path):
@@ -475,13 +476,13 @@ class CertificateManagementCommand(Command):
475
476
  status="revoked",
476
477
  )
477
478
 
478
- logger.info(f"Certificate revoked successfully: {cert_path}")
479
+ get_global_logger().info(f"Certificate revoked successfully: {cert_path}")
479
480
  return SuccessResult(
480
481
  data={"certificate": cert_result.to_dict(), "revocation_result": result}
481
482
  )
482
483
 
483
484
  except Exception as e:
484
- logger.error(f"Certificate revocation failed: {e}")
485
+ get_global_logger().error(f"Certificate revocation failed: {e}")
485
486
  return ErrorResult(message=f"Certificate revocation failed: {str(e)}")
486
487
 
487
488
  async def cert_list(self, cert_dir: str) -> CommandResult:
@@ -495,7 +496,7 @@ class CertificateManagementCommand(Command):
495
496
  CommandResult with list of certificates
496
497
  """
497
498
  try:
498
- logger.info(f"Listing certificates in directory: {cert_dir}")
499
+ get_global_logger().info(f"Listing certificates in directory: {cert_dir}")
499
500
 
500
501
  # Validate parameters
501
502
  if not cert_dir or not os.path.exists(cert_dir):
@@ -526,7 +527,7 @@ class CertificateManagementCommand(Command):
526
527
  )
527
528
  certificates.append(cert_result.to_dict())
528
529
  except Exception as e:
529
- logger.warning(f"Could not read certificate {file_path}: {e}")
530
+ get_global_logger().warning(f"Could not read certificate {file_path}: {e}")
530
531
  # Add certificate with error status
531
532
  cert_result = CertificateResult(
532
533
  cert_path=str(file_path),
@@ -537,7 +538,7 @@ class CertificateManagementCommand(Command):
537
538
  )
538
539
  certificates.append(cert_result.to_dict())
539
540
 
540
- logger.info(f"Found {len(certificates)} certificates in {cert_dir}")
541
+ get_global_logger().info(f"Found {len(certificates)} certificates in {cert_dir}")
541
542
  return SuccessResult(
542
543
  data={
543
544
  "certificates": certificates,
@@ -547,7 +548,7 @@ class CertificateManagementCommand(Command):
547
548
  )
548
549
 
549
550
  except Exception as e:
550
- logger.error(f"Certificate listing failed: {e}")
551
+ get_global_logger().error(f"Certificate listing failed: {e}")
551
552
  return ErrorResult(message=f"Certificate listing failed: {str(e)}")
552
553
 
553
554
  async def cert_info(self, cert_path: str) -> CommandResult:
@@ -561,7 +562,7 @@ class CertificateManagementCommand(Command):
561
562
  CommandResult with certificate information
562
563
  """
563
564
  try:
564
- logger.info(f"Getting certificate info: {cert_path}")
565
+ get_global_logger().info(f"Getting certificate info: {cert_path}")
565
566
 
566
567
  # Validate parameters
567
568
  if not cert_path or not os.path.exists(cert_path):
@@ -587,7 +588,7 @@ class CertificateManagementCommand(Command):
587
588
  error=None if validation.is_valid else validation.error_message,
588
589
  )
589
590
 
590
- logger.info(f"Certificate info retrieved successfully: {cert_path}")
591
+ get_global_logger().info(f"Certificate info retrieved successfully: {cert_path}")
591
592
  return SuccessResult(
592
593
  data={
593
594
  "certificate": cert_result.to_dict(),
@@ -602,5 +603,5 @@ class CertificateManagementCommand(Command):
602
603
  )
603
604
 
604
605
  except Exception as e:
605
- logger.error(f"Certificate info retrieval failed: {e}")
606
+ get_global_logger().error(f"Certificate info retrieval failed: {e}")
606
607
  return ErrorResult(message=f"Certificate info retrieval failed: {str(e)}")