mcp-proxy-adapter 4.0.0__tar.gz → 4.1.1__tar.gz
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-4.0.0/mcp_proxy_adapter.egg-info → mcp_proxy_adapter-4.1.1}/PKG-INFO +3 -3
- mcp_proxy_adapter-4.1.1/docs/EN/development/command_auto_discovery.md +277 -0
- mcp_proxy_adapter-4.1.1/docs/EN/user/configuration.md +128 -0
- mcp_proxy_adapter-4.1.1/docs/RU/development/command_auto_discovery.md +277 -0
- mcp_proxy_adapter-4.1.1/docs/RU/user/configuration.md +128 -0
- mcp_proxy_adapter-4.1.1/examples/custom_project_example/README.md +103 -0
- mcp_proxy_adapter-4.1.1/examples/custom_project_example/README_EN.md +103 -0
- mcp_proxy_adapter-4.1.1/examples/simple_custom_commands/README.md +149 -0
- mcp_proxy_adapter-4.1.1/examples/simple_custom_commands/README_EN.md +149 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/command_registry.py +26 -6
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/config.py +1 -1
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/basic_server/server.py +5 -0
- mcp_proxy_adapter-4.1.1/mcp_proxy_adapter/examples/custom_commands/config.json +35 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/server.py +5 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/version.py +1 -1
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1/mcp_proxy_adapter.egg-info}/PKG-INFO +3 -3
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter.egg-info/SOURCES.txt +7 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/pyproject.toml +1 -1
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/setup.py +4 -4
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_app.py +308 -4
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_handlers_extended.py +63 -1
- mcp_proxy_adapter-4.1.1/tests/commands/test_command_discovery_config.py +137 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_hooks.py +98 -1
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_custom_commands_server.py +11 -5
- mcp_proxy_adapter-4.0.0/docs/EN/user/configuration.md +0 -67
- mcp_proxy_adapter-4.0.0/docs/RU/user/configuration.md +0 -67
- mcp_proxy_adapter-4.0.0/mcp_proxy_adapter/examples/custom_commands/config.json +0 -62
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/LICENSE +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/MANIFEST.in +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/README.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/API_SCHEMA.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/AUTOMATED_PUBLISHING.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/BASIC_ARCHITECTURE.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/COMMAND_CHECKLIST.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/COMMAND_RESULTS.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/COMMAND_TEMPLATE.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/CONFIGURATION_PRINCIPLES.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/DOCUMENTATION_MAP.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/DOCUMENTATION_STANDARDS.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/ERROR_HANDLING.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/EXAMPLES_COMMAND_CLASSES.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/GLOSSARY.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/LOGGING_SYSTEM.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/NAMING_STANDARDS.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/OPENAPI_SCHEMA.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/PROJECT_EXTENSION_GUIDE.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/PROJECT_IDEOLOGY.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/PROJECT_RULES.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/PROJECT_STRUCTURE.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/PUBLISHING_TO_PYPI.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/README.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/api/cmd_endpoint.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/api/errors.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/api/intro.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/api/requests.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/api/responses.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/commands/get_date_command.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/commands/help_command.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/commands/index.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/commands/new_uuid4_command.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/commands/reload_settings_command.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/commands/settings_command.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/development/COMMAND_METADATA_ENHANCEMENT.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/development/DEPENDENCY_INJECTION.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/development/HOOK_SYSTEM.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/development/METADATA_COMMANDS.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/development/OPENAPI_CUSTOMIZATION.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/development/REMOVE_COMMAND_GUIDE.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/development/TOOL_INTEGRATION.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/development/architecture.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/development/settings_management.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/examples/README.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/examples/anti_patterns.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/examples/basic_example.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/examples/complete_example.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/examples/minimal_example.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/testing/README.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/user/basic_usage.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/user/deployment.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/user/examples.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/EN/user/installation.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/API_SCHEMA.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/AUTOMATED_PUBLISHING.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/BASIC_ARCHITECTURE.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/COMMAND_CHECKLIST.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/COMMAND_RESULTS.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/COMMAND_TEMPLATE.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/CONFIGURATION_PRINCIPLES.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/DOCUMENTATION_MAP.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/DOCUMENTATION_STANDARDS.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/ERROR_HANDLING.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/EXAMPLES_COMMAND_CLASSES.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/GLOSSARY.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/LOGGING_SYSTEM.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/NAMING_STANDARDS.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/OPENAPI_SCHEMA.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/PROJECT_EXTENSION_GUIDE.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/PROJECT_IDEOLOGY.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/PROJECT_RULES.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/PROJECT_STRUCTURE.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/PUBLISHING_TO_PYPI.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/README.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/api/cmd_endpoint.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/api/errors.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/api/intro.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/api/requests.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/api/responses.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/commands/get_date_command.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/commands/help_command.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/commands/index.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/commands/new_uuid4_command.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/commands/reload_settings_command.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/commands/settings_command.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/development/COMMAND_METADATA_ENHANCEMENT.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/development/DEPENDENCY_INJECTION.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/development/HOOK_SYSTEM.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/development/METADATA_COMMANDS.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/development/OPENAPI_CUSTOMIZATION.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/development/PLAN_REALIZACII_METADATA.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/development/REMOVE_COMMAND_GUIDE.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/development/TOOL_INTEGRATION.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/development/architecture.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/development/settings_management.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/examples/README.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/examples/anti_patterns.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/examples/basic_example.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/examples/complete_example.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/examples/minimal_example.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/testing/README.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/user/basic_usage.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/user/deployment.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/user/examples.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/docs/RU/user/installation.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/app.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/handlers.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/middleware/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/middleware/auth.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/middleware/base.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/middleware/error_handling.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/middleware/logging.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/middleware/performance.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/middleware/rate_limit.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/schemas.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/tool_integration.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/api/tools.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/base.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/config_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/dependency_container.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/health_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/help_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/hooks.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/reload_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/reload_settings_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/result.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/commands/settings_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/core/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/core/errors.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/core/logging.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/core/settings.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/core/utils.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/custom_openapi.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/README.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/basic_server/README.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/basic_server/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/basic_server/basic_custom_settings.json +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/basic_server/config.json +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/basic_server/custom_settings_example.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/README.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/advanced_hooks.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/auto_commands/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/auto_commands/auto_echo_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/auto_commands/auto_info_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/custom_health_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/custom_help_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/custom_openapi_generator.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/custom_settings.json +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/custom_settings_manager.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/data_transform_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/echo_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/hooks.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/intercept_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/manual_echo_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/custom_commands/test_hooks.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/deployment/README.md +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/deployment/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/deployment/config.development.json +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/deployment/config.json +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/deployment/config.production.json +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/deployment/config.staging.json +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/deployment/docker-compose.yml +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/deployment/run.sh +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/examples/deployment/run_docker.sh +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/openapi.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/schemas/base_schema.json +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/schemas/openapi_schema.json +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/api/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/api/test_cmd_endpoint.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/api/test_custom_openapi.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/api/test_handlers.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/api/test_middleware.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/api/test_schemas.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/api/test_tool_integration.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/commands/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/commands/test_config_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/commands/test_echo_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/commands/test_help_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/conftest.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/functional/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/functional/test_api.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/integration/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/integration/test_cmd_integration.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/integration/test_integration.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/performance/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/performance/test_performance.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/stubs/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/stubs/echo_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/test_api_endpoints.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/test_api_handlers.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/test_base_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/test_batch_requests.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/test_command_registry.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/test_config.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/test_utils.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/unit/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/unit/test_base_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter/tests/unit/test_config.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter.egg-info/dependency_links.txt +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter.egg-info/requires.txt +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/mcp_proxy_adapter.egg-info/top_level.txt +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/requirements.txt +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/setup.cfg +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_app_extended.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_auth.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_error_handling.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_handler_dependency_injection.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_middleware_base.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_middleware_logging.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_middleware_performance.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_openapi.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_rate_limit.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_schemas_extended.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_schemas_final.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_tool_description.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_tool_integration.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/api/test_tools.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_base_command_extended.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_base_command_final.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_command_di.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_command_metadata.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_command_registry_extended.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_config_command_extended.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_dependency_container.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_echo_command_di.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_health_command_extended.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_help_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_priority_commands.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_reload_commands_extended.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_result.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/commands/test_settings_command_extended.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/conftest.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/core/test_config.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/core/test_errors.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/core/test_logging.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/core/test_settings_extended.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/core/test_utils.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_advanced_hooks.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_auto_echo_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_auto_info_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_basic_server.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_custom_commands.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_custom_commands_hooks.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_custom_health_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_custom_help_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_custom_openapi_generator.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_custom_settings_manager.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_data_transform_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_echo_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_intercept_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/examples/test_manual_echo_command.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/integration/__init__.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/integration/test_di_integration.py +0 -0
- {mcp_proxy_adapter-4.0.0 → mcp_proxy_adapter-4.1.1}/tests/test_custom_openapi_extended.py +0 -0
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-proxy-adapter
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.1.1
|
4
4
|
Summary: Reliable microservice with unified JSON-RPC endpoint
|
5
|
-
Home-page: https://github.com/
|
6
|
-
Author:
|
5
|
+
Home-page: https://github.com/maverikod/mcp-proxy-adapter
|
6
|
+
Author: Vasiliy Zdanovskiy
|
7
7
|
Author-email: Vasiliy Zubarev <vasiliy.zubarev@example.com>
|
8
8
|
License: MIT License
|
9
9
|
|
@@ -0,0 +1,277 @@
|
|
1
|
+
# Command Auto-Discovery and Configuration Reload
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
|
5
|
+
The MCP Proxy Adapter system supports automatic command discovery and the ability to reload configuration without restarting the server. During reload, custom commands are preserved while built-in commands are reloaded fresh.
|
6
|
+
|
7
|
+
## Command Auto-Discovery Process
|
8
|
+
|
9
|
+
### How It Works
|
10
|
+
|
11
|
+
Command auto-discovery works according to the following principles:
|
12
|
+
|
13
|
+
1. **Package Scanning**: The system scans specified packages for modules with names ending in `_command`
|
14
|
+
2. **Class Analysis**: In each module, it looks for classes that inherit from `Command`
|
15
|
+
3. **Automatic Registration**: Found commands are automatically registered in the registry
|
16
|
+
|
17
|
+
### Auto-Discovery Configuration
|
18
|
+
|
19
|
+
```json
|
20
|
+
{
|
21
|
+
"commands": {
|
22
|
+
"auto_discovery": true,
|
23
|
+
"discovery_path": "mcp_proxy_adapter.commands",
|
24
|
+
"custom_commands_path": "./custom_commands"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
```
|
28
|
+
|
29
|
+
### `discover_commands()` Method
|
30
|
+
|
31
|
+
```python
|
32
|
+
def discover_commands(self, package_path: str = "mcp_proxy_adapter.commands") -> int:
|
33
|
+
"""
|
34
|
+
Automatically discovers and registers commands in the specified package.
|
35
|
+
|
36
|
+
Args:
|
37
|
+
package_path: Path to package with commands
|
38
|
+
|
39
|
+
Returns:
|
40
|
+
Number of discovered and registered commands
|
41
|
+
"""
|
42
|
+
```
|
43
|
+
|
44
|
+
## Command Types
|
45
|
+
|
46
|
+
### 1. Built-in Commands
|
47
|
+
|
48
|
+
Commands provided with the framework:
|
49
|
+
- `help` - command help
|
50
|
+
- `health` - server health check
|
51
|
+
- `config` - configuration management
|
52
|
+
- `reload` - configuration reload
|
53
|
+
- `settings` - settings management
|
54
|
+
- `reload_settings` - settings reload
|
55
|
+
|
56
|
+
### 2. Auto-Discovered Commands
|
57
|
+
|
58
|
+
Commands found automatically in packages:
|
59
|
+
- Must be located in modules with names `*_command.py`
|
60
|
+
- Must inherit from the base `Command` class
|
61
|
+
- Are registered automatically at startup
|
62
|
+
|
63
|
+
### 3. Custom Commands
|
64
|
+
|
65
|
+
Commands registered manually:
|
66
|
+
- Registered via `register_custom_command()`
|
67
|
+
- Have priority over built-in commands
|
68
|
+
- Are preserved during configuration reload
|
69
|
+
|
70
|
+
## Command Priority Hierarchy
|
71
|
+
|
72
|
+
1. **Custom Commands** (highest priority)
|
73
|
+
2. **Auto-Discovered Commands**
|
74
|
+
3. **Built-in Commands** (lowest priority)
|
75
|
+
|
76
|
+
## Configuration Reload
|
77
|
+
|
78
|
+
### `reload_config_and_commands()` Method
|
79
|
+
|
80
|
+
```python
|
81
|
+
def reload_config_and_commands(self, package_path: str = "mcp_proxy_adapter.commands") -> Dict[str, Any]:
|
82
|
+
"""
|
83
|
+
Reloads configuration and re-discovers commands.
|
84
|
+
|
85
|
+
Args:
|
86
|
+
package_path: Path to package with commands
|
87
|
+
|
88
|
+
Returns:
|
89
|
+
Dictionary with reload information:
|
90
|
+
- config_reloaded: Configuration reload success
|
91
|
+
- commands_discovered: Number of discovered commands
|
92
|
+
- custom_commands_preserved: Number of preserved custom commands
|
93
|
+
- total_commands: Total number of commands after reload
|
94
|
+
- built_in_commands: Number of built-in commands
|
95
|
+
- custom_commands: Number of custom commands
|
96
|
+
"""
|
97
|
+
```
|
98
|
+
|
99
|
+
### Reload Process
|
100
|
+
|
101
|
+
1. **Preserve Custom Commands**: Create backup of custom commands
|
102
|
+
2. **Reload Configuration**: Load new configuration from file
|
103
|
+
3. **Reinitialize Logging**: Configure logging with new parameters
|
104
|
+
4. **Clear Registry**: Remove all commands except custom ones
|
105
|
+
5. **Restore Custom Commands**: Restore saved custom commands
|
106
|
+
6. **Re-discover Commands**: Re-discover and register commands
|
107
|
+
|
108
|
+
### Custom Command Preservation
|
109
|
+
|
110
|
+
Custom commands are preserved during reload thanks to:
|
111
|
+
|
112
|
+
```python
|
113
|
+
# Preserve custom commands
|
114
|
+
custom_commands_backup = self._custom_commands.copy()
|
115
|
+
|
116
|
+
# Clear all commands
|
117
|
+
self._commands.clear()
|
118
|
+
self._instances.clear()
|
119
|
+
|
120
|
+
# Restore custom commands
|
121
|
+
self._custom_commands = custom_commands_backup
|
122
|
+
```
|
123
|
+
|
124
|
+
## Usage Examples
|
125
|
+
|
126
|
+
### Registering Custom Commands
|
127
|
+
|
128
|
+
```python
|
129
|
+
from mcp_proxy_adapter.commands.command_registry import registry
|
130
|
+
from mcp_proxy_adapter.commands.base import Command
|
131
|
+
|
132
|
+
class MyCustomCommand(Command):
|
133
|
+
name = "my_custom"
|
134
|
+
|
135
|
+
async def execute(self, **kwargs):
|
136
|
+
return SuccessResult(message="Custom command executed")
|
137
|
+
|
138
|
+
# Register with priority
|
139
|
+
registry.register_custom_command(MyCustomCommand)
|
140
|
+
```
|
141
|
+
|
142
|
+
### Configuration Reload
|
143
|
+
|
144
|
+
```python
|
145
|
+
# Reload via command
|
146
|
+
result = await reload_command.execute()
|
147
|
+
|
148
|
+
# Direct reload
|
149
|
+
reload_info = registry.reload_config_and_commands()
|
150
|
+
print(f"Discovered commands: {reload_info['commands_discovered']}")
|
151
|
+
print(f"Preserved custom: {reload_info['custom_commands_preserved']}")
|
152
|
+
```
|
153
|
+
|
154
|
+
### Checking Command Types
|
155
|
+
|
156
|
+
```python
|
157
|
+
# Check custom command existence
|
158
|
+
if registry.custom_command_exists("my_custom"):
|
159
|
+
print("Custom command exists")
|
160
|
+
|
161
|
+
# Get command with priority
|
162
|
+
command = registry.get_command_with_priority("my_custom")
|
163
|
+
|
164
|
+
# Get all commands with info
|
165
|
+
all_commands = registry.get_all_commands_info()
|
166
|
+
```
|
167
|
+
|
168
|
+
## Work Demonstration
|
169
|
+
|
170
|
+
Create file `demo_reload.py`:
|
171
|
+
|
172
|
+
```python
|
173
|
+
#!/usr/bin/env python3
|
174
|
+
"""
|
175
|
+
Demonstration of command auto-discovery and configuration reload.
|
176
|
+
"""
|
177
|
+
|
178
|
+
from mcp_proxy_adapter.commands.command_registry import registry
|
179
|
+
from mcp_proxy_adapter.commands.base import Command
|
180
|
+
from mcp_proxy_adapter.commands.result import SuccessResult
|
181
|
+
|
182
|
+
class DemoCommand(Command):
|
183
|
+
name = "demo"
|
184
|
+
result_class = SuccessResult
|
185
|
+
|
186
|
+
async def execute(self, message: str = "Hello!", **kwargs):
|
187
|
+
return SuccessResult(message=f"Demo: {message}")
|
188
|
+
|
189
|
+
def main():
|
190
|
+
# Register custom command
|
191
|
+
registry.register_custom_command(DemoCommand)
|
192
|
+
print(f"Before reload: {len(registry.get_all_commands())} commands")
|
193
|
+
|
194
|
+
# Reload configuration
|
195
|
+
result = registry.reload_config_and_commands()
|
196
|
+
print(f"After reload: {result['total_commands']} commands")
|
197
|
+
print(f"Preserved custom: {result['custom_commands_preserved']}")
|
198
|
+
|
199
|
+
# Check preservation
|
200
|
+
if registry.custom_command_exists("demo"):
|
201
|
+
print("✅ Custom command preserved!")
|
202
|
+
else:
|
203
|
+
print("❌ Custom command lost!")
|
204
|
+
|
205
|
+
if __name__ == "__main__":
|
206
|
+
main()
|
207
|
+
```
|
208
|
+
|
209
|
+
## System Advantages
|
210
|
+
|
211
|
+
1. **Flexibility**: Ability to add commands without code changes
|
212
|
+
2. **Reliability**: Preservation of custom commands during reload
|
213
|
+
3. **Performance**: Automatic discovery without manual registration
|
214
|
+
4. **Prioritization**: Custom commands have priority over built-in ones
|
215
|
+
5. **Monitoring**: Detailed information about reload process
|
216
|
+
|
217
|
+
## Behavior When Deleting Commands
|
218
|
+
|
219
|
+
### What Happens When a Command File is Deleted
|
220
|
+
|
221
|
+
1. **Before Reload**: Command remains available as it's already loaded in memory
|
222
|
+
2. **After Reload**: Command disappears from registry as the file no longer exists
|
223
|
+
|
224
|
+
### Process for Handling Deleted Commands
|
225
|
+
|
226
|
+
```python
|
227
|
+
# During configuration reload:
|
228
|
+
def reload_config_and_commands(self, package_path: str = "mcp_proxy_adapter.commands") -> Dict[str, Any]:
|
229
|
+
# 1. Preserve custom commands
|
230
|
+
custom_commands_backup = self._custom_commands.copy()
|
231
|
+
|
232
|
+
# 2. Clear all commands (except custom ones)
|
233
|
+
self._commands.clear()
|
234
|
+
self._instances.clear()
|
235
|
+
|
236
|
+
# 3. Re-discover commands (deleted files are ignored)
|
237
|
+
commands_discovered = self.discover_commands(package_path)
|
238
|
+
|
239
|
+
# 4. Restore custom commands
|
240
|
+
self._custom_commands = custom_commands_backup
|
241
|
+
```
|
242
|
+
|
243
|
+
### Import Error Handling
|
244
|
+
|
245
|
+
The system correctly handles situations where command files are deleted:
|
246
|
+
|
247
|
+
```python
|
248
|
+
try:
|
249
|
+
module = importlib.import_module(module_path)
|
250
|
+
# Process command...
|
251
|
+
except Exception as e:
|
252
|
+
logger.error(f"Error loading command module {module_path}: {e}")
|
253
|
+
# Module is skipped, error is logged
|
254
|
+
```
|
255
|
+
|
256
|
+
### Advantages of This Behavior
|
257
|
+
|
258
|
+
1. **Safety**: Deleted commands don't remain in the system
|
259
|
+
2. **Consistency**: Command registry always matches the file system
|
260
|
+
3. **Fault Tolerance**: Import errors don't interrupt system operation
|
261
|
+
4. **Flexibility**: Commands can be dynamically added and removed
|
262
|
+
|
263
|
+
## Limitations
|
264
|
+
|
265
|
+
1. **Naming Requirements**: Modules must end with `_command`
|
266
|
+
2. **Inheritance**: Commands must inherit from base `Command` class
|
267
|
+
3. **Server Restart**: Some configuration changes may require server restart
|
268
|
+
4. **Dependencies**: Custom commands with dependencies must be registered as instances
|
269
|
+
5. **Command Deletion**: Configuration reload is required to remove commands from registry
|
270
|
+
|
271
|
+
## Recommendations
|
272
|
+
|
273
|
+
1. **Use Custom Commands** to override built-in ones
|
274
|
+
2. **Group Commands** in separate packages for better organization
|
275
|
+
3. **Test Reload** before deploying to production
|
276
|
+
4. **Monitor Logs** to track auto-discovery process
|
277
|
+
5. **Document Custom Commands** to facilitate maintenance
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# Configuration
|
2
|
+
|
3
|
+
This guide describes how to configure the MCP Proxy service.
|
4
|
+
|
5
|
+
## Configuration File
|
6
|
+
|
7
|
+
The MCP Proxy service is configured using a JSON configuration file. By default, it looks for a file named `config.json` in the current directory.
|
8
|
+
|
9
|
+
You can specify a different configuration file using the `--config` command-line option:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
mcp-proxy --config /path/to/config.json
|
13
|
+
```
|
14
|
+
|
15
|
+
## Configuration Options
|
16
|
+
|
17
|
+
The configuration is organized into sections. Here are the available options:
|
18
|
+
|
19
|
+
### Server Configuration
|
20
|
+
|
21
|
+
| Option | Type | Default | Description |
|
22
|
+
|--------|------|---------|-------------|
|
23
|
+
| server.host | string | "0.0.0.0" | The host to bind the service to |
|
24
|
+
| server.port | number | 8000 | The port to listen on |
|
25
|
+
| server.debug | boolean | false | Enable debug mode |
|
26
|
+
| server.log_level | string | "INFO" | The logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
|
27
|
+
|
28
|
+
### Logging Configuration
|
29
|
+
|
30
|
+
| Option | Type | Default | Description |
|
31
|
+
|--------|------|---------|-------------|
|
32
|
+
| logging.level | string | "INFO" | The logging level |
|
33
|
+
| logging.log_dir | string | "./logs" | Directory for log files |
|
34
|
+
| logging.log_file | string | "mcp_proxy_adapter.log" | Main log file name |
|
35
|
+
| logging.error_log_file | string | "mcp_proxy_adapter_error.log" | Error log file name |
|
36
|
+
| logging.access_log_file | string | "mcp_proxy_adapter_access.log" | Access log file name |
|
37
|
+
| logging.max_file_size | string | "10MB" | Maximum log file size |
|
38
|
+
| logging.backup_count | number | 5 | Number of backup log files |
|
39
|
+
| logging.console_output | boolean | true | Enable console logging |
|
40
|
+
| logging.file_output | boolean | true | Enable file logging |
|
41
|
+
|
42
|
+
### Commands Configuration
|
43
|
+
|
44
|
+
| Option | Type | Default | Description |
|
45
|
+
|--------|------|---------|-------------|
|
46
|
+
| commands.auto_discovery | boolean | true | Enable automatic command discovery |
|
47
|
+
| commands.discovery_path | string | "mcp_proxy_adapter.commands" | **Path to package with commands** |
|
48
|
+
| commands.custom_commands_path | string | null | Path to custom commands (deprecated) |
|
49
|
+
|
50
|
+
**Important**: The `commands.discovery_path` parameter specifies the Python package path where your commands are located. For example:
|
51
|
+
- `"mcp_proxy_adapter.commands"` - built-in commands
|
52
|
+
- `"myproject.commands"` - your project's commands
|
53
|
+
- `"custom_commands.commands"` - custom commands package
|
54
|
+
|
55
|
+
## Example Configuration
|
56
|
+
|
57
|
+
Here's an example configuration file:
|
58
|
+
|
59
|
+
```json
|
60
|
+
{
|
61
|
+
"server": {
|
62
|
+
"host": "0.0.0.0",
|
63
|
+
"port": 8000,
|
64
|
+
"debug": false,
|
65
|
+
"log_level": "INFO"
|
66
|
+
},
|
67
|
+
"logging": {
|
68
|
+
"level": "INFO",
|
69
|
+
"log_dir": "./logs",
|
70
|
+
"log_file": "mcp_proxy_adapter.log",
|
71
|
+
"error_log_file": "mcp_proxy_adapter_error.log",
|
72
|
+
"access_log_file": "mcp_proxy_adapter_access.log",
|
73
|
+
"max_file_size": "10MB",
|
74
|
+
"backup_count": 5,
|
75
|
+
"console_output": true,
|
76
|
+
"file_output": true
|
77
|
+
},
|
78
|
+
"commands": {
|
79
|
+
"auto_discovery": true,
|
80
|
+
"discovery_path": "mcp_proxy_adapter.commands",
|
81
|
+
"custom_commands_path": null
|
82
|
+
}
|
83
|
+
}
|
84
|
+
```
|
85
|
+
|
86
|
+
### Example with Custom Commands
|
87
|
+
|
88
|
+
If you have your own commands in a package called `myproject.commands`:
|
89
|
+
|
90
|
+
```json
|
91
|
+
{
|
92
|
+
"server": {
|
93
|
+
"host": "127.0.0.1",
|
94
|
+
"port": 8001,
|
95
|
+
"debug": true,
|
96
|
+
"log_level": "DEBUG"
|
97
|
+
},
|
98
|
+
"logging": {
|
99
|
+
"level": "DEBUG",
|
100
|
+
"log_dir": "./logs",
|
101
|
+
"log_file": "myproject.log"
|
102
|
+
},
|
103
|
+
"commands": {
|
104
|
+
"auto_discovery": true,
|
105
|
+
"discovery_path": "myproject.commands"
|
106
|
+
}
|
107
|
+
}
|
108
|
+
```
|
109
|
+
|
110
|
+
## Environment Variables
|
111
|
+
|
112
|
+
You can also configure the service using environment variables. Environment variables take precedence over the configuration file.
|
113
|
+
|
114
|
+
The environment variable format is `MCP_UPPERCASE_OPTION_NAME`. For example, to set the port:
|
115
|
+
|
116
|
+
```bash
|
117
|
+
export MCP_PORT=8000
|
118
|
+
```
|
119
|
+
|
120
|
+
## Testing the Configuration
|
121
|
+
|
122
|
+
To verify your configuration, you can run the service with the `--validate-config` option:
|
123
|
+
|
124
|
+
```bash
|
125
|
+
mcp-proxy --config /path/to/config.json --validate-config
|
126
|
+
```
|
127
|
+
|
128
|
+
This will validate the configuration file and exit without starting the service.
|
@@ -0,0 +1,277 @@
|
|
1
|
+
# Автообнаружение команд и перезагрузка конфигурации
|
2
|
+
|
3
|
+
## Обзор
|
4
|
+
|
5
|
+
Система MCP Proxy Adapter поддерживает автоматическое обнаружение команд и возможность перезагрузки конфигурации без перезапуска сервера. При перезагрузке пользовательские команды сохраняются, а встроенные команды перезагружаются заново.
|
6
|
+
|
7
|
+
## Процесс автообнаружения команд
|
8
|
+
|
9
|
+
### Принцип работы
|
10
|
+
|
11
|
+
Автообнаружение команд работает по следующим принципам:
|
12
|
+
|
13
|
+
1. **Сканирование пакетов**: Система сканирует указанные пакеты на наличие модулей с именами, заканчивающимися на `_command`
|
14
|
+
2. **Анализ классов**: В каждом модуле ищутся классы, наследующие от `Command`
|
15
|
+
3. **Автоматическая регистрация**: Найденные команды автоматически регистрируются в реестре
|
16
|
+
|
17
|
+
### Конфигурация автообнаружения
|
18
|
+
|
19
|
+
```json
|
20
|
+
{
|
21
|
+
"commands": {
|
22
|
+
"auto_discovery": true,
|
23
|
+
"discovery_path": "mcp_proxy_adapter.commands",
|
24
|
+
"custom_commands_path": "./custom_commands"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
```
|
28
|
+
|
29
|
+
### Метод `discover_commands()`
|
30
|
+
|
31
|
+
```python
|
32
|
+
def discover_commands(self, package_path: str = "mcp_proxy_adapter.commands") -> int:
|
33
|
+
"""
|
34
|
+
Автоматически обнаруживает и регистрирует команды в указанном пакете.
|
35
|
+
|
36
|
+
Args:
|
37
|
+
package_path: Путь к пакету с командами
|
38
|
+
|
39
|
+
Returns:
|
40
|
+
Количество обнаруженных и зарегистрированных команд
|
41
|
+
"""
|
42
|
+
```
|
43
|
+
|
44
|
+
## Типы команд
|
45
|
+
|
46
|
+
### 1. Встроенные команды (Built-in Commands)
|
47
|
+
|
48
|
+
Команды, поставляемые с фреймворком:
|
49
|
+
- `help` - справка по командам
|
50
|
+
- `health` - проверка состояния сервера
|
51
|
+
- `config` - управление конфигурацией
|
52
|
+
- `reload` - перезагрузка конфигурации
|
53
|
+
- `settings` - управление настройками
|
54
|
+
- `reload_settings` - перезагрузка настроек
|
55
|
+
|
56
|
+
### 2. Автообнаруженные команды (Auto-discovered Commands)
|
57
|
+
|
58
|
+
Команды, найденные автоматически в пакетах:
|
59
|
+
- Должны находиться в модулях с именами `*_command.py`
|
60
|
+
- Должны наследовать от базового класса `Command`
|
61
|
+
- Регистрируются автоматически при запуске
|
62
|
+
|
63
|
+
### 3. Пользовательские команды (Custom Commands)
|
64
|
+
|
65
|
+
Команды, зарегистрированные вручную:
|
66
|
+
- Регистрируются через `register_custom_command()`
|
67
|
+
- Имеют приоритет над встроенными командами
|
68
|
+
- Сохраняются при перезагрузке конфигурации
|
69
|
+
|
70
|
+
## Иерархия приоритетов команд
|
71
|
+
|
72
|
+
1. **Пользовательские команды** (высший приоритет)
|
73
|
+
2. **Автообнаруженные команды**
|
74
|
+
3. **Встроенные команды** (низший приоритет)
|
75
|
+
|
76
|
+
## Перезагрузка конфигурации
|
77
|
+
|
78
|
+
### Метод `reload_config_and_commands()`
|
79
|
+
|
80
|
+
```python
|
81
|
+
def reload_config_and_commands(self, package_path: str = "mcp_proxy_adapter.commands") -> Dict[str, Any]:
|
82
|
+
"""
|
83
|
+
Перезагружает конфигурацию и переобнаруживает команды.
|
84
|
+
|
85
|
+
Args:
|
86
|
+
package_path: Путь к пакету с командами
|
87
|
+
|
88
|
+
Returns:
|
89
|
+
Словарь с информацией о перезагрузке:
|
90
|
+
- config_reloaded: Успешность перезагрузки конфигурации
|
91
|
+
- commands_discovered: Количество обнаруженных команд
|
92
|
+
- custom_commands_preserved: Количество сохраненных пользовательских команд
|
93
|
+
- total_commands: Общее количество команд после перезагрузки
|
94
|
+
- built_in_commands: Количество встроенных команд
|
95
|
+
- custom_commands: Количество пользовательских команд
|
96
|
+
"""
|
97
|
+
```
|
98
|
+
|
99
|
+
### Процесс перезагрузки
|
100
|
+
|
101
|
+
1. **Сохранение пользовательских команд**: Создается резервная копия пользовательских команд
|
102
|
+
2. **Перезагрузка конфигурации**: Загружается новая конфигурация из файла
|
103
|
+
3. **Переинициализация логирования**: Настраивается логирование с новыми параметрами
|
104
|
+
4. **Очистка реестра**: Удаляются все команды, кроме пользовательских
|
105
|
+
5. **Восстановление пользовательских команд**: Восстанавливаются сохраненные пользовательские команды
|
106
|
+
6. **Переобнаружение команд**: Заново обнаруживаются и регистрируются команды
|
107
|
+
|
108
|
+
### Сохранение пользовательских команд
|
109
|
+
|
110
|
+
Пользовательские команды сохраняются при перезагрузке благодаря:
|
111
|
+
|
112
|
+
```python
|
113
|
+
# Сохранение пользовательских команд
|
114
|
+
custom_commands_backup = self._custom_commands.copy()
|
115
|
+
|
116
|
+
# Очистка всех команд
|
117
|
+
self._commands.clear()
|
118
|
+
self._instances.clear()
|
119
|
+
|
120
|
+
# Восстановление пользовательских команд
|
121
|
+
self._custom_commands = custom_commands_backup
|
122
|
+
```
|
123
|
+
|
124
|
+
## Примеры использования
|
125
|
+
|
126
|
+
### Регистрация пользовательской команды
|
127
|
+
|
128
|
+
```python
|
129
|
+
from mcp_proxy_adapter.commands.command_registry import registry
|
130
|
+
from mcp_proxy_adapter.commands.base import Command
|
131
|
+
|
132
|
+
class MyCustomCommand(Command):
|
133
|
+
name = "my_custom"
|
134
|
+
|
135
|
+
async def execute(self, **kwargs):
|
136
|
+
return SuccessResult(message="Custom command executed")
|
137
|
+
|
138
|
+
# Регистрация с приоритетом
|
139
|
+
registry.register_custom_command(MyCustomCommand)
|
140
|
+
```
|
141
|
+
|
142
|
+
### Перезагрузка конфигурации
|
143
|
+
|
144
|
+
```python
|
145
|
+
# Перезагрузка через команду
|
146
|
+
result = await reload_command.execute()
|
147
|
+
|
148
|
+
# Прямая перезагрузка
|
149
|
+
reload_info = registry.reload_config_and_commands()
|
150
|
+
print(f"Обнаружено команд: {reload_info['commands_discovered']}")
|
151
|
+
print(f"Сохранено пользовательских: {reload_info['custom_commands_preserved']}")
|
152
|
+
```
|
153
|
+
|
154
|
+
### Проверка типов команд
|
155
|
+
|
156
|
+
```python
|
157
|
+
# Проверка существования пользовательской команды
|
158
|
+
if registry.custom_command_exists("my_custom"):
|
159
|
+
print("Пользовательская команда существует")
|
160
|
+
|
161
|
+
# Получение команды с учетом приоритета
|
162
|
+
command = registry.get_command_with_priority("my_custom")
|
163
|
+
|
164
|
+
# Получение всех команд с информацией
|
165
|
+
all_commands = registry.get_all_commands_info()
|
166
|
+
```
|
167
|
+
|
168
|
+
## Демонстрация работы
|
169
|
+
|
170
|
+
Создайте файл `demo_reload.py`:
|
171
|
+
|
172
|
+
```python
|
173
|
+
#!/usr/bin/env python3
|
174
|
+
"""
|
175
|
+
Демонстрация автообнаружения команд и перезагрузки конфигурации.
|
176
|
+
"""
|
177
|
+
|
178
|
+
from mcp_proxy_adapter.commands.command_registry import registry
|
179
|
+
from mcp_proxy_adapter.commands.base import Command
|
180
|
+
from mcp_proxy_adapter.commands.result import SuccessResult
|
181
|
+
|
182
|
+
class DemoCommand(Command):
|
183
|
+
name = "demo"
|
184
|
+
result_class = SuccessResult
|
185
|
+
|
186
|
+
async def execute(self, message: str = "Hello!", **kwargs):
|
187
|
+
return SuccessResult(message=f"Demo: {message}")
|
188
|
+
|
189
|
+
def main():
|
190
|
+
# Регистрация пользовательской команды
|
191
|
+
registry.register_custom_command(DemoCommand)
|
192
|
+
print(f"До перезагрузки: {len(registry.get_all_commands())} команд")
|
193
|
+
|
194
|
+
# Перезагрузка конфигурации
|
195
|
+
result = registry.reload_config_and_commands()
|
196
|
+
print(f"После перезагрузки: {result['total_commands']} команд")
|
197
|
+
print(f"Сохранено пользовательских: {result['custom_commands_preserved']}")
|
198
|
+
|
199
|
+
# Проверка сохранения
|
200
|
+
if registry.custom_command_exists("demo"):
|
201
|
+
print("✅ Пользовательская команда сохранена!")
|
202
|
+
else:
|
203
|
+
print("❌ Пользовательская команда потеряна!")
|
204
|
+
|
205
|
+
if __name__ == "__main__":
|
206
|
+
main()
|
207
|
+
```
|
208
|
+
|
209
|
+
## Преимущества системы
|
210
|
+
|
211
|
+
1. **Гибкость**: Возможность добавления команд без изменения кода
|
212
|
+
2. **Надежность**: Сохранение пользовательских команд при перезагрузке
|
213
|
+
3. **Производительность**: Автоматическое обнаружение без ручной регистрации
|
214
|
+
4. **Приоритизация**: Пользовательские команды имеют приоритет над встроенными
|
215
|
+
5. **Мониторинг**: Детальная информация о процессе перезагрузки
|
216
|
+
|
217
|
+
## Поведение при удалении команд
|
218
|
+
|
219
|
+
### Что происходит при удалении файла команды
|
220
|
+
|
221
|
+
1. **До перезагрузки**: Команда остается доступной, так как она уже загружена в память
|
222
|
+
2. **После перезагрузки**: Команда исчезает из реестра, так как файл больше не существует
|
223
|
+
|
224
|
+
### Процесс обработки удаленных команд
|
225
|
+
|
226
|
+
```python
|
227
|
+
# При перезагрузке конфигурации:
|
228
|
+
def reload_config_and_commands(self, package_path: str = "mcp_proxy_adapter.commands") -> Dict[str, Any]:
|
229
|
+
# 1. Сохранение пользовательских команд
|
230
|
+
custom_commands_backup = self._custom_commands.copy()
|
231
|
+
|
232
|
+
# 2. Очистка всех команд (кроме пользовательских)
|
233
|
+
self._commands.clear()
|
234
|
+
self._instances.clear()
|
235
|
+
|
236
|
+
# 3. Переобнаружение команд (удаленные файлы игнорируются)
|
237
|
+
commands_discovered = self.discover_commands(package_path)
|
238
|
+
|
239
|
+
# 4. Восстановление пользовательских команд
|
240
|
+
self._custom_commands = custom_commands_backup
|
241
|
+
```
|
242
|
+
|
243
|
+
### Обработка ошибок импорта
|
244
|
+
|
245
|
+
Система корректно обрабатывает ситуации, когда файлы команд удалены:
|
246
|
+
|
247
|
+
```python
|
248
|
+
try:
|
249
|
+
module = importlib.import_module(module_path)
|
250
|
+
# Обработка команды...
|
251
|
+
except Exception as e:
|
252
|
+
logger.error(f"Error loading command module {module_path}: {e}")
|
253
|
+
# Модуль пропускается, ошибка логируется
|
254
|
+
```
|
255
|
+
|
256
|
+
### Преимущества такого поведения
|
257
|
+
|
258
|
+
1. **Безопасность**: Удаленные команды не остаются в системе
|
259
|
+
2. **Консистентность**: Реестр команд всегда соответствует файловой системе
|
260
|
+
3. **Отказоустойчивость**: Ошибки импорта не прерывают работу системы
|
261
|
+
4. **Гибкость**: Можно динамически добавлять и удалять команды
|
262
|
+
|
263
|
+
## Ограничения
|
264
|
+
|
265
|
+
1. **Требования к именованию**: Модули должны заканчиваться на `_command`
|
266
|
+
2. **Наследование**: Команды должны наследовать от базового класса `Command`
|
267
|
+
3. **Перезапуск сервера**: Некоторые изменения конфигурации могут требовать перезапуска
|
268
|
+
4. **Зависимости**: Пользовательские команды с зависимостями должны регистрироваться как экземпляры
|
269
|
+
5. **Удаление команд**: Требуется перезагрузка конфигурации для удаления команд из реестра
|
270
|
+
|
271
|
+
## Рекомендации
|
272
|
+
|
273
|
+
1. **Используйте пользовательские команды** для переопределения встроенных
|
274
|
+
2. **Группируйте команды** в отдельные пакеты для лучшей организации
|
275
|
+
3. **Тестируйте перезагрузку** перед развертыванием в продакшене
|
276
|
+
4. **Мониторьте логи** для отслеживания процесса автообнаружения
|
277
|
+
5. **Документируйте пользовательские команды** для облегчения поддержки
|