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,247 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Author: Vasiliy Zdanovskiy
|
|
3
|
+
email: vasilyvz@gmail.com
|
|
4
|
+
|
|
5
|
+
Configuration parsers for registration context building.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any, Dict, Optional, Tuple
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def parse_simple_config_format(
|
|
14
|
+
proxy_registration_config: Dict[str, Any], logger: Any
|
|
15
|
+
) -> Optional[Any]:
|
|
16
|
+
"""
|
|
17
|
+
Parse SimpleConfig format from registration configuration dict.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
proxy_registration_config: Registration configuration dictionary
|
|
21
|
+
logger: Logger instance
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
RegistrationConfig object or None if not SimpleConfig format
|
|
25
|
+
"""
|
|
26
|
+
if not proxy_registration_config or "heartbeat" not in proxy_registration_config:
|
|
27
|
+
return None
|
|
28
|
+
|
|
29
|
+
heartbeat_config = proxy_registration_config.get("heartbeat", {})
|
|
30
|
+
if not isinstance(heartbeat_config, dict) or not heartbeat_config.get("url"):
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
from mcp_proxy_adapter.core.config.simple_config import (
|
|
35
|
+
HeartbeatConfig,
|
|
36
|
+
SSLConfig,
|
|
37
|
+
sync_ssl_hostname_check_keys,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
# Create HeartbeatConfig object
|
|
41
|
+
heartbeat_obj = HeartbeatConfig(
|
|
42
|
+
url=heartbeat_config.get("url"),
|
|
43
|
+
interval=heartbeat_config.get("interval", 30),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# Extract certificates from ssl sub-section (new format)
|
|
47
|
+
ssl_config_dict = proxy_registration_config.get("ssl", {})
|
|
48
|
+
cert_file = (
|
|
49
|
+
ssl_config_dict.get("cert")
|
|
50
|
+
if ssl_config_dict and isinstance(ssl_config_dict, dict)
|
|
51
|
+
else None
|
|
52
|
+
)
|
|
53
|
+
key_file = (
|
|
54
|
+
ssl_config_dict.get("key")
|
|
55
|
+
if ssl_config_dict and isinstance(ssl_config_dict, dict)
|
|
56
|
+
else None
|
|
57
|
+
)
|
|
58
|
+
ca_cert_file = (
|
|
59
|
+
ssl_config_dict.get("ca")
|
|
60
|
+
if ssl_config_dict and isinstance(ssl_config_dict, dict)
|
|
61
|
+
else None
|
|
62
|
+
)
|
|
63
|
+
crl_file = (
|
|
64
|
+
ssl_config_dict.get("crl")
|
|
65
|
+
if ssl_config_dict and isinstance(ssl_config_dict, dict)
|
|
66
|
+
else None
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# Create SSLConfig object if we have ssl data
|
|
70
|
+
ssl_obj = None
|
|
71
|
+
if ssl_config_dict and isinstance(ssl_config_dict, dict):
|
|
72
|
+
# Bug af11fb2e: sync check_hostname/dnscheck the same way
|
|
73
|
+
# SimpleConfigModel does (sync_ssl_hostname_check_keys) before
|
|
74
|
+
# building the SSLConfig object, so a config that only sets one
|
|
75
|
+
# of the two names still carries an explicit, non-lossy signal
|
|
76
|
+
# through this ad-hoc parser instead of the unset key silently
|
|
77
|
+
# becoming a fabricated dnscheck=False default.
|
|
78
|
+
_synced_ssl = sync_ssl_hostname_check_keys(dict(ssl_config_dict))
|
|
79
|
+
ssl_obj = SSLConfig(
|
|
80
|
+
cert=cert_file,
|
|
81
|
+
key=key_file,
|
|
82
|
+
ca=ca_cert_file,
|
|
83
|
+
crl=crl_file,
|
|
84
|
+
dnscheck=_synced_ssl.get("dnscheck", False),
|
|
85
|
+
check_hostname=_synced_ssl.get("check_hostname"),
|
|
86
|
+
# Legacy chain-verification override (e.g. "CERT_NONE"),
|
|
87
|
+
# read straight from the raw ssl dict since it is not part
|
|
88
|
+
# of the check_hostname/dnscheck sync above.
|
|
89
|
+
verify_mode=_synced_ssl.get("verify_mode"),
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
_meta = proxy_registration_config.get("metadata")
|
|
93
|
+
if _meta is not None and not isinstance(_meta, dict):
|
|
94
|
+
_meta = None
|
|
95
|
+
|
|
96
|
+
registration_config = type(
|
|
97
|
+
"RegistrationConfig",
|
|
98
|
+
(),
|
|
99
|
+
{
|
|
100
|
+
"enabled": proxy_registration_config.get("enabled", False),
|
|
101
|
+
"protocol": proxy_registration_config.get("protocol", "http"),
|
|
102
|
+
"register_url": proxy_registration_config.get("register_url"),
|
|
103
|
+
"unregister_url": proxy_registration_config.get("unregister_url"),
|
|
104
|
+
"server_id": proxy_registration_config.get("server_id"),
|
|
105
|
+
"server_name": proxy_registration_config.get("server_name"),
|
|
106
|
+
"instance_uuid": proxy_registration_config.get(
|
|
107
|
+
"instance_uuid"
|
|
108
|
+
), # CRITICAL: Preserve UUID
|
|
109
|
+
"ssl": ssl_obj,
|
|
110
|
+
"cert_file": cert_file,
|
|
111
|
+
"key_file": key_file,
|
|
112
|
+
"ca_cert_file": ca_cert_file,
|
|
113
|
+
"crl_file": crl_file,
|
|
114
|
+
"check_hostname": proxy_registration_config.get("check_hostname", True),
|
|
115
|
+
"use_system_ca": proxy_registration_config.get("use_system_ca", False),
|
|
116
|
+
"auto_on_startup": proxy_registration_config.get(
|
|
117
|
+
"auto_on_startup", True
|
|
118
|
+
),
|
|
119
|
+
"heartbeat": heartbeat_obj,
|
|
120
|
+
"metadata": _meta,
|
|
121
|
+
"capabilities": proxy_registration_config.get("capabilities"),
|
|
122
|
+
},
|
|
123
|
+
)()
|
|
124
|
+
logger.debug("Using registration section from SimpleConfig format (dict)")
|
|
125
|
+
return registration_config
|
|
126
|
+
except Exception as e:
|
|
127
|
+
logger.debug(f"Could not create RegistrationConfig from dict: {e}")
|
|
128
|
+
return None
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def extract_ssl_config_from_model(
|
|
132
|
+
registration_config_from_model: Any,
|
|
133
|
+
) -> Optional[Dict[str, Any]]:
|
|
134
|
+
"""
|
|
135
|
+
Extract SSL configuration from RegistrationConfig model.
|
|
136
|
+
|
|
137
|
+
Bug af11fb2e: this used to copy a hardcoded five keys (cert/key/ca/crl/
|
|
138
|
+
dnscheck), silently dropping ``check_hostname`` - resolve_registration_
|
|
139
|
+
credentials() then fell back to the bare ``dnscheck`` dataclass default
|
|
140
|
+
(False) for any config that never set either key, turning an unset
|
|
141
|
+
hostname-verification policy into "do not verify". The conversion is
|
|
142
|
+
now generic over the ``SSLConfig`` dataclass's actual fields (see
|
|
143
|
+
``ssl_config_as_dict()``), so every current field (``check_hostname``,
|
|
144
|
+
``verify_mode``) and any future one is carried through automatically
|
|
145
|
+
instead of requiring a matching hardcoded key here.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
registration_config_from_model: RegistrationConfig model instance
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
SSL configuration dictionary or None
|
|
152
|
+
"""
|
|
153
|
+
ssl_obj = getattr(registration_config_from_model, "ssl", None)
|
|
154
|
+
if not ssl_obj:
|
|
155
|
+
return None
|
|
156
|
+
|
|
157
|
+
from mcp_proxy_adapter.core.config.simple_config import ssl_config_as_dict
|
|
158
|
+
|
|
159
|
+
return ssl_config_as_dict(ssl_obj)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def convert_model_to_dict_config(
|
|
163
|
+
registration_config_from_model: Any, logger: Any
|
|
164
|
+
) -> Tuple[Dict[str, Any], str]:
|
|
165
|
+
"""
|
|
166
|
+
Convert RegistrationConfig model to dictionary format.
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
registration_config_from_model: RegistrationConfig model instance
|
|
170
|
+
logger: Logger instance
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
Tuple of (proxy_registration_config dict, heartbeat_url)
|
|
174
|
+
"""
|
|
175
|
+
heartbeat_url = registration_config_from_model.heartbeat.url
|
|
176
|
+
if not heartbeat_url:
|
|
177
|
+
error_msg = (
|
|
178
|
+
"registration.heartbeat.url is required when registration.enabled=true. "
|
|
179
|
+
"It must be a full URL (e.g., http://localhost:3005/proxy/heartbeat)"
|
|
180
|
+
)
|
|
181
|
+
logger.error(f"❌ Configuration error: {error_msg}")
|
|
182
|
+
raise ValueError(error_msg)
|
|
183
|
+
|
|
184
|
+
ssl_config = extract_ssl_config_from_model(registration_config_from_model)
|
|
185
|
+
|
|
186
|
+
proxy_registration_config = {
|
|
187
|
+
"enabled": registration_config_from_model.enabled,
|
|
188
|
+
"protocol": registration_config_from_model.protocol,
|
|
189
|
+
"register_url": registration_config_from_model.register_url,
|
|
190
|
+
"unregister_url": registration_config_from_model.unregister_url,
|
|
191
|
+
"server_id": registration_config_from_model.server_id,
|
|
192
|
+
"server_name": getattr(registration_config_from_model, "server_name", None),
|
|
193
|
+
"instance_uuid": getattr(
|
|
194
|
+
registration_config_from_model, "instance_uuid", None
|
|
195
|
+
), # CRITICAL: Preserve UUID
|
|
196
|
+
"ssl": ssl_config,
|
|
197
|
+
"check_hostname": getattr(
|
|
198
|
+
registration_config_from_model, "check_hostname", True
|
|
199
|
+
),
|
|
200
|
+
"use_system_ca": getattr(
|
|
201
|
+
registration_config_from_model, "use_system_ca", False
|
|
202
|
+
),
|
|
203
|
+
"auto_on_startup": registration_config_from_model.auto_on_startup,
|
|
204
|
+
"heartbeat": {
|
|
205
|
+
"url": heartbeat_url,
|
|
206
|
+
"interval": registration_config_from_model.heartbeat.interval,
|
|
207
|
+
},
|
|
208
|
+
}
|
|
209
|
+
_meta = getattr(registration_config_from_model, "metadata", None)
|
|
210
|
+
if isinstance(_meta, dict):
|
|
211
|
+
proxy_registration_config["metadata"] = _meta
|
|
212
|
+
# Bug 6e654f3f: preserve an explicit operator-set capabilities override
|
|
213
|
+
# through the model round-trip so build_server_metadata() can honour it
|
|
214
|
+
# verbatim instead of it silently vanishing here and falling through to
|
|
215
|
+
# the derived/default path.
|
|
216
|
+
_capabilities = getattr(registration_config_from_model, "capabilities", None)
|
|
217
|
+
if _capabilities is not None:
|
|
218
|
+
proxy_registration_config["capabilities"] = _capabilities
|
|
219
|
+
logger.debug(f"🔍 Created proxy_registration_config with ssl: {ssl_config}")
|
|
220
|
+
|
|
221
|
+
return proxy_registration_config, heartbeat_url
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def extract_ssl_config_from_dict(
|
|
225
|
+
proxy_registration_config: Dict[str, Any],
|
|
226
|
+
) -> Tuple[Optional[str], Optional[str], Optional[str]]:
|
|
227
|
+
"""
|
|
228
|
+
Extract SSL certificate paths from registration configuration.
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
proxy_registration_config: Registration configuration dictionary
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
Tuple of (cert_file, key_file, ca_cert_file)
|
|
235
|
+
"""
|
|
236
|
+
ssl_config = proxy_registration_config.get("ssl", {})
|
|
237
|
+
cert_file = (
|
|
238
|
+
ssl_config.get("cert") if ssl_config and isinstance(ssl_config, dict) else None
|
|
239
|
+
)
|
|
240
|
+
key_file = (
|
|
241
|
+
ssl_config.get("key") if ssl_config and isinstance(ssl_config, dict) else None
|
|
242
|
+
)
|
|
243
|
+
ca_cert_file = (
|
|
244
|
+
ssl_config.get("ca") if ssl_config and isinstance(ssl_config, dict) else None
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
return cert_file, key_file, ca_cert_file
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Author: Vasiliy Zdanovskiy
|
|
3
|
+
email: vasilyvz@gmail.com
|
|
4
|
+
|
|
5
|
+
Context builder for registration with proxy server.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any, Dict, Optional
|
|
11
|
+
|
|
12
|
+
from .config_parsers import (
|
|
13
|
+
convert_model_to_dict_config,
|
|
14
|
+
parse_simple_config_format,
|
|
15
|
+
)
|
|
16
|
+
from .metadata_builders import build_advertised_url, build_server_metadata
|
|
17
|
+
from .models import RegistrationContext
|
|
18
|
+
from .resolvers import resolve_registration_credentials
|
|
19
|
+
from .url_builders import (
|
|
20
|
+
build_proxy_url_from_registration_config,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def prepare_registration_context(
|
|
25
|
+
config: Dict[str, Any], logger: Any
|
|
26
|
+
) -> Optional[RegistrationContext]:
|
|
27
|
+
"""Build registration context from configuration.
|
|
28
|
+
|
|
29
|
+
Uses registration section from SimpleConfigModel (independent from server section).
|
|
30
|
+
Only supports the new "registration" format.
|
|
31
|
+
|
|
32
|
+
Returns ``None`` when registration should not be performed.
|
|
33
|
+
"""
|
|
34
|
+
# Only use "registration" key from config
|
|
35
|
+
registration_config = dict(config.get("registration") or {})
|
|
36
|
+
|
|
37
|
+
if not registration_config:
|
|
38
|
+
logger.info("No registration section found in configuration")
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
# Try to parse SimpleConfig format
|
|
42
|
+
registration_config_from_model = parse_simple_config_format(
|
|
43
|
+
registration_config, logger
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# Initialize registration_enabled
|
|
47
|
+
registration_enabled = False
|
|
48
|
+
|
|
49
|
+
# Use registration from SimpleConfigModel if available
|
|
50
|
+
if registration_config_from_model:
|
|
51
|
+
registration_config, _ = convert_model_to_dict_config(
|
|
52
|
+
registration_config_from_model, logger
|
|
53
|
+
)
|
|
54
|
+
# CRITICAL: Preserve instance_uuid from original config if it was lost
|
|
55
|
+
if "instance_uuid" not in registration_config or not registration_config.get(
|
|
56
|
+
"instance_uuid"
|
|
57
|
+
):
|
|
58
|
+
original_uuid = config.get("registration", {}).get("instance_uuid")
|
|
59
|
+
if original_uuid:
|
|
60
|
+
registration_config["instance_uuid"] = original_uuid
|
|
61
|
+
logger.debug(
|
|
62
|
+
f"🔍 Restored instance_uuid from original config: {original_uuid}"
|
|
63
|
+
)
|
|
64
|
+
registration_enabled = (
|
|
65
|
+
registration_config_from_model.enabled
|
|
66
|
+
and registration_config_from_model.auto_on_startup
|
|
67
|
+
)
|
|
68
|
+
elif registration_config and "heartbeat" in registration_config:
|
|
69
|
+
# registration_config already has heartbeat - use it directly (SimpleConfig format)
|
|
70
|
+
heartbeat_config = registration_config.get("heartbeat", {})
|
|
71
|
+
if isinstance(heartbeat_config, dict) and heartbeat_config.get("url"):
|
|
72
|
+
# heartbeat.url exists - this is SimpleConfig format
|
|
73
|
+
registration_enabled = registration_config.get(
|
|
74
|
+
"enabled", False
|
|
75
|
+
) and registration_config.get("auto_on_startup", True)
|
|
76
|
+
logger.debug(
|
|
77
|
+
f"Using SimpleConfig format: enabled={registration_enabled}, "
|
|
78
|
+
f"heartbeat.url={heartbeat_config.get('url')}"
|
|
79
|
+
)
|
|
80
|
+
else:
|
|
81
|
+
# heartbeat exists but url is missing - error
|
|
82
|
+
error_msg = (
|
|
83
|
+
"registration.heartbeat.url is required when registration.enabled=true. "
|
|
84
|
+
"It must be a full URL (e.g., http://localhost:3005/proxy/heartbeat)"
|
|
85
|
+
)
|
|
86
|
+
logger.error(f"❌ Configuration error: {error_msg}")
|
|
87
|
+
raise ValueError(error_msg)
|
|
88
|
+
else:
|
|
89
|
+
# Invalid format - registration section must have heartbeat.url
|
|
90
|
+
error_msg = (
|
|
91
|
+
"registration.heartbeat.url is required when registration.enabled=true. "
|
|
92
|
+
"It must be a full URL (e.g., http://localhost:3005/proxy/heartbeat)"
|
|
93
|
+
)
|
|
94
|
+
logger.error(f"❌ Configuration error: {error_msg}")
|
|
95
|
+
raise ValueError(error_msg)
|
|
96
|
+
|
|
97
|
+
if not registration_enabled:
|
|
98
|
+
logger.info(
|
|
99
|
+
"Proxy registration disabled (auto_on_startup=false or enabled=false)"
|
|
100
|
+
)
|
|
101
|
+
return None
|
|
102
|
+
|
|
103
|
+
# Build proxy URL and register endpoint
|
|
104
|
+
result = build_proxy_url_from_registration_config(registration_config, logger)
|
|
105
|
+
proxy_url, register_endpoint, _, _, _, _ = result
|
|
106
|
+
if proxy_url is None or register_endpoint is None:
|
|
107
|
+
return None
|
|
108
|
+
|
|
109
|
+
# Build server metadata
|
|
110
|
+
server_config = dict(config.get("server") or {})
|
|
111
|
+
advertised_url = build_advertised_url(server_config, logger)
|
|
112
|
+
server_name, capabilities, metadata = build_server_metadata(
|
|
113
|
+
config,
|
|
114
|
+
registration_config,
|
|
115
|
+
server_config,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
# Resolve credentials
|
|
119
|
+
credentials = resolve_registration_credentials(registration_config)
|
|
120
|
+
|
|
121
|
+
return RegistrationContext(
|
|
122
|
+
server_name=server_name,
|
|
123
|
+
advertised_url=advertised_url,
|
|
124
|
+
proxy_url=proxy_url,
|
|
125
|
+
register_endpoint=register_endpoint,
|
|
126
|
+
capabilities=capabilities,
|
|
127
|
+
metadata=metadata,
|
|
128
|
+
proxy_registration_config=registration_config,
|
|
129
|
+
credentials=credentials,
|
|
130
|
+
)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Author: Vasiliy Zdanovskiy
|
|
3
|
+
email: vasilyvz@gmail.com
|
|
4
|
+
|
|
5
|
+
Helper functions for registration context building.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Optional, Tuple
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def build_cert_tuple(
|
|
15
|
+
cert_file: Optional[str],
|
|
16
|
+
key_file: Optional[str],
|
|
17
|
+
) -> Optional[Tuple[str, str]]:
|
|
18
|
+
"""
|
|
19
|
+
Build certificate tuple from file paths.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
cert_file: Path to certificate file
|
|
23
|
+
key_file: Path to private key file
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
Tuple of (cert_path, key_path) if both files exist, None otherwise
|
|
27
|
+
"""
|
|
28
|
+
if not cert_file or not key_file:
|
|
29
|
+
return None
|
|
30
|
+
|
|
31
|
+
cert_path = Path(cert_file)
|
|
32
|
+
key_path = Path(key_file)
|
|
33
|
+
if not cert_path.exists() or not key_path.exists():
|
|
34
|
+
return None
|
|
35
|
+
|
|
36
|
+
return (str(cert_path), str(key_path))
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Author: Vasiliy Zdanovskiy
|
|
3
|
+
email: vasilyvz@gmail.com
|
|
4
|
+
|
|
5
|
+
Metadata builders for registration context.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any, Dict
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def build_advertised_url(server_config: Dict[str, Any], logger: Any) -> str:
|
|
14
|
+
"""
|
|
15
|
+
Build advertised URL for server registration.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
server_config: Server configuration dictionary
|
|
19
|
+
logger: Logger instance
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
Advertised URL string
|
|
23
|
+
"""
|
|
24
|
+
host = server_config.get("host", "127.0.0.1")
|
|
25
|
+
port = server_config.get("port", 8000)
|
|
26
|
+
protocol = server_config.get("protocol", "http")
|
|
27
|
+
advertised_host = server_config.get("advertised_host") or host
|
|
28
|
+
if advertised_host in ("0.0.0.0", "::", "[::]"):
|
|
29
|
+
logger.info(
|
|
30
|
+
"📡 Server host '%s' is not directly reachable; using 'localhost' for advertised URL",
|
|
31
|
+
advertised_host,
|
|
32
|
+
)
|
|
33
|
+
advertised_host = "localhost"
|
|
34
|
+
scheme = "https" if protocol in ("https", "mtls") else "http"
|
|
35
|
+
advertised_url = f"{scheme}://{advertised_host}:{port}"
|
|
36
|
+
return advertised_url
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def build_server_metadata(
|
|
40
|
+
config: Dict[str, Any],
|
|
41
|
+
registration_config: Dict[str, Any],
|
|
42
|
+
server_config: Dict[str, Any],
|
|
43
|
+
) -> tuple[str, list[str], Dict[str, Any]]:
|
|
44
|
+
"""
|
|
45
|
+
Build server name, capabilities, and metadata for registration.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
config: Full configuration dictionary
|
|
49
|
+
registration_config: Registration configuration dictionary
|
|
50
|
+
server_config: Server configuration dictionary
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
Tuple of (server_name, capabilities, metadata)
|
|
54
|
+
"""
|
|
55
|
+
host = server_config.get("host", "127.0.0.1")
|
|
56
|
+
port = server_config.get("port", 8000)
|
|
57
|
+
protocol = server_config.get("protocol", "http")
|
|
58
|
+
|
|
59
|
+
# Normalize host for server_name (use localhost for 0.0.0.0, ::, [::])
|
|
60
|
+
host_for_name = host
|
|
61
|
+
if host in ("0.0.0.0", "::", "[::]"):
|
|
62
|
+
host_for_name = "localhost"
|
|
63
|
+
|
|
64
|
+
server_name = registration_config.get("server_id") or registration_config.get(
|
|
65
|
+
"server_name"
|
|
66
|
+
)
|
|
67
|
+
server_name = server_name or f"mcp-adapter-{host_for_name}-{port}"
|
|
68
|
+
|
|
69
|
+
# Bug 6e654f3f: capabilities used to be a hardcoded ["jsonrpc", "health"]
|
|
70
|
+
# pair whenever the operator did not set registration.capabilities
|
|
71
|
+
# explicitly, regardless of how many commands the server actually
|
|
72
|
+
# exposed. An explicit value is still honoured verbatim (operator
|
|
73
|
+
# override). With no explicit value, derive it at registration time from
|
|
74
|
+
# the live command registry: the two protocol markers plus the sorted
|
|
75
|
+
# names of every command actually registered right now.
|
|
76
|
+
#
|
|
77
|
+
# Ordering, confirmed by reading the real startup path: this function is
|
|
78
|
+
# only ever reached via ``prepare_registration_context``, which is only
|
|
79
|
+
# ever called from ``RegistrationManager.register_with_proxy`` /
|
|
80
|
+
# ``start_heartbeat`` (api/core/registration_manager/manager.py) - both
|
|
81
|
+
# invoked exclusively from the FastAPI lifespan "startup" event
|
|
82
|
+
# (api/core/lifespan_manager.py), which fires only once the ASGI server
|
|
83
|
+
# begins actually serving. By then ``AppFactory.create_app`` has already
|
|
84
|
+
# called ``register_builtin_commands`` (api/core/app_factory.py), and an
|
|
85
|
+
# entrypoint such as examples/full_application/main.py has already
|
|
86
|
+
# registered its custom commands too (create_app() then
|
|
87
|
+
# register_all_commands(), both strictly before engine.run_server()) -
|
|
88
|
+
# so the registry is fully populated by the time this code runs.
|
|
89
|
+
explicit_capabilities = registration_config.get("capabilities")
|
|
90
|
+
if explicit_capabilities is not None:
|
|
91
|
+
capabilities = explicit_capabilities
|
|
92
|
+
else:
|
|
93
|
+
try:
|
|
94
|
+
from mcp_proxy_adapter.commands.command_registry import (
|
|
95
|
+
registry as _command_registry,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
command_names = sorted(_command_registry.get_all_commands().keys())
|
|
99
|
+
except Exception:
|
|
100
|
+
command_names = []
|
|
101
|
+
capabilities = ["jsonrpc", "health"] + command_names
|
|
102
|
+
# Extract UUID from registration config (instance_uuid) or fallback to config uuid
|
|
103
|
+
uuid_value = registration_config.get("instance_uuid") or config.get("uuid")
|
|
104
|
+
|
|
105
|
+
metadata = {
|
|
106
|
+
"protocol": protocol,
|
|
107
|
+
"host": host,
|
|
108
|
+
"port": port,
|
|
109
|
+
**(registration_config.get("metadata") or {}),
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# Include UUID in metadata temporarily for extraction by proxy_api.py
|
|
113
|
+
# UUID will be extracted from metadata, removed from metadata, and placed at root level of payload
|
|
114
|
+
if uuid_value:
|
|
115
|
+
metadata["uuid"] = uuid_value
|
|
116
|
+
|
|
117
|
+
return server_name, capabilities, metadata
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Author: Vasiliy Zdanovskiy
|
|
3
|
+
email: vasilyvz@gmail.com
|
|
4
|
+
|
|
5
|
+
Data models for registration context.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class ProxyCredentials:
|
|
16
|
+
"""Client certificate and verification settings for proxy communication."""
|
|
17
|
+
|
|
18
|
+
cert: Optional[Tuple[str, str]]
|
|
19
|
+
verify: Union[bool, str]
|
|
20
|
+
check_hostname: bool = True # DNS/hostname verification flag
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass
|
|
24
|
+
class RegistrationContext:
|
|
25
|
+
"""Prepared data required to register the adapter with a proxy."""
|
|
26
|
+
|
|
27
|
+
server_name: str
|
|
28
|
+
advertised_url: str
|
|
29
|
+
proxy_url: str
|
|
30
|
+
register_endpoint: str
|
|
31
|
+
capabilities: List[str]
|
|
32
|
+
metadata: Dict[str, Any]
|
|
33
|
+
proxy_registration_config: Dict[str, Any]
|
|
34
|
+
credentials: ProxyCredentials
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass
|
|
38
|
+
class HeartbeatSettings:
|
|
39
|
+
"""Configuration for heartbeat scheduling."""
|
|
40
|
+
|
|
41
|
+
interval: int
|
|
42
|
+
url: str # Full URL for heartbeat (e.g., "http://localhost:3005/proxy/heartbeat")
|