mcp-proxy-adapter 6.0.0__py3-none-any.whl → 6.1.1__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/api/app.py +174 -80
- mcp_proxy_adapter/api/handlers.py +16 -5
- mcp_proxy_adapter/api/middleware/__init__.py +9 -4
- mcp_proxy_adapter/api/middleware/command_permission_middleware.py +148 -0
- mcp_proxy_adapter/api/middleware/factory.py +36 -12
- mcp_proxy_adapter/api/middleware/protocol_middleware.py +32 -13
- mcp_proxy_adapter/api/middleware/unified_security.py +160 -0
- mcp_proxy_adapter/api/middleware/user_info_middleware.py +83 -0
- mcp_proxy_adapter/commands/__init__.py +7 -1
- mcp_proxy_adapter/commands/base.py +7 -4
- mcp_proxy_adapter/commands/builtin_commands.py +8 -2
- mcp_proxy_adapter/commands/command_registry.py +8 -0
- mcp_proxy_adapter/commands/echo_command.py +81 -0
- mcp_proxy_adapter/commands/help_command.py +21 -14
- mcp_proxy_adapter/commands/proxy_registration_command.py +326 -185
- mcp_proxy_adapter/commands/role_test_command.py +141 -0
- mcp_proxy_adapter/commands/security_command.py +488 -0
- mcp_proxy_adapter/commands/ssl_setup_command.py +2 -2
- mcp_proxy_adapter/commands/token_management_command.py +1 -1
- mcp_proxy_adapter/config.py +81 -21
- mcp_proxy_adapter/core/app_factory.py +326 -0
- mcp_proxy_adapter/core/client_security.py +384 -0
- mcp_proxy_adapter/core/logging.py +8 -3
- mcp_proxy_adapter/core/mtls_asgi.py +156 -0
- mcp_proxy_adapter/core/mtls_asgi_app.py +187 -0
- mcp_proxy_adapter/core/protocol_manager.py +139 -8
- mcp_proxy_adapter/core/proxy_client.py +602 -0
- mcp_proxy_adapter/core/proxy_registration.py +299 -47
- mcp_proxy_adapter/core/security_adapter.py +12 -15
- mcp_proxy_adapter/core/security_integration.py +285 -0
- mcp_proxy_adapter/core/server_adapter.py +345 -0
- mcp_proxy_adapter/core/server_engine.py +364 -0
- mcp_proxy_adapter/core/unified_config_adapter.py +579 -0
- mcp_proxy_adapter/docs/EN/TROUBLESHOOTING.md +285 -0
- mcp_proxy_adapter/docs/RU/TROUBLESHOOTING.md +285 -0
- mcp_proxy_adapter/examples/README.md +230 -97
- mcp_proxy_adapter/examples/README_EN.md +258 -0
- mcp_proxy_adapter/examples/SECURITY_TESTING.md +455 -0
- mcp_proxy_adapter/examples/basic_framework/configs/http_auth.json +37 -0
- mcp_proxy_adapter/examples/basic_framework/configs/http_simple.json +23 -0
- mcp_proxy_adapter/examples/basic_framework/configs/https_auth.json +43 -0
- mcp_proxy_adapter/examples/basic_framework/configs/https_no_protocol_middleware.json +36 -0
- mcp_proxy_adapter/examples/basic_framework/configs/https_simple.json +29 -0
- mcp_proxy_adapter/examples/basic_framework/configs/mtls_no_protocol_middleware.json +34 -0
- mcp_proxy_adapter/examples/basic_framework/configs/mtls_no_roles.json +39 -0
- mcp_proxy_adapter/examples/basic_framework/configs/mtls_simple.json +35 -0
- mcp_proxy_adapter/examples/basic_framework/configs/mtls_with_roles.json +45 -0
- mcp_proxy_adapter/examples/basic_framework/main.py +63 -0
- mcp_proxy_adapter/examples/basic_framework/roles.json +21 -0
- mcp_proxy_adapter/examples/cert_config.json +9 -0
- mcp_proxy_adapter/examples/certs/admin.crt +32 -0
- mcp_proxy_adapter/examples/certs/admin.key +52 -0
- mcp_proxy_adapter/examples/certs/admin_cert.pem +21 -0
- mcp_proxy_adapter/examples/certs/admin_key.pem +28 -0
- mcp_proxy_adapter/examples/certs/ca_cert.pem +23 -0
- mcp_proxy_adapter/examples/certs/ca_cert.srl +1 -0
- mcp_proxy_adapter/examples/certs/ca_key.pem +28 -0
- mcp_proxy_adapter/examples/certs/cert_config.json +9 -0
- mcp_proxy_adapter/examples/certs/client.crt +32 -0
- mcp_proxy_adapter/examples/certs/client.key +52 -0
- mcp_proxy_adapter/examples/certs/client_admin.crt +32 -0
- mcp_proxy_adapter/examples/certs/client_admin.key +52 -0
- mcp_proxy_adapter/examples/certs/client_user.crt +32 -0
- mcp_proxy_adapter/examples/certs/client_user.key +52 -0
- mcp_proxy_adapter/examples/certs/guest_cert.pem +21 -0
- mcp_proxy_adapter/examples/certs/guest_key.pem +28 -0
- mcp_proxy_adapter/examples/certs/mcp_proxy_adapter_ca_ca.crt +23 -0
- mcp_proxy_adapter/examples/certs/proxy_cert.pem +21 -0
- mcp_proxy_adapter/examples/certs/proxy_key.pem +28 -0
- mcp_proxy_adapter/examples/certs/readonly.crt +32 -0
- mcp_proxy_adapter/examples/certs/readonly.key +52 -0
- mcp_proxy_adapter/examples/certs/readonly_cert.pem +21 -0
- mcp_proxy_adapter/examples/certs/readonly_key.pem +28 -0
- mcp_proxy_adapter/examples/certs/server.crt +32 -0
- mcp_proxy_adapter/examples/certs/server.key +52 -0
- mcp_proxy_adapter/examples/certs/server_cert.pem +32 -0
- mcp_proxy_adapter/examples/certs/server_key.pem +52 -0
- mcp_proxy_adapter/examples/certs/test_ca_ca.crt +20 -0
- mcp_proxy_adapter/examples/certs/user.crt +32 -0
- mcp_proxy_adapter/examples/certs/user.key +52 -0
- mcp_proxy_adapter/examples/certs/user_cert.pem +21 -0
- mcp_proxy_adapter/examples/certs/user_key.pem +28 -0
- mcp_proxy_adapter/examples/client_configs/api_key_client.json +13 -0
- mcp_proxy_adapter/examples/client_configs/basic_auth_client.json +13 -0
- mcp_proxy_adapter/examples/client_configs/certificate_client.json +22 -0
- mcp_proxy_adapter/examples/client_configs/jwt_client.json +15 -0
- mcp_proxy_adapter/examples/client_configs/no_auth_client.json +9 -0
- mcp_proxy_adapter/examples/commands/__init__.py +1 -0
- mcp_proxy_adapter/examples/create_certificates_simple.py +307 -0
- mcp_proxy_adapter/examples/debug_request_state.py +144 -0
- mcp_proxy_adapter/examples/debug_role_chain.py +205 -0
- mcp_proxy_adapter/examples/demo_client.py +341 -0
- mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py +99 -0
- mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py +106 -0
- mcp_proxy_adapter/examples/full_application/configs/http_auth.json +37 -0
- mcp_proxy_adapter/examples/full_application/configs/http_simple.json +23 -0
- mcp_proxy_adapter/examples/full_application/configs/https_auth.json +39 -0
- mcp_proxy_adapter/examples/full_application/configs/https_simple.json +25 -0
- mcp_proxy_adapter/examples/full_application/configs/mtls_no_roles.json +39 -0
- mcp_proxy_adapter/examples/full_application/configs/mtls_with_roles.json +45 -0
- mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py +97 -0
- mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py +95 -0
- mcp_proxy_adapter/examples/full_application/main.py +138 -0
- mcp_proxy_adapter/examples/full_application/roles.json +21 -0
- mcp_proxy_adapter/examples/generate_all_certificates.py +429 -0
- mcp_proxy_adapter/examples/generate_certificates.py +121 -0
- mcp_proxy_adapter/examples/keys/ca_key.pem +28 -0
- mcp_proxy_adapter/examples/keys/mcp_proxy_adapter_ca_ca.key +28 -0
- mcp_proxy_adapter/examples/keys/test_ca_ca.key +28 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log +220 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.1 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.2 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.3 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.4 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.5 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log +220 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.1 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.2 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.3 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.4 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.5 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log +2 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.1 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.2 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.3 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.4 +1 -0
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.5 +1 -0
- mcp_proxy_adapter/examples/proxy_registration_example.py +401 -0
- mcp_proxy_adapter/examples/roles.json +38 -0
- mcp_proxy_adapter/examples/run_example.py +81 -0
- mcp_proxy_adapter/examples/run_security_tests.py +326 -0
- mcp_proxy_adapter/examples/run_security_tests_fixed.py +300 -0
- mcp_proxy_adapter/examples/security_test_client.py +743 -0
- mcp_proxy_adapter/examples/server_configs/config_basic_http.json +204 -0
- mcp_proxy_adapter/examples/server_configs/config_http_token.json +238 -0
- mcp_proxy_adapter/examples/server_configs/config_https.json +215 -0
- mcp_proxy_adapter/examples/server_configs/config_https_token.json +231 -0
- mcp_proxy_adapter/examples/server_configs/config_mtls.json +215 -0
- mcp_proxy_adapter/examples/server_configs/config_proxy_registration.json +250 -0
- mcp_proxy_adapter/examples/server_configs/config_simple.json +46 -0
- mcp_proxy_adapter/examples/server_configs/roles.json +38 -0
- mcp_proxy_adapter/examples/test_config_generator.py +110 -0
- mcp_proxy_adapter/examples/test_examples.py +344 -0
- mcp_proxy_adapter/examples/universal_client.py +628 -0
- mcp_proxy_adapter/main.py +21 -10
- mcp_proxy_adapter/utils/config_generator.py +727 -0
- mcp_proxy_adapter/version.py +5 -2
- mcp_proxy_adapter-6.1.1.dist-info/METADATA +205 -0
- mcp_proxy_adapter-6.1.1.dist-info/RECORD +197 -0
- mcp_proxy_adapter-6.1.1.dist-info/entry_points.txt +2 -0
- {mcp_proxy_adapter-6.0.0.dist-info → mcp_proxy_adapter-6.1.1.dist-info}/licenses/LICENSE +2 -2
- mcp_proxy_adapter/api/middleware/auth.py +0 -146
- mcp_proxy_adapter/api/middleware/auth_adapter.py +0 -235
- mcp_proxy_adapter/api/middleware/mtls_adapter.py +0 -305
- mcp_proxy_adapter/api/middleware/mtls_middleware.py +0 -296
- mcp_proxy_adapter/api/middleware/rate_limit.py +0 -152
- mcp_proxy_adapter/api/middleware/rate_limit_adapter.py +0 -241
- mcp_proxy_adapter/api/middleware/roles_adapter.py +0 -365
- mcp_proxy_adapter/api/middleware/roles_middleware.py +0 -381
- mcp_proxy_adapter/api/middleware/security.py +0 -376
- mcp_proxy_adapter/api/middleware/token_auth_middleware.py +0 -261
- mcp_proxy_adapter/examples/__init__.py +0 -7
- mcp_proxy_adapter/examples/basic_server/README.md +0 -60
- mcp_proxy_adapter/examples/basic_server/__init__.py +0 -7
- mcp_proxy_adapter/examples/basic_server/basic_custom_settings.json +0 -39
- mcp_proxy_adapter/examples/basic_server/config.json +0 -70
- mcp_proxy_adapter/examples/basic_server/config_all_protocols.json +0 -54
- mcp_proxy_adapter/examples/basic_server/config_http.json +0 -70
- mcp_proxy_adapter/examples/basic_server/config_http_only.json +0 -52
- mcp_proxy_adapter/examples/basic_server/config_https.json +0 -58
- mcp_proxy_adapter/examples/basic_server/config_mtls.json +0 -58
- mcp_proxy_adapter/examples/basic_server/config_ssl.json +0 -46
- mcp_proxy_adapter/examples/basic_server/custom_settings_example.py +0 -238
- mcp_proxy_adapter/examples/basic_server/server.py +0 -114
- mcp_proxy_adapter/examples/custom_commands/README.md +0 -127
- mcp_proxy_adapter/examples/custom_commands/__init__.py +0 -27
- mcp_proxy_adapter/examples/custom_commands/advanced_hooks.py +0 -566
- mcp_proxy_adapter/examples/custom_commands/auto_commands/__init__.py +0 -6
- mcp_proxy_adapter/examples/custom_commands/auto_commands/auto_echo_command.py +0 -103
- mcp_proxy_adapter/examples/custom_commands/auto_commands/auto_info_command.py +0 -111
- mcp_proxy_adapter/examples/custom_commands/auto_commands/test_command.py +0 -105
- mcp_proxy_adapter/examples/custom_commands/catalog/commands/test_command.py +0 -129
- mcp_proxy_adapter/examples/custom_commands/config.json +0 -118
- mcp_proxy_adapter/examples/custom_commands/config_all_protocols.json +0 -46
- mcp_proxy_adapter/examples/custom_commands/config_https_only.json +0 -46
- mcp_proxy_adapter/examples/custom_commands/config_https_transport.json +0 -33
- mcp_proxy_adapter/examples/custom_commands/config_mtls_only.json +0 -46
- mcp_proxy_adapter/examples/custom_commands/config_mtls_transport.json +0 -33
- mcp_proxy_adapter/examples/custom_commands/config_single_transport.json +0 -33
- mcp_proxy_adapter/examples/custom_commands/custom_health_command.py +0 -169
- mcp_proxy_adapter/examples/custom_commands/custom_help_command.py +0 -215
- mcp_proxy_adapter/examples/custom_commands/custom_openapi_generator.py +0 -76
- mcp_proxy_adapter/examples/custom_commands/custom_settings.json +0 -96
- mcp_proxy_adapter/examples/custom_commands/custom_settings_manager.py +0 -241
- mcp_proxy_adapter/examples/custom_commands/data_transform_command.py +0 -135
- mcp_proxy_adapter/examples/custom_commands/echo_command.py +0 -122
- mcp_proxy_adapter/examples/custom_commands/full_help_response.json +0 -1
- mcp_proxy_adapter/examples/custom_commands/generated_openapi.json +0 -629
- mcp_proxy_adapter/examples/custom_commands/get_openapi.py +0 -103
- mcp_proxy_adapter/examples/custom_commands/hooks.py +0 -230
- mcp_proxy_adapter/examples/custom_commands/intercept_command.py +0 -123
- mcp_proxy_adapter/examples/custom_commands/loadable_commands/test_ignored.py +0 -129
- mcp_proxy_adapter/examples/custom_commands/manual_echo_command.py +0 -103
- mcp_proxy_adapter/examples/custom_commands/proxy_connection_manager.py +0 -278
- mcp_proxy_adapter/examples/custom_commands/server.py +0 -252
- mcp_proxy_adapter/examples/custom_commands/simple_openapi_server.py +0 -75
- mcp_proxy_adapter/examples/custom_commands/start_server_with_proxy_manager.py +0 -299
- mcp_proxy_adapter/examples/custom_commands/start_server_with_registration.py +0 -278
- mcp_proxy_adapter/examples/custom_commands/test_hooks.py +0 -176
- mcp_proxy_adapter/examples/custom_commands/test_openapi.py +0 -27
- mcp_proxy_adapter/examples/custom_commands/test_registry.py +0 -23
- mcp_proxy_adapter/examples/custom_commands/test_simple.py +0 -19
- mcp_proxy_adapter/examples/custom_project_example/README.md +0 -103
- mcp_proxy_adapter/examples/custom_project_example/README_EN.md +0 -103
- mcp_proxy_adapter/examples/deployment/README.md +0 -49
- mcp_proxy_adapter/examples/deployment/__init__.py +0 -7
- mcp_proxy_adapter/examples/deployment/config.development.json +0 -8
- mcp_proxy_adapter/examples/deployment/config.json +0 -29
- mcp_proxy_adapter/examples/deployment/config.production.json +0 -12
- mcp_proxy_adapter/examples/deployment/config.staging.json +0 -11
- mcp_proxy_adapter/examples/deployment/docker-compose.yml +0 -31
- mcp_proxy_adapter/examples/deployment/run.sh +0 -43
- mcp_proxy_adapter/examples/deployment/run_docker.sh +0 -84
- mcp_proxy_adapter/examples/simple_custom_commands/README.md +0 -149
- mcp_proxy_adapter/examples/simple_custom_commands/README_EN.md +0 -149
- mcp_proxy_adapter/schemas/base_schema.json +0 -114
- mcp_proxy_adapter/schemas/openapi_schema.json +0 -314
- mcp_proxy_adapter/schemas/roles_schema.json +0 -162
- mcp_proxy_adapter/tests/__init__.py +0 -0
- mcp_proxy_adapter/tests/api/__init__.py +0 -3
- mcp_proxy_adapter/tests/api/test_cmd_endpoint.py +0 -115
- mcp_proxy_adapter/tests/api/test_custom_openapi.py +0 -617
- mcp_proxy_adapter/tests/api/test_handlers.py +0 -522
- mcp_proxy_adapter/tests/api/test_middleware.py +0 -340
- mcp_proxy_adapter/tests/api/test_schemas.py +0 -546
- mcp_proxy_adapter/tests/api/test_tool_integration.py +0 -531
- mcp_proxy_adapter/tests/commands/__init__.py +0 -3
- mcp_proxy_adapter/tests/commands/test_config_command.py +0 -211
- mcp_proxy_adapter/tests/commands/test_echo_command.py +0 -127
- mcp_proxy_adapter/tests/commands/test_help_command.py +0 -136
- mcp_proxy_adapter/tests/conftest.py +0 -131
- mcp_proxy_adapter/tests/functional/__init__.py +0 -3
- mcp_proxy_adapter/tests/functional/test_api.py +0 -253
- mcp_proxy_adapter/tests/integration/__init__.py +0 -3
- mcp_proxy_adapter/tests/integration/test_cmd_integration.py +0 -129
- mcp_proxy_adapter/tests/integration/test_integration.py +0 -255
- mcp_proxy_adapter/tests/performance/__init__.py +0 -3
- mcp_proxy_adapter/tests/performance/test_performance.py +0 -189
- mcp_proxy_adapter/tests/stubs/__init__.py +0 -10
- mcp_proxy_adapter/tests/stubs/echo_command.py +0 -104
- mcp_proxy_adapter/tests/test_api_endpoints.py +0 -271
- mcp_proxy_adapter/tests/test_api_handlers.py +0 -289
- mcp_proxy_adapter/tests/test_base_command.py +0 -123
- mcp_proxy_adapter/tests/test_batch_requests.py +0 -117
- mcp_proxy_adapter/tests/test_command_registry.py +0 -281
- mcp_proxy_adapter/tests/test_config.py +0 -127
- mcp_proxy_adapter/tests/test_utils.py +0 -65
- mcp_proxy_adapter/tests/unit/__init__.py +0 -3
- mcp_proxy_adapter/tests/unit/test_base_command.py +0 -436
- mcp_proxy_adapter/tests/unit/test_config.py +0 -270
- mcp_proxy_adapter-6.0.0.dist-info/METADATA +0 -201
- mcp_proxy_adapter-6.0.0.dist-info/RECORD +0 -179
- {mcp_proxy_adapter-6.0.0.dist-info → mcp_proxy_adapter-6.1.1.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-6.0.0.dist-info → mcp_proxy_adapter-6.1.1.dist-info}/top_level.txt +0 -0
@@ -1,241 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Custom Settings Manager Example
|
3
|
-
|
4
|
-
This module demonstrates how to create a custom settings manager
|
5
|
-
that extends the framework's settings system with application-specific settings.
|
6
|
-
"""
|
7
|
-
|
8
|
-
import json
|
9
|
-
import os
|
10
|
-
from typing import Dict, Any, Optional
|
11
|
-
from mcp_proxy_adapter.core.settings import (
|
12
|
-
add_custom_settings,
|
13
|
-
get_custom_settings,
|
14
|
-
get_custom_setting_value,
|
15
|
-
set_custom_setting_value
|
16
|
-
)
|
17
|
-
from mcp_proxy_adapter.core.logging import get_logger
|
18
|
-
|
19
|
-
|
20
|
-
class CustomSettingsManager:
|
21
|
-
"""
|
22
|
-
Custom settings manager for the extended server example.
|
23
|
-
|
24
|
-
This class demonstrates how to:
|
25
|
-
1. Load custom settings from JSON files
|
26
|
-
2. Add them to the framework's settings system
|
27
|
-
3. Provide convenient access methods
|
28
|
-
4. Handle settings validation and defaults
|
29
|
-
"""
|
30
|
-
|
31
|
-
def __init__(self, config_file: str = "custom_settings.json"):
|
32
|
-
"""
|
33
|
-
Initialize the custom settings manager.
|
34
|
-
|
35
|
-
Args:
|
36
|
-
config_file: Path to custom settings JSON file
|
37
|
-
"""
|
38
|
-
self.config_file = config_file
|
39
|
-
self.logger = get_logger("custom_settings_manager")
|
40
|
-
self._load_custom_settings()
|
41
|
-
|
42
|
-
def _load_custom_settings(self) -> None:
|
43
|
-
"""Load custom settings from JSON file."""
|
44
|
-
try:
|
45
|
-
if os.path.exists(self.config_file):
|
46
|
-
with open(self.config_file, 'r', encoding='utf-8') as f:
|
47
|
-
custom_settings = json.load(f)
|
48
|
-
|
49
|
-
self.logger.info(f"📁 Loaded custom settings from: {self.config_file}")
|
50
|
-
self.logger.debug(f"📋 Custom settings: {custom_settings}")
|
51
|
-
|
52
|
-
# Add to framework's settings system
|
53
|
-
add_custom_settings(custom_settings)
|
54
|
-
|
55
|
-
else:
|
56
|
-
self.logger.warning(f"⚠️ Custom settings file not found: {self.config_file}")
|
57
|
-
self.logger.info("📝 Using default custom settings")
|
58
|
-
|
59
|
-
# Use default settings
|
60
|
-
default_settings = self._get_default_settings()
|
61
|
-
add_custom_settings(default_settings)
|
62
|
-
|
63
|
-
except Exception as e:
|
64
|
-
self.logger.error(f"❌ Failed to load custom settings: {e}")
|
65
|
-
self.logger.info("📝 Using default custom settings")
|
66
|
-
|
67
|
-
# Use default settings on error
|
68
|
-
default_settings = self._get_default_settings()
|
69
|
-
add_custom_settings(default_settings)
|
70
|
-
|
71
|
-
def _get_default_settings(self) -> Dict[str, Any]:
|
72
|
-
"""Get default custom settings."""
|
73
|
-
return {
|
74
|
-
"application": {
|
75
|
-
"name": "Extended MCP Proxy Server",
|
76
|
-
"version": "2.0.0",
|
77
|
-
"environment": "development"
|
78
|
-
},
|
79
|
-
"features": {
|
80
|
-
"advanced_hooks": True,
|
81
|
-
"custom_commands": True,
|
82
|
-
"data_transformation": True,
|
83
|
-
"command_interception": True,
|
84
|
-
"performance_monitoring": False
|
85
|
-
},
|
86
|
-
"security": {
|
87
|
-
"enable_authentication": False,
|
88
|
-
"max_request_size": "10MB",
|
89
|
-
"rate_limiting": {
|
90
|
-
"enabled": False,
|
91
|
-
"requests_per_minute": 100
|
92
|
-
}
|
93
|
-
},
|
94
|
-
"monitoring": {
|
95
|
-
"enable_metrics": True,
|
96
|
-
"metrics_interval": 60,
|
97
|
-
"health_check_interval": 30
|
98
|
-
},
|
99
|
-
"custom_commands": {
|
100
|
-
"auto_echo": {
|
101
|
-
"enabled": True,
|
102
|
-
"max_length": 1000
|
103
|
-
},
|
104
|
-
"data_transform": {
|
105
|
-
"enabled": True,
|
106
|
-
"transform_types": ["uppercase", "lowercase", "reverse"]
|
107
|
-
},
|
108
|
-
"intercept": {
|
109
|
-
"enabled": True,
|
110
|
-
"bypass_conditions": ["input_value == 0"]
|
111
|
-
}
|
112
|
-
}
|
113
|
-
}
|
114
|
-
|
115
|
-
def get_application_name(self) -> str:
|
116
|
-
"""Get application name."""
|
117
|
-
return get_custom_setting_value("application.name", "Extended MCP Proxy Server")
|
118
|
-
|
119
|
-
def get_application_version(self) -> str:
|
120
|
-
"""Get application version."""
|
121
|
-
return get_custom_setting_value("application.version", "2.0.0")
|
122
|
-
|
123
|
-
def get_environment(self) -> str:
|
124
|
-
"""Get application environment."""
|
125
|
-
return get_custom_setting_value("application.environment", "development")
|
126
|
-
|
127
|
-
def is_feature_enabled(self, feature_name: str) -> bool:
|
128
|
-
"""Check if a feature is enabled."""
|
129
|
-
return get_custom_setting_value(f"features.{feature_name}", False)
|
130
|
-
|
131
|
-
def get_security_setting(self, setting_name: str, default: Any = None) -> Any:
|
132
|
-
"""Get security setting."""
|
133
|
-
return get_custom_setting_value(f"security.{setting_name}", default)
|
134
|
-
|
135
|
-
def get_monitoring_setting(self, setting_name: str, default: Any = None) -> Any:
|
136
|
-
"""Get monitoring setting."""
|
137
|
-
return get_custom_setting_value(f"monitoring.{setting_name}", default)
|
138
|
-
|
139
|
-
def get_custom_command_setting(self, command_name: str, setting_name: str, default: Any = None) -> Any:
|
140
|
-
"""Get custom command setting."""
|
141
|
-
return get_custom_setting_value(f"custom_commands.{command_name}.{setting_name}", default)
|
142
|
-
|
143
|
-
def set_custom_setting(self, key: str, value: Any) -> None:
|
144
|
-
"""Set a custom setting."""
|
145
|
-
set_custom_setting_value(key, value)
|
146
|
-
self.logger.info(f"🔧 Set custom setting: {key} = {value}")
|
147
|
-
|
148
|
-
def get_all_custom_settings(self) -> Dict[str, Any]:
|
149
|
-
"""Get all custom settings."""
|
150
|
-
return get_custom_settings()
|
151
|
-
|
152
|
-
def reload_settings(self) -> None:
|
153
|
-
"""Reload custom settings from file."""
|
154
|
-
self.logger.info("🔄 Reloading custom settings...")
|
155
|
-
self._load_custom_settings()
|
156
|
-
self.logger.info("✅ Custom settings reloaded")
|
157
|
-
|
158
|
-
def validate_settings(self) -> Dict[str, Any]:
|
159
|
-
"""
|
160
|
-
Validate current settings and return validation results.
|
161
|
-
|
162
|
-
Returns:
|
163
|
-
Dictionary with validation results
|
164
|
-
"""
|
165
|
-
validation_results = {
|
166
|
-
"valid": True,
|
167
|
-
"errors": [],
|
168
|
-
"warnings": []
|
169
|
-
}
|
170
|
-
|
171
|
-
# Validate required settings
|
172
|
-
required_settings = [
|
173
|
-
"application.name",
|
174
|
-
"application.version",
|
175
|
-
"features.advanced_hooks"
|
176
|
-
]
|
177
|
-
|
178
|
-
for setting in required_settings:
|
179
|
-
if get_custom_setting_value(setting) is None:
|
180
|
-
validation_results["valid"] = False
|
181
|
-
validation_results["errors"].append(f"Missing required setting: {setting}")
|
182
|
-
|
183
|
-
# Validate feature dependencies
|
184
|
-
if self.is_feature_enabled("data_transformation"):
|
185
|
-
if not self.is_feature_enabled("custom_commands"):
|
186
|
-
validation_results["warnings"].append(
|
187
|
-
"data_transformation requires custom_commands to be enabled"
|
188
|
-
)
|
189
|
-
|
190
|
-
# Validate security settings
|
191
|
-
if self.get_security_setting("enable_authentication"):
|
192
|
-
if not self.get_security_setting("rate_limiting.enabled"):
|
193
|
-
validation_results["warnings"].append(
|
194
|
-
"Authentication enabled but rate limiting is disabled"
|
195
|
-
)
|
196
|
-
|
197
|
-
return validation_results
|
198
|
-
|
199
|
-
def print_settings_summary(self) -> None:
|
200
|
-
"""Print a summary of current settings."""
|
201
|
-
self.logger.info("📊 Custom Settings Summary:")
|
202
|
-
self.logger.info(f" Application: {self.get_application_name()} v{self.get_application_version()}")
|
203
|
-
self.logger.info(f" Environment: {self.get_environment()}")
|
204
|
-
|
205
|
-
# Features
|
206
|
-
features = []
|
207
|
-
for feature in ["advanced_hooks", "custom_commands", "data_transformation", "command_interception"]:
|
208
|
-
if self.is_feature_enabled(feature):
|
209
|
-
features.append(feature)
|
210
|
-
|
211
|
-
self.logger.info(f" Enabled Features: {', '.join(features) if features else 'None'}")
|
212
|
-
|
213
|
-
# Security
|
214
|
-
auth_enabled = self.get_security_setting("enable_authentication", False)
|
215
|
-
rate_limiting = self.get_security_setting("rate_limiting.enabled", False)
|
216
|
-
self.logger.info(f" Security: Auth={auth_enabled}, Rate Limiting={rate_limiting}")
|
217
|
-
|
218
|
-
# Monitoring
|
219
|
-
metrics_enabled = self.get_monitoring_setting("enable_metrics", False)
|
220
|
-
self.logger.info(f" Monitoring: Metrics={metrics_enabled}")
|
221
|
-
|
222
|
-
|
223
|
-
# Convenience functions for easy access
|
224
|
-
def get_app_name() -> str:
|
225
|
-
"""Get application name."""
|
226
|
-
return get_custom_setting_value("application.name", "Extended MCP Proxy Server")
|
227
|
-
|
228
|
-
|
229
|
-
def is_feature_enabled(feature_name: str) -> bool:
|
230
|
-
"""Check if a feature is enabled."""
|
231
|
-
return get_custom_setting_value(f"features.{feature_name}", False)
|
232
|
-
|
233
|
-
|
234
|
-
def get_security_setting(setting_name: str, default: Any = None) -> Any:
|
235
|
-
"""Get security setting."""
|
236
|
-
return get_custom_setting_value(f"security.{setting_name}", default)
|
237
|
-
|
238
|
-
|
239
|
-
def get_monitoring_setting(setting_name: str, default: Any = None) -> Any:
|
240
|
-
"""Get monitoring setting."""
|
241
|
-
return get_custom_setting_value(f"monitoring.{setting_name}", default)
|
@@ -1,135 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Data Transform Command Example
|
3
|
-
|
4
|
-
A command that demonstrates advanced hooks with data transformation.
|
5
|
-
"""
|
6
|
-
|
7
|
-
from typing import Dict, Any, Optional
|
8
|
-
from mcp_proxy_adapter.commands.base import Command
|
9
|
-
from mcp_proxy_adapter.commands.result import CommandResult
|
10
|
-
|
11
|
-
|
12
|
-
class DataTransformResult(CommandResult):
|
13
|
-
"""
|
14
|
-
Result of the data transform command execution.
|
15
|
-
"""
|
16
|
-
|
17
|
-
def __init__(self, original_data: Dict[str, Any], transformed_data: Dict[str, Any],
|
18
|
-
processing_info: Dict[str, Any]):
|
19
|
-
"""
|
20
|
-
Initialize data transform command result.
|
21
|
-
|
22
|
-
Args:
|
23
|
-
original_data: Original input data
|
24
|
-
transformed_data: Transformed output data
|
25
|
-
processing_info: Information about processing steps
|
26
|
-
"""
|
27
|
-
self.original_data = original_data
|
28
|
-
self.transformed_data = transformed_data
|
29
|
-
self.processing_info = processing_info
|
30
|
-
|
31
|
-
def to_dict(self) -> Dict[str, Any]:
|
32
|
-
"""
|
33
|
-
Convert result to dictionary.
|
34
|
-
|
35
|
-
Returns:
|
36
|
-
Dict[str, Any]: Result as dictionary
|
37
|
-
"""
|
38
|
-
return {
|
39
|
-
"original_data": self.original_data,
|
40
|
-
"transformed_data": self.transformed_data,
|
41
|
-
"processing_info": self.processing_info,
|
42
|
-
"command_type": "data_transform"
|
43
|
-
}
|
44
|
-
|
45
|
-
@classmethod
|
46
|
-
def get_schema(cls) -> Dict[str, Any]:
|
47
|
-
"""
|
48
|
-
Get JSON schema for the result.
|
49
|
-
|
50
|
-
Returns:
|
51
|
-
Dict[str, Any]: JSON schema
|
52
|
-
"""
|
53
|
-
return {
|
54
|
-
"type": "object",
|
55
|
-
"properties": {
|
56
|
-
"original_data": {"type": "object"},
|
57
|
-
"transformed_data": {"type": "object"},
|
58
|
-
"processing_info": {"type": "object"},
|
59
|
-
"command_type": {"type": "string"}
|
60
|
-
}
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
|
-
class DataTransformCommand(Command):
|
65
|
-
"""
|
66
|
-
Data transform command for demonstrating advanced hooks.
|
67
|
-
"""
|
68
|
-
|
69
|
-
name = "data_transform"
|
70
|
-
result_class = DataTransformResult
|
71
|
-
|
72
|
-
async def execute(self, data: Optional[Dict[str, Any]] = None,
|
73
|
-
transform_type: Optional[str] = None, **kwargs) -> DataTransformResult:
|
74
|
-
"""
|
75
|
-
Execute data transform command.
|
76
|
-
|
77
|
-
Args:
|
78
|
-
data: Input data to transform
|
79
|
-
transform_type: Type of transformation to apply
|
80
|
-
**kwargs: Additional parameters
|
81
|
-
|
82
|
-
Returns:
|
83
|
-
DataTransformResult: Data transform command result
|
84
|
-
"""
|
85
|
-
# Get original data (may be modified by hooks)
|
86
|
-
original_data = data or {}
|
87
|
-
transform_type = transform_type or "default"
|
88
|
-
|
89
|
-
# Apply transformation based on type
|
90
|
-
if transform_type == "uppercase":
|
91
|
-
transformed_data = {k: str(v).upper() for k, v in original_data.items()}
|
92
|
-
elif transform_type == "lowercase":
|
93
|
-
transformed_data = {k: str(v).lower() for k, v in original_data.items()}
|
94
|
-
elif transform_type == "reverse":
|
95
|
-
transformed_data = {k: str(v)[::-1] for k, v in original_data.items()}
|
96
|
-
else:
|
97
|
-
transformed_data = original_data.copy()
|
98
|
-
|
99
|
-
# Add processing info
|
100
|
-
processing_info = {
|
101
|
-
"transform_type": transform_type,
|
102
|
-
"input_keys": list(original_data.keys()),
|
103
|
-
"output_keys": list(transformed_data.keys()),
|
104
|
-
"hook_enhanced": kwargs.get("hook_enhanced", False),
|
105
|
-
"data_modified": kwargs.get("data_modified", False)
|
106
|
-
}
|
107
|
-
|
108
|
-
return DataTransformResult(
|
109
|
-
original_data=original_data,
|
110
|
-
transformed_data=transformed_data,
|
111
|
-
processing_info=processing_info
|
112
|
-
)
|
113
|
-
|
114
|
-
@classmethod
|
115
|
-
def get_schema(cls) -> Dict[str, Any]:
|
116
|
-
"""
|
117
|
-
Get JSON schema for command parameters.
|
118
|
-
|
119
|
-
Returns:
|
120
|
-
Dict[str, Any]: JSON schema
|
121
|
-
"""
|
122
|
-
return {
|
123
|
-
"type": "object",
|
124
|
-
"properties": {
|
125
|
-
"data": {
|
126
|
-
"type": "object",
|
127
|
-
"description": "Input data to transform"
|
128
|
-
},
|
129
|
-
"transform_type": {
|
130
|
-
"type": "string",
|
131
|
-
"enum": ["uppercase", "lowercase", "reverse", "default"],
|
132
|
-
"description": "Type of transformation to apply"
|
133
|
-
}
|
134
|
-
}
|
135
|
-
}
|
@@ -1,122 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Echo Command Example
|
3
|
-
|
4
|
-
A simple echo command that returns the input message.
|
5
|
-
"""
|
6
|
-
|
7
|
-
from typing import Dict, Any, Optional
|
8
|
-
from datetime import datetime
|
9
|
-
from mcp_proxy_adapter.commands.base import Command
|
10
|
-
from mcp_proxy_adapter.commands.result import SuccessResult
|
11
|
-
|
12
|
-
|
13
|
-
class EchoResult(SuccessResult):
|
14
|
-
"""
|
15
|
-
Result of the echo command execution.
|
16
|
-
"""
|
17
|
-
|
18
|
-
def __init__(self, message: str, timestamp: str):
|
19
|
-
"""
|
20
|
-
Initialize echo command result.
|
21
|
-
|
22
|
-
Args:
|
23
|
-
message: The echoed message
|
24
|
-
timestamp: Timestamp of execution
|
25
|
-
"""
|
26
|
-
super().__init__(
|
27
|
-
data={
|
28
|
-
"message": message,
|
29
|
-
"timestamp": timestamp,
|
30
|
-
"echoed": True
|
31
|
-
}
|
32
|
-
)
|
33
|
-
|
34
|
-
@classmethod
|
35
|
-
def get_schema(cls) -> Dict[str, Any]:
|
36
|
-
"""
|
37
|
-
Get JSON schema for result validation.
|
38
|
-
|
39
|
-
Returns:
|
40
|
-
Dict[str, Any]: JSON schema
|
41
|
-
"""
|
42
|
-
return {
|
43
|
-
"type": "object",
|
44
|
-
"properties": {
|
45
|
-
"data": {
|
46
|
-
"type": "object",
|
47
|
-
"properties": {
|
48
|
-
"message": {"type": "string"},
|
49
|
-
"timestamp": {"type": "string"},
|
50
|
-
"echoed": {"type": "boolean"}
|
51
|
-
},
|
52
|
-
"required": ["message", "timestamp", "echoed"]
|
53
|
-
}
|
54
|
-
},
|
55
|
-
"required": ["data"]
|
56
|
-
}
|
57
|
-
|
58
|
-
|
59
|
-
class EchoCommand(Command):
|
60
|
-
"""
|
61
|
-
Echo command that returns the input message.
|
62
|
-
"""
|
63
|
-
|
64
|
-
name = "echo"
|
65
|
-
result_class = EchoResult
|
66
|
-
|
67
|
-
async def execute(self, message: Optional[str] = None, **kwargs) -> EchoResult:
|
68
|
-
"""
|
69
|
-
Execute echo command.
|
70
|
-
|
71
|
-
Args:
|
72
|
-
message: Message to echo (optional)
|
73
|
-
**kwargs: Additional parameters
|
74
|
-
|
75
|
-
Returns:
|
76
|
-
EchoResult: Echo command result
|
77
|
-
"""
|
78
|
-
# Use provided message or default
|
79
|
-
if message is None:
|
80
|
-
message = kwargs.get("text", "Hello, World!")
|
81
|
-
|
82
|
-
# Check if hook added timestamp
|
83
|
-
hook_timestamp = kwargs.get("hook_timestamp")
|
84
|
-
if hook_timestamp:
|
85
|
-
# Use hook timestamp if available
|
86
|
-
timestamp = hook_timestamp
|
87
|
-
else:
|
88
|
-
# Get current timestamp
|
89
|
-
timestamp = datetime.now().isoformat()
|
90
|
-
|
91
|
-
# Add hook metadata to result
|
92
|
-
result = EchoResult(message=message, timestamp=timestamp)
|
93
|
-
|
94
|
-
# Add hook information if available
|
95
|
-
if kwargs.get("hook_processed"):
|
96
|
-
result.data["hook_processed"] = True
|
97
|
-
result.data["hook_timestamp"] = hook_timestamp
|
98
|
-
|
99
|
-
return result
|
100
|
-
|
101
|
-
@classmethod
|
102
|
-
def get_schema(cls) -> Dict[str, Any]:
|
103
|
-
"""
|
104
|
-
Get JSON schema for command parameters.
|
105
|
-
|
106
|
-
Returns:
|
107
|
-
Dict[str, Any]: JSON schema
|
108
|
-
"""
|
109
|
-
return {
|
110
|
-
"type": "object",
|
111
|
-
"properties": {
|
112
|
-
"message": {
|
113
|
-
"type": "string",
|
114
|
-
"description": "Message to echo",
|
115
|
-
"default": "Hello, World!"
|
116
|
-
},
|
117
|
-
"text": {
|
118
|
-
"type": "string",
|
119
|
-
"description": "Alternative parameter name for message"
|
120
|
-
}
|
121
|
-
}
|
122
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"jsonrpc":"2.0","result":{"commands":{"echo":{"name":"echo","metadata":{"name":"echo","version":"0.1","plugin":"","descr":"","category":"","author":"","email":"","source_url":"","summary":"Echo command that returns the input message.","description":"Echo command that returns the input message.","params":{"message":{"name":"message","required":false,"type":"typing.Optional[str]","default":null},"kwargs":{"name":"kwargs","required":true}},"examples":[{"command":"echo","params":{"kwargs":"..."},"description":"Call echo command with required parameters"},{"command":"echo","params":{"message":null,"kwargs":"..."},"description":"Call echo command with all parameters"}],"schema":{"type":"object","properties":{"message":{"type":"string","description":"Message to echo","default":"Hello, World!"},"text":{"type":"string","description":"Alternative parameter name for message"}}},"result_schema":{"type":"object","properties":{"data":{"type":"object","properties":{"message":{"type":"string"},"timestamp":{"type":"string"},"echoed":{"type":"boolean"}},"required":["message","timestamp","echoed"]}},"required":["data"]},"result_class":"EchoResult"},"schema":{"type":"object","properties":{"message":{"type":"string","description":"Message to echo","default":"Hello, World!"},"text":{"type":"string","description":"Alternative parameter name for message"}}},"type":"custom"},"help":{"name":"help","metadata":{"name":"help","version":"0.1","plugin":"","descr":"","category":"","author":"","email":"","source_url":"","summary":"Custom help command with enhanced functionality.","description":"Custom help command with enhanced functionality.","params":{"cmdname":{"name":"cmdname","required":false,"type":"typing.Optional[str]","default":null},"kwargs":{"name":"kwargs","required":true}},"examples":[{"command":"help","params":{"kwargs":"..."},"description":"Call help command with required parameters"},{"command":"help","params":{"cmdname":null,"kwargs":"..."},"description":"Call help command with all parameters"}],"schema":{"type":"object","properties":{"cmdname":{"type":"string","description":"Name of specific command to get help for"}}},"result_schema":{"type":"object","properties":{"cmdname":{"type":"string","description":"Name of the command"},"info":{"type":"object","properties":{"description":{"type":"string"},"summary":{"type":"string"},"params":{"type":"object"},"examples":{"type":"array"},"custom_help":{"type":"boolean"}}},"tool_info":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"version":{"type":"string"},"custom_help":{"type":"boolean"}}},"help_usage":{"type":"object","properties":{"description":{"type":"string"},"examples":{"type":"array"}}},"commands":{"type":"object"},"total":{"type":"integer"},"custom_features":{"type":"object"}}},"result_class":"CustomHelpResult"},"schema":{"type":"object","properties":{"cmdname":{"type":"string","description":"Name of specific command to get help for"}}},"type":"custom"},"health":{"name":"health","metadata":{"name":"health","version":"0.1","plugin":"","descr":"","category":"","author":"","email":"","source_url":"","summary":"Custom health command with enhanced system information.","description":"Custom health command with enhanced system information.","params":{"kwargs":{"name":"kwargs","required":true}},"examples":[{"command":"health","params":{"kwargs":"..."},"description":"Call health command with required parameters"}],"schema":{"type":"object","properties":{},"description":"Get enhanced system health information"},"result_schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string"},"version":{"type":"string"},"uptime":{"type":"number"},"components":{"type":"object"},"custom_metrics":{"type":"object"},"custom_health":{"type":"boolean"}},"required":["status","version","uptime","components","custom_metrics","custom_health"]}},"required":["data"]},"result_class":"CustomHealthResult"},"schema":{"type":"object","properties":{},"description":"Get enhanced system health information"},"type":"custom"},"data_transform":{"name":"data_transform","metadata":{"name":"data_transform","version":"0.1","plugin":"","descr":"","category":"","author":"","email":"","source_url":"","summary":"Data transform command for demonstrating advanced hooks.","description":"Data transform command for demonstrating advanced hooks.","params":{"data":{"name":"data","required":false,"type":"typing.Optional[typing.Dict[str, typing.Any]]","default":null},"transform_type":{"name":"transform_type","required":false,"type":"typing.Optional[str]","default":null},"kwargs":{"name":"kwargs","required":true}},"examples":[{"command":"data_transform","params":{"kwargs":"..."},"description":"Call data_transform command with required parameters"},{"command":"data_transform","params":{"data":null,"transform_type":null,"kwargs":"..."},"description":"Call data_transform command with all parameters"}],"schema":{"type":"object","properties":{"data":{"type":"object","description":"Input data to transform"},"transform_type":{"type":"string","enum":["uppercase","lowercase","reverse","default"],"description":"Type of transformation to apply"}}},"result_schema":{"type":"object","properties":{"original_data":{"type":"object"},"transformed_data":{"type":"object"},"processing_info":{"type":"object"},"command_type":{"type":"string"}}},"result_class":"DataTransformResult"},"schema":{"type":"object","properties":{"data":{"type":"object","description":"Input data to transform"},"transform_type":{"type":"string","enum":["uppercase","lowercase","reverse","default"],"description":"Type of transformation to apply"}}},"type":"custom"},"intercept":{"name":"intercept","metadata":{"name":"intercept","version":"0.1","plugin":"","descr":"","category":"","author":"","email":"","source_url":"","summary":"Intercept command for demonstrating hook interception.","description":"Intercept command for demonstrating hook interception.","params":{"action":{"name":"action","required":false,"type":"typing.Optional[str]","default":null},"bypass_flag":{"name":"bypass_flag","required":false,"type":"typing.Optional[int]","default":null},"kwargs":{"name":"kwargs","required":true}},"examples":[{"command":"intercept","params":{"kwargs":"..."},"description":"Call intercept command with required parameters"},{"command":"intercept","params":{"action":null,"bypass_flag":null,"kwargs":"..."},"description":"Call intercept command with all parameters"}],"schema":{"type":"object","properties":{"action":{"type":"string","description":"Action to perform"},"bypass_flag":{"type":"integer","enum":[0,1],"description":"Flag to determine execution (0 = bypass, 1 = execute)"}}},"result_schema":{"type":"object","properties":{"message":{"type":"string"},"executed":{"type":"boolean"},"intercept_reason":{"type":"string"},"hook_data":{"type":"object"},"command_type":{"type":"string"}}},"result_class":"InterceptResult"},"schema":{"type":"object","properties":{"action":{"type":"string","description":"Action to perform"},"bypass_flag":{"type":"integer","enum":[0,1],"description":"Flag to determine execution (0 = bypass, 1 = execute)"}}},"type":"custom"},"manual_echo":{"name":"manual_echo","metadata":{"name":"manual_echo","version":"0.1","plugin":"","descr":"","category":"","author":"","email":"","source_url":"","summary":"Manually registered echo command.","description":"Manually registered echo command.","params":{"message":{"name":"message","required":false,"type":"typing.Optional[str]","default":null},"kwargs":{"name":"kwargs","required":true}},"examples":[{"command":"manual_echo","params":{"kwargs":"..."},"description":"Call manual_echo command with required parameters"},{"command":"manual_echo","params":{"message":null,"kwargs":"..."},"description":"Call manual_echo command with all parameters"}],"schema":{"type":"object","properties":{"message":{"type":"string","description":"Message to echo","default":"Hello from manually registered command!"}}},"result_schema":{"type":"object","properties":{"message":{"type":"string"},"manually_registered":{"type":"boolean"},"command_type":{"type":"string"}}},"result_class":"ManualEchoResult"},"schema":{"type":"object","properties":{"message":{"type":"string","description":"Message to echo","default":"Hello from manually registered command!"}}},"type":"custom"},"config":{"name":"config","metadata":{"name":"config","version":"0.1","plugin":"","descr":"","category":"","author":"","email":"","source_url":"","summary":"Command for managing service configuration.","description":"Command for managing service configuration.","params":{"operation":{"name":"operation","required":false,"type":"<class 'str'>","default":"get"},"path":{"name":"path","required":false,"type":"<class 'str'>","default":null},"value":{"name":"value","required":false,"type":"typing.Any","default":null}},"examples":[{"command":"config","description":"Call config command without parameters"},{"command":"config","params":{"operation":"get","path":null,"value":null},"description":"Call config command with all parameters"}],"schema":{"type":"object","properties":{"operation":{"type":"string","enum":["get","set"],"default":"get","description":"Operation to perform (get or set)"},"path":{"type":"string","description":"Configuration path in dot notation (e.g. 'server.host')"},"value":{"description":"Value to set (required for 'set' operation)"}},"required":["operation"],"additionalProperties":false},"result_schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object"},"message":{"type":"string"}},"required":["success"]},"result_class":"ConfigResult"},"schema":{"type":"object","properties":{"operation":{"type":"string","enum":["get","set"],"default":"get","description":"Operation to perform (get or set)"},"path":{"type":"string","description":"Configuration path in dot notation (e.g. 'server.host')"},"value":{"description":"Value to set (required for 'set' operation)"}},"required":["operation"],"additionalProperties":false},"type":"built-in"},"reload":{"name":"reload","metadata":{"name":"reload","version":"0.1","plugin":"","descr":"","category":"","author":"","email":"","source_url":"","summary":"Command for reloading configuration and rediscovering commands.","description":"Command for reloading configuration and rediscovering commands.\nUses the unified initialization logic.","params":{"params":{"name":"params","required":true}},"examples":[{"command":"reload","params":{"params":"..."},"description":"Call reload command with required parameters"}],"schema":{"type":"object","properties":{"config_path":{"type":"string","description":"Path to configuration file to reload","default":null}},"additionalProperties":false},"result_schema":{},"result_class":null},"schema":{"type":"object","properties":{"config_path":{"type":"string","description":"Path to configuration file to reload","default":null}},"additionalProperties":false},"type":"built-in"},"settings":{"name":"settings","metadata":{"name":"settings","version":"0.1","plugin":"","descr":"","category":"","author":"","email":"","source_url":"","summary":"Command for managing framework settings.","description":"Command for managing framework settings.","params":{"params":{"name":"params","required":true}},"examples":[{"command":"settings","params":{"params":"..."},"description":"Call settings command with required parameters"}],"schema":{"type":"object","properties":{"operation":{"type":"string","description":"Operation to perform","enum":["get","set","get_all","reload"],"default":"get_all"},"key":{"type":"string","description":"Configuration key in dot notation (e.g., 'server.host', 'custom.feature_enabled')"},"value":{"description":"Configuration value to set (for 'set' operation)"}},"required":["operation"],"additionalProperties":false},"result_schema":{},"result_class":null},"schema":{"type":"object","properties":{"operation":{"type":"string","description":"Operation to perform","enum":["get","set","get_all","reload"],"default":"get_all"},"key":{"type":"string","description":"Configuration key in dot notation (e.g., 'server.host', 'custom.feature_enabled')"},"value":{"description":"Configuration value to set (for 'set' operation)"}},"required":["operation"],"additionalProperties":false},"type":"built-in"},"load":{"name":"load","metadata":{"name":"load","version":"0.1","plugin":"","descr":"","category":"","author":"","email":"","source_url":"","summary":"Command that loads commands from local path or URL.","description":"Command that loads commands from local path or URL.\n\nThis command allows dynamic loading of command modules from either local file system\nor remote HTTP/HTTPS URLs. The command automatically detects whether the source\nis a local path or URL and handles the loading accordingly.\n\nFor local paths, the command loads Python modules ending with '_command.py'.\nFor URLs, the command downloads the Python code and loads it as a temporary module.\n\nThe loaded commands are registered in the command registry and become immediately\navailable for execution. Only commands that inherit from the base Command class\nand are properly structured will be loaded and registered.\n\nSecurity considerations:\n- Local paths are validated for existence and proper naming\n- URLs are downloaded with timeout protection\n- Temporary files are automatically cleaned up after loading\n- Only files ending with '_command.py' are accepted\n\nExamples:\n- Load from local file: \"./my_command.py\"\n- Load from URL: \"https://example.com/remote_command.py\"","params":{"source":{"name":"source","required":true,"type":"<class 'str'>"},"kwargs":{"name":"kwargs","required":true}},"examples":[{"command":"load","params":{"source":"./custom_command.py"},"description":"Load a command from local file system"},{"command":"load","params":{"source":"https://raw.githubusercontent.com/user/repo/main/remote_command.py"},"description":"Load a command from GitHub raw content"},{"command":"load","params":{"source":"https://example.com/api/commands/test_command.py"},"description":"Load a command from remote API endpoint"}],"schema":{"type":"object","properties":{"source":{"type":"string","description":"Source path or URL to load command from (must end with '_command.py')","examples":["./my_command.py","https://example.com/remote_command.py"]}},"required":["source"]},"result_schema":{"type":"object","properties":{"data":{"type":"object","properties":{"success":{"type":"boolean"},"commands_loaded":{"type":"integer"},"loaded_commands":{"type":"array","items":{"type":"string"}},"source":{"type":"string"},"error":{"type":"string"}},"required":["success","commands_loaded","loaded_commands","source"]}},"required":["data"]},"result_class":"LoadResult"},"schema":{"type":"object","properties":{"source":{"type":"string","description":"Source path or URL to load command from (must end with '_command.py')","examples":["./my_command.py","https://example.com/remote_command.py"]}},"required":["source"]},"type":"built-in"},"unload":{"name":"unload","metadata":{"name":"unload","version":"0.1","plugin":"","descr":"","category":"","author":"","email":"","source_url":"","summary":"Command that unloads loaded commands from registry.","description":"Command that unloads loaded commands from registry.\n\nThis command allows removal of dynamically loaded commands from the command registry.\nOnly commands that were loaded via the 'load' command or from the commands directory\ncan be unloaded. Built-in commands and custom commands registered with higher priority\ncannot be unloaded using this command.\n\nWhen a command is unloaded:\n- The command class is removed from the loaded commands registry\n- Any command instances are also removed\n- The command becomes unavailable for execution\n- Built-in and custom commands with the same name remain unaffected\n\nThis is useful for:\n- Removing outdated or problematic commands\n- Managing memory usage by unloading unused commands\n- Testing different versions of commands\n- Cleaning up temporary commands loaded for testing\n\nNote: Unloading a command does not affect other commands and does not require\na system restart. The command can be reloaded later if needed.","params":{"command_name":{"name":"command_name","required":true,"type":"<class 'str'>"},"kwargs":{"name":"kwargs","required":true}},"examples":[{"command":"unload","params":{"command_name":"test_command"},"description":"Unload a previously loaded test command"},{"command":"unload","params":{"command_name":"remote_command"},"description":"Unload a command that was loaded from URL"},{"command":"unload","params":{"command_name":"custom_command"},"description":"Unload a custom command loaded from local file"}],"schema":{"type":"object","properties":{"command_name":{"type":"string","description":"Name of the command to unload (must be a loaded command)"}},"required":["command_name"]},"result_schema":{"type":"object","properties":{"data":{"type":"object","properties":{"success":{"type":"boolean"},"command_name":{"type":"string"},"error":{"type":"string"}},"required":["success","command_name"]}},"required":["data"]},"result_class":"UnloadResult"},"schema":{"type":"object","properties":{"command_name":{"type":"string","description":"Name of the command to unload (must be a loaded command)"}},"required":["command_name"]},"type":"built-in"},"plugins":{"name":"plugins","metadata":{"name":"plugins","summary":"Command that reads and displays available plugins from a plugins server","description":"\n Command that reads and displays available plugins from a plugins server.\n \n This command fetches a JSON file from a configured plugins server URL that contains\n a list of available plugins. Each plugin in the list typically contains metadata\n such as name, description, URL, version, and author information.\n \n The plugins server URL is configured in the system configuration under\n 'commands.plugins_server'. The JSON file should contain an array of plugin objects\n with the following structure:\n \n {\n \"plugins\": [\n {\n \"name\": \"plugin_name\",\n \"description\": \"Plugin description\",\n \"url\": \"https://server.com/plugin.py\",\n \"version\": \"1.0.0\",\n \"author\": \"Author Name\"\n }\n ]\n }\n \n This command is useful for:\n - Discovering available plugins without manually browsing the server\n - Getting metadata about plugins before loading them\n - Building plugin management interfaces\n - Checking plugin availability and versions\n \n The command will return the list of all available plugins along with their\n metadata, making it easy to choose which plugins to load.\n ","parameters":{},"examples":[{"command":"plugins","description":"Get list of available plugins from configured server"},{"command":"plugins","description":"Discover plugins without parameters"},{"command":"plugins","description":"Check plugin availability and metadata"}],"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"success":{"type":"boolean"},"plugins_server":{"type":"string"},"plugins":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"url":{"type":"string"},"version":{"type":"string"},"author":{"type":"string"}}}},"total_plugins":{"type":"integer"},"error":{"type":"string"}},"required":["success","plugins_server","plugins","total_plugins"]}},"required":["data"]}},"schema":{"type":"object","properties":{},"additionalProperties":false},"type":"built-in"},"transport_management":{"name":"transport_management","metadata":{"name":"transport_management","version":"0.1","plugin":"","descr":"Manage and query transport configurations (HTTP, HTTPS, MTLS)","category":"","author":"","email":"","source_url":"","summary":"Transport management command.","description":"Transport management command.\n\nThis command provides functionality to manage and query transport configurations.","params":{"params":{"name":"params","required":true}},"examples":[{"command":"transport_management","params":{"params":"..."},"description":"Call transport_management command with required parameters"}],"schema":{"type":"object","properties":{"action":{"type":"string","enum":["get_info","validate","reload"],"description":"Action to perform"}},"required":["action"]},"result_schema":{},"result_class":null},"schema":{"type":"object","properties":{"action":{"type":"string","enum":["get_info","validate","reload"],"description":"Action to perform"}},"required":["action"]},"type":"built-in"},"proxy_registration":{"name":"proxy_registration","error":"ProxyRegistrationCommand.get_schema() missing 1 required positional argument: 'self'","type":"built-in"}},"total":14,"custom_help":true,"custom_features":{"enhanced":true,"total_commands":14,"custom_commands":["echo","help","health"],"request_id":null,"hook_processed":false}},"id":15}
|