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,917 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Author: Vasiliy Zdanovskiy
|
|
3
|
+
email: vasilyvz@gmail.com
|
|
4
|
+
|
|
5
|
+
Simple configuration generator for MCP Proxy Adapter.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import copy
|
|
11
|
+
import json
|
|
12
|
+
import os
|
|
13
|
+
import threading
|
|
14
|
+
import uuid
|
|
15
|
+
from typing import Any, Callable, Dict, List, Mapping, Optional, Set, Tuple
|
|
16
|
+
|
|
17
|
+
from mcp_proxy_adapter.core.orchestration.orchestration_config import StaticServerEntry
|
|
18
|
+
|
|
19
|
+
from .orchestration_section import OrchestrationSectionConfig
|
|
20
|
+
from .section_validators import check_project_section_name
|
|
21
|
+
from .settings_declaration import SETTINGS, get_default
|
|
22
|
+
from .simple_config import (
|
|
23
|
+
AuthConfig,
|
|
24
|
+
ClientConfig,
|
|
25
|
+
HeartbeatConfig,
|
|
26
|
+
JobPushConfig,
|
|
27
|
+
QueueManagerConfig,
|
|
28
|
+
RegistrationConfig,
|
|
29
|
+
ServerConfig,
|
|
30
|
+
ServerValidationConfig,
|
|
31
|
+
SimpleConfig,
|
|
32
|
+
SimpleConfigModel,
|
|
33
|
+
SSLConfig,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
VERIFY_MODES = ("CERT_NONE", "CERT_OPTIONAL", "CERT_REQUIRED")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def apply_config_overrides(
|
|
40
|
+
path: str,
|
|
41
|
+
set_overrides: Optional[Dict[str, Any]] = None,
|
|
42
|
+
section_overlays: Optional[Dict[str, Dict[str, Any]]] = None,
|
|
43
|
+
) -> None:
|
|
44
|
+
"""
|
|
45
|
+
Write project sections and dotted-key overrides into a saved config file.
|
|
46
|
+
|
|
47
|
+
``SimpleConfig.save`` persists only the dataclass sections of the adapter,
|
|
48
|
+
so project-owned top-level sections (and any generic override) are merged
|
|
49
|
+
into the JSON document afterwards. Overlays are applied first, then
|
|
50
|
+
``set_overrides``; a dotted key ``a.b.c`` addresses nested objects and
|
|
51
|
+
creates missing intermediate objects.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
path: Path of an already saved JSON configuration file.
|
|
55
|
+
set_overrides: Mapping of dotted ``section.key`` paths to values.
|
|
56
|
+
section_overlays: Mapping of top-level section name to a dict that is
|
|
57
|
+
merged (key by key) into that section.
|
|
58
|
+
|
|
59
|
+
Raises:
|
|
60
|
+
ValueError: If a dotted path crosses a non-object value or the file
|
|
61
|
+
does not hold a JSON object.
|
|
62
|
+
"""
|
|
63
|
+
if not set_overrides and not section_overlays:
|
|
64
|
+
return
|
|
65
|
+
with open(path, "r", encoding="utf-8") as handle:
|
|
66
|
+
data = json.load(handle)
|
|
67
|
+
if not isinstance(data, dict):
|
|
68
|
+
raise ValueError(f"Configuration file {path} is not a JSON object")
|
|
69
|
+
for name, overlay in (section_overlays or {}).items():
|
|
70
|
+
current = data.get(name)
|
|
71
|
+
if current is None:
|
|
72
|
+
current = {}
|
|
73
|
+
data[name] = current
|
|
74
|
+
if not isinstance(current, dict):
|
|
75
|
+
raise ValueError(f"Section '{name}' is not an object; cannot overlay it")
|
|
76
|
+
current.update(overlay)
|
|
77
|
+
for dotted, value in (set_overrides or {}).items():
|
|
78
|
+
parts = dotted.split(".")
|
|
79
|
+
node: Dict[str, Any] = data
|
|
80
|
+
for part in parts[:-1]:
|
|
81
|
+
child = node.get(part)
|
|
82
|
+
if child is None:
|
|
83
|
+
child = {}
|
|
84
|
+
node[part] = child
|
|
85
|
+
if not isinstance(child, dict):
|
|
86
|
+
raise ValueError(f"Cannot set '{dotted}': '{part}' is not an object")
|
|
87
|
+
node = child
|
|
88
|
+
node[parts[-1]] = value
|
|
89
|
+
with open(path, "w", encoding="utf-8") as handle:
|
|
90
|
+
json.dump(data, handle, indent=2, ensure_ascii=False)
|
|
91
|
+
handle.write("\n")
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
GeneratorSectionProvider = Callable[[Dict[str, Any]], Mapping[str, Any]]
|
|
95
|
+
|
|
96
|
+
_PROVIDERS: Dict[str, GeneratorSectionProvider] = {}
|
|
97
|
+
_PROVIDERS_LOCK = threading.Lock()
|
|
98
|
+
|
|
99
|
+
# generate() parameter -> dotted configuration key it sets (R-L5 exclusivity).
|
|
100
|
+
DEDICATED_PARAM_KEYS: Dict[str, str] = {
|
|
101
|
+
"server_host": "server.host",
|
|
102
|
+
"server_port": "server.port",
|
|
103
|
+
"server_cert_file": "server.ssl.cert",
|
|
104
|
+
"server_key_file": "server.ssl.key",
|
|
105
|
+
"server_ca_cert_file": "server.ssl.ca",
|
|
106
|
+
"server_crl_file": "server.ssl.crl",
|
|
107
|
+
"server_debug": "server.debug",
|
|
108
|
+
"server_log_level": "server.log_level",
|
|
109
|
+
"server_log_dir": "server.log_dir",
|
|
110
|
+
"server_servername": "server.servername",
|
|
111
|
+
"server_advertised_host": "server.advertised_host",
|
|
112
|
+
"server_rules": "server.rules",
|
|
113
|
+
"server_keep_alive_timeout": "server.keep_alive_timeout",
|
|
114
|
+
"server_log_file_output": "server.log_file_output",
|
|
115
|
+
"ssl_verify_mode": "server.ssl.verify_mode",
|
|
116
|
+
"registration_host": "registration.host",
|
|
117
|
+
"registration_port": "registration.port",
|
|
118
|
+
"registration_protocol": "registration.protocol",
|
|
119
|
+
"registration_server_id": "registration.server_id",
|
|
120
|
+
"registration_server_name": "registration.server_name",
|
|
121
|
+
"instance_uuid": "registration.instance_uuid",
|
|
122
|
+
"registration_heartbeat_interval": "registration.heartbeat_interval",
|
|
123
|
+
"registration_capabilities": "registration.capabilities",
|
|
124
|
+
"registration_unregister_url": "registration.unregister_url",
|
|
125
|
+
"registration_metadata": "registration.metadata",
|
|
126
|
+
"queue_completed_job_retention_seconds": "queue_manager.completed_job_retention_seconds",
|
|
127
|
+
"queue_manager_max_retained_terminal_jobs": "queue_manager.max_retained_terminal_jobs",
|
|
128
|
+
"job_push_legacy_unified_terminal_dedup": "job_push.legacy_unified_terminal_dedup",
|
|
129
|
+
"orchestration_discovery_enabled": "orchestration.discovery_enabled",
|
|
130
|
+
"orchestration_polling_interval": "orchestration.polling_interval",
|
|
131
|
+
"orchestration_initial_poll_timeout": "orchestration.initial_poll_timeout",
|
|
132
|
+
"orchestration_stale_snapshot_behavior": "orchestration.stale_snapshot_behavior",
|
|
133
|
+
"orchestration_mutex_lock_timeout": "orchestration.mutex_lock_timeout",
|
|
134
|
+
"orchestration_static_servers": "orchestration.static_servers",
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def register_generator_section_provider(
|
|
139
|
+
section: str, provider: GeneratorSectionProvider
|
|
140
|
+
) -> None:
|
|
141
|
+
"""
|
|
142
|
+
Register a provider that adds a project section to every generated config.
|
|
143
|
+
|
|
144
|
+
``generate()`` calls ``provider(deep copy of the generated adapter config)``
|
|
145
|
+
and writes the returned mapping under ``section``; a ``section_overlays``
|
|
146
|
+
entry for the same section wins key by key. A raising provider makes
|
|
147
|
+
``generate`` raise ``RuntimeError`` naming the section and writes no file.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
section: Project top-level section name (not adapter-owned).
|
|
151
|
+
provider: Callable returning the section mapping.
|
|
152
|
+
|
|
153
|
+
Raises:
|
|
154
|
+
TypeError: If ``section`` is not a string or ``provider`` is not callable.
|
|
155
|
+
ValueError: If ``section`` is empty or adapter-owned.
|
|
156
|
+
"""
|
|
157
|
+
check_project_section_name(section)
|
|
158
|
+
if not callable(provider):
|
|
159
|
+
raise TypeError("provider must be callable")
|
|
160
|
+
with _PROVIDERS_LOCK:
|
|
161
|
+
_PROVIDERS[section] = provider
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def unregister_generator_section_provider(section: str) -> None:
|
|
165
|
+
"""Remove the provider of ``section``; an unknown section is a no-op."""
|
|
166
|
+
with _PROVIDERS_LOCK:
|
|
167
|
+
_PROVIDERS.pop(section, None)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class ConfigOverrideConflictError(ValueError):
|
|
171
|
+
"""A dedicated parameter and ``set_overrides`` address the same key."""
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def _declared_adapter_key(section: str, key: str) -> bool:
|
|
175
|
+
"""Return True when ``section.key`` (or a path inside an object leaf) is declared."""
|
|
176
|
+
parts = key.split(".")
|
|
177
|
+
for end in range(len(parts), 0, -1):
|
|
178
|
+
spec = SETTINGS.get((section, ".".join(parts[:end])))
|
|
179
|
+
if spec is not None:
|
|
180
|
+
return end == len(parts) or "object" in spec.types
|
|
181
|
+
return False
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def _adapter_owned(section: str) -> bool:
|
|
185
|
+
"""Return True when ``section`` is an adapter-owned top-level section."""
|
|
186
|
+
try:
|
|
187
|
+
check_project_section_name(section)
|
|
188
|
+
except ValueError:
|
|
189
|
+
return True
|
|
190
|
+
except TypeError:
|
|
191
|
+
return False
|
|
192
|
+
return False
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
_PY_JSON_TYPES = (
|
|
196
|
+
(bool, ("boolean",)),
|
|
197
|
+
(int, ("integer", "number")),
|
|
198
|
+
(float, ("number",)),
|
|
199
|
+
(str, ("string",)),
|
|
200
|
+
(list, ("array",)),
|
|
201
|
+
(tuple, ("array",)),
|
|
202
|
+
(dict, ("object",)),
|
|
203
|
+
(type(None), ("null",)),
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def _declared_value_problems(overrides: Mapping[str, Any]) -> List[str]:
|
|
208
|
+
"""Check override values against the declared type, allowed values and range."""
|
|
209
|
+
problems: List[str] = []
|
|
210
|
+
for dotted, value in overrides.items():
|
|
211
|
+
section, _, key = dotted.partition(".")
|
|
212
|
+
spec = SETTINGS.get((section, key))
|
|
213
|
+
if spec is None:
|
|
214
|
+
continue
|
|
215
|
+
names: Tuple[str, ...] = ()
|
|
216
|
+
for py_type, json_names in _PY_JSON_TYPES:
|
|
217
|
+
if isinstance(value, py_type):
|
|
218
|
+
names = json_names
|
|
219
|
+
break
|
|
220
|
+
if not set(names) & set(spec.types):
|
|
221
|
+
problems.append(f"{dotted}: expected {'/'.join(spec.types)}, got {value!r}")
|
|
222
|
+
continue
|
|
223
|
+
if spec.allowed_values and value not in spec.allowed_values:
|
|
224
|
+
problems.append(
|
|
225
|
+
f"{dotted}: {value!r} is not one of "
|
|
226
|
+
f"{', '.join(str(v) for v in spec.allowed_values)}"
|
|
227
|
+
)
|
|
228
|
+
if isinstance(value, (int, float)) and not isinstance(value, bool):
|
|
229
|
+
if spec.minimum is not None and value < spec.minimum:
|
|
230
|
+
problems.append(
|
|
231
|
+
f"{dotted}: {value!r} is below the minimum {spec.minimum}"
|
|
232
|
+
)
|
|
233
|
+
if spec.maximum is not None and value > spec.maximum:
|
|
234
|
+
problems.append(
|
|
235
|
+
f"{dotted}: {value!r} is above the maximum {spec.maximum}"
|
|
236
|
+
)
|
|
237
|
+
return problems
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def _validation_errors(path: str) -> List[Any]:
|
|
241
|
+
"""Load ``path`` and return the error-level findings of SimpleConfigValidator."""
|
|
242
|
+
from .simple_config import ConfigError, SimpleConfig
|
|
243
|
+
from .simple_config_validator import SimpleConfigValidator
|
|
244
|
+
|
|
245
|
+
with open(path, "r", encoding="utf-8") as handle:
|
|
246
|
+
raw = json.load(handle)
|
|
247
|
+
try:
|
|
248
|
+
model = SimpleConfig(path).load()
|
|
249
|
+
except ConfigError as exc:
|
|
250
|
+
return [e for e in exc.errors if getattr(e, "level", "error") == "error"]
|
|
251
|
+
try:
|
|
252
|
+
found = SimpleConfigValidator(config_path=path).validate(model, raw_config=raw)
|
|
253
|
+
except Exception: # noqa: BLE001 - adapter validators may choke on odd values
|
|
254
|
+
return []
|
|
255
|
+
return [e for e in found if e.level == "error"]
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def finalize_generated_config(
|
|
259
|
+
path: str,
|
|
260
|
+
set_overrides: Optional[Dict[str, Any]] = None,
|
|
261
|
+
section_overlays: Optional[Dict[str, Dict[str, Any]]] = None,
|
|
262
|
+
dedicated: Optional[Mapping[str, Any]] = None,
|
|
263
|
+
) -> None:
|
|
264
|
+
"""
|
|
265
|
+
Apply providers, overlays and ``--set`` overrides to a saved config and validate.
|
|
266
|
+
|
|
267
|
+
Order: refuse a dedicated parameter that also appears in ``set_overrides``;
|
|
268
|
+
refuse a ``set_overrides`` key of an adapter-owned section that is not a
|
|
269
|
+
declared setting; run the registered section providers; merge overlays
|
|
270
|
+
(they win key by key) and overrides; validate declared values and project sections and refuse any
|
|
271
|
+
project-section error the unmodified file did not already have. The file is modified in
|
|
272
|
+
place, so callers pass a scratch path and move it on success.
|
|
273
|
+
|
|
274
|
+
Args:
|
|
275
|
+
path: Saved configuration file (scratch copy).
|
|
276
|
+
set_overrides: Dotted ``section.key`` -> value mapping.
|
|
277
|
+
section_overlays: Project section -> dict merged key by key.
|
|
278
|
+
dedicated: Dotted key -> value of the dedicated parameters that were
|
|
279
|
+
given (``None`` values are ignored).
|
|
280
|
+
|
|
281
|
+
Raises:
|
|
282
|
+
ConfigOverrideConflictError: A key is set by a dedicated parameter and
|
|
283
|
+
by ``set_overrides``.
|
|
284
|
+
ValueError: Unknown adapter-owned key, or the result fails validation.
|
|
285
|
+
RuntimeError: A section provider raised.
|
|
286
|
+
"""
|
|
287
|
+
overrides = dict(set_overrides or {})
|
|
288
|
+
given = {k for k, v in (dedicated or {}).items() if v is not None}
|
|
289
|
+
clash = sorted(k for k in overrides if k in given)
|
|
290
|
+
if clash:
|
|
291
|
+
raise ConfigOverrideConflictError(
|
|
292
|
+
f"{', '.join(clash)} is set by a dedicated option and by --set/set_overrides; use one"
|
|
293
|
+
)
|
|
294
|
+
unknown = sorted(
|
|
295
|
+
k
|
|
296
|
+
for k in overrides
|
|
297
|
+
if _adapter_owned(k.split(".", 1)[0])
|
|
298
|
+
and not _declared_adapter_key(
|
|
299
|
+
k.split(".", 1)[0], k.split(".", 1)[1] if "." in k else ""
|
|
300
|
+
)
|
|
301
|
+
)
|
|
302
|
+
if unknown:
|
|
303
|
+
raise ValueError("unknown adapter setting(s): " + ", ".join(unknown))
|
|
304
|
+
invalid = _declared_value_problems(overrides)
|
|
305
|
+
if invalid:
|
|
306
|
+
raise ValueError("invalid --set/set_overrides value(s): " + "; ".join(invalid))
|
|
307
|
+
with _PROVIDERS_LOCK:
|
|
308
|
+
providers = dict(_PROVIDERS)
|
|
309
|
+
if not (overrides or section_overlays or providers):
|
|
310
|
+
return
|
|
311
|
+
baseline: Set[Tuple[Any, Any, str]] = {
|
|
312
|
+
(e.section, e.key, e.message) for e in _validation_errors(path)
|
|
313
|
+
}
|
|
314
|
+
with open(path, "r", encoding="utf-8") as handle:
|
|
315
|
+
generated = json.load(handle)
|
|
316
|
+
overlays: Dict[str, Dict[str, Any]] = {}
|
|
317
|
+
for name, provider in providers.items():
|
|
318
|
+
try:
|
|
319
|
+
produced = provider(copy.deepcopy(generated))
|
|
320
|
+
overlays[name] = dict(produced)
|
|
321
|
+
except Exception as exc: # noqa: BLE001 - reported with the section name
|
|
322
|
+
raise RuntimeError(
|
|
323
|
+
f"generator section provider for '{name}' failed: "
|
|
324
|
+
f"{type(exc).__name__}: {exc}"
|
|
325
|
+
) from exc
|
|
326
|
+
for name, overlay in (section_overlays or {}).items():
|
|
327
|
+
overlays.setdefault(name, {}).update(overlay)
|
|
328
|
+
apply_config_overrides(path, overrides, overlays)
|
|
329
|
+
fresh = [
|
|
330
|
+
e
|
|
331
|
+
for e in _validation_errors(path)
|
|
332
|
+
if (e.section, e.key, e.message) not in baseline
|
|
333
|
+
and not (isinstance(e.section, str) and _adapter_owned(e.section))
|
|
334
|
+
]
|
|
335
|
+
if fresh:
|
|
336
|
+
raise ValueError(
|
|
337
|
+
"generated configuration is invalid: "
|
|
338
|
+
+ "; ".join(
|
|
339
|
+
(
|
|
340
|
+
f"{e.section}.{e.key}: {e.message}"
|
|
341
|
+
if e.section and e.key
|
|
342
|
+
else (f"{e.section}: {e.message}" if e.section else e.message)
|
|
343
|
+
)
|
|
344
|
+
for e in fresh
|
|
345
|
+
)
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
class SimpleConfigGenerator:
|
|
350
|
+
"""Generate minimal configuration according to the plan."""
|
|
351
|
+
|
|
352
|
+
def generate(
|
|
353
|
+
self,
|
|
354
|
+
protocol: str,
|
|
355
|
+
with_proxy: bool = False,
|
|
356
|
+
out_path: str = "config.json",
|
|
357
|
+
# Server parameters
|
|
358
|
+
server_host: Optional[str] = None,
|
|
359
|
+
server_port: Optional[int] = None,
|
|
360
|
+
server_cert_file: Optional[str] = None,
|
|
361
|
+
server_key_file: Optional[str] = None,
|
|
362
|
+
server_ca_cert_file: Optional[str] = None,
|
|
363
|
+
server_crl_file: Optional[str] = None,
|
|
364
|
+
server_debug: Optional[bool] = None,
|
|
365
|
+
server_log_level: Optional[str] = None,
|
|
366
|
+
server_log_dir: Optional[str] = None,
|
|
367
|
+
# Client parameters
|
|
368
|
+
client_enabled: bool = False,
|
|
369
|
+
client_protocol: Optional[str] = None,
|
|
370
|
+
client_cert_file: Optional[str] = None,
|
|
371
|
+
client_key_file: Optional[str] = None,
|
|
372
|
+
client_ca_cert_file: Optional[str] = None,
|
|
373
|
+
client_crl_file: Optional[str] = None,
|
|
374
|
+
# Registration parameters
|
|
375
|
+
registration_host: Optional[str] = None,
|
|
376
|
+
registration_port: Optional[int] = None,
|
|
377
|
+
registration_protocol: Optional[str] = None,
|
|
378
|
+
registration_cert_file: Optional[str] = None,
|
|
379
|
+
registration_key_file: Optional[str] = None,
|
|
380
|
+
registration_ca_cert_file: Optional[str] = None,
|
|
381
|
+
registration_crl_file: Optional[str] = None,
|
|
382
|
+
registration_server_id: Optional[str] = None,
|
|
383
|
+
registration_server_name: Optional[str] = None,
|
|
384
|
+
instance_uuid: Optional[str] = None,
|
|
385
|
+
# Additional server parameters (todo 60fc5ea7)
|
|
386
|
+
server_servername: Optional[str] = None,
|
|
387
|
+
server_advertised_host: Optional[str] = None,
|
|
388
|
+
server_rules: Optional[Dict[str, Any]] = None,
|
|
389
|
+
server_dnscheck: Optional[bool] = None,
|
|
390
|
+
# Additional registration parameters (todo 60fc5ea7)
|
|
391
|
+
registration_heartbeat_interval: Optional[int] = None,
|
|
392
|
+
registration_dnscheck: Optional[bool] = None,
|
|
393
|
+
registration_auto_on_startup: Optional[bool] = None,
|
|
394
|
+
registration_auto_on_shutdown: Optional[bool] = None,
|
|
395
|
+
registration_metadata: Optional[Dict[str, Any]] = None,
|
|
396
|
+
# Server validation parameters (todo 60fc5ea7: whole section was
|
|
397
|
+
# unreachable from any CLI surface - ServerValidationConfig's 12
|
|
398
|
+
# fields, live in the shipped https_token_roles.json example)
|
|
399
|
+
server_validation_enabled: bool = False,
|
|
400
|
+
server_validation_protocol: Optional[str] = None,
|
|
401
|
+
server_validation_cert_file: Optional[str] = None,
|
|
402
|
+
server_validation_key_file: Optional[str] = None,
|
|
403
|
+
server_validation_ca_cert_file: Optional[str] = None,
|
|
404
|
+
server_validation_crl_file: Optional[str] = None,
|
|
405
|
+
server_validation_dnscheck: Optional[bool] = None,
|
|
406
|
+
server_validation_timeout: Optional[int] = None,
|
|
407
|
+
server_validation_use_token: bool = False,
|
|
408
|
+
server_validation_use_roles: bool = False,
|
|
409
|
+
server_validation_tokens: Optional[Dict[str, List[str]]] = None,
|
|
410
|
+
server_validation_roles: Optional[Dict[str, List[str]]] = None,
|
|
411
|
+
server_validation_auth_header: Optional[str] = None,
|
|
412
|
+
server_validation_roles_header: Optional[str] = None,
|
|
413
|
+
server_validation_health_path: Optional[str] = None,
|
|
414
|
+
server_validation_check_hostname: bool = False,
|
|
415
|
+
# Orchestration parameters (todo 60fc5ea7: whole section was
|
|
416
|
+
# unreachable from any CLI surface - OrchestrationSectionConfig's 6
|
|
417
|
+
# fields; real, loaded, validated, fail-fast on invalid UUID4)
|
|
418
|
+
orchestration_discovery_enabled: Optional[bool] = None,
|
|
419
|
+
orchestration_polling_interval: Optional[float] = None,
|
|
420
|
+
orchestration_initial_poll_timeout: Optional[float] = None,
|
|
421
|
+
orchestration_stale_snapshot_behavior: Optional[str] = None,
|
|
422
|
+
orchestration_mutex_lock_timeout: Optional[float] = None,
|
|
423
|
+
orchestration_static_servers: Optional[List[Dict[str, Any]]] = None,
|
|
424
|
+
# Additional queue manager parameter (todo 60fc5ea7)
|
|
425
|
+
queue_completed_job_retention_seconds: Optional[int] = None,
|
|
426
|
+
# Project sections and generic dotted overrides (bug a5ad5c40)
|
|
427
|
+
set_overrides: Optional[Dict[str, Any]] = None,
|
|
428
|
+
section_overlays: Optional[Dict[str, Dict[str, Any]]] = None,
|
|
429
|
+
# Dedicated parameters for fields previously unreachable (bug 92b1050e)
|
|
430
|
+
server_keep_alive_timeout: Optional[float] = None,
|
|
431
|
+
server_log_file_output: Optional[bool] = None,
|
|
432
|
+
job_push_legacy_unified_terminal_dedup: Optional[bool] = None,
|
|
433
|
+
queue_manager_max_retained_terminal_jobs: Optional[int] = None,
|
|
434
|
+
ssl_verify_mode: Optional[str] = None,
|
|
435
|
+
registration_capabilities: Optional[List[str]] = None,
|
|
436
|
+
registration_unregister_url: Optional[str] = None,
|
|
437
|
+
heartbeat_url: Optional[str] = None,
|
|
438
|
+
) -> str:
|
|
439
|
+
"""
|
|
440
|
+
Generate configuration with optional custom parameters.
|
|
441
|
+
|
|
442
|
+
Args:
|
|
443
|
+
protocol: Server protocol (http, https, mtls)
|
|
444
|
+
with_proxy: Enable proxy registration (default: False)
|
|
445
|
+
out_path: Output file path
|
|
446
|
+
# Server parameters
|
|
447
|
+
server_host: Server host (default: 0.0.0.0)
|
|
448
|
+
server_port: Server port (default: 8080)
|
|
449
|
+
server_cert_file: Server certificate file path
|
|
450
|
+
server_key_file: Server key file path
|
|
451
|
+
server_ca_cert_file: Server CA certificate file path
|
|
452
|
+
server_crl_file: Server CRL file path
|
|
453
|
+
server_debug: Enable debug mode (default: False)
|
|
454
|
+
server_log_level: Log level: DEBUG, INFO, WARNING, ERROR, CRITICAL (default: INFO)
|
|
455
|
+
server_log_dir: Log directory path (default: ./logs)
|
|
456
|
+
# Client parameters
|
|
457
|
+
client_enabled: Enable outbound client configuration (default: False)
|
|
458
|
+
client_protocol: Client protocol (http, https, mtls; default: same as server)
|
|
459
|
+
client_cert_file: Client certificate file path
|
|
460
|
+
client_key_file: Client key file path
|
|
461
|
+
client_ca_cert_file: Client CA certificate file path
|
|
462
|
+
client_crl_file: Client CRL file path
|
|
463
|
+
# Registration parameters
|
|
464
|
+
registration_host: Registration proxy host (default: localhost)
|
|
465
|
+
registration_port: Registration proxy port (default: 3005)
|
|
466
|
+
registration_protocol: Registration protocol (http, https, mtls)
|
|
467
|
+
registration_cert_file: Registration certificate file path
|
|
468
|
+
registration_key_file: Registration key file path
|
|
469
|
+
registration_ca_cert_file: Registration CA certificate file path
|
|
470
|
+
registration_crl_file: Registration CRL file path
|
|
471
|
+
registration_server_id: Server ID for registration
|
|
472
|
+
registration_server_name: Server name for registration
|
|
473
|
+
instance_uuid: Server instance UUID (UUID4 format, auto-generated if not provided)
|
|
474
|
+
# Additional server parameters
|
|
475
|
+
server_servername: DNS name of the server (default: derived from server_host)
|
|
476
|
+
server_advertised_host: Hostname advertised to external clients (default: None)
|
|
477
|
+
server_rules: Access control rules dict (default: None)
|
|
478
|
+
server_dnscheck: Enable/disable DNS hostname check for server SSL (default: False)
|
|
479
|
+
# Additional registration parameters
|
|
480
|
+
registration_heartbeat_interval: Heartbeat ping interval in seconds (default: 30)
|
|
481
|
+
registration_dnscheck: Enable/disable DNS hostname check for registration SSL
|
|
482
|
+
(default: True, False when protocol is mtls)
|
|
483
|
+
registration_auto_on_startup: Automatically register on startup (default: True)
|
|
484
|
+
registration_auto_on_shutdown: Automatically unregister on shutdown (default: True)
|
|
485
|
+
registration_metadata: Optional metadata dict merged into the registration payload
|
|
486
|
+
# Server validation parameters (proxy-side validation of this server)
|
|
487
|
+
server_validation_enabled: Enable server_validation section (default: False)
|
|
488
|
+
server_validation_protocol: Protocol used for validation calls (default: http)
|
|
489
|
+
server_validation_cert_file: Server validation certificate file path
|
|
490
|
+
server_validation_key_file: Server validation key file path
|
|
491
|
+
server_validation_ca_cert_file: Server validation CA certificate file path
|
|
492
|
+
server_validation_crl_file: Server validation CRL file path
|
|
493
|
+
server_validation_dnscheck: Enable/disable DNS hostname check (default: False)
|
|
494
|
+
server_validation_timeout: Connection timeout in seconds (default: 10)
|
|
495
|
+
server_validation_use_token: Require token authentication (default: False)
|
|
496
|
+
server_validation_use_roles: Require role-based authorization (default: False)
|
|
497
|
+
server_validation_tokens: Tokens dict mapping token to roles (default: {})
|
|
498
|
+
server_validation_roles: Roles dict mapping role to permissions (default: {})
|
|
499
|
+
server_validation_auth_header: Header name for token authentication (default: X-API-Key)
|
|
500
|
+
server_validation_roles_header: Header name for roles (default: X-Roles)
|
|
501
|
+
server_validation_health_path: Health endpoint path (default: /health)
|
|
502
|
+
server_validation_check_hostname: Verify DNS name on TLS connections (default: False)
|
|
503
|
+
# Orchestration parameters (discovery and static server list)
|
|
504
|
+
orchestration_discovery_enabled: Enable orchestration discovery (default: False)
|
|
505
|
+
orchestration_polling_interval: Polling interval in seconds (default: 30.0)
|
|
506
|
+
orchestration_initial_poll_timeout: Initial poll timeout in seconds (default: 60.0)
|
|
507
|
+
orchestration_stale_snapshot_behavior: Policy for stale snapshot (default: keep)
|
|
508
|
+
orchestration_mutex_lock_timeout: Mutex lock timeout in seconds (default: 5.0)
|
|
509
|
+
orchestration_static_servers: List of {host, port, id} dicts (default: [])
|
|
510
|
+
# Additional queue manager parameter
|
|
511
|
+
queue_completed_job_retention_seconds: How long to keep completed jobs before
|
|
512
|
+
cleanup, in seconds (default: 21600 = 6 hours; 0 = keep indefinitely)
|
|
513
|
+
set_overrides: Dotted ``section.key`` -> value overrides written into the
|
|
514
|
+
saved file after the adapter sections (may override adapter keys and
|
|
515
|
+
create project sections; nested dotted keys allowed)
|
|
516
|
+
section_overlays: Top-level project section name -> dict merged into the
|
|
517
|
+
saved file; unknown sections are written as given
|
|
518
|
+
server_keep_alive_timeout: HTTP keep-alive timeout in seconds (default: 5.0)
|
|
519
|
+
server_log_file_output: Write log files under log_dir (default: False)
|
|
520
|
+
job_push_legacy_unified_terminal_dedup: Write the job_push section with the
|
|
521
|
+
legacy terminal deduplication flag set to this value
|
|
522
|
+
queue_manager_max_retained_terminal_jobs: Cap on retained terminal job
|
|
523
|
+
records (default: derived at start)
|
|
524
|
+
ssl_verify_mode: server.ssl.verify_mode: CERT_NONE, CERT_OPTIONAL or
|
|
525
|
+
CERT_REQUIRED; requires protocol https or mtls
|
|
526
|
+
registration_capabilities: Explicit registration capabilities list
|
|
527
|
+
registration_unregister_url: Explicit unregister URL (not re-derived)
|
|
528
|
+
heartbeat_url: Explicit heartbeat URL (not re-derived)
|
|
529
|
+
|
|
530
|
+
Raises:
|
|
531
|
+
ValueError: On an invalid ssl_verify_mode, a dedicated parameter and
|
|
532
|
+
``set_overrides`` naming the same key, an unknown key of an
|
|
533
|
+
adapter-owned section in ``set_overrides``, or a result the
|
|
534
|
+
validator refuses (nothing is written).
|
|
535
|
+
RuntimeError: If a registered section provider raised.
|
|
536
|
+
"""
|
|
537
|
+
given = {name: locals()[name] for name in DEDICATED_PARAM_KEYS}
|
|
538
|
+
if server_keep_alive_timeout is not None and (
|
|
539
|
+
isinstance(server_keep_alive_timeout, bool)
|
|
540
|
+
or not isinstance(server_keep_alive_timeout, (int, float))
|
|
541
|
+
or server_keep_alive_timeout < 0
|
|
542
|
+
):
|
|
543
|
+
raise ValueError(
|
|
544
|
+
"Invalid server.keep_alive_timeout "
|
|
545
|
+
f"{server_keep_alive_timeout!r}: expected a non-negative number"
|
|
546
|
+
)
|
|
547
|
+
if ssl_verify_mode is not None:
|
|
548
|
+
if ssl_verify_mode not in VERIFY_MODES:
|
|
549
|
+
raise ValueError(
|
|
550
|
+
f"Invalid ssl.verify_mode '{ssl_verify_mode}': expected one of "
|
|
551
|
+
f"{', '.join(VERIFY_MODES)}"
|
|
552
|
+
)
|
|
553
|
+
if protocol not in ("https", "mtls"):
|
|
554
|
+
raise ValueError("ssl.verify_mode requires protocol https or mtls")
|
|
555
|
+
# Server configuration with new structure
|
|
556
|
+
server_host_val = (
|
|
557
|
+
server_host
|
|
558
|
+
or "0.0.0.0" # nosec B104 - documented default for a config generator (see docstring: "server_host") overridable by the caller-supplied server_host argument
|
|
559
|
+
)
|
|
560
|
+
default_servername = (
|
|
561
|
+
server_host_val
|
|
562
|
+
if server_host_val
|
|
563
|
+
!= "0.0.0.0" # nosec B104 - comparison only, normalizing a bind-all host to a servername
|
|
564
|
+
else "localhost"
|
|
565
|
+
)
|
|
566
|
+
server_servername_val = server_servername or default_servername
|
|
567
|
+
|
|
568
|
+
# Create SSL config if needed
|
|
569
|
+
server_ssl = None
|
|
570
|
+
if protocol in ("https", "mtls"):
|
|
571
|
+
# For mTLS, CA certificate is required
|
|
572
|
+
if protocol == "mtls":
|
|
573
|
+
if not server_ca_cert_file:
|
|
574
|
+
raise ValueError(
|
|
575
|
+
"CA certificate is required for mTLS protocol. Provide --server-ca-cert-file parameter."
|
|
576
|
+
)
|
|
577
|
+
# Explicit Optional[str]: without it mypy infers server_ca's
|
|
578
|
+
# type as `str` from this branch alone (narrowed by the
|
|
579
|
+
# `raise` above) and then flags the https branch's Optional
|
|
580
|
+
# assignment below as incompatible, even though CA really is
|
|
581
|
+
# optional for https (SSLConfig.ca is Optional[str]).
|
|
582
|
+
server_ca: Optional[str] = server_ca_cert_file
|
|
583
|
+
else:
|
|
584
|
+
# For HTTPS, CA is optional
|
|
585
|
+
server_ca = server_ca_cert_file
|
|
586
|
+
|
|
587
|
+
server_ssl = SSLConfig(
|
|
588
|
+
cert=server_cert_file or "./certs/server.crt",
|
|
589
|
+
key=server_key_file or "./certs/server.key",
|
|
590
|
+
ca=server_ca,
|
|
591
|
+
crl=server_crl_file,
|
|
592
|
+
dnscheck=(
|
|
593
|
+
server_dnscheck
|
|
594
|
+
if server_dnscheck is not None
|
|
595
|
+
else get_default("server", "ssl.dnscheck")
|
|
596
|
+
), # Default false for server
|
|
597
|
+
verify_mode=ssl_verify_mode,
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
server = ServerConfig(
|
|
601
|
+
host=server_host_val,
|
|
602
|
+
port=server_port or 8080,
|
|
603
|
+
protocol=protocol,
|
|
604
|
+
servername=server_servername_val,
|
|
605
|
+
ssl=server_ssl,
|
|
606
|
+
rules=server_rules,
|
|
607
|
+
advertised_host=server_advertised_host,
|
|
608
|
+
debug=(
|
|
609
|
+
server_debug
|
|
610
|
+
if server_debug is not None
|
|
611
|
+
else get_default("server", "debug")
|
|
612
|
+
), # Default: production mode
|
|
613
|
+
log_level=server_log_level or get_default("server", "log_level"),
|
|
614
|
+
log_dir=server_log_dir or get_default("server", "log_dir"),
|
|
615
|
+
log_file_output=(
|
|
616
|
+
server_log_file_output
|
|
617
|
+
if server_log_file_output is not None
|
|
618
|
+
else get_default("server", "log_file_output")
|
|
619
|
+
),
|
|
620
|
+
keep_alive_timeout=(
|
|
621
|
+
server_keep_alive_timeout
|
|
622
|
+
if server_keep_alive_timeout is not None
|
|
623
|
+
else get_default("server", "keep_alive_timeout")
|
|
624
|
+
),
|
|
625
|
+
)
|
|
626
|
+
|
|
627
|
+
# Client configuration (outbound connections to other servers)
|
|
628
|
+
client_ssl = None
|
|
629
|
+
client_protocol_val = client_protocol or protocol
|
|
630
|
+
if client_enabled and client_protocol_val in ("https", "mtls"):
|
|
631
|
+
# Explicit Optional[str]: same mypy narrow-inference-from-first-
|
|
632
|
+
# branch issue as server_ca above (CA is optional for https).
|
|
633
|
+
if client_protocol_val == "mtls" and not client_ca_cert_file:
|
|
634
|
+
client_ca: Optional[str] = "./certs/client_ca.crt"
|
|
635
|
+
else:
|
|
636
|
+
client_ca = client_ca_cert_file
|
|
637
|
+
|
|
638
|
+
client_ssl = SSLConfig(
|
|
639
|
+
cert=client_cert_file or "./certs/client.crt",
|
|
640
|
+
key=client_key_file or "./certs/client.key",
|
|
641
|
+
ca=client_ca,
|
|
642
|
+
crl=client_crl_file,
|
|
643
|
+
dnscheck=True, # Default true for client
|
|
644
|
+
)
|
|
645
|
+
|
|
646
|
+
client = ClientConfig(
|
|
647
|
+
enabled=client_enabled,
|
|
648
|
+
protocol=client_protocol_val if client_enabled else "http",
|
|
649
|
+
ssl=client_ssl,
|
|
650
|
+
)
|
|
651
|
+
|
|
652
|
+
# Registration configuration
|
|
653
|
+
if with_proxy:
|
|
654
|
+
reg_host = registration_host or "localhost"
|
|
655
|
+
reg_port = registration_port or 3005
|
|
656
|
+
reg_protocol = registration_protocol or "http"
|
|
657
|
+
|
|
658
|
+
# Generate instance_uuid if not provided (must be UUID4)
|
|
659
|
+
if instance_uuid is None:
|
|
660
|
+
instance_uuid = str(uuid.uuid4())
|
|
661
|
+
else:
|
|
662
|
+
# Validate provided UUID
|
|
663
|
+
try:
|
|
664
|
+
uuid_obj = uuid.UUID(instance_uuid)
|
|
665
|
+
if uuid_obj.version != 4:
|
|
666
|
+
raise ValueError(
|
|
667
|
+
f"instance_uuid must be UUID4, got UUID version {uuid_obj.version}"
|
|
668
|
+
)
|
|
669
|
+
except ValueError as e:
|
|
670
|
+
raise ValueError(f"Invalid instance_uuid format: {str(e)}")
|
|
671
|
+
|
|
672
|
+
# Determine URL scheme based on protocol
|
|
673
|
+
scheme = "https" if reg_protocol in ("https", "mtls") else "http"
|
|
674
|
+
|
|
675
|
+
# Create full URLs for registration and heartbeat
|
|
676
|
+
register_url = f"{scheme}://{reg_host}:{reg_port}/register"
|
|
677
|
+
unregister_url = registration_unregister_url or (
|
|
678
|
+
f"{scheme}://{reg_host}:{reg_port}/unregister"
|
|
679
|
+
)
|
|
680
|
+
heartbeat_url_val = heartbeat_url or (
|
|
681
|
+
f"{scheme}://{reg_host}:{reg_port}/proxy/heartbeat"
|
|
682
|
+
)
|
|
683
|
+
|
|
684
|
+
# Create heartbeat config
|
|
685
|
+
heartbeat_interval = (
|
|
686
|
+
registration_heartbeat_interval
|
|
687
|
+
if registration_heartbeat_interval is not None
|
|
688
|
+
else 30
|
|
689
|
+
)
|
|
690
|
+
heartbeat = HeartbeatConfig(
|
|
691
|
+
url=heartbeat_url_val, interval=heartbeat_interval
|
|
692
|
+
)
|
|
693
|
+
|
|
694
|
+
# Create SSL config for registration if needed
|
|
695
|
+
registration_ssl = None
|
|
696
|
+
if reg_protocol in ("https", "mtls"):
|
|
697
|
+
default_reg_dnscheck = (
|
|
698
|
+
False if reg_protocol == "mtls" else True
|
|
699
|
+
) # Disable DNS check for mTLS by default
|
|
700
|
+
reg_dnscheck_val = (
|
|
701
|
+
registration_dnscheck
|
|
702
|
+
if registration_dnscheck is not None
|
|
703
|
+
else default_reg_dnscheck
|
|
704
|
+
)
|
|
705
|
+
registration_ssl = SSLConfig(
|
|
706
|
+
cert=registration_cert_file or "./certs/registration.crt",
|
|
707
|
+
key=registration_key_file or "./certs/registration.key",
|
|
708
|
+
ca=registration_ca_cert_file
|
|
709
|
+
or ("./certs/ca.crt" if reg_protocol == "mtls" else None),
|
|
710
|
+
crl=registration_crl_file,
|
|
711
|
+
dnscheck=reg_dnscheck_val,
|
|
712
|
+
# SimpleConfig.load() aliases registration.ssl.check_hostname
|
|
713
|
+
# and dnscheck (preferring check_hostname when the *key* is
|
|
714
|
+
# present in the raw JSON, regardless of its value), and
|
|
715
|
+
# SimpleConfig.save() always writes both keys (dataclass
|
|
716
|
+
# vars(), never omitted). Left at its SSLConfig default of
|
|
717
|
+
# None, that combination silently overwrites dnscheck with
|
|
718
|
+
# None on every load()/save() round trip a generated config
|
|
719
|
+
# takes (e.g. config_generate_command's post-generate()
|
|
720
|
+
# reload). Setting check_hostname to the SAME value here
|
|
721
|
+
# keeps the aliasing a no-op instead of a data-loss bug.
|
|
722
|
+
check_hostname=reg_dnscheck_val,
|
|
723
|
+
)
|
|
724
|
+
|
|
725
|
+
# Create registration config with new format
|
|
726
|
+
registration = RegistrationConfig(
|
|
727
|
+
enabled=True,
|
|
728
|
+
protocol=reg_protocol,
|
|
729
|
+
register_url=register_url,
|
|
730
|
+
unregister_url=unregister_url,
|
|
731
|
+
heartbeat_interval=heartbeat_interval,
|
|
732
|
+
ssl=registration_ssl,
|
|
733
|
+
heartbeat=heartbeat,
|
|
734
|
+
auto_on_startup=(
|
|
735
|
+
registration_auto_on_startup
|
|
736
|
+
if registration_auto_on_startup is not None
|
|
737
|
+
else True
|
|
738
|
+
),
|
|
739
|
+
auto_on_shutdown=(
|
|
740
|
+
registration_auto_on_shutdown
|
|
741
|
+
if registration_auto_on_shutdown is not None
|
|
742
|
+
else True
|
|
743
|
+
),
|
|
744
|
+
server_id=registration_server_id,
|
|
745
|
+
server_name=registration_server_name,
|
|
746
|
+
instance_uuid=instance_uuid,
|
|
747
|
+
metadata=registration_metadata,
|
|
748
|
+
capabilities=registration_capabilities,
|
|
749
|
+
)
|
|
750
|
+
else:
|
|
751
|
+
# Registration disabled - create minimal config with default URLs (not used when disabled)
|
|
752
|
+
disabled_heartbeat_interval = (
|
|
753
|
+
registration_heartbeat_interval
|
|
754
|
+
if registration_heartbeat_interval is not None
|
|
755
|
+
else 30
|
|
756
|
+
)
|
|
757
|
+
registration = RegistrationConfig(
|
|
758
|
+
enabled=False,
|
|
759
|
+
protocol="http",
|
|
760
|
+
register_url="http://localhost:3005/register", # Default value, not used when disabled
|
|
761
|
+
unregister_url=registration_unregister_url
|
|
762
|
+
or "http://localhost:3005/unregister", # Default value, not used when disabled
|
|
763
|
+
heartbeat_interval=disabled_heartbeat_interval, # Required field even when disabled
|
|
764
|
+
auto_on_startup=(
|
|
765
|
+
registration_auto_on_startup
|
|
766
|
+
if registration_auto_on_startup is not None
|
|
767
|
+
else True
|
|
768
|
+
),
|
|
769
|
+
auto_on_shutdown=(
|
|
770
|
+
registration_auto_on_shutdown
|
|
771
|
+
if registration_auto_on_shutdown is not None
|
|
772
|
+
else True
|
|
773
|
+
),
|
|
774
|
+
metadata=registration_metadata,
|
|
775
|
+
capabilities=registration_capabilities,
|
|
776
|
+
heartbeat=HeartbeatConfig(
|
|
777
|
+
url=heartbeat_url or "http://localhost:3005/proxy/heartbeat",
|
|
778
|
+
interval=disabled_heartbeat_interval,
|
|
779
|
+
),
|
|
780
|
+
)
|
|
781
|
+
|
|
782
|
+
auth = AuthConfig(use_token=False, use_roles=False, tokens={}, roles={})
|
|
783
|
+
|
|
784
|
+
# Server validation configuration (proxy-side validation of this
|
|
785
|
+
# server; todo 60fc5ea7 - previously unreachable from any CLI
|
|
786
|
+
# surface, so SimpleConfigModel's factory default (all-disabled)
|
|
787
|
+
# was the only value a generated config could ever carry).
|
|
788
|
+
sv_protocol = server_validation_protocol or "http"
|
|
789
|
+
sv_needs_ssl = sv_protocol in ("https", "mtls") or any(
|
|
790
|
+
v is not None
|
|
791
|
+
for v in (
|
|
792
|
+
server_validation_cert_file,
|
|
793
|
+
server_validation_key_file,
|
|
794
|
+
server_validation_ca_cert_file,
|
|
795
|
+
server_validation_crl_file,
|
|
796
|
+
server_validation_dnscheck,
|
|
797
|
+
)
|
|
798
|
+
)
|
|
799
|
+
server_validation_ssl = None
|
|
800
|
+
if sv_needs_ssl:
|
|
801
|
+
server_validation_ssl = SSLConfig(
|
|
802
|
+
cert=server_validation_cert_file,
|
|
803
|
+
key=server_validation_key_file,
|
|
804
|
+
ca=server_validation_ca_cert_file,
|
|
805
|
+
crl=server_validation_crl_file,
|
|
806
|
+
dnscheck=(
|
|
807
|
+
server_validation_dnscheck
|
|
808
|
+
if server_validation_dnscheck is not None
|
|
809
|
+
else False
|
|
810
|
+
),
|
|
811
|
+
)
|
|
812
|
+
|
|
813
|
+
server_validation = ServerValidationConfig(
|
|
814
|
+
enabled=server_validation_enabled,
|
|
815
|
+
protocol=sv_protocol,
|
|
816
|
+
ssl=server_validation_ssl,
|
|
817
|
+
timeout=(
|
|
818
|
+
server_validation_timeout
|
|
819
|
+
if server_validation_timeout is not None
|
|
820
|
+
else 10
|
|
821
|
+
),
|
|
822
|
+
use_token=server_validation_use_token,
|
|
823
|
+
use_roles=server_validation_use_roles,
|
|
824
|
+
tokens=server_validation_tokens or {},
|
|
825
|
+
roles=server_validation_roles or {},
|
|
826
|
+
auth_header=server_validation_auth_header or "X-API-Key",
|
|
827
|
+
roles_header=server_validation_roles_header or "X-Roles",
|
|
828
|
+
health_path=server_validation_health_path or "/health",
|
|
829
|
+
check_hostname=server_validation_check_hostname,
|
|
830
|
+
)
|
|
831
|
+
|
|
832
|
+
# Orchestration configuration (discovery and static server list,
|
|
833
|
+
# TZ section 10; todo 60fc5ea7 - previously unreachable from any
|
|
834
|
+
# CLI surface).
|
|
835
|
+
static_servers_list: List[StaticServerEntry] = [
|
|
836
|
+
StaticServerEntry(
|
|
837
|
+
host=item.get("host", ""),
|
|
838
|
+
port=int(item.get("port", 0)),
|
|
839
|
+
id=item.get("id", ""), # noqa: A001
|
|
840
|
+
)
|
|
841
|
+
for item in (orchestration_static_servers or [])
|
|
842
|
+
]
|
|
843
|
+
orchestration = OrchestrationSectionConfig(
|
|
844
|
+
discovery_enabled=(
|
|
845
|
+
orchestration_discovery_enabled
|
|
846
|
+
if orchestration_discovery_enabled is not None
|
|
847
|
+
else False
|
|
848
|
+
),
|
|
849
|
+
polling_interval=(
|
|
850
|
+
orchestration_polling_interval
|
|
851
|
+
if orchestration_polling_interval is not None
|
|
852
|
+
else 30.0
|
|
853
|
+
),
|
|
854
|
+
initial_poll_timeout=(
|
|
855
|
+
orchestration_initial_poll_timeout
|
|
856
|
+
if orchestration_initial_poll_timeout is not None
|
|
857
|
+
else 60.0
|
|
858
|
+
),
|
|
859
|
+
stale_snapshot_behavior=orchestration_stale_snapshot_behavior or "keep",
|
|
860
|
+
mutex_lock_timeout=(
|
|
861
|
+
orchestration_mutex_lock_timeout
|
|
862
|
+
if orchestration_mutex_lock_timeout is not None
|
|
863
|
+
else 5.0
|
|
864
|
+
),
|
|
865
|
+
static_servers=static_servers_list,
|
|
866
|
+
)
|
|
867
|
+
|
|
868
|
+
# Queue manager configuration with defaults
|
|
869
|
+
queue_manager = QueueManagerConfig(
|
|
870
|
+
enabled=True,
|
|
871
|
+
in_memory=True,
|
|
872
|
+
registry_path=None,
|
|
873
|
+
shutdown_timeout=30.0,
|
|
874
|
+
max_concurrent_jobs=10,
|
|
875
|
+
max_queue_size=None, # No global limit by default
|
|
876
|
+
per_job_type_limits=None, # No per-type limits by default
|
|
877
|
+
max_retained_terminal_jobs=queue_manager_max_retained_terminal_jobs,
|
|
878
|
+
completed_job_retention_seconds=(
|
|
879
|
+
queue_completed_job_retention_seconds
|
|
880
|
+
if queue_completed_job_retention_seconds is not None
|
|
881
|
+
else 21600
|
|
882
|
+
),
|
|
883
|
+
default_poll_interval=0.0, # Default: no polling (returns job_id immediately)
|
|
884
|
+
default_max_wait_time=None, # No default max wait time
|
|
885
|
+
)
|
|
886
|
+
|
|
887
|
+
cfg = SimpleConfig()
|
|
888
|
+
cfg.model = SimpleConfigModel(
|
|
889
|
+
server=server,
|
|
890
|
+
client=client,
|
|
891
|
+
registration=registration,
|
|
892
|
+
server_validation=server_validation,
|
|
893
|
+
auth=auth,
|
|
894
|
+
queue_manager=queue_manager,
|
|
895
|
+
orchestration=orchestration,
|
|
896
|
+
job_push=(
|
|
897
|
+
JobPushConfig(
|
|
898
|
+
legacy_unified_terminal_dedup=job_push_legacy_unified_terminal_dedup
|
|
899
|
+
)
|
|
900
|
+
if job_push_legacy_unified_terminal_dedup is not None
|
|
901
|
+
else None
|
|
902
|
+
),
|
|
903
|
+
)
|
|
904
|
+
scratch = f"{out_path}.gen-{os.getpid()}-{uuid.uuid4().hex[:8]}.tmp"
|
|
905
|
+
try:
|
|
906
|
+
cfg.save(scratch)
|
|
907
|
+
finalize_generated_config(
|
|
908
|
+
scratch,
|
|
909
|
+
set_overrides,
|
|
910
|
+
section_overlays,
|
|
911
|
+
{key: given.get(name) for name, key in DEDICATED_PARAM_KEYS.items()},
|
|
912
|
+
)
|
|
913
|
+
os.replace(scratch, out_path)
|
|
914
|
+
finally:
|
|
915
|
+
if os.path.exists(scratch):
|
|
916
|
+
os.unlink(scratch)
|
|
917
|
+
return out_path
|