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,109 @@
|
|
|
1
|
+
"""The runner module of the unified_error_handling_example package: main."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import uuid
|
|
7
|
+
from typing import Any, Dict
|
|
8
|
+
|
|
9
|
+
from .demos import (
|
|
10
|
+
demonstrate_command_level_error,
|
|
11
|
+
demonstrate_in_process_state,
|
|
12
|
+
demonstrate_queued_command,
|
|
13
|
+
)
|
|
14
|
+
from .support import _client_from_url, _parse_args, explain_job_id_and_stop_semantics
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
async def main() -> int:
|
|
18
|
+
"""Run all three demonstrations against ``--url``, print progress plus
|
|
19
|
+
the machine-readable JSON summary, and return the process exit code.
|
|
20
|
+
|
|
21
|
+
Every summary boolean is computed from a real call made in this run -
|
|
22
|
+
nothing is hardcoded to make the JSON line look correct. The example
|
|
23
|
+
cleans up after itself in a ``finally`` block: the ``settings`` key it
|
|
24
|
+
wrote is restored to whatever value (or absence, reported as ``None``)
|
|
25
|
+
it observed before writing, using only the existing ``settings``
|
|
26
|
+
command's own ``set`` operation - no new command or capability.
|
|
27
|
+
"""
|
|
28
|
+
args = _parse_args()
|
|
29
|
+
client = _client_from_url(args.url)
|
|
30
|
+
|
|
31
|
+
example_key = f"unified_example_{uuid.uuid4().hex[:8]}"
|
|
32
|
+
marker_value = "unified-nuance-demo"
|
|
33
|
+
summary: Dict[str, Any] = {
|
|
34
|
+
"in_process_state_visible": False,
|
|
35
|
+
"command_error_detected": False,
|
|
36
|
+
"command_error_terminal_event": None,
|
|
37
|
+
"queued_command_completed": False,
|
|
38
|
+
"ok": False,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
print(f"Connecting to {args.url} ...")
|
|
42
|
+
original_value: Any = None
|
|
43
|
+
try:
|
|
44
|
+
before = await client.execute_command(
|
|
45
|
+
"settings", {"operation": "get", "key": example_key}
|
|
46
|
+
)
|
|
47
|
+
original_value = before.get("value") if isinstance(before, dict) else None
|
|
48
|
+
|
|
49
|
+
print(
|
|
50
|
+
"\n[N-a] settings round trip: execute_command (sync, SET) -> "
|
|
51
|
+
"execute_command_unified (GET) on the same server process"
|
|
52
|
+
)
|
|
53
|
+
state_visible, observed = await demonstrate_in_process_state(
|
|
54
|
+
client, example_key, marker_value
|
|
55
|
+
)
|
|
56
|
+
summary["in_process_state_visible"] = state_visible
|
|
57
|
+
print(
|
|
58
|
+
f" observed via execute_command_unified: {observed!r} "
|
|
59
|
+
f"(expected {marker_value!r}) -> "
|
|
60
|
+
f"{'in-process state IS visible' if state_visible else 'MISMATCH'}"
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
print(
|
|
64
|
+
"\n[N-b] calculator divide-by-zero via execute_command_unified "
|
|
65
|
+
"(command-level failure, framework-level completion)"
|
|
66
|
+
)
|
|
67
|
+
error_detected, terminal_event, error_payload = (
|
|
68
|
+
await demonstrate_command_level_error(client)
|
|
69
|
+
)
|
|
70
|
+
summary["command_error_detected"] = error_detected
|
|
71
|
+
summary["command_error_terminal_event"] = terminal_event
|
|
72
|
+
print(
|
|
73
|
+
f" terminal event: {terminal_event!r}; nested error: "
|
|
74
|
+
f"{error_payload!r}; detected as a failure: {error_detected}"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
print(
|
|
78
|
+
"\n[N-a queue half] long_running_task (use_queue=True) via "
|
|
79
|
+
"execute_command_unified, running in a queue worker"
|
|
80
|
+
)
|
|
81
|
+
queued_ok = await demonstrate_queued_command(client)
|
|
82
|
+
summary["queued_command_completed"] = queued_ok
|
|
83
|
+
print(f" queued command completed successfully: {queued_ok}")
|
|
84
|
+
|
|
85
|
+
print("\n[N-c] job_id / stop semantics (explanation only)")
|
|
86
|
+
print(f" {explain_job_id_and_stop_semantics()}")
|
|
87
|
+
finally:
|
|
88
|
+
try:
|
|
89
|
+
await client.execute_command(
|
|
90
|
+
"settings",
|
|
91
|
+
{"operation": "set", "key": example_key, "value": original_value},
|
|
92
|
+
)
|
|
93
|
+
except Exception as cleanup_exc: # nosec B110 - best-effort cleanup;
|
|
94
|
+
# the example's own pass/fail verdict never depends on this, and
|
|
95
|
+
# swallowing a cleanup-only failure here must not mask the real
|
|
96
|
+
# demonstration results already collected above.
|
|
97
|
+
print(f" cleanup warning for key {example_key!r}: {cleanup_exc}")
|
|
98
|
+
await client.close()
|
|
99
|
+
|
|
100
|
+
summary["ok"] = bool(
|
|
101
|
+
summary["in_process_state_visible"]
|
|
102
|
+
and summary["command_error_detected"]
|
|
103
|
+
and summary["command_error_terminal_event"] == "command_completed"
|
|
104
|
+
and summary["queued_command_completed"]
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
print()
|
|
108
|
+
print(json.dumps(summary))
|
|
109
|
+
return 0 if summary["ok"] else 1
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""The support module of the unified_error_handling_example package:
|
|
2
|
+
explain_job_id_and_stop_semantics, _parse_args, _client_from_url.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import argparse
|
|
8
|
+
from urllib.parse import urlsplit
|
|
9
|
+
|
|
10
|
+
from mcp_proxy_adapter.client.jsonrpc_client import JsonRpcClient
|
|
11
|
+
from mcp_proxy_adapter.examples.unified_error_handling_texts import (
|
|
12
|
+
JOB_ID_STOP_EXPLANATION,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def explain_job_id_and_stop_semantics() -> str:
|
|
17
|
+
"""Nuance N-c, explanation only - this function calls nothing, it just
|
|
18
|
+
states what the two ``job_id`` values obtained above actually mean.
|
|
19
|
+
|
|
20
|
+
For the queued ``long_running_task`` call, ``job_id`` names a real
|
|
21
|
+
queuemgr job: ``queue_stop_job`` on it would genuinely cancel the worker
|
|
22
|
+
process running that job. For the in-process ``settings``/``calculator``
|
|
23
|
+
calls, ``job_id`` instead names an adapter-side detached-fallback
|
|
24
|
+
record, not a queuemgr job - ``queue_stop_job`` on THAT kind of id does
|
|
25
|
+
NOT cancel the in-process execution (cancelling a command already
|
|
26
|
+
running inside the server process mid-flight is unsafe and is
|
|
27
|
+
deliberately refused); the command always runs to completion and
|
|
28
|
+
publishes its own terminal result under the same ``job_id`` regardless
|
|
29
|
+
of any stop request. This example never calls ``queue_stop_job`` or
|
|
30
|
+
otherwise attempts to cancel either job; it only explains the
|
|
31
|
+
distinction so a reader does not assume stop behaves the same way for
|
|
32
|
+
both.
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
A one-paragraph human-readable explanation, printed by ``main()``.
|
|
36
|
+
"""
|
|
37
|
+
return JOB_ID_STOP_EXPLANATION
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _parse_args() -> argparse.Namespace:
|
|
41
|
+
"""Parse the one CLI argument this example needs: the base server URL.
|
|
42
|
+
|
|
43
|
+
The tester's fixed contract for this example invokes it as
|
|
44
|
+
``python <path> --url http://127.0.0.1:<port>`` against a freshly
|
|
45
|
+
started ``examples/full_application`` ``http_basic`` server, so
|
|
46
|
+
``--url`` (not the ``--host``/``--port``/``--protocol`` triplet the
|
|
47
|
+
older ``client_usage_example.py`` uses) is the required flag.
|
|
48
|
+
"""
|
|
49
|
+
parser = argparse.ArgumentParser(
|
|
50
|
+
description=(
|
|
51
|
+
"Demonstrate the unified/WS command-session nuances (bug "
|
|
52
|
+
"0d64b41c): where a command runs (use_queue), how a "
|
|
53
|
+
"command-level failure arrives (command_completed with nested "
|
|
54
|
+
"success:false, not command_failed), and job_id/stop semantics "
|
|
55
|
+
"for an in-process run."
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
parser.add_argument(
|
|
59
|
+
"--url",
|
|
60
|
+
default="http://127.0.0.1:8080",
|
|
61
|
+
help="Base URL of a running examples/full_application http_basic server",
|
|
62
|
+
)
|
|
63
|
+
return parser.parse_args()
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _client_from_url(url: str) -> JsonRpcClient:
|
|
67
|
+
"""Build a ``JsonRpcClient`` from a single ``--url`` argument.
|
|
68
|
+
|
|
69
|
+
Splits ``scheme://host:port`` into the constructor's own
|
|
70
|
+
``protocol``/``host``/``port`` parameters; this example only targets
|
|
71
|
+
plain HTTP (the tester's contract runs it against ``http_basic``), so a
|
|
72
|
+
missing scheme/port fall back to ``http``/``8080`` rather than guessing
|
|
73
|
+
at TLS material this script does not accept as arguments.
|
|
74
|
+
"""
|
|
75
|
+
parts = urlsplit(url)
|
|
76
|
+
protocol = parts.scheme or "http"
|
|
77
|
+
host = parts.hostname or "127.0.0.1"
|
|
78
|
+
port = parts.port or 8080
|
|
79
|
+
return JsonRpcClient(protocol=protocol, host=host, port=port, timeout=30.0)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Stored explanation text of ``unified_error_handling_example.py``.
|
|
3
|
+
|
|
4
|
+
The example keeps its prose here as data, so its function only names it.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
JOB_ID_STOP_EXPLANATION = (
|
|
10
|
+
"job_id from the queued long_running_task call above names a real queuemgr job - "
|
|
11
|
+
"queue_stop_job would actually cancel its worker process. job_id from the in-"
|
|
12
|
+
"process settings/calculator calls above instead names an adapter-side record, "
|
|
13
|
+
"not a queuemgr job: queue_stop_job on it does not cancel the in-process "
|
|
14
|
+
"execution (that would be unsafe while it runs inside the server process); it "
|
|
15
|
+
"always runs to completion and publishes its own terminal result under that "
|
|
16
|
+
"job_id. This example calls stop on neither."
|
|
17
|
+
)
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Thin demonstration wrapper over the library's ``UniversalClient``.
|
|
3
|
+
|
|
4
|
+
Overview
|
|
5
|
+
--------
|
|
6
|
+
This module does **not** implement its own connect/auth/SSL/request logic.
|
|
7
|
+
It re-exports and drives ``mcp_proxy_adapter.core.client.UniversalClient`` -
|
|
8
|
+
the actual library client - and adds a handful of demo helpers
|
|
9
|
+
(``create_client_config``, ``create_mtls_client_config``,
|
|
10
|
+
``demo_all_connection_methods``, ``demo_specific_connection``,
|
|
11
|
+
``demo_mtls_connection``) that ``demo_client.py`` and this module's own
|
|
12
|
+
``__main__`` block call. Consumers who want the client in their own code
|
|
13
|
+
should import it directly::
|
|
14
|
+
|
|
15
|
+
from mcp_proxy_adapter.core.client import UniversalClient
|
|
16
|
+
# or, for the config-file convenience constructor:
|
|
17
|
+
from mcp_proxy_adapter.core.client import create_client_from_config
|
|
18
|
+
|
|
19
|
+
This example exists to show the config shape and the demo call sequence,
|
|
20
|
+
not to be a second implementation.
|
|
21
|
+
|
|
22
|
+
Configuration shape (the LIBRARY client's real contract - see
|
|
23
|
+
``mcp_proxy_adapter/core/client/client.py``, ``factory.py`` and
|
|
24
|
+
``ssl_handler.py``)
|
|
25
|
+
----------------------------------------------------------------------------
|
|
26
|
+
Top level::
|
|
27
|
+
|
|
28
|
+
{
|
|
29
|
+
"server_url": "http://host:port",
|
|
30
|
+
"timeout": 30,
|
|
31
|
+
"retry_attempts": 3,
|
|
32
|
+
"retry_delay": 1,
|
|
33
|
+
"security": { ... }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
``security.auth_method`` is one of ``none`` (default), ``api_key``, ``jwt``,
|
|
37
|
+
``basic``. **``certificate`` is not a valid ``auth_method``**: the library
|
|
38
|
+
client authenticates client certificates through the SSL layer, not through
|
|
39
|
+
an auth header, and construction/connection with
|
|
40
|
+
``auth_method: "certificate"`` fails with a clear error rather than
|
|
41
|
+
silently doing nothing (see the ``core/client`` bug-59f20ab4 branch, which
|
|
42
|
+
rejects it at construction; on a client that has not merged that fix yet,
|
|
43
|
+
``connect()`` still fails closed with a typed error rather than a bare
|
|
44
|
+
``AttributeError``). Present a client certificate via mTLS instead - see
|
|
45
|
+
``create_mtls_client_config`` below.
|
|
46
|
+
|
|
47
|
+
Per-``auth_method`` nested blocks:
|
|
48
|
+
|
|
49
|
+
- ``api_key``: ``security.api_key = {"key": ..., "header": "X-API-Key"}``.
|
|
50
|
+
- ``jwt``: ``security.jwt = {"username": ..., "password": ..., "secret": ...,
|
|
51
|
+
"expiry_hours": 24}``.
|
|
52
|
+
- ``basic``: ``security.basic = {"username": ..., "password": ...}``.
|
|
53
|
+
|
|
54
|
+
TLS / mTLS, independent of ``auth_method``:
|
|
55
|
+
|
|
56
|
+
- ``security.ssl.enabled`` (bool) turns TLS on for the connection.
|
|
57
|
+
- ``security.ssl.ca_cert_file`` (or ``ca_cert``) - CA bundle for chain
|
|
58
|
+
verification; omitted means the system trust store.
|
|
59
|
+
- ``security.ssl.verify`` (bool, default True) - chain verification.
|
|
60
|
+
- ``security.ssl.check_hostname`` (bool, default True) - hostname matching;
|
|
61
|
+
independent of ``verify`` (turning it off never weakens chain checking).
|
|
62
|
+
- ``security.ssl.min_tls_version`` / ``max_tls_version`` - optional TLS
|
|
63
|
+
version bounds (e.g. ``"TLSv1.2"``).
|
|
64
|
+
- ``security.certificate.cert_file`` / ``security.certificate.key_file`` -
|
|
65
|
+
the CLIENT certificate/key presented for mTLS. These are read by the SSL
|
|
66
|
+
layer whenever present, regardless of ``auth_method`` - this is the one
|
|
67
|
+
place a client certificate belongs; it is not gated behind an
|
|
68
|
+
``auth_method: "certificate"`` value or a ``certificate.enabled`` flag.
|
|
69
|
+
|
|
70
|
+
Typical flow
|
|
71
|
+
------------
|
|
72
|
+
1. Build a config dict (``create_client_config`` for auth-method demos,
|
|
73
|
+
``create_mtls_client_config`` for mutual TLS) or load JSON from disk.
|
|
74
|
+
2. ``async with UniversalClient(config) as client:`` - ``connect()`` builds
|
|
75
|
+
the SSL context (if any) and performs auth, then ``get``/``post``/
|
|
76
|
+
``test_connection``/``test_security_features`` drive the server.
|
|
77
|
+
3. CLI without args: ``demo_all_connection_methods`` walks the auth-method
|
|
78
|
+
matrix. CLI with an auth method name: ``demo_specific_connection``
|
|
79
|
+
targets ``http://localhost:8000`` with demo credentials (``mtls`` calls
|
|
80
|
+
``demo_mtls_connection`` instead). CLI ``--config``: loads a
|
|
81
|
+
``server``/``ssl``-shaped file the same way
|
|
82
|
+
``core.client.factory.create_client_from_config`` does, then optionally
|
|
83
|
+
calls a JSON-RPC method.
|
|
84
|
+
|
|
85
|
+
Limitations
|
|
86
|
+
-----------
|
|
87
|
+
- Not a full MCP client over stdio; HTTP JSON-RPC and REST-style paths only
|
|
88
|
+
(no WebSocket job channel); for bidirectional ``/ws`` and queue completion
|
|
89
|
+
via WebSocket use ``scripts/example_bidirectional_ws_mtls.py``.
|
|
90
|
+
- Demos assume services and certificates exist at hardcoded paths; failures
|
|
91
|
+
are printed and swallowed in places for illustration.
|
|
92
|
+
|
|
93
|
+
Author: Vasiliy Zdanovskiy
|
|
94
|
+
email: vasilyvz@gmail.com
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
# flake8: noqa: F401
|
|
98
|
+
import asyncio # noqa: F401
|
|
99
|
+
import json # noqa: F401
|
|
100
|
+
import sys # noqa: F401
|
|
101
|
+
from typing import Any, Dict, List # noqa: F401
|
|
102
|
+
|
|
103
|
+
from mcp_proxy_adapter.client.jsonrpc_client.exceptions import ( # noqa: F401
|
|
104
|
+
TransportConfigurationError,
|
|
105
|
+
)
|
|
106
|
+
from mcp_proxy_adapter.core.client import UniversalClient, create_client_from_config
|
|
107
|
+
from mcp_proxy_adapter.examples.universal_client_split_parts.configs import ( # noqa: F401
|
|
108
|
+
create_client_config,
|
|
109
|
+
create_mtls_client_config,
|
|
110
|
+
)
|
|
111
|
+
from mcp_proxy_adapter.examples.universal_client_split_parts.demos import ( # noqa: F401
|
|
112
|
+
demo_all_connection_methods,
|
|
113
|
+
demo_mtls_connection,
|
|
114
|
+
demo_specific_connection,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
__all__ = [
|
|
118
|
+
"UniversalClient",
|
|
119
|
+
"create_client_config",
|
|
120
|
+
"create_mtls_client_config",
|
|
121
|
+
"demo_all_connection_methods",
|
|
122
|
+
"demo_specific_connection",
|
|
123
|
+
"demo_mtls_connection",
|
|
124
|
+
]
|
|
125
|
+
if __name__ == "__main__":
|
|
126
|
+
import argparse
|
|
127
|
+
|
|
128
|
+
parser = argparse.ArgumentParser(
|
|
129
|
+
description="Universal Client for MCP Proxy Adapter"
|
|
130
|
+
)
|
|
131
|
+
parser.add_argument("--config", help="Path to configuration file")
|
|
132
|
+
parser.add_argument("--method", help="JSON-RPC method to call")
|
|
133
|
+
parser.add_argument("--params", help="JSON-RPC parameters (JSON string)")
|
|
134
|
+
parser.add_argument("--auth-method", help="Authentication method")
|
|
135
|
+
parser.add_argument("--server-url", help="Server URL")
|
|
136
|
+
args = parser.parse_args()
|
|
137
|
+
|
|
138
|
+
if args.config:
|
|
139
|
+
|
|
140
|
+
async def run_config_cli(config_file: str) -> None:
|
|
141
|
+
"""Build a client from a ``server``/``ssl``-shaped config file
|
|
142
|
+
(the same shape ``core.client.factory.create_client_from_config``
|
|
143
|
+
reads) and optionally invoke a JSON-RPC method."""
|
|
144
|
+
print("š Testing --config connection")
|
|
145
|
+
print("=" * 40)
|
|
146
|
+
try:
|
|
147
|
+
client = create_client_from_config(config_file)
|
|
148
|
+
except (TransportConfigurationError, ValueError) as e:
|
|
149
|
+
print(f"ā Error loading configuration: {e}")
|
|
150
|
+
return
|
|
151
|
+
print(f"Connecting to {client.base_url} with --config authentication...")
|
|
152
|
+
async with client:
|
|
153
|
+
success = await client.test_connection()
|
|
154
|
+
if not success:
|
|
155
|
+
print("ā Connection failed")
|
|
156
|
+
return
|
|
157
|
+
print("No authentication required")
|
|
158
|
+
print("Connection established successfully")
|
|
159
|
+
method = args.method or "help"
|
|
160
|
+
params: Dict[str, Any] = {}
|
|
161
|
+
if args.params:
|
|
162
|
+
try:
|
|
163
|
+
params = json.loads(args.params)
|
|
164
|
+
except json.JSONDecodeError:
|
|
165
|
+
print("ā Invalid JSON parameters")
|
|
166
|
+
return
|
|
167
|
+
command_data = {
|
|
168
|
+
"jsonrpc": "2.0",
|
|
169
|
+
"method": method,
|
|
170
|
+
"params": params,
|
|
171
|
+
"id": 1,
|
|
172
|
+
}
|
|
173
|
+
try:
|
|
174
|
+
result = await client.post("/api/jsonrpc", command_data)
|
|
175
|
+
print(f"ā
Method '{method}' executed successfully:")
|
|
176
|
+
print(json.dumps(result, indent=2))
|
|
177
|
+
except Exception as e:
|
|
178
|
+
print(f"ā Method '{method}' execution failed: {e}")
|
|
179
|
+
|
|
180
|
+
asyncio.run(run_config_cli(args.config))
|
|
181
|
+
elif len(sys.argv) > 1:
|
|
182
|
+
# Test specific auth method (legacy mode)
|
|
183
|
+
auth_method = sys.argv[1]
|
|
184
|
+
cli_kwargs: Dict[str, Any] = {}
|
|
185
|
+
if auth_method == "api_key":
|
|
186
|
+
cli_kwargs["api_key"] = "demo_key_123"
|
|
187
|
+
elif auth_method == "jwt":
|
|
188
|
+
cli_kwargs.update(
|
|
189
|
+
{
|
|
190
|
+
"username": "demo_user",
|
|
191
|
+
"password": "demo_password", # nosec B105 - test/demo fixture string assigned to a credential-shaped variable name, not a real secret
|
|
192
|
+
"secret": "demo_secret", # nosec B105 - test/demo fixture string assigned to a credential-shaped variable name, not a real secret
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
elif auth_method == "basic":
|
|
196
|
+
cli_kwargs.update(
|
|
197
|
+
{
|
|
198
|
+
"username": "demo_user",
|
|
199
|
+
"password": "demo_password", # nosec B105 - test/demo fixture string assigned to a credential-shaped variable name, not a real secret
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
if auth_method in ("certificate", "mtls"):
|
|
203
|
+
asyncio.run(
|
|
204
|
+
demo_mtls_connection(
|
|
205
|
+
"https://localhost:8443",
|
|
206
|
+
"./certs/client.crt",
|
|
207
|
+
"./keys/client.key",
|
|
208
|
+
"./certs/ca.crt",
|
|
209
|
+
)
|
|
210
|
+
)
|
|
211
|
+
else:
|
|
212
|
+
asyncio.run(demo_specific_connection(auth_method, **cli_kwargs))
|
|
213
|
+
else:
|
|
214
|
+
# Demo all connection methods
|
|
215
|
+
asyncio.run(demo_all_connection_methods())
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""The configs module of the universal_client package: create_client_config,
|
|
2
|
+
create_mtls_client_config.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def create_client_config(
|
|
9
|
+
server_url: str, auth_method: str = "none", **kwargs: Any
|
|
10
|
+
) -> Dict[str, Any]:
|
|
11
|
+
"""
|
|
12
|
+
Create a library ``UniversalClient`` configuration for an auth-method demo.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
server_url: Server URL
|
|
16
|
+
auth_method: Authentication method (none, api_key, jwt, basic).
|
|
17
|
+
``certificate`` is not supported here - use
|
|
18
|
+
``create_mtls_client_config`` for mutual TLS.
|
|
19
|
+
**kwargs: Additional configuration parameters
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
Client configuration dictionary
|
|
23
|
+
|
|
24
|
+
Raises:
|
|
25
|
+
ValueError: If ``auth_method`` is ``"certificate"``.
|
|
26
|
+
"""
|
|
27
|
+
if auth_method == "certificate":
|
|
28
|
+
raise ValueError(
|
|
29
|
+
"auth_method 'certificate' is not supported by this demo helper; "
|
|
30
|
+
"present a client certificate through the ssl/certificate config "
|
|
31
|
+
"instead (see create_mtls_client_config)."
|
|
32
|
+
)
|
|
33
|
+
security: Dict[str, Any] = {"auth_method": auth_method}
|
|
34
|
+
config: Dict[str, Any] = {
|
|
35
|
+
"server_url": server_url,
|
|
36
|
+
"timeout": kwargs.get("timeout", 30),
|
|
37
|
+
"retry_attempts": kwargs.get("retry_attempts", 3),
|
|
38
|
+
"retry_delay": kwargs.get("retry_delay", 1),
|
|
39
|
+
"security": security,
|
|
40
|
+
}
|
|
41
|
+
if auth_method == "api_key":
|
|
42
|
+
security["api_key"] = {
|
|
43
|
+
"key": kwargs.get("api_key", "your_api_key_here"),
|
|
44
|
+
"header": kwargs.get("header", "X-API-Key"),
|
|
45
|
+
}
|
|
46
|
+
elif auth_method == "jwt":
|
|
47
|
+
security["jwt"] = {
|
|
48
|
+
"username": kwargs.get("username", "user"),
|
|
49
|
+
"password": kwargs.get("password", "password"),
|
|
50
|
+
"secret": kwargs.get("secret", "your_jwt_secret"),
|
|
51
|
+
"expiry_hours": kwargs.get("expiry_hours", 24),
|
|
52
|
+
}
|
|
53
|
+
elif auth_method == "basic":
|
|
54
|
+
security["basic"] = {
|
|
55
|
+
"username": kwargs.get("username", "user"),
|
|
56
|
+
"password": kwargs.get("password", "password"),
|
|
57
|
+
}
|
|
58
|
+
return config
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def create_mtls_client_config(
|
|
62
|
+
server_url: str,
|
|
63
|
+
cert_file: str,
|
|
64
|
+
key_file: str,
|
|
65
|
+
ca_cert_file: str,
|
|
66
|
+
**kwargs: Any,
|
|
67
|
+
) -> Dict[str, Any]:
|
|
68
|
+
"""
|
|
69
|
+
Create a library ``UniversalClient`` configuration for mutual TLS.
|
|
70
|
+
|
|
71
|
+
The client certificate/key go under ``security.certificate``; the CA
|
|
72
|
+
bundle goes under ``security.ssl.ca_cert_file``. ``auth_method`` stays
|
|
73
|
+
``"none"`` - mTLS is negotiated by the SSL context, not by an auth
|
|
74
|
+
header (see the module docstring).
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
server_url: Server URL (should be ``https://...``)
|
|
78
|
+
cert_file: Path to the client certificate
|
|
79
|
+
key_file: Path to the client private key
|
|
80
|
+
ca_cert_file: Path to the CA bundle used to verify the server
|
|
81
|
+
**kwargs: ``verify`` / ``check_hostname`` overrides (default True)
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
Client configuration dictionary
|
|
85
|
+
"""
|
|
86
|
+
return {
|
|
87
|
+
"server_url": server_url,
|
|
88
|
+
"timeout": kwargs.get("timeout", 30),
|
|
89
|
+
"retry_attempts": kwargs.get("retry_attempts", 3),
|
|
90
|
+
"retry_delay": kwargs.get("retry_delay", 1),
|
|
91
|
+
"security": {
|
|
92
|
+
"auth_method": "none",
|
|
93
|
+
"certificate": {
|
|
94
|
+
"cert_file": cert_file,
|
|
95
|
+
"key_file": key_file,
|
|
96
|
+
},
|
|
97
|
+
"ssl": {
|
|
98
|
+
"enabled": True,
|
|
99
|
+
"ca_cert_file": ca_cert_file,
|
|
100
|
+
"verify": kwargs.get("verify", True),
|
|
101
|
+
"check_hostname": kwargs.get("check_hostname", True),
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"""The demos module of the universal_client package: demo_all_connection_methods,
|
|
2
|
+
demo_specific_connection, demo_mtls_connection.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, List
|
|
6
|
+
|
|
7
|
+
from mcp_proxy_adapter.client.jsonrpc_client.exceptions import (
|
|
8
|
+
TransportConfigurationError,
|
|
9
|
+
)
|
|
10
|
+
from mcp_proxy_adapter.core.client import UniversalClient
|
|
11
|
+
|
|
12
|
+
from .configs import create_client_config, create_mtls_client_config
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
async def demo_all_connection_methods() -> None:
|
|
16
|
+
"""Demonstrate all supported connection methods."""
|
|
17
|
+
print("š Universal Client Demo - All Connection Methods")
|
|
18
|
+
print("=" * 60)
|
|
19
|
+
# Test configurations for different auth methods
|
|
20
|
+
test_configs: List[Dict[str, Any]] = [
|
|
21
|
+
{
|
|
22
|
+
"name": "No Authentication",
|
|
23
|
+
"config": create_client_config("http://localhost:8000", "none"),
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "API Key Authentication",
|
|
27
|
+
"config": create_client_config(
|
|
28
|
+
"http://localhost:8000", "api_key", api_key="demo_api_key_123"
|
|
29
|
+
),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "JWT Authentication",
|
|
33
|
+
"config": create_client_config(
|
|
34
|
+
"http://localhost:8000",
|
|
35
|
+
"jwt",
|
|
36
|
+
username="demo_user",
|
|
37
|
+
password="demo_password", # nosec B106 - test/demo fixture string passed as a credential-shaped keyword argument, not a real secret
|
|
38
|
+
secret="demo_jwt_secret",
|
|
39
|
+
),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "Basic Authentication",
|
|
43
|
+
"config": create_client_config(
|
|
44
|
+
"http://localhost:8000",
|
|
45
|
+
"basic",
|
|
46
|
+
username="demo_user",
|
|
47
|
+
password="demo_password", # nosec B106 - test/demo fixture string passed as a credential-shaped keyword argument, not a real secret
|
|
48
|
+
),
|
|
49
|
+
},
|
|
50
|
+
]
|
|
51
|
+
for test_config in test_configs:
|
|
52
|
+
print(f"\nš Testing: {test_config['name']}")
|
|
53
|
+
print("-" * 40)
|
|
54
|
+
try:
|
|
55
|
+
async with UniversalClient(test_config["config"]) as client:
|
|
56
|
+
success = await client.test_connection()
|
|
57
|
+
if success:
|
|
58
|
+
security_results = await client.test_security_features()
|
|
59
|
+
print("Security Features:")
|
|
60
|
+
for feature, status in security_results.items():
|
|
61
|
+
status_icon = "ā
" if status else "ā"
|
|
62
|
+
print(f" {status_icon} {feature}: {status}")
|
|
63
|
+
try:
|
|
64
|
+
result = await client.get("/api/status")
|
|
65
|
+
print(f"API Status: {result}")
|
|
66
|
+
except Exception as e:
|
|
67
|
+
print(f"API call failed: {e}")
|
|
68
|
+
else:
|
|
69
|
+
print("ā Connection failed")
|
|
70
|
+
except Exception as e:
|
|
71
|
+
print(f"ā Test failed: {e}")
|
|
72
|
+
print("\nš Testing: Mutual TLS (mTLS)")
|
|
73
|
+
print("-" * 40)
|
|
74
|
+
await demo_mtls_connection(
|
|
75
|
+
"https://localhost:8443",
|
|
76
|
+
"./certs/client.crt",
|
|
77
|
+
"./keys/client.key",
|
|
78
|
+
"./certs/ca.crt",
|
|
79
|
+
)
|
|
80
|
+
print("\nš Demo completed!")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
async def demo_specific_connection(auth_method: str, **kwargs: Any) -> None:
|
|
84
|
+
"""
|
|
85
|
+
Demo a specific connection method.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
auth_method: Authentication method to test (none, api_key, jwt,
|
|
89
|
+
basic). Use ``demo_mtls_connection`` for mutual TLS.
|
|
90
|
+
**kwargs: Configuration parameters
|
|
91
|
+
"""
|
|
92
|
+
print(f"š Testing {auth_method} connection")
|
|
93
|
+
print("=" * 40)
|
|
94
|
+
config = create_client_config("http://localhost:8000", auth_method, **kwargs)
|
|
95
|
+
async with UniversalClient(config) as client:
|
|
96
|
+
success = await client.test_connection()
|
|
97
|
+
if success:
|
|
98
|
+
print("ā
Connection successful!")
|
|
99
|
+
try:
|
|
100
|
+
status = await client.get("/api/status")
|
|
101
|
+
print(f"Server Status: {status}")
|
|
102
|
+
command_data = {
|
|
103
|
+
"jsonrpc": "2.0",
|
|
104
|
+
"method": "test_command",
|
|
105
|
+
"params": {"message": "Hello from universal client!"},
|
|
106
|
+
"id": 1,
|
|
107
|
+
}
|
|
108
|
+
result = await client.post("/api/jsonrpc", command_data)
|
|
109
|
+
print(f"Command Result: {result}")
|
|
110
|
+
except Exception as e:
|
|
111
|
+
print(f"API calls failed: {e}")
|
|
112
|
+
else:
|
|
113
|
+
print("ā Connection failed")
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
async def demo_mtls_connection(
|
|
117
|
+
server_url: str, cert_file: str, key_file: str, ca_cert_file: str
|
|
118
|
+
) -> None:
|
|
119
|
+
"""
|
|
120
|
+
Demo a mutual TLS connection.
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
server_url: Server URL (should be ``https://...``)
|
|
124
|
+
cert_file: Path to the client certificate
|
|
125
|
+
key_file: Path to the client private key
|
|
126
|
+
ca_cert_file: Path to the CA bundle used to verify the server
|
|
127
|
+
"""
|
|
128
|
+
print(f"š Testing mTLS connection to {server_url}")
|
|
129
|
+
print("=" * 40)
|
|
130
|
+
config = create_mtls_client_config(server_url, cert_file, key_file, ca_cert_file)
|
|
131
|
+
try:
|
|
132
|
+
async with UniversalClient(config) as client:
|
|
133
|
+
success = await client.test_connection()
|
|
134
|
+
if success:
|
|
135
|
+
print("ā
Connection successful!")
|
|
136
|
+
try:
|
|
137
|
+
status = await client.get("/api/status")
|
|
138
|
+
print(f"Server Status: {status}")
|
|
139
|
+
except Exception as e:
|
|
140
|
+
print(f"API calls failed: {e}")
|
|
141
|
+
else:
|
|
142
|
+
print("ā Connection failed")
|
|
143
|
+
except TransportConfigurationError as e:
|
|
144
|
+
print(f"ā mTLS setup failed: {e}")
|