mcp-proxy-adapter-dev 8.11.16__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/__init__.py +73 -0
- mcp_proxy_adapter/__main__.py +13 -0
- mcp_proxy_adapter/api/__init__.py +38 -0
- mcp_proxy_adapter/api/app.py +64 -0
- mcp_proxy_adapter/api/command_session_service.py +455 -0
- mcp_proxy_adapter/api/core/__init__.py +19 -0
- mcp_proxy_adapter/api/core/app_factory.py +215 -0
- mcp_proxy_adapter/api/core/app_factory_certificates.py +159 -0
- mcp_proxy_adapter/api/core/app_factory_config.py +75 -0
- mcp_proxy_adapter/api/core/app_factory_routes.py +345 -0
- mcp_proxy_adapter/api/core/app_factory_validators.py +165 -0
- mcp_proxy_adapter/api/core/lifespan_manager/__init__.py +52 -0
- mcp_proxy_adapter/api/core/lifespan_manager/manager.py +354 -0
- mcp_proxy_adapter/api/core/lifespan_manager/queue_config.py +37 -0
- mcp_proxy_adapter/api/core/lifespan_manager/signal_registration.py +74 -0
- mcp_proxy_adapter/api/core/registration/__init__.py +24 -0
- mcp_proxy_adapter/api/core/registration/config_parsers.py +247 -0
- mcp_proxy_adapter/api/core/registration/context_builder.py +130 -0
- mcp_proxy_adapter/api/core/registration/helpers.py +36 -0
- mcp_proxy_adapter/api/core/registration/metadata_builders.py +117 -0
- mcp_proxy_adapter/api/core/registration/models.py +42 -0
- mcp_proxy_adapter/api/core/registration/resolvers.py +195 -0
- mcp_proxy_adapter/api/core/registration/url_builders.py +122 -0
- mcp_proxy_adapter/api/core/registration_context.py +30 -0
- mcp_proxy_adapter/api/core/registration_manager/__init__.py +31 -0
- mcp_proxy_adapter/api/core/registration_manager/helpers.py +307 -0
- mcp_proxy_adapter/api/core/registration_manager/manager.py +584 -0
- mcp_proxy_adapter/api/core/registration_manager/status.py +152 -0
- mcp_proxy_adapter/api/core/registration_tasks.py +387 -0
- mcp_proxy_adapter/api/core/ssl_context_factory.py +99 -0
- mcp_proxy_adapter/api/execute_async_contract.py +124 -0
- mcp_proxy_adapter/api/handlers/__init__.py +335 -0
- mcp_proxy_adapter/api/handlers/command_execution.py +709 -0
- mcp_proxy_adapter/api/handlers/health.py +157 -0
- mcp_proxy_adapter/api/handlers/jsonrpc.py +207 -0
- mcp_proxy_adapter/api/handlers/transfer_notify.py +313 -0
- mcp_proxy_adapter/api/handlers/transfer_sessions.py +287 -0
- mcp_proxy_adapter/api/handlers_async.py +233 -0
- mcp_proxy_adapter/api/health_provider.py +44 -0
- mcp_proxy_adapter/api/jsonrpc_job_lifecycle.py +165 -0
- mcp_proxy_adapter/api/jsonrpc_job_status.py +94 -0
- mcp_proxy_adapter/api/middleware/__init__.py +14 -0
- mcp_proxy_adapter/api/middleware/command_permission_middleware.py +73 -0
- mcp_proxy_adapter/api/middleware/request_logging.py +153 -0
- mcp_proxy_adapter/api/middleware/unified_security.py +367 -0
- mcp_proxy_adapter/api/openapi/__init__.py +18 -0
- mcp_proxy_adapter/api/openapi/command_integration.py +107 -0
- mcp_proxy_adapter/api/openapi/openapi_generator.py +138 -0
- mcp_proxy_adapter/api/openapi/openapi_registry.py +55 -0
- mcp_proxy_adapter/api/public_downloads.py +68 -0
- mcp_proxy_adapter/api/schemas.py +290 -0
- mcp_proxy_adapter/api/tool_integration.py +124 -0
- mcp_proxy_adapter/api/tools.py +244 -0
- mcp_proxy_adapter/api/transfer_session_service.py +329 -0
- mcp_proxy_adapter/api/ws_endpoint.py +653 -0
- mcp_proxy_adapter/api/ws_identity.py +111 -0
- mcp_proxy_adapter/cli/__init__.py +12 -0
- mcp_proxy_adapter/cli/commands/__init__.py +14 -0
- mcp_proxy_adapter/cli/commands/client.py +137 -0
- mcp_proxy_adapter/cli/commands/config_docs/__init__.py +23 -0
- mcp_proxy_adapter/cli/commands/config_docs/cli.py +63 -0
- mcp_proxy_adapter/cli/commands/config_docs/declared_settings.py +45 -0
- mcp_proxy_adapter/cli/commands/config_docs/render.py +58 -0
- mcp_proxy_adapter/cli/commands/config_docs/sections/__init__.py +61 -0
- mcp_proxy_adapter/cli/commands/config_docs/sections/_chunk.py +19 -0
- mcp_proxy_adapter/cli/commands/config_docs/sections/authentication.py +127 -0
- mcp_proxy_adapter/cli/commands/config_docs/sections/best_practices.py +166 -0
- mcp_proxy_adapter/cli/commands/config_docs/sections/common_patterns.py +154 -0
- mcp_proxy_adapter/cli/commands/config_docs/sections/overview.py +135 -0
- mcp_proxy_adapter/cli/commands/config_docs/sections/queue_manager.py +140 -0
- mcp_proxy_adapter/cli/commands/config_docs/sections/registration.py +212 -0
- mcp_proxy_adapter/cli/commands/config_docs/sections/server.py +193 -0
- mcp_proxy_adapter/cli/commands/config_docs/sections/troubleshooting.py +215 -0
- mcp_proxy_adapter/cli/commands/config_generate.py +95 -0
- mcp_proxy_adapter/cli/commands/config_generate_parts/__init__.py +1 -0
- mcp_proxy_adapter/cli/commands/config_generate_parts/arguments.py +44 -0
- mcp_proxy_adapter/cli/commands/config_generate_parts/arguments_core.py +141 -0
- mcp_proxy_adapter/cli/commands/config_generate_parts/arguments_queue.py +140 -0
- mcp_proxy_adapter/cli/commands/config_generate_parts/arguments_validation.py +142 -0
- mcp_proxy_adapter/cli/commands/config_generate_parts/generation.py +365 -0
- mcp_proxy_adapter/cli/commands/config_generate_parts/parsing.py +122 -0
- mcp_proxy_adapter/cli/commands/config_validate.py +154 -0
- mcp_proxy_adapter/cli/commands/info.py +297 -0
- mcp_proxy_adapter/cli/commands/server.py +361 -0
- mcp_proxy_adapter/cli/commands/sets.py +165 -0
- mcp_proxy_adapter/cli/commands/standalone_entry.py +25 -0
- mcp_proxy_adapter/cli/commands/testconfig.py +205 -0
- mcp_proxy_adapter/cli/examples/__init__.py +9 -0
- mcp_proxy_adapter/cli/main.py +75 -0
- mcp_proxy_adapter/cli/parser.py +244 -0
- mcp_proxy_adapter/cli/validators.py +389 -0
- mcp_proxy_adapter/client/jsonrpc_client/__init__.py +139 -0
- mcp_proxy_adapter/client/jsonrpc_client/client.py +257 -0
- mcp_proxy_adapter/client/jsonrpc_client/command_api.py +369 -0
- mcp_proxy_adapter/client/jsonrpc_client/command_api_bases/__init__.py +1 -0
- mcp_proxy_adapter/client/jsonrpc_client/command_api_bases/async_base.py +241 -0
- mcp_proxy_adapter/client/jsonrpc_client/command_api_bases/basic_base.py +150 -0
- mcp_proxy_adapter/client/jsonrpc_client/command_api_bases/catalog_base.py +178 -0
- mcp_proxy_adapter/client/jsonrpc_client/command_api_bases/constants.py +38 -0
- mcp_proxy_adapter/client/jsonrpc_client/command_api_bases/helpers.py +66 -0
- mcp_proxy_adapter/client/jsonrpc_client/command_api_bases/queue_base.py +137 -0
- mcp_proxy_adapter/client/jsonrpc_client/exceptions/__init__.py +70 -0
- mcp_proxy_adapter/client/jsonrpc_client/exceptions/base.py +102 -0
- mcp_proxy_adapter/client/jsonrpc_client/exceptions/classification.py +143 -0
- mcp_proxy_adapter/client/jsonrpc_client/exceptions/request_errors.py +169 -0
- mcp_proxy_adapter/client/jsonrpc_client/exceptions/schema_errors.py +90 -0
- mcp_proxy_adapter/client/jsonrpc_client/exceptions/transfer_errors.py +48 -0
- mcp_proxy_adapter/client/jsonrpc_client/exceptions/transport_errors.py +153 -0
- mcp_proxy_adapter/client/jsonrpc_client/execution_status_observer.py +66 -0
- mcp_proxy_adapter/client/jsonrpc_client/job_event_registry.py +322 -0
- mcp_proxy_adapter/client/jsonrpc_client/job_tracking_mixin.py +206 -0
- mcp_proxy_adapter/client/jsonrpc_client/job_tracking_types.py +135 -0
- mcp_proxy_adapter/client/jsonrpc_client/openapi_validator.py +127 -0
- mcp_proxy_adapter/client/jsonrpc_client/operation_state.py +221 -0
- mcp_proxy_adapter/client/jsonrpc_client/proxy_api.py +93 -0
- mcp_proxy_adapter/client/jsonrpc_client/proxy_api_bases/__init__.py +1 -0
- mcp_proxy_adapter/client/jsonrpc_client/proxy_api_bases/client_base.py +117 -0
- mcp_proxy_adapter/client/jsonrpc_client/proxy_api_bases/lifecycle_base.py +222 -0
- mcp_proxy_adapter/client/jsonrpc_client/proxy_api_bases/register_base.py +230 -0
- mcp_proxy_adapter/client/jsonrpc_client/proxy_api_bases/uuid_base.py +95 -0
- mcp_proxy_adapter/client/jsonrpc_client/queue_api.py +302 -0
- mcp_proxy_adapter/client/jsonrpc_client/queue_status.py +192 -0
- mcp_proxy_adapter/client/jsonrpc_client/schema_generator.py +143 -0
- mcp_proxy_adapter/client/jsonrpc_client/schema_generator_bases/__init__.py +1 -0
- mcp_proxy_adapter/client/jsonrpc_client/schema_generator_bases/models.py +45 -0
- mcp_proxy_adapter/client/jsonrpc_client/schema_generator_bases/parse_base.py +215 -0
- mcp_proxy_adapter/client/jsonrpc_client/schema_generator_bases/validate_base.py +181 -0
- mcp_proxy_adapter/client/jsonrpc_client/transfer_integrity.py +57 -0
- mcp_proxy_adapter/client/jsonrpc_client/transport/__init__.py +161 -0
- mcp_proxy_adapter/client/jsonrpc_client/transport/constants.py +30 -0
- mcp_proxy_adapter/client/jsonrpc_client/transport/helpers.py +118 -0
- mcp_proxy_adapter/client/jsonrpc_client/transport/http_base.py +325 -0
- mcp_proxy_adapter/client/jsonrpc_client/transport/rpc_base.py +311 -0
- mcp_proxy_adapter/client/jsonrpc_client/transport/tls_base.py +295 -0
- mcp_proxy_adapter/client/jsonrpc_client/transport/transfer_base.py +282 -0
- mcp_proxy_adapter/client/jsonrpc_client/ws_command_session.py +230 -0
- mcp_proxy_adapter/client/jsonrpc_client/ws_command_session_bases/__init__.py +1 -0
- mcp_proxy_adapter/client/jsonrpc_client/ws_command_session_bases/core_base.py +154 -0
- mcp_proxy_adapter/client/jsonrpc_client/ws_command_session_bases/helpers.py +72 -0
- mcp_proxy_adapter/client/jsonrpc_client/ws_command_session_bases/wait_base.py +279 -0
- mcp_proxy_adapter/client/jsonrpc_client/ws_job_status.py +337 -0
- mcp_proxy_adapter/client/jsonrpc_client/ws_job_status_parts/__init__.py +1 -0
- mcp_proxy_adapter/client/jsonrpc_client/ws_job_status_parts/channel.py +159 -0
- mcp_proxy_adapter/client/jsonrpc_client/ws_job_status_parts/command_channel.py +154 -0
- mcp_proxy_adapter/client/jsonrpc_client/ws_job_status_parts/helpers.py +76 -0
- mcp_proxy_adapter/client/proxy.py +124 -0
- mcp_proxy_adapter/commands/__init__.py +27 -0
- mcp_proxy_adapter/commands/base.py +998 -0
- mcp_proxy_adapter/commands/builtin_commands.py +186 -0
- mcp_proxy_adapter/commands/command_help_info.py +101 -0
- mcp_proxy_adapter/commands/command_registry/__init__.py +55 -0
- mcp_proxy_adapter/commands/command_registry/builtins_part.py +206 -0
- mcp_proxy_adapter/commands/command_registry/facade.py +310 -0
- mcp_proxy_adapter/commands/command_registry/lifecycle_part.py +232 -0
- mcp_proxy_adapter/commands/command_registry/loader.py +145 -0
- mcp_proxy_adapter/commands/command_registry/mutations_part.py +228 -0
- mcp_proxy_adapter/commands/command_registry/part_base.py +59 -0
- mcp_proxy_adapter/commands/command_registry/queries_part.py +304 -0
- mcp_proxy_adapter/commands/config_command.py +208 -0
- mcp_proxy_adapter/commands/dependency_container.py +35 -0
- mcp_proxy_adapter/commands/echo_command.py +97 -0
- mcp_proxy_adapter/commands/health_command.py +162 -0
- mcp_proxy_adapter/commands/help_command.py +296 -0
- mcp_proxy_adapter/commands/hooks.py +590 -0
- mcp_proxy_adapter/commands/job_metadata.py +26 -0
- mcp_proxy_adapter/commands/load_command.py +134 -0
- mcp_proxy_adapter/commands/nested_validation.py +185 -0
- mcp_proxy_adapter/commands/plugins_command.py +250 -0
- mcp_proxy_adapter/commands/proxy_registration_command.py +475 -0
- mcp_proxy_adapter/commands/queue/__init__.py +83 -0
- mcp_proxy_adapter/commands/queue/add_job_command.py +358 -0
- mcp_proxy_adapter/commands/queue/command_execution_diagnostics.py +100 -0
- mcp_proxy_adapter/commands/queue/delete_job_command.py +92 -0
- mcp_proxy_adapter/commands/queue/get_logs_command.py +90 -0
- mcp_proxy_adapter/commands/queue/get_status_command.py +105 -0
- mcp_proxy_adapter/commands/queue/health_command.py +44 -0
- mcp_proxy_adapter/commands/queue/job_domain_errors.py +117 -0
- mcp_proxy_adapter/commands/queue/job_params.py +163 -0
- mcp_proxy_adapter/commands/queue/jobs/__init__.py +41 -0
- mcp_proxy_adapter/commands/queue/jobs/basic_jobs.py +205 -0
- mcp_proxy_adapter/commands/queue/jobs/command_execution_job.py +198 -0
- mcp_proxy_adapter/commands/queue/jobs/command_restore_base.py +48 -0
- mcp_proxy_adapter/commands/queue/jobs/command_run_base.py +389 -0
- mcp_proxy_adapter/commands/queue/jobs/job_helpers.py +80 -0
- mcp_proxy_adapter/commands/queue/jobs/long_jobs.py +257 -0
- mcp_proxy_adapter/commands/queue/list_jobs_command.py +127 -0
- mcp_proxy_adapter/commands/queue/start_job_command.py +97 -0
- mcp_proxy_adapter/commands/queue/stop_job_command.py +107 -0
- mcp_proxy_adapter/commands/queue_commands.py +49 -0
- mcp_proxy_adapter/commands/registration_status_command.py +83 -0
- mcp_proxy_adapter/commands/reload_command.py +183 -0
- mcp_proxy_adapter/commands/result.py +201 -0
- mcp_proxy_adapter/commands/result_helpers.py +43 -0
- mcp_proxy_adapter/commands/role_test_command.py +119 -0
- mcp_proxy_adapter/commands/roles_management_command/__init__.py +58 -0
- mcp_proxy_adapter/commands/roles_management_command/actions_part.py +400 -0
- mcp_proxy_adapter/commands/roles_management_command/dispatch_part.py +239 -0
- mcp_proxy_adapter/commands/roles_management_command/facade.py +233 -0
- mcp_proxy_adapter/commands/roles_management_command/part_base.py +61 -0
- mcp_proxy_adapter/commands/roles_management_command/results.py +105 -0
- mcp_proxy_adapter/commands/roles_management_command/storage_part.py +181 -0
- mcp_proxy_adapter/commands/schema_helpers.py +45 -0
- mcp_proxy_adapter/commands/settings_command.py +205 -0
- mcp_proxy_adapter/commands/transfer_command_support.py +83 -0
- mcp_proxy_adapter/commands/transfer_download_begin_command.py +245 -0
- mcp_proxy_adapter/commands/transfer_download_status_command.py +121 -0
- mcp_proxy_adapter/commands/transfer_schema_support.py +96 -0
- mcp_proxy_adapter/commands/transfer_upload_begin_command.py +254 -0
- mcp_proxy_adapter/commands/transfer_upload_complete_command.py +161 -0
- mcp_proxy_adapter/commands/transfer_upload_status_command.py +122 -0
- mcp_proxy_adapter/commands/transport_management_command.py +144 -0
- mcp_proxy_adapter/commands/unload_command.py +109 -0
- mcp_proxy_adapter/config.py +30 -0
- mcp_proxy_adapter/core/__init__.py +8 -0
- mcp_proxy_adapter/core/app_factory/__init__.py +17 -0
- mcp_proxy_adapter/core/app_factory/app_creator.py +66 -0
- mcp_proxy_adapter/core/app_factory/config_loader.py +125 -0
- mcp_proxy_adapter/core/app_factory/factory.py +158 -0
- mcp_proxy_adapter/core/app_factory/server_runner.py +152 -0
- mcp_proxy_adapter/core/app_factory/ssl_config.py +194 -0
- mcp_proxy_adapter/core/app_factory/validators.py +57 -0
- mcp_proxy_adapter/core/async_context.py +28 -0
- mcp_proxy_adapter/core/auth/__init__.py +18 -0
- mcp_proxy_adapter/core/auth/certificate_validator.py +239 -0
- mcp_proxy_adapter/core/auth/models.py +47 -0
- mcp_proxy_adapter/core/auth/mtls_validator.py +84 -0
- mcp_proxy_adapter/core/auth/token_validator.py +114 -0
- mcp_proxy_adapter/core/auth_validator.py +137 -0
- mcp_proxy_adapter/core/certificate/__init__.py +20 -0
- mcp_proxy_adapter/core/certificate/certificate_validator/__init__.py +55 -0
- mcp_proxy_adapter/core/certificate/certificate_validator/facade.py +340 -0
- mcp_proxy_adapter/core/certificate/certificate_validator/info_part.py +130 -0
- mcp_proxy_adapter/core/certificate/certificate_validator/key_part.py +146 -0
- mcp_proxy_adapter/core/certificate/certificate_validator/part_base.py +65 -0
- mcp_proxy_adapter/core/certificate/certificate_validator/revocation_part.py +112 -0
- mcp_proxy_adapter/core/client/__init__.py +11 -0
- mcp_proxy_adapter/core/client/auth_handler.py +120 -0
- mcp_proxy_adapter/core/client/client.py +314 -0
- mcp_proxy_adapter/core/client/factory.py +110 -0
- mcp_proxy_adapter/core/client/request_handler.py +122 -0
- mcp_proxy_adapter/core/client/ssl_handler.py +105 -0
- mcp_proxy_adapter/core/client_manager.py +281 -0
- mcp_proxy_adapter/core/client_security/__init__.py +53 -0
- mcp_proxy_adapter/core/client_security/auth_part.py +227 -0
- mcp_proxy_adapter/core/client_security/cert_part.py +124 -0
- mcp_proxy_adapter/core/client_security/facade.py +181 -0
- mcp_proxy_adapter/core/client_security/part_base.py +62 -0
- mcp_proxy_adapter/core/client_security/ssl_part.py +275 -0
- mcp_proxy_adapter/core/config/__init__.py +29 -0
- mcp_proxy_adapter/core/config/config.py +963 -0
- mcp_proxy_adapter/core/config/config_factory.py +16 -0
- mcp_proxy_adapter/core/config/config_graph.py +250 -0
- mcp_proxy_adapter/core/config/config_loader.py +70 -0
- mcp_proxy_adapter/core/config/env_placeholders.py +52 -0
- mcp_proxy_adapter/core/config/feature_manager.py +109 -0
- mcp_proxy_adapter/core/config/orchestration_section.py +119 -0
- mcp_proxy_adapter/core/config/reload_violations.py +269 -0
- mcp_proxy_adapter/core/config/section_validators.py +190 -0
- mcp_proxy_adapter/core/config/settings_declaration.py +255 -0
- mcp_proxy_adapter/core/config/simple_config.py +893 -0
- mcp_proxy_adapter/core/config/simple_config_generator.py +917 -0
- mcp_proxy_adapter/core/config/simple_config_validator.py +333 -0
- mcp_proxy_adapter/core/config/validators/__init__.py +29 -0
- mcp_proxy_adapter/core/config/validators/auth_validator.py +146 -0
- mcp_proxy_adapter/core/config/validators/base_validator.py +102 -0
- mcp_proxy_adapter/core/config/validators/certificate_validator_helper.py +114 -0
- mcp_proxy_adapter/core/config/validators/client_validator.py +131 -0
- mcp_proxy_adapter/core/config/validators/job_push_validator.py +55 -0
- mcp_proxy_adapter/core/config/validators/queue_manager_validator.py +133 -0
- mcp_proxy_adapter/core/config/validators/registration_validator.py +366 -0
- mcp_proxy_adapter/core/config/validators/server_validation_validator.py +154 -0
- mcp_proxy_adapter/core/config/validators/server_validator.py +326 -0
- mcp_proxy_adapter/core/config/validators/ssl_validator.py +221 -0
- mcp_proxy_adapter/core/config/websocket_validator.py +99 -0
- mcp_proxy_adapter/core/config_validator.py +29 -0
- mcp_proxy_adapter/core/constants.py +201 -0
- mcp_proxy_adapter/core/crl_utils.py +338 -0
- mcp_proxy_adapter/core/date_utils.py +119 -0
- mcp_proxy_adapter/core/delivery/__init__.py +35 -0
- mcp_proxy_adapter/core/delivery/contracts.py +57 -0
- mcp_proxy_adapter/core/delivery/exceptions.py +19 -0
- mcp_proxy_adapter/core/delivery/terminal_replay_store.py +129 -0
- mcp_proxy_adapter/core/delivery/ws_delivery_manager.py +117 -0
- mcp_proxy_adapter/core/domain_errors.py +189 -0
- mcp_proxy_adapter/core/error_handling.py +98 -0
- mcp_proxy_adapter/core/errors/__init__.py +259 -0
- mcp_proxy_adapter/core/errors/config_errors.py +142 -0
- mcp_proxy_adapter/core/file_utils.py +94 -0
- mcp_proxy_adapter/core/job_manager.py +115 -0
- mcp_proxy_adapter/core/job_push/__init__.py +124 -0
- mcp_proxy_adapter/core/job_push/caller_loss.py +89 -0
- mcp_proxy_adapter/core/job_push/engine.py +282 -0
- mcp_proxy_adapter/core/job_push/events/__init__.py +111 -0
- mcp_proxy_adapter/core/job_push/events/builders.py +282 -0
- mcp_proxy_adapter/core/job_push/events/command_session_payloads.py +50 -0
- mcp_proxy_adapter/core/job_push/events/delivery_payloads.py +52 -0
- mcp_proxy_adapter/core/job_push/events/event_names.py +163 -0
- mcp_proxy_adapter/core/job_push/events/job_payloads.py +83 -0
- mcp_proxy_adapter/core/job_push/events/transfer_payloads.py +72 -0
- mcp_proxy_adapter/core/job_push/execute_async_deliver_guard.py +55 -0
- mcp_proxy_adapter/core/job_push/finish_signal.py +91 -0
- mcp_proxy_adapter/core/job_push/hooks.py +53 -0
- mcp_proxy_adapter/core/job_push/job_status_accumulator.py +376 -0
- mcp_proxy_adapter/core/job_push/lifespan_wiring.py +252 -0
- mcp_proxy_adapter/core/job_push/notifier.py +139 -0
- mcp_proxy_adapter/core/job_push/notifier_policy.py +38 -0
- mcp_proxy_adapter/core/job_push/queue_custom_push.py +67 -0
- mcp_proxy_adapter/core/job_push/subscriptions.py +160 -0
- mcp_proxy_adapter/core/job_push/transfer_correlation.py +47 -0
- mcp_proxy_adapter/core/job_push/transfer_push.py +135 -0
- mcp_proxy_adapter/core/json_utils.py +81 -0
- mcp_proxy_adapter/core/logging/__init__.py +42 -0
- mcp_proxy_adapter/core/logging/formatters.py +55 -0
- mcp_proxy_adapter/core/logging/global_logger.py +41 -0
- mcp_proxy_adapter/core/logging/request_logger.py +50 -0
- mcp_proxy_adapter/core/logging/setup.py +190 -0
- mcp_proxy_adapter/core/logging/worker.py +107 -0
- mcp_proxy_adapter/core/mtls_asgi_app.py +216 -0
- mcp_proxy_adapter/core/mtls_server.py +180 -0
- mcp_proxy_adapter/core/orchestration/__init__.py +90 -0
- mcp_proxy_adapter/core/orchestration/candidate_validator.py +196 -0
- mcp_proxy_adapter/core/orchestration/catalog_builder.py +136 -0
- mcp_proxy_adapter/core/orchestration/catalog_snapshot.py +115 -0
- mcp_proxy_adapter/core/orchestration/command_record.py +43 -0
- mcp_proxy_adapter/core/orchestration/discovery_client.py +229 -0
- mcp_proxy_adapter/core/orchestration/orchestration_api.py +273 -0
- mcp_proxy_adapter/core/orchestration/orchestration_config.py +146 -0
- mcp_proxy_adapter/core/orchestration/orchestration_errors.py +305 -0
- mcp_proxy_adapter/core/orchestration/orchestration_lifespan.py +199 -0
- mcp_proxy_adapter/core/orchestration/parameter_graph.py +106 -0
- mcp_proxy_adapter/core/orchestration/polling_loop.py +281 -0
- mcp_proxy_adapter/core/orchestration/server_record.py +37 -0
- mcp_proxy_adapter/core/orchestration/snapshot_holder.py +90 -0
- mcp_proxy_adapter/core/orchestration/tool_context_exposure.py +83 -0
- mcp_proxy_adapter/core/orchestration/tool_context_snapshot.py +164 -0
- mcp_proxy_adapter/core/path_utils.py +220 -0
- mcp_proxy_adapter/core/protocol_manager.py +260 -0
- mcp_proxy_adapter/core/proxy/__init__.py +62 -0
- mcp_proxy_adapter/core/proxy/auth_manager.py +110 -0
- mcp_proxy_adapter/core/proxy_client.py +252 -0
- mcp_proxy_adapter/core/proxy_registration.py +55 -0
- mcp_proxy_adapter/core/role_utils.py +166 -0
- mcp_proxy_adapter/core/server_adapter.py +302 -0
- mcp_proxy_adapter/core/server_engine.py +384 -0
- mcp_proxy_adapter/core/settings.py +299 -0
- mcp_proxy_adapter/core/signal_handler.py +136 -0
- mcp_proxy_adapter/core/ssl_utils.py +482 -0
- mcp_proxy_adapter/core/transport_manager.py +168 -0
- mcp_proxy_adapter/core/utils.py +74 -0
- mcp_proxy_adapter/core/validation/__init__.py +21 -0
- mcp_proxy_adapter/core/validation/config_validator.py +256 -0
- mcp_proxy_adapter/core/validation/file_validator.py +229 -0
- mcp_proxy_adapter/core/validation/protocol_validator.py +322 -0
- mcp_proxy_adapter/core/validation/proxy_registration_validator.py +268 -0
- mcp_proxy_adapter/core/validation/security_validator.py +300 -0
- mcp_proxy_adapter/core/validation/validation_result.py +34 -0
- mcp_proxy_adapter/core/validation/validator_support.py +64 -0
- mcp_proxy_adapter/core/validation_utils.py +160 -0
- mcp_proxy_adapter/core/ws_timeouts.py +88 -0
- mcp_proxy_adapter/custom_openapi.py +93 -0
- mcp_proxy_adapter/examples/PROTOCOL_EXAMPLES.md +79 -0
- mcp_proxy_adapter/examples/README.md +272 -0
- mcp_proxy_adapter/examples/README_EN.md +258 -0
- mcp_proxy_adapter/examples/SECURITY_TESTING.md +455 -0
- mcp_proxy_adapter/examples/__init__.py +16 -0
- mcp_proxy_adapter/examples/basic_framework/__init__.py +9 -0
- mcp_proxy_adapter/examples/basic_framework/commands/__init__.py +4 -0
- mcp_proxy_adapter/examples/basic_framework/configs/http_auth.json +21 -0
- mcp_proxy_adapter/examples/basic_framework/configs/http_simple.json +21 -0
- mcp_proxy_adapter/examples/basic_framework/configs/https_auth.json +21 -0
- mcp_proxy_adapter/examples/basic_framework/configs/https_no_protocol_middleware.json +21 -0
- mcp_proxy_adapter/examples/basic_framework/configs/https_simple.json +21 -0
- mcp_proxy_adapter/examples/basic_framework/configs/mtls_no_protocol_middleware.json +21 -0
- mcp_proxy_adapter/examples/basic_framework/configs/mtls_no_roles.json +21 -0
- mcp_proxy_adapter/examples/basic_framework/configs/mtls_simple.json +21 -0
- mcp_proxy_adapter/examples/basic_framework/configs/mtls_with_registration.json +73 -0
- mcp_proxy_adapter/examples/basic_framework/configs/mtls_with_roles.json +21 -0
- mcp_proxy_adapter/examples/basic_framework/hooks/__init__.py +4 -0
- mcp_proxy_adapter/examples/basic_framework/main.py +123 -0
- mcp_proxy_adapter/examples/basic_framework/roles.json +1 -0
- mcp_proxy_adapter/examples/bug_report_security_framework.md +141 -0
- mcp_proxy_adapter/examples/cert_config.json +1 -0
- mcp_proxy_adapter/examples/certs/cert_config.json +1 -0
- mcp_proxy_adapter/examples/check_config.py +71 -0
- mcp_proxy_adapter/examples/check_config_split_parts/__init__.py +3 -0
- mcp_proxy_adapter/examples/check_config_split_parts/checker.py +247 -0
- mcp_proxy_adapter/examples/check_config_split_parts/cli.py +68 -0
- mcp_proxy_adapter/examples/check_config_split_parts/commands.py +102 -0
- mcp_proxy_adapter/examples/cli_config_examples/__init__.py +8 -0
- mcp_proxy_adapter/examples/cli_config_examples/examples_configs/http.json +69 -0
- mcp_proxy_adapter/examples/cli_config_examples/examples_configs/https_token_roles.json +84 -0
- mcp_proxy_adapter/examples/cli_config_examples/examples_configs/mtls_roles.json +84 -0
- mcp_proxy_adapter/examples/cli_config_examples/http_basic.py +97 -0
- mcp_proxy_adapter/examples/cli_config_examples/https_token.py +128 -0
- mcp_proxy_adapter/examples/cli_config_examples/mtls_roles.py +140 -0
- mcp_proxy_adapter/examples/client_configs/api_key_client.json +1 -0
- mcp_proxy_adapter/examples/client_configs/basic_auth_client.json +1 -0
- mcp_proxy_adapter/examples/client_configs/certificate_client.json +1 -0
- mcp_proxy_adapter/examples/client_configs/jwt_client.json +1 -0
- mcp_proxy_adapter/examples/client_configs/no_auth_client.json +1 -0
- mcp_proxy_adapter/examples/client_usage_example.py +216 -0
- mcp_proxy_adapter/examples/commands/__init__.py +5 -0
- mcp_proxy_adapter/examples/comprehensive/__init__.py +10 -0
- mcp_proxy_adapter/examples/comprehensive/run.py +906 -0
- mcp_proxy_adapter/examples/comprehensive_config.json +10 -0
- mcp_proxy_adapter/examples/config.json +10 -0
- mcp_proxy_adapter/examples/config_builder.py +272 -0
- mcp_proxy_adapter/examples/config_cli.py +340 -0
- mcp_proxy_adapter/examples/config_factory.py +325 -0
- mcp_proxy_adapter/examples/configs/full_featured.json +10 -0
- mcp_proxy_adapter/examples/configs/http_auth.json +10 -0
- mcp_proxy_adapter/examples/configs/http_simple.json +10 -0
- mcp_proxy_adapter/examples/configs/http_token.json +10 -0
- mcp_proxy_adapter/examples/configs/https_auth.json +10 -0
- mcp_proxy_adapter/examples/configs/https_simple.json +10 -0
- mcp_proxy_adapter/examples/configs/https_token.json +10 -0
- mcp_proxy_adapter/examples/configs/mtls_no_roles.json +10 -0
- mcp_proxy_adapter/examples/configs/mtls_simple.json +10 -0
- mcp_proxy_adapter/examples/configs/mtls_with_proxy.json +10 -0
- mcp_proxy_adapter/examples/configs/mtls_with_roles.json +10 -0
- mcp_proxy_adapter/examples/configs/roles.json +1 -0
- mcp_proxy_adapter/examples/create_test_configs.py +216 -0
- mcp_proxy_adapter/examples/debug_role_chain.py +192 -0
- mcp_proxy_adapter/examples/demo_client.py +339 -0
- mcp_proxy_adapter/examples/examples_correct/http_example.json +10 -0
- mcp_proxy_adapter/examples/full_application/__init__.py +11 -0
- mcp_proxy_adapter/examples/full_application/commands/__init__.py +32 -0
- mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py +75 -0
- mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py +101 -0
- mcp_proxy_adapter/examples/full_application/commands/embed_job_status_command.py +133 -0
- mcp_proxy_adapter/examples/full_application/commands/embed_queue_command.py +153 -0
- mcp_proxy_adapter/examples/full_application/commands/long_running_command.py +175 -0
- mcp_proxy_adapter/examples/full_application/commands/slow_start_long_task_command.py +172 -0
- mcp_proxy_adapter/examples/full_application/configs/http_basic.json +73 -0
- mcp_proxy_adapter/examples/full_application/configs/http_basic_smart_assistant_proxy3004.json +67 -0
- mcp_proxy_adapter/examples/full_application/configs/http_no_registration.json +72 -0
- mcp_proxy_adapter/examples/full_application/configs/http_token.json +69 -0
- mcp_proxy_adapter/examples/full_application/configs/http_token_roles.json +81 -0
- mcp_proxy_adapter/examples/full_application/configs/http_token_roles_smart_assistant_proxy3004.json +81 -0
- mcp_proxy_adapter/examples/full_application/configs/http_token_smart_assistant_proxy3004.json +69 -0
- mcp_proxy_adapter/examples/full_application/configs/https_basic.json +74 -0
- mcp_proxy_adapter/examples/full_application/configs/https_basic_smart_assistant_proxy3004.json +81 -0
- mcp_proxy_adapter/examples/full_application/configs/https_token.json +76 -0
- mcp_proxy_adapter/examples/full_application/configs/https_token_roles.json +88 -0
- mcp_proxy_adapter/examples/full_application/configs/https_token_roles_smart_assistant_proxy3004.json +95 -0
- mcp_proxy_adapter/examples/full_application/configs/https_token_smart_assistant_proxy3004.json +83 -0
- mcp_proxy_adapter/examples/full_application/configs/mtls_no_roles.json +78 -0
- mcp_proxy_adapter/examples/full_application/configs/mtls_no_roles_correct.json +76 -0
- mcp_proxy_adapter/examples/full_application/configs/mtls_no_roles_smart_assistant_proxy3004.json +83 -0
- mcp_proxy_adapter/examples/full_application/configs/mtls_no_security.json +77 -0
- mcp_proxy_adapter/examples/full_application/configs/mtls_with_roles.json +82 -0
- mcp_proxy_adapter/examples/full_application/configs/mtls_with_roles_correct.json +88 -0
- mcp_proxy_adapter/examples/full_application/configs/mtls_with_roles_smart_assistant_proxy3004.json +95 -0
- mcp_proxy_adapter/examples/full_application/configs/mtls_ws_repro.json +76 -0
- mcp_proxy_adapter/examples/full_application/configs/proxy_server.json +64 -0
- mcp_proxy_adapter/examples/full_application/configs/proxy_server_https.json +63 -0
- mcp_proxy_adapter/examples/full_application/configs/proxy_server_mtls.json +63 -0
- mcp_proxy_adapter/examples/full_application/example_support.py +45 -0
- mcp_proxy_adapter/examples/full_application/hooks/__init__.py +4 -0
- mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py +51 -0
- mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py +46 -0
- mcp_proxy_adapter/examples/full_application/main.py +95 -0
- mcp_proxy_adapter/examples/full_application/main_modules/__init__.py +1 -0
- mcp_proxy_adapter/examples/full_application/main_modules/registration.py +122 -0
- mcp_proxy_adapter/examples/full_application/main_modules/runner.py +310 -0
- mcp_proxy_adapter/examples/full_application/proxy_commands/__init__.py +113 -0
- mcp_proxy_adapter/examples/full_application/proxy_commands/_shared.py +8 -0
- mcp_proxy_adapter/examples/full_application/proxy_commands/lifecycle_commands.py +196 -0
- mcp_proxy_adapter/examples/full_application/proxy_commands/register_command.py +254 -0
- mcp_proxy_adapter/examples/full_application/proxy_commands/registry_state.py +8 -0
- mcp_proxy_adapter/examples/full_application/proxy_commands/results.py +142 -0
- mcp_proxy_adapter/examples/full_application/proxy_endpoints.py +162 -0
- mcp_proxy_adapter/examples/full_application/proxy_schemas.py +91 -0
- mcp_proxy_adapter/examples/full_application/roles.json +1 -0
- mcp_proxy_adapter/examples/full_application/test_client.py +341 -0
- mcp_proxy_adapter/examples/full_application/test_minimal_server.py +57 -0
- mcp_proxy_adapter/examples/full_application/test_queue_and_descriptions.py +283 -0
- mcp_proxy_adapter/examples/full_application/test_server.py +221 -0
- mcp_proxy_adapter/examples/full_application/test_simple_server.py +141 -0
- mcp_proxy_adapter/examples/generate_all_certificates.py +74 -0
- mcp_proxy_adapter/examples/generate_config.py +44 -0
- mcp_proxy_adapter/examples/generate_config_parts/__init__.py +3 -0
- mcp_proxy_adapter/examples/generate_config_parts/builders.py +234 -0
- mcp_proxy_adapter/examples/generate_config_parts/cli.py +260 -0
- mcp_proxy_adapter/examples/generate_config_parts/outputs.py +137 -0
- mcp_proxy_adapter/examples/generator_validator_compatibility_report.md +127 -0
- mcp_proxy_adapter/examples/http_proxy_example.json +17 -0
- mcp_proxy_adapter/examples/https_proxy_example.json +17 -0
- mcp_proxy_adapter/examples/job_tracking_demo.py +235 -0
- mcp_proxy_adapter/examples/proxy_server_support.py +384 -0
- mcp_proxy_adapter/examples/queue_demo_simple.py +37 -0
- mcp_proxy_adapter/examples/queue_demo_simple_parts/__init__.py +3 -0
- mcp_proxy_adapter/examples/queue_demo_simple_parts/_shared.py +8 -0
- mcp_proxy_adapter/examples/queue_demo_simple_parts/demo.py +213 -0
- mcp_proxy_adapter/examples/queue_demo_simple_parts/mock_commands.py +130 -0
- mcp_proxy_adapter/examples/queue_demo_simple_parts/mock_manager.py +272 -0
- mcp_proxy_adapter/examples/queue_example_support.py +36 -0
- mcp_proxy_adapter/examples/queue_fire_and_forget_example.py +370 -0
- mcp_proxy_adapter/examples/queue_server_demo.py +73 -0
- mcp_proxy_adapter/examples/queue_server_example.py +76 -0
- mcp_proxy_adapter/examples/queue_server_simple.py +251 -0
- mcp_proxy_adapter/examples/required_certificates.py +216 -0
- mcp_proxy_adapter/examples/run_example.py +119 -0
- mcp_proxy_adapter/examples/run_full_test_suite.py +674 -0
- mcp_proxy_adapter/examples/run_proxy_server.py +118 -0
- mcp_proxy_adapter/examples/run_security_tests_fixed.py +876 -0
- mcp_proxy_adapter/examples/security_test/__init__.py +18 -0
- mcp_proxy_adapter/examples/security_test/auth_manager.py +49 -0
- mcp_proxy_adapter/examples/security_test/ssl_context_manager.py +144 -0
- mcp_proxy_adapter/examples/security_test/test_client.py +218 -0
- mcp_proxy_adapter/examples/security_test/test_result.py +23 -0
- mcp_proxy_adapter/examples/security_test_client.py +103 -0
- mcp_proxy_adapter/examples/server_configs/config_basic_http.json +16 -0
- mcp_proxy_adapter/examples/server_configs/config_http_token.json +16 -0
- mcp_proxy_adapter/examples/server_configs/config_https.json +16 -0
- mcp_proxy_adapter/examples/server_configs/config_https_token.json +16 -0
- mcp_proxy_adapter/examples/server_configs/config_mtls.json +16 -0
- mcp_proxy_adapter/examples/server_configs/config_proxy_registration.json +15 -0
- mcp_proxy_adapter/examples/server_configs/config_simple.json +9 -0
- mcp_proxy_adapter/examples/server_configs/http_simple.json +14 -0
- mcp_proxy_adapter/examples/server_configs/http_token.json +14 -0
- mcp_proxy_adapter/examples/server_configs/https_simple.json +14 -0
- mcp_proxy_adapter/examples/server_configs/https_token.json +14 -0
- mcp_proxy_adapter/examples/server_configs/mtls_no_roles.json +8 -0
- mcp_proxy_adapter/examples/server_configs/mtls_test.json +8 -0
- mcp_proxy_adapter/examples/server_configs/mtls_with_roles.json +14 -0
- mcp_proxy_adapter/examples/server_configs/roles.json +1 -0
- mcp_proxy_adapter/examples/setup/__init__.py +48 -0
- mcp_proxy_adapter/examples/setup/certificate_manager.py +384 -0
- mcp_proxy_adapter/examples/setup/config_generator.py +6 -0
- mcp_proxy_adapter/examples/setup/config_validator.py +140 -0
- mcp_proxy_adapter/examples/setup/environment_setup.py +143 -0
- mcp_proxy_adapter/examples/setup/test_files_generator.py +6 -0
- mcp_proxy_adapter/examples/setup/test_runner.py +143 -0
- mcp_proxy_adapter/examples/setup_test_environment.py +233 -0
- mcp_proxy_adapter/examples/simple_http_example.json +17 -0
- mcp_proxy_adapter/examples/simple_https_example.json +17 -0
- mcp_proxy_adapter/examples/simple_protocol_test.py +167 -0
- mcp_proxy_adapter/examples/test_client/README.md +166 -0
- mcp_proxy_adapter/examples/test_client/__init__.py +7 -0
- mcp_proxy_adapter/examples/test_client/main.py +102 -0
- mcp_proxy_adapter/examples/test_client/main_split_parts/__init__.py +1 -0
- mcp_proxy_adapter/examples/test_client/main_split_parts/helpers.py +83 -0
- mcp_proxy_adapter/examples/test_client/main_split_parts/runner.py +115 -0
- mcp_proxy_adapter/examples/test_client/main_split_parts/scenarios.py +195 -0
- mcp_proxy_adapter/examples/test_config.py +183 -0
- mcp_proxy_adapter/examples/test_configs/custom_https.json +10 -0
- mcp_proxy_adapter/examples/test_configs/http_simple.json +10 -0
- mcp_proxy_adapter/examples/test_examples.py +361 -0
- mcp_proxy_adapter/examples/test_mcp_server.py +249 -0
- mcp_proxy_adapter/examples/test_protocol_examples.py +373 -0
- mcp_proxy_adapter/examples/test_proxy/README.md +70 -0
- mcp_proxy_adapter/examples/test_proxy/__init__.py +7 -0
- mcp_proxy_adapter/examples/test_proxy/main.py +106 -0
- mcp_proxy_adapter/examples/test_server/README.md +58 -0
- mcp_proxy_adapter/examples/test_server/__init__.py +7 -0
- mcp_proxy_adapter/examples/test_server/main.py +349 -0
- mcp_proxy_adapter/examples/transparent_queue_commands.py +281 -0
- mcp_proxy_adapter/examples/transparent_queue_e1_sync_call.py +102 -0
- mcp_proxy_adapter/examples/transparent_queue_e2_event_stream.py +134 -0
- mcp_proxy_adapter/examples/transparent_queue_e3_ws_timeouts.py +341 -0
- mcp_proxy_adapter/examples/transparent_queue_e4_ws_fallback.py +159 -0
- mcp_proxy_adapter/examples/transparent_queue_e5_inner_failure.py +189 -0
- mcp_proxy_adapter/examples/transparent_queue_e6_atomic_state.py +203 -0
- mcp_proxy_adapter/examples/transparent_queue_e7_caller_loss.py +63 -0
- mcp_proxy_adapter/examples/transparent_queue_e7_split2/__init__.py +3 -0
- mcp_proxy_adapter/examples/transparent_queue_e7_split2/cases.py +335 -0
- mcp_proxy_adapter/examples/transparent_queue_e7_split2/helpers.py +66 -0
- mcp_proxy_adapter/examples/transparent_queue_support.py +377 -0
- mcp_proxy_adapter/examples/unified_error_handling_example.py +127 -0
- mcp_proxy_adapter/examples/unified_error_handling_split_parts/__init__.py +3 -0
- mcp_proxy_adapter/examples/unified_error_handling_split_parts/demos.py +180 -0
- mcp_proxy_adapter/examples/unified_error_handling_split_parts/runner.py +109 -0
- mcp_proxy_adapter/examples/unified_error_handling_split_parts/support.py +79 -0
- mcp_proxy_adapter/examples/unified_error_handling_texts.py +17 -0
- mcp_proxy_adapter/examples/universal_client.py +215 -0
- mcp_proxy_adapter/examples/universal_client_split_parts/__init__.py +3 -0
- mcp_proxy_adapter/examples/universal_client_split_parts/configs.py +104 -0
- mcp_proxy_adapter/examples/universal_client_split_parts/demos.py +144 -0
- mcp_proxy_adapter/examples/update_config_certificates.py +156 -0
- mcp_proxy_adapter/examples/validate_generator_compatibility_simple.py +60 -0
- mcp_proxy_adapter/examples/websocket_examples/__init__.py +8 -0
- mcp_proxy_adapter/examples/websocket_examples/client_bidirectional_websocket.py +100 -0
- mcp_proxy_adapter/examples/websocket_examples/client_websocket_job_status.py +103 -0
- mcp_proxy_adapter/examples/websocket_examples/run_ws_test_server.py +157 -0
- mcp_proxy_adapter/examples/ws_examples/__init__.py +6 -0
- mcp_proxy_adapter/examples/ws_examples/http_basic_ws.py +68 -0
- mcp_proxy_adapter/examples/ws_examples/http_token_roles_ws.py +66 -0
- mcp_proxy_adapter/examples/ws_examples/http_token_ws.py +80 -0
- mcp_proxy_adapter/examples/ws_examples/https_basic_ws.py +61 -0
- mcp_proxy_adapter/examples/ws_examples/https_token_roles_ws.py +67 -0
- mcp_proxy_adapter/examples/ws_examples/https_token_ws.py +64 -0
- mcp_proxy_adapter/examples/ws_examples/mtls_basic_ws.py +94 -0
- mcp_proxy_adapter/examples/ws_examples/mtls_roles_ws.py +88 -0
- mcp_proxy_adapter/examples/ws_examples/ws_example_runner.py +233 -0
- mcp_proxy_adapter/integrations/__init__.py +31 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/__init__.py +124 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/_compat.py +60 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/_health.py +299 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/_limits.py +70 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/_process_reap.py +232 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/_result_builders.py +119 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/_status_helpers.py +167 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/global_manager.py +174 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/job_types/__init__.py +375 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/job_types/value_types.py +97 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/job_types/worker_probe.py +29 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/manager/__init__.py +52 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/manager/fallback_base.py +240 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/manager/fallback_stop_base.py +179 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/manager/health_base.py +460 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/manager/integration.py +189 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/manager/job_start_base.py +333 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/manager/job_stop_base.py +274 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/manager/lifecycle_base.py +393 -0
- mcp_proxy_adapter/integrations/queuemgr_integration/manager/query_base.py +269 -0
- mcp_proxy_adapter/integrations/queuemgr_registration.py +66 -0
- mcp_proxy_adapter/integrations/queuemgr_version.py +39 -0
- mcp_proxy_adapter/main.py +385 -0
- mcp_proxy_adapter/main_ssl_paths.py +29 -0
- mcp_proxy_adapter/py.typed +0 -0
- mcp_proxy_adapter/schemas/base_schema.json +114 -0
- mcp_proxy_adapter/schemas/openapi_schema.json +269 -0
- mcp_proxy_adapter/schemas/roles.json +37 -0
- mcp_proxy_adapter/schemas/roles_schema.json +162 -0
- mcp_proxy_adapter/transfer/__init__.py +56 -0
- mcp_proxy_adapter/transfer/checksums.py +81 -0
- mcp_proxy_adapter/transfer/client_downloader/__init__.py +37 -0
- mcp_proxy_adapter/transfer/client_downloader/download_support.py +109 -0
- mcp_proxy_adapter/transfer/client_downloader/downloader.py +300 -0
- mcp_proxy_adapter/transfer/client_uploader.py +278 -0
- mcp_proxy_adapter/transfer/compression.py +127 -0
- mcp_proxy_adapter/transfer/errors.py +253 -0
- mcp_proxy_adapter/transfer/json_coerce.py +32 -0
- mcp_proxy_adapter/transfer/models.py +337 -0
- mcp_proxy_adapter/transfer/path_confinement.py +69 -0
- mcp_proxy_adapter/transfer/progress_percent.py +25 -0
- mcp_proxy_adapter/transfer/server_store.py +878 -0
- mcp_proxy_adapter/version.py +8 -0
- mcp_proxy_adapter_dev-8.11.16.dist-info/METADATA +1666 -0
- mcp_proxy_adapter_dev-8.11.16.dist-info/RECORD +644 -0
- mcp_proxy_adapter_dev-8.11.16.dist-info/WHEEL +5 -0
- mcp_proxy_adapter_dev-8.11.16.dist-info/entry_points.txt +12 -0
- mcp_proxy_adapter_dev-8.11.16.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Author: Vasiliy Zdanovskiy
|
|
3
|
+
email: vasilyvz@gmail.com
|
|
4
|
+
|
|
5
|
+
RegistrationManager class for proxy registration functionality.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import asyncio
|
|
9
|
+
from typing import Any, Dict, List, Optional
|
|
10
|
+
from urllib.parse import urlparse
|
|
11
|
+
|
|
12
|
+
from mcp_proxy_adapter.api.core.registration_context import (
|
|
13
|
+
HeartbeatSettings,
|
|
14
|
+
ProxyCredentials,
|
|
15
|
+
RegistrationContext,
|
|
16
|
+
prepare_registration_context,
|
|
17
|
+
resolve_heartbeat_settings,
|
|
18
|
+
resolve_runtime_credentials,
|
|
19
|
+
resolve_unregister_endpoint,
|
|
20
|
+
)
|
|
21
|
+
from mcp_proxy_adapter.api.core.registration_tasks import (
|
|
22
|
+
create_heartbeat_task,
|
|
23
|
+
)
|
|
24
|
+
from mcp_proxy_adapter.api.core.registration_tasks import (
|
|
25
|
+
unregister_from_proxy as unregister_task,
|
|
26
|
+
)
|
|
27
|
+
from mcp_proxy_adapter.client.jsonrpc_client import JsonRpcClient
|
|
28
|
+
from mcp_proxy_adapter.core.logging import get_global_logger
|
|
29
|
+
|
|
30
|
+
from .helpers import (
|
|
31
|
+
apply_context,
|
|
32
|
+
can_start_tasks,
|
|
33
|
+
classify_registration_error,
|
|
34
|
+
format_httpx_error,
|
|
35
|
+
format_registration_error_message,
|
|
36
|
+
log_credentials,
|
|
37
|
+
)
|
|
38
|
+
from .status import set_registration_snapshot, set_registration_status, set_stop_flag
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class RegistrationSetupError(RuntimeError):
|
|
42
|
+
"""Raised when registration setup encounters a fatal, non-recoverable error.
|
|
43
|
+
|
|
44
|
+
Raised by ``RegistrationManager.start_heartbeat()`` when configuration
|
|
45
|
+
validation or context preparation fails. This class deliberately does
|
|
46
|
+
NOT call ``sys.exit()`` itself (bug 85fbfd87) - RegistrationManager is a
|
|
47
|
+
library-safe unit that never terminates the process on its own. The
|
|
48
|
+
ONE real caller, ``api/core/lifespan_manager.py``'s ``lifespan()``,
|
|
49
|
+
decides what a registration setup failure means for server startup: it
|
|
50
|
+
catches this specific type, reports it (``logger.critical()`` plus
|
|
51
|
+
``_report_fatal_to_stderr()`` for a NullHandler-default consumer), and
|
|
52
|
+
re-raises so the ASGI lifespan fails and the server process exits
|
|
53
|
+
non-zero - see that module's docstring for the full mechanism.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class RegistrationManager:
|
|
60
|
+
"""Manager for proxy registration functionality using JsonRpcClient."""
|
|
61
|
+
|
|
62
|
+
def __init__(self) -> None:
|
|
63
|
+
"""Initialize registration manager."""
|
|
64
|
+
self.logger = get_global_logger()
|
|
65
|
+
self.registered = False
|
|
66
|
+
self._registration_config: Optional[Dict[str, Any]] = None
|
|
67
|
+
self.registration_task: Optional[asyncio.Task] = None
|
|
68
|
+
self.server_name: Optional[str] = None
|
|
69
|
+
self.server_url: Optional[str] = None
|
|
70
|
+
self.proxy_url: Optional[str] = None
|
|
71
|
+
self.capabilities: List[str] = []
|
|
72
|
+
self.metadata: Dict[str, Any] = {}
|
|
73
|
+
self.config: Optional[Dict[str, Any]] = None
|
|
74
|
+
self._proxy_registration_config: Dict[str, Any] = {}
|
|
75
|
+
self._registration_credentials: Optional[ProxyCredentials] = None
|
|
76
|
+
self._runtime_credentials: Optional[ProxyCredentials] = None
|
|
77
|
+
self._register_endpoint: str = "/register"
|
|
78
|
+
self._heartbeat_settings: Optional[HeartbeatSettings] = None
|
|
79
|
+
# Bug 398ba96c follow-up: last TLS error kind actually logged at
|
|
80
|
+
# ERROR by register_with_proxy()'s retry loop, so a persistent
|
|
81
|
+
# failure - across retries within one call AND across the repeated
|
|
82
|
+
# calls heartbeat_loop makes every cycle while unregistered - logs
|
|
83
|
+
# ERROR once per state change instead of once per attempt.
|
|
84
|
+
self._last_logged_error_kind: Optional[str] = None
|
|
85
|
+
|
|
86
|
+
def _get_state(self) -> Dict[str, Any]:
|
|
87
|
+
"""Get manager state as dictionary."""
|
|
88
|
+
return {
|
|
89
|
+
"server_name": self.server_name,
|
|
90
|
+
"server_url": self.server_url,
|
|
91
|
+
"proxy_url": self.proxy_url,
|
|
92
|
+
"capabilities": self.capabilities,
|
|
93
|
+
"metadata": self.metadata,
|
|
94
|
+
"config": self.config,
|
|
95
|
+
"_proxy_registration_config": self._proxy_registration_config,
|
|
96
|
+
"_registration_credentials": self._registration_credentials,
|
|
97
|
+
"_runtime_credentials": self._runtime_credentials,
|
|
98
|
+
"_register_endpoint": self._register_endpoint,
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
def _set_state(self, state: Dict[str, Any]) -> None:
|
|
102
|
+
"""Set manager state from dictionary."""
|
|
103
|
+
self.server_name = state.get("server_name")
|
|
104
|
+
self.server_url = state.get("server_url")
|
|
105
|
+
self.proxy_url = state.get("proxy_url")
|
|
106
|
+
self.capabilities = state.get("capabilities", [])
|
|
107
|
+
self.metadata = state.get("metadata", {})
|
|
108
|
+
self.config = state.get("config")
|
|
109
|
+
self._proxy_registration_config = state.get("_proxy_registration_config", {})
|
|
110
|
+
self._registration_credentials = state.get("_registration_credentials")
|
|
111
|
+
self._runtime_credentials = state.get("_runtime_credentials")
|
|
112
|
+
self._register_endpoint = state.get("_register_endpoint", "/register")
|
|
113
|
+
|
|
114
|
+
def _apply_context(
|
|
115
|
+
self, context: RegistrationContext, config: Dict[str, Any]
|
|
116
|
+
) -> None:
|
|
117
|
+
"""Apply registration context to manager state."""
|
|
118
|
+
state = self._get_state()
|
|
119
|
+
apply_context(context, config, state)
|
|
120
|
+
self._set_state(state)
|
|
121
|
+
|
|
122
|
+
def _log_credentials(self, prefix: str, credentials: ProxyCredentials) -> None:
|
|
123
|
+
"""Log proxy credentials information."""
|
|
124
|
+
log_credentials(self.logger, prefix, credentials)
|
|
125
|
+
|
|
126
|
+
def _format_httpx_error(self, exc: Exception) -> str:
|
|
127
|
+
"""Format httpx exception for logging."""
|
|
128
|
+
return format_httpx_error(exc)
|
|
129
|
+
|
|
130
|
+
def _require_registration_context(self) -> None:
|
|
131
|
+
"""Verify registration context is fully initialized.
|
|
132
|
+
|
|
133
|
+
Raises RuntimeError if proxy_url, server_name, or server_url are None.
|
|
134
|
+
"""
|
|
135
|
+
if self.proxy_url is None:
|
|
136
|
+
raise RuntimeError(
|
|
137
|
+
"proxy_url not initialized; registration context incomplete"
|
|
138
|
+
)
|
|
139
|
+
if self.server_name is None:
|
|
140
|
+
raise RuntimeError(
|
|
141
|
+
"server_name not initialized; registration context incomplete"
|
|
142
|
+
)
|
|
143
|
+
if self.server_url is None:
|
|
144
|
+
raise RuntimeError(
|
|
145
|
+
"server_url not initialized; registration context incomplete"
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
def _can_start_tasks(self) -> bool:
|
|
149
|
+
"""Check if registration tasks can be started."""
|
|
150
|
+
return can_start_tasks(self._get_state())
|
|
151
|
+
|
|
152
|
+
async def register_with_proxy(self, config: Dict[str, Any]) -> bool:
|
|
153
|
+
"""
|
|
154
|
+
Register this server with the proxy using JsonRpcClient.
|
|
155
|
+
|
|
156
|
+
Uses only the new ``registration`` format from SimpleConfig.
|
|
157
|
+
Registration is controlled by ``registration.auto_on_startup``.
|
|
158
|
+
"""
|
|
159
|
+
context = prepare_registration_context(config, self.logger)
|
|
160
|
+
if context is None:
|
|
161
|
+
await set_registration_snapshot(enabled=False, registered=False)
|
|
162
|
+
return True
|
|
163
|
+
|
|
164
|
+
self._apply_context(context, config)
|
|
165
|
+
await set_registration_snapshot(
|
|
166
|
+
enabled=True,
|
|
167
|
+
registered=self.registered,
|
|
168
|
+
proxy_url=self.proxy_url,
|
|
169
|
+
server_name=self.server_name,
|
|
170
|
+
server_url=self.server_url,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
self._require_registration_context()
|
|
174
|
+
# _require_registration_context() already raises if any of these are
|
|
175
|
+
# None; the assert only narrows the type for mypy, it never fires.
|
|
176
|
+
assert (
|
|
177
|
+
self.proxy_url is not None
|
|
178
|
+
) # nosec B101 - type-narrowing only, _require_registration_context() above already raised if None
|
|
179
|
+
assert (
|
|
180
|
+
self.server_name is not None
|
|
181
|
+
) # nosec B101 - type-narrowing only, _require_registration_context() above already raised if None
|
|
182
|
+
assert (
|
|
183
|
+
self.server_url is not None
|
|
184
|
+
) # nosec B101 - type-narrowing only, _require_registration_context() above already raised if None
|
|
185
|
+
proxy_url: str = self.proxy_url
|
|
186
|
+
|
|
187
|
+
# Parse proxy URL to extract host and port
|
|
188
|
+
parsed = urlparse(proxy_url)
|
|
189
|
+
proxy_host = parsed.hostname or "localhost"
|
|
190
|
+
proxy_port = parsed.port or (443 if parsed.scheme == "https" else 80)
|
|
191
|
+
|
|
192
|
+
# Get protocol from URL scheme
|
|
193
|
+
proxy_protocol = parsed.scheme or "http"
|
|
194
|
+
# Check if mTLS (https with certificates)
|
|
195
|
+
ssl_config = self._proxy_registration_config.get("ssl", {})
|
|
196
|
+
if (
|
|
197
|
+
isinstance(ssl_config, dict)
|
|
198
|
+
and ssl_config.get("cert")
|
|
199
|
+
and ssl_config.get("ca")
|
|
200
|
+
):
|
|
201
|
+
proxy_protocol = "mtls"
|
|
202
|
+
|
|
203
|
+
# Extract client certificate paths from credentials
|
|
204
|
+
client_cert = None
|
|
205
|
+
client_key = None
|
|
206
|
+
client_ca = None
|
|
207
|
+
if context.credentials.cert:
|
|
208
|
+
client_cert, client_key = context.credentials.cert
|
|
209
|
+
if isinstance(context.credentials.verify, str):
|
|
210
|
+
client_ca = context.credentials.verify
|
|
211
|
+
|
|
212
|
+
self.logger.debug(
|
|
213
|
+
"Creating JsonRpcClient: protocol=%s, host=%s, port=%s, cert=%s, ca=%s",
|
|
214
|
+
proxy_protocol,
|
|
215
|
+
proxy_host,
|
|
216
|
+
proxy_port,
|
|
217
|
+
client_cert is not None,
|
|
218
|
+
client_ca is not None,
|
|
219
|
+
)
|
|
220
|
+
if client_cert:
|
|
221
|
+
self.logger.debug(" Client cert: %s, key: %s", client_cert, client_key)
|
|
222
|
+
if client_ca:
|
|
223
|
+
self.logger.debug(" CA cert: %s", client_ca)
|
|
224
|
+
|
|
225
|
+
client = JsonRpcClient(
|
|
226
|
+
protocol=proxy_protocol,
|
|
227
|
+
host=proxy_host,
|
|
228
|
+
port=proxy_port,
|
|
229
|
+
cert=client_cert,
|
|
230
|
+
key=client_key,
|
|
231
|
+
ca=client_ca,
|
|
232
|
+
check_hostname=context.credentials.check_hostname,
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
async def _register() -> Dict[str, Any]:
|
|
236
|
+
"""Register server with proxy; return registration response."""
|
|
237
|
+
self._log_credentials("🔐 Registration SSL config", context.credentials)
|
|
238
|
+
self.logger.info(f"📡 Connecting to proxy: {proxy_url}")
|
|
239
|
+
self.logger.info(
|
|
240
|
+
" Endpoint: %s, Server: %s -> %s",
|
|
241
|
+
self._register_endpoint,
|
|
242
|
+
self.server_name,
|
|
243
|
+
self.server_url,
|
|
244
|
+
)
|
|
245
|
+
self.logger.info(f"🔍 [REG_MANAGER] Metadata: {self.metadata}")
|
|
246
|
+
self.logger.info(
|
|
247
|
+
f"🔍 [REG_MANAGER] UUID in metadata: {self.metadata.get('uuid')}"
|
|
248
|
+
)
|
|
249
|
+
self.logger.info("🔍 [REG_MANAGER] Calling client.register_with_proxy...")
|
|
250
|
+
try:
|
|
251
|
+
result = await client.register_with_proxy(
|
|
252
|
+
proxy_url=proxy_url,
|
|
253
|
+
server_name=context.server_name,
|
|
254
|
+
server_url=context.advertised_url,
|
|
255
|
+
capabilities=self.capabilities,
|
|
256
|
+
metadata=self.metadata,
|
|
257
|
+
cert=context.credentials.cert,
|
|
258
|
+
verify=context.credentials.verify,
|
|
259
|
+
)
|
|
260
|
+
self.logger.info(
|
|
261
|
+
f"🔍 [REG_MANAGER] Registration response received: {result}"
|
|
262
|
+
)
|
|
263
|
+
return result
|
|
264
|
+
except Exception: # noqa: BLE001
|
|
265
|
+
# Bug a2b87028: classification and logging of this exception
|
|
266
|
+
# is deferred to the outer retry loop's except block (line 311)
|
|
267
|
+
# so it happens exactly once and is paired with the
|
|
268
|
+
# last_error/last_error_kind snapshot update. The inner
|
|
269
|
+
# _register() function just re-raises; outer handles display.
|
|
270
|
+
raise
|
|
271
|
+
|
|
272
|
+
max_retries = 5
|
|
273
|
+
retry_delay = 2
|
|
274
|
+
|
|
275
|
+
try:
|
|
276
|
+
for attempt in range(max_retries):
|
|
277
|
+
try:
|
|
278
|
+
registration_response = await _register()
|
|
279
|
+
if registration_response is not None:
|
|
280
|
+
self.logger.debug(
|
|
281
|
+
"Proxy registration response payload: %s",
|
|
282
|
+
registration_response,
|
|
283
|
+
)
|
|
284
|
+
# Bug 8613b454: an "already registered" error-key
|
|
285
|
+
# check used to live here, gated on
|
|
286
|
+
# registration_response.get("error", ""). Removed as
|
|
287
|
+
# dead code, not merely unreachable-in-practice: this
|
|
288
|
+
# branch only runs when _register() RETURNS (no
|
|
289
|
+
# exception), and JsonRpcClient.register_with_proxy()
|
|
290
|
+
# (mcp_proxy_adapter/client/jsonrpc_client/proxy_api.py)
|
|
291
|
+
# never returns a dict carrying an "error" key on any
|
|
292
|
+
# code path - every HTTP >= 400 response either raises
|
|
293
|
+
# RuntimeError/ConnectionError/TimeoutError or falls
|
|
294
|
+
# through to response.raise_for_status(), so
|
|
295
|
+
# registration_response.get("error", "") was
|
|
296
|
+
# ALWAYS "" here, by construction of the client this
|
|
297
|
+
# method calls, independent of which proxy answers.
|
|
298
|
+
# See the removed unregister/re-register recovery
|
|
299
|
+
# block below (former exception-path siblings) for
|
|
300
|
+
# the fuller evidence trail.
|
|
301
|
+
self.logger.info(
|
|
302
|
+
"✅ Successfully registered with proxy as %s -> %s",
|
|
303
|
+
self.server_name,
|
|
304
|
+
self.server_url,
|
|
305
|
+
)
|
|
306
|
+
self.registered = True
|
|
307
|
+
await set_registration_status(True)
|
|
308
|
+
# Bug a2b87028: clear any previously recorded
|
|
309
|
+
# failure - a successful registration means the
|
|
310
|
+
# error last_error/last_error_kind describe is no
|
|
311
|
+
# longer current.
|
|
312
|
+
await set_registration_snapshot(
|
|
313
|
+
registered=True, last_error=None, last_error_kind=None
|
|
314
|
+
)
|
|
315
|
+
# Bug 398ba96c follow-up: a fresh success clears the
|
|
316
|
+
# dedup tracker below, so the NEXT distinct failure
|
|
317
|
+
# (whatever kind it is) logs at ERROR again instead
|
|
318
|
+
# of staying silently suppressed forever.
|
|
319
|
+
self._last_logged_error_kind = None
|
|
320
|
+
return True
|
|
321
|
+
except Exception as exc: # noqa: BLE001
|
|
322
|
+
last_error_kind = classify_registration_error(exc)
|
|
323
|
+
display_msg = format_registration_error_message(
|
|
324
|
+
exc, self.proxy_url or proxy_url
|
|
325
|
+
)
|
|
326
|
+
# Bug 398ba96c follow-up: heartbeat_loop
|
|
327
|
+
# (registration_tasks.py) calls register_with_proxy()
|
|
328
|
+
# again on EVERY heartbeat cycle while unregistered, and
|
|
329
|
+
# this retry loop runs up to `max_retries` attempts per
|
|
330
|
+
# call - so a persistent TLS misconfiguration used to
|
|
331
|
+
# log a fresh ERROR line on every attempt of every call
|
|
332
|
+
# (heartbeat_loop's own dedup, added by 398ba96c's first
|
|
333
|
+
# fix, only covers its own two except blocks and never
|
|
334
|
+
# sees these per-attempt failures at all). Track the
|
|
335
|
+
# last logged kind on the manager instance - it
|
|
336
|
+
# persists across both retries within one call AND
|
|
337
|
+
# across separate calls - and log ERROR only on the
|
|
338
|
+
# first occurrence of a kind or when the kind changes;
|
|
339
|
+
# repeats log at DEBUG.
|
|
340
|
+
if (
|
|
341
|
+
last_error_kind == "tls_verification"
|
|
342
|
+
and self._last_logged_error_kind != last_error_kind
|
|
343
|
+
):
|
|
344
|
+
self.logger.error("❌ %s", display_msg)
|
|
345
|
+
self._last_logged_error_kind = last_error_kind
|
|
346
|
+
elif last_error_kind == "tls_verification":
|
|
347
|
+
self.logger.debug("TLS verification error persists: %s", exc)
|
|
348
|
+
|
|
349
|
+
# Bug 8613b454: an "already registered" unregister-then-
|
|
350
|
+
# re-register recovery block used to live here, gated on
|
|
351
|
+
# `"already registered" in full_error.lower()` (and two
|
|
352
|
+
# further nested checks of the same shape on the retry's
|
|
353
|
+
# own response/exception). Removed as dead code: the only
|
|
354
|
+
# proxy registration commands this project ships -
|
|
355
|
+
# mcp_proxy_adapter/examples/full_application/
|
|
356
|
+
# proxy_commands.py's ProxyRegisterCommand.execute() and
|
|
357
|
+
# mcp_proxy_adapter/examples/test_proxy/main.py - both
|
|
358
|
+
# perform an unconditional upsert on every registration
|
|
359
|
+
# call and never return an "error" field at all, so
|
|
360
|
+
# neither the outer gate nor its nested siblings could
|
|
361
|
+
# ever match against either reference proxy (confirmed by
|
|
362
|
+
# reading both command implementations directly, and
|
|
363
|
+
# independently documented in
|
|
364
|
+
# pipeline/checks/check_proxy_registration.py's module
|
|
365
|
+
# docstring, which asserts the REACHABLE contract instead:
|
|
366
|
+
# a second registration of the same server_id is an
|
|
367
|
+
# idempotent upsert that collapses to one registry entry).
|
|
368
|
+
# No source for a distinct external proxy product that
|
|
369
|
+
# returns this error exists anywhere in this repository
|
|
370
|
+
# or its docs (docs/TRANSPARENT_REGISTRATION.md and
|
|
371
|
+
# docs/EN/guides/registration_with_mcp_proxy_in_docker_mtls.md
|
|
372
|
+
# document no such contract), so there is nothing to wire
|
|
373
|
+
# this recovery path to. If a real external proxy that
|
|
374
|
+
# needs this recovery is integrated in the future, it
|
|
375
|
+
# should be re-added keyed to THAT proxy's actual,
|
|
376
|
+
# observed error contract rather than resurrected
|
|
377
|
+
# speculatively - a registration failure of any other
|
|
378
|
+
# shape already falls through to the retry-with-backoff
|
|
379
|
+
# logic immediately below, unchanged by this removal.
|
|
380
|
+
|
|
381
|
+
# Existing retry logic for other errors
|
|
382
|
+
if attempt < max_retries - 1:
|
|
383
|
+
self.logger.warning(
|
|
384
|
+
"⚠️ Registration attempt %s/%s failed: %s. Retrying in %ss...",
|
|
385
|
+
attempt + 1,
|
|
386
|
+
max_retries,
|
|
387
|
+
display_msg,
|
|
388
|
+
retry_delay,
|
|
389
|
+
)
|
|
390
|
+
await asyncio.sleep(retry_delay)
|
|
391
|
+
retry_delay *= 2
|
|
392
|
+
else:
|
|
393
|
+
self.logger.warning(
|
|
394
|
+
"⚠️ %s (after %s attempts). Server is running; API is available without proxy.",
|
|
395
|
+
display_msg,
|
|
396
|
+
max_retries,
|
|
397
|
+
)
|
|
398
|
+
await set_registration_snapshot(
|
|
399
|
+
registered=False,
|
|
400
|
+
last_error=display_msg,
|
|
401
|
+
last_error_kind=last_error_kind,
|
|
402
|
+
)
|
|
403
|
+
return False
|
|
404
|
+
return False
|
|
405
|
+
except Exception as exc: # noqa: BLE001
|
|
406
|
+
self.logger.error(f"❌ Registration error: {exc}")
|
|
407
|
+
await set_registration_snapshot(
|
|
408
|
+
registered=False,
|
|
409
|
+
last_error=format_registration_error_message(
|
|
410
|
+
exc, self.proxy_url or proxy_url
|
|
411
|
+
),
|
|
412
|
+
last_error_kind=classify_registration_error(exc),
|
|
413
|
+
)
|
|
414
|
+
return False
|
|
415
|
+
finally:
|
|
416
|
+
await client.close()
|
|
417
|
+
|
|
418
|
+
async def start_heartbeat(self, config: Dict[str, Any]) -> None:
|
|
419
|
+
"""Start heartbeat task using JsonRpcClient."""
|
|
420
|
+
self.logger.info(
|
|
421
|
+
"🔍 start_heartbeat called with config keys: %s",
|
|
422
|
+
list(config.keys()) if config else "None",
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
await set_stop_flag(False)
|
|
426
|
+
self._registration_config = config
|
|
427
|
+
|
|
428
|
+
try:
|
|
429
|
+
context = prepare_registration_context(config, self.logger)
|
|
430
|
+
except ValueError as e:
|
|
431
|
+
self.logger.error(f"❌ Configuration error in registration: {e}")
|
|
432
|
+
self.logger.error("🛑 Stopping server due to configuration error")
|
|
433
|
+
raise RegistrationSetupError(
|
|
434
|
+
f"Registration configuration error: {e}"
|
|
435
|
+
) from e
|
|
436
|
+
except Exception as e:
|
|
437
|
+
self.logger.error(f"❌ Failed to prepare registration context: {e}")
|
|
438
|
+
self.logger.error("🛑 Stopping server due to registration error")
|
|
439
|
+
raise RegistrationSetupError(
|
|
440
|
+
f"Failed to prepare registration context: {e}"
|
|
441
|
+
) from e
|
|
442
|
+
|
|
443
|
+
self.logger.info(f"🔍 Registration context prepared: {context is not None}")
|
|
444
|
+
|
|
445
|
+
if context is not None:
|
|
446
|
+
self._apply_context(context, config)
|
|
447
|
+
await set_registration_snapshot(
|
|
448
|
+
enabled=True,
|
|
449
|
+
registered=self.registered,
|
|
450
|
+
proxy_url=self.proxy_url,
|
|
451
|
+
server_name=self.server_name,
|
|
452
|
+
server_url=self.server_url,
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
if context is None:
|
|
456
|
+
await set_registration_snapshot(enabled=False, registered=False)
|
|
457
|
+
self.logger.debug("Registration is disabled, heartbeat task will not start")
|
|
458
|
+
return
|
|
459
|
+
|
|
460
|
+
self.logger.info("✅ Registration context available")
|
|
461
|
+
self.logger.info(
|
|
462
|
+
f"✅ Context applied: server_name={self.server_name}, proxy_url={self.proxy_url}"
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
if not self._can_start_tasks():
|
|
466
|
+
self.logger.warning(
|
|
467
|
+
"⚠️ Cannot start tasks (missing proxy_url, server_name, or server_url)"
|
|
468
|
+
)
|
|
469
|
+
return
|
|
470
|
+
|
|
471
|
+
credentials = self._registration_credentials or resolve_runtime_credentials(
|
|
472
|
+
self._proxy_registration_config,
|
|
473
|
+
)
|
|
474
|
+
settings = resolve_heartbeat_settings(
|
|
475
|
+
self._proxy_registration_config,
|
|
476
|
+
self.proxy_url or "http://localhost:3005",
|
|
477
|
+
)
|
|
478
|
+
self._runtime_credentials = credentials
|
|
479
|
+
self._heartbeat_settings = settings
|
|
480
|
+
|
|
481
|
+
heartbeat_url = settings.url
|
|
482
|
+
self.logger.info(
|
|
483
|
+
"💓 Starting heartbeat task (interval: %ss)", settings.interval
|
|
484
|
+
)
|
|
485
|
+
|
|
486
|
+
if self.server_name is None:
|
|
487
|
+
raise RuntimeError(
|
|
488
|
+
"server_name not initialized; registration context incomplete"
|
|
489
|
+
)
|
|
490
|
+
if self.server_url is None:
|
|
491
|
+
raise RuntimeError(
|
|
492
|
+
"server_url not initialized; registration context incomplete"
|
|
493
|
+
)
|
|
494
|
+
|
|
495
|
+
self.registration_task = create_heartbeat_task(
|
|
496
|
+
registration_manager=self,
|
|
497
|
+
proxy_url=heartbeat_url,
|
|
498
|
+
server_name=self.server_name,
|
|
499
|
+
server_url=self.server_url,
|
|
500
|
+
capabilities=self.capabilities,
|
|
501
|
+
metadata=self.metadata,
|
|
502
|
+
settings=settings,
|
|
503
|
+
credentials=credentials,
|
|
504
|
+
logger=self.logger,
|
|
505
|
+
)
|
|
506
|
+
|
|
507
|
+
async def stop(self) -> None:
|
|
508
|
+
"""Stop registration manager and unregister from proxy."""
|
|
509
|
+
await set_stop_flag(True)
|
|
510
|
+
|
|
511
|
+
if self.registration_task:
|
|
512
|
+
self.registration_task.cancel()
|
|
513
|
+
try:
|
|
514
|
+
await self.registration_task
|
|
515
|
+
except asyncio.CancelledError:
|
|
516
|
+
pass
|
|
517
|
+
self.registration_task = None
|
|
518
|
+
|
|
519
|
+
await set_stop_flag(False)
|
|
520
|
+
|
|
521
|
+
if not (self.registered and self._can_start_tasks() and self.config):
|
|
522
|
+
self.registered = False
|
|
523
|
+
return
|
|
524
|
+
|
|
525
|
+
credentials = self._runtime_credentials or resolve_runtime_credentials(
|
|
526
|
+
self._proxy_registration_config,
|
|
527
|
+
)
|
|
528
|
+
endpoint = resolve_unregister_endpoint(
|
|
529
|
+
self._proxy_registration_config,
|
|
530
|
+
)
|
|
531
|
+
|
|
532
|
+
if self.proxy_url is None:
|
|
533
|
+
raise RuntimeError(
|
|
534
|
+
"proxy_url not initialized; registration context incomplete"
|
|
535
|
+
)
|
|
536
|
+
if self.server_name is None:
|
|
537
|
+
raise RuntimeError(
|
|
538
|
+
"server_name not initialized; registration context incomplete"
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
try:
|
|
542
|
+
await unregister_task(
|
|
543
|
+
proxy_url=self.proxy_url,
|
|
544
|
+
server_name=self.server_name,
|
|
545
|
+
endpoint=endpoint,
|
|
546
|
+
credentials=credentials,
|
|
547
|
+
logger=self.logger,
|
|
548
|
+
)
|
|
549
|
+
except Exception as exc: # noqa: BLE001
|
|
550
|
+
self.logger.error(f"Error unregistering from proxy: {exc}")
|
|
551
|
+
finally:
|
|
552
|
+
self.registered = False
|
|
553
|
+
|
|
554
|
+
async def unregister(self) -> None:
|
|
555
|
+
"""Unregister from proxy (used internally)."""
|
|
556
|
+
if not (self.registered and self._can_start_tasks() and self.config):
|
|
557
|
+
return
|
|
558
|
+
|
|
559
|
+
credentials = self._runtime_credentials or resolve_runtime_credentials(
|
|
560
|
+
self._proxy_registration_config,
|
|
561
|
+
)
|
|
562
|
+
endpoint = resolve_unregister_endpoint(
|
|
563
|
+
self._proxy_registration_config,
|
|
564
|
+
)
|
|
565
|
+
|
|
566
|
+
if self.proxy_url is None:
|
|
567
|
+
raise RuntimeError(
|
|
568
|
+
"proxy_url not initialized; registration context incomplete"
|
|
569
|
+
)
|
|
570
|
+
if self.server_name is None:
|
|
571
|
+
raise RuntimeError(
|
|
572
|
+
"server_name not initialized; registration context incomplete"
|
|
573
|
+
)
|
|
574
|
+
|
|
575
|
+
try:
|
|
576
|
+
await unregister_task(
|
|
577
|
+
proxy_url=self.proxy_url,
|
|
578
|
+
server_name=self.server_name,
|
|
579
|
+
endpoint=endpoint,
|
|
580
|
+
credentials=credentials,
|
|
581
|
+
logger=self.logger,
|
|
582
|
+
)
|
|
583
|
+
except Exception as exc: # noqa: BLE001
|
|
584
|
+
self.logger.error(f"Error unregistering from proxy: {exc}")
|