mcp-proxy-adapter 6.9.28__py3-none-any.whl → 6.9.30__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.
Potentially problematic release.
This version of mcp-proxy-adapter might be problematic. Click here for more details.
- mcp_proxy_adapter/__init__.py +10 -0
- mcp_proxy_adapter/__main__.py +8 -21
- mcp_proxy_adapter/api/app.py +10 -913
- mcp_proxy_adapter/api/core/__init__.py +18 -0
- mcp_proxy_adapter/api/core/app_factory.py +243 -0
- mcp_proxy_adapter/api/core/lifespan_manager.py +55 -0
- mcp_proxy_adapter/api/core/registration_manager.py +166 -0
- mcp_proxy_adapter/api/core/ssl_context_factory.py +88 -0
- mcp_proxy_adapter/api/handlers.py +78 -199
- mcp_proxy_adapter/api/middleware/__init__.py +1 -44
- mcp_proxy_adapter/api/middleware/base.py +0 -42
- mcp_proxy_adapter/api/middleware/command_permission_middleware.py +0 -85
- mcp_proxy_adapter/api/middleware/error_handling.py +1 -127
- mcp_proxy_adapter/api/middleware/factory.py +0 -94
- mcp_proxy_adapter/api/middleware/logging.py +0 -112
- mcp_proxy_adapter/api/middleware/performance.py +0 -35
- mcp_proxy_adapter/api/middleware/protocol_middleware.py +2 -98
- mcp_proxy_adapter/api/middleware/transport_middleware.py +0 -37
- mcp_proxy_adapter/api/middleware/unified_security.py +10 -10
- mcp_proxy_adapter/api/middleware/user_info_middleware.py +0 -118
- mcp_proxy_adapter/api/openapi/__init__.py +21 -0
- mcp_proxy_adapter/api/openapi/command_integration.py +105 -0
- mcp_proxy_adapter/api/openapi/openapi_generator.py +40 -0
- mcp_proxy_adapter/api/openapi/openapi_registry.py +62 -0
- mcp_proxy_adapter/api/openapi/schema_loader.py +116 -0
- mcp_proxy_adapter/api/schemas.py +0 -61
- mcp_proxy_adapter/api/tool_integration.py +0 -117
- mcp_proxy_adapter/api/tools.py +0 -46
- mcp_proxy_adapter/cli/__init__.py +12 -0
- mcp_proxy_adapter/cli/commands/__init__.py +15 -0
- mcp_proxy_adapter/cli/commands/client.py +100 -0
- mcp_proxy_adapter/cli/commands/config_generate.py +21 -0
- mcp_proxy_adapter/cli/commands/config_validate.py +36 -0
- mcp_proxy_adapter/cli/commands/generate.py +259 -0
- mcp_proxy_adapter/cli/commands/server.py +174 -0
- mcp_proxy_adapter/cli/commands/sets.py +128 -0
- mcp_proxy_adapter/cli/commands/testconfig.py +177 -0
- mcp_proxy_adapter/cli/examples/__init__.py +8 -0
- mcp_proxy_adapter/cli/examples/http_basic.py +82 -0
- mcp_proxy_adapter/cli/examples/https_token.py +96 -0
- mcp_proxy_adapter/cli/examples/mtls_roles.py +103 -0
- mcp_proxy_adapter/cli/main.py +63 -0
- mcp_proxy_adapter/cli/parser.py +324 -0
- mcp_proxy_adapter/cli/validators.py +231 -0
- mcp_proxy_adapter/client/jsonrpc_client.py +406 -0
- mcp_proxy_adapter/client/proxy.py +45 -0
- mcp_proxy_adapter/commands/__init__.py +44 -28
- mcp_proxy_adapter/commands/auth_validation_command.py +7 -344
- mcp_proxy_adapter/commands/base.py +19 -43
- mcp_proxy_adapter/commands/builtin_commands.py +0 -75
- mcp_proxy_adapter/commands/catalog/__init__.py +20 -0
- mcp_proxy_adapter/commands/catalog/catalog_loader.py +34 -0
- mcp_proxy_adapter/commands/catalog/catalog_manager.py +122 -0
- mcp_proxy_adapter/commands/catalog/catalog_syncer.py +149 -0
- mcp_proxy_adapter/commands/catalog/command_catalog.py +43 -0
- mcp_proxy_adapter/commands/catalog/dependency_manager.py +37 -0
- mcp_proxy_adapter/commands/catalog_manager.py +58 -928
- mcp_proxy_adapter/commands/cert_monitor_command.py +0 -88
- mcp_proxy_adapter/commands/certificate_management_command.py +0 -45
- mcp_proxy_adapter/commands/command_registry.py +172 -904
- mcp_proxy_adapter/commands/config_command.py +0 -28
- mcp_proxy_adapter/commands/dependency_container.py +1 -70
- mcp_proxy_adapter/commands/dependency_manager.py +0 -128
- mcp_proxy_adapter/commands/echo_command.py +0 -34
- mcp_proxy_adapter/commands/health_command.py +0 -3
- mcp_proxy_adapter/commands/help_command.py +0 -159
- mcp_proxy_adapter/commands/hooks.py +0 -137
- mcp_proxy_adapter/commands/key_management_command.py +0 -25
- mcp_proxy_adapter/commands/load_command.py +7 -78
- mcp_proxy_adapter/commands/plugins_command.py +0 -16
- mcp_proxy_adapter/commands/protocol_management_command.py +0 -28
- mcp_proxy_adapter/commands/proxy_registration_command.py +0 -88
- mcp_proxy_adapter/commands/queue_commands.py +750 -0
- mcp_proxy_adapter/commands/registration_status_command.py +0 -43
- mcp_proxy_adapter/commands/registry/__init__.py +18 -0
- mcp_proxy_adapter/commands/registry/command_info.py +103 -0
- mcp_proxy_adapter/commands/registry/command_loader.py +207 -0
- mcp_proxy_adapter/commands/registry/command_manager.py +119 -0
- mcp_proxy_adapter/commands/registry/command_registry.py +217 -0
- mcp_proxy_adapter/commands/reload_command.py +0 -80
- mcp_proxy_adapter/commands/result.py +25 -77
- mcp_proxy_adapter/commands/role_test_command.py +0 -44
- mcp_proxy_adapter/commands/roles_management_command.py +0 -199
- mcp_proxy_adapter/commands/security_command.py +0 -30
- mcp_proxy_adapter/commands/settings_command.py +0 -68
- mcp_proxy_adapter/commands/ssl_setup_command.py +0 -42
- mcp_proxy_adapter/commands/token_management_command.py +0 -1
- mcp_proxy_adapter/commands/transport_management_command.py +0 -20
- mcp_proxy_adapter/commands/unload_command.py +0 -71
- mcp_proxy_adapter/config.py +15 -626
- mcp_proxy_adapter/core/__init__.py +5 -39
- mcp_proxy_adapter/core/app_factory.py +14 -36
- mcp_proxy_adapter/core/app_runner.py +0 -27
- mcp_proxy_adapter/core/auth_validator.py +1 -93
- mcp_proxy_adapter/core/certificate/__init__.py +20 -0
- mcp_proxy_adapter/core/certificate/certificate_creator.py +371 -0
- mcp_proxy_adapter/core/certificate/certificate_extractor.py +183 -0
- mcp_proxy_adapter/core/certificate/certificate_utils.py +249 -0
- mcp_proxy_adapter/core/certificate/certificate_validator.py +110 -0
- mcp_proxy_adapter/core/certificate/ssl_context_manager.py +70 -0
- mcp_proxy_adapter/core/certificate_utils.py +64 -903
- mcp_proxy_adapter/core/client.py +10 -9
- mcp_proxy_adapter/core/client_manager.py +0 -19
- mcp_proxy_adapter/core/client_security.py +0 -2
- mcp_proxy_adapter/core/config/__init__.py +18 -0
- mcp_proxy_adapter/core/config/config.py +195 -0
- mcp_proxy_adapter/core/config/config_factory.py +22 -0
- mcp_proxy_adapter/core/config/config_loader.py +66 -0
- mcp_proxy_adapter/core/config/feature_manager.py +31 -0
- mcp_proxy_adapter/core/config/simple_config.py +112 -0
- mcp_proxy_adapter/core/config/simple_config_generator.py +50 -0
- mcp_proxy_adapter/core/config/simple_config_validator.py +96 -0
- mcp_proxy_adapter/core/config_converter.py +0 -186
- mcp_proxy_adapter/core/config_validator.py +96 -1238
- mcp_proxy_adapter/core/errors.py +7 -42
- mcp_proxy_adapter/core/job_manager.py +54 -0
- mcp_proxy_adapter/core/logging.py +2 -22
- mcp_proxy_adapter/core/mtls_asgi.py +0 -20
- mcp_proxy_adapter/core/mtls_asgi_app.py +0 -12
- mcp_proxy_adapter/core/mtls_proxy.py +0 -80
- mcp_proxy_adapter/core/mtls_server.py +3 -173
- mcp_proxy_adapter/core/protocol_manager.py +1 -191
- mcp_proxy_adapter/core/proxy/__init__.py +22 -0
- mcp_proxy_adapter/core/proxy/auth_manager.py +27 -0
- mcp_proxy_adapter/core/proxy/proxy_registration_manager.py +137 -0
- mcp_proxy_adapter/core/proxy/registration_client.py +60 -0
- mcp_proxy_adapter/core/proxy/ssl_manager.py +101 -0
- mcp_proxy_adapter/core/proxy_client.py +0 -1
- mcp_proxy_adapter/core/proxy_registration.py +36 -913
- mcp_proxy_adapter/core/role_utils.py +0 -308
- mcp_proxy_adapter/core/security_adapter.py +1 -36
- mcp_proxy_adapter/core/security_factory.py +1 -150
- mcp_proxy_adapter/core/security_integration.py +0 -33
- mcp_proxy_adapter/core/server_adapter.py +1 -40
- mcp_proxy_adapter/core/server_engine.py +2 -173
- mcp_proxy_adapter/core/settings.py +0 -127
- mcp_proxy_adapter/core/signal_handler.py +0 -65
- mcp_proxy_adapter/core/ssl_utils.py +19 -137
- mcp_proxy_adapter/core/transport_manager.py +0 -151
- mcp_proxy_adapter/core/unified_config_adapter.py +1 -193
- mcp_proxy_adapter/core/utils.py +1 -182
- mcp_proxy_adapter/core/validation/__init__.py +21 -0
- mcp_proxy_adapter/core/validation/config_validator.py +211 -0
- mcp_proxy_adapter/core/validation/file_validator.py +73 -0
- mcp_proxy_adapter/core/validation/protocol_validator.py +191 -0
- mcp_proxy_adapter/core/validation/security_validator.py +58 -0
- mcp_proxy_adapter/core/validation/validation_result.py +27 -0
- mcp_proxy_adapter/custom_openapi.py +33 -652
- mcp_proxy_adapter/examples/bugfix_certificate_config.py +0 -23
- mcp_proxy_adapter/examples/check_config.py +0 -2
- mcp_proxy_adapter/examples/client_usage_example.py +164 -0
- mcp_proxy_adapter/examples/config_builder.py +13 -2
- mcp_proxy_adapter/examples/config_cli.py +0 -1
- mcp_proxy_adapter/examples/create_test_configs.py +0 -46
- mcp_proxy_adapter/examples/debug_request_state.py +0 -1
- mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py +0 -47
- mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py +0 -45
- mcp_proxy_adapter/examples/full_application/commands/echo_command.py +0 -12
- mcp_proxy_adapter/examples/full_application/commands/help_command.py +0 -12
- mcp_proxy_adapter/examples/full_application/commands/list_command.py +0 -7
- mcp_proxy_adapter/examples/full_application/hooks/__init__.py +0 -2
- mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py +0 -59
- mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py +0 -54
- mcp_proxy_adapter/examples/full_application/main.py +186 -150
- mcp_proxy_adapter/examples/full_application/proxy_endpoints.py +0 -107
- mcp_proxy_adapter/examples/full_application/test_minimal_server.py +0 -24
- mcp_proxy_adapter/examples/full_application/test_server.py +0 -58
- mcp_proxy_adapter/examples/generate_config.py +65 -11
- mcp_proxy_adapter/examples/queue_demo_simple.py +632 -0
- mcp_proxy_adapter/examples/queue_integration_example.py +578 -0
- mcp_proxy_adapter/examples/queue_server_demo.py +82 -0
- mcp_proxy_adapter/examples/queue_server_example.py +85 -0
- mcp_proxy_adapter/examples/queue_server_simple.py +173 -0
- mcp_proxy_adapter/examples/required_certificates.py +0 -2
- mcp_proxy_adapter/examples/run_full_test_suite.py +0 -29
- mcp_proxy_adapter/examples/run_proxy_server.py +31 -71
- mcp_proxy_adapter/examples/run_security_tests_fixed.py +0 -27
- mcp_proxy_adapter/examples/security_test/__init__.py +18 -0
- mcp_proxy_adapter/examples/security_test/auth_manager.py +14 -0
- mcp_proxy_adapter/examples/security_test/ssl_context_manager.py +28 -0
- mcp_proxy_adapter/examples/security_test/test_client.py +159 -0
- mcp_proxy_adapter/examples/security_test/test_result.py +22 -0
- mcp_proxy_adapter/examples/security_test_client.py +24 -1075
- mcp_proxy_adapter/examples/setup/__init__.py +24 -0
- mcp_proxy_adapter/examples/setup/certificate_manager.py +215 -0
- mcp_proxy_adapter/examples/setup/config_generator.py +12 -0
- mcp_proxy_adapter/examples/setup/config_validator.py +118 -0
- mcp_proxy_adapter/examples/setup/environment_setup.py +62 -0
- mcp_proxy_adapter/examples/setup/test_files_generator.py +10 -0
- mcp_proxy_adapter/examples/setup/test_runner.py +89 -0
- mcp_proxy_adapter/examples/setup_test_environment.py +133 -1425
- mcp_proxy_adapter/examples/test_config.py +0 -3
- mcp_proxy_adapter/examples/test_config_builder.py +25 -405
- mcp_proxy_adapter/examples/test_examples.py +0 -1
- mcp_proxy_adapter/examples/test_framework_complete.py +0 -2
- mcp_proxy_adapter/examples/test_mcp_server.py +0 -1
- mcp_proxy_adapter/examples/test_protocol_examples.py +0 -1
- mcp_proxy_adapter/examples/universal_client.py +0 -6
- mcp_proxy_adapter/examples/update_config_certificates.py +0 -1
- mcp_proxy_adapter/examples/validate_generator_compatibility.py +0 -1
- mcp_proxy_adapter/examples/validate_generator_compatibility_simple.py +0 -187
- mcp_proxy_adapter/integrations/__init__.py +25 -0
- mcp_proxy_adapter/integrations/queuemgr_integration.py +462 -0
- mcp_proxy_adapter/main.py +70 -62
- mcp_proxy_adapter/openapi.py +0 -22
- mcp_proxy_adapter/version.py +1 -1
- {mcp_proxy_adapter-6.9.28.dist-info → mcp_proxy_adapter-6.9.30.dist-info}/METADATA +2 -1
- mcp_proxy_adapter-6.9.30.dist-info/RECORD +235 -0
- {mcp_proxy_adapter-6.9.28.dist-info → mcp_proxy_adapter-6.9.30.dist-info}/entry_points.txt +1 -1
- mcp_proxy_adapter-6.9.28.dist-info/RECORD +0 -149
- {mcp_proxy_adapter-6.9.28.dist-info → mcp_proxy_adapter-6.9.30.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-6.9.28.dist-info → mcp_proxy_adapter-6.9.30.dist-info}/top_level.txt +0 -0
|
@@ -10,7 +10,6 @@ Version: 1.0.0
|
|
|
10
10
|
|
|
11
11
|
import json
|
|
12
12
|
import logging
|
|
13
|
-
from typing import Dict, List, Optional, Any
|
|
14
13
|
from pathlib import Path
|
|
15
14
|
|
|
16
15
|
from .base import Command
|
|
@@ -40,57 +39,8 @@ class RolesListResult(SuccessResult):
|
|
|
40
39
|
self.roles = roles
|
|
41
40
|
self.total_count = total_count
|
|
42
41
|
|
|
43
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
44
|
-
"""
|
|
45
|
-
Convert to dictionary format.
|
|
46
|
-
|
|
47
|
-
Returns:
|
|
48
|
-
Dictionary representation
|
|
49
|
-
"""
|
|
50
|
-
return {
|
|
51
|
-
"success": self.success,
|
|
52
|
-
"roles": self.roles,
|
|
53
|
-
"total_count": self.total_count,
|
|
54
|
-
}
|
|
55
42
|
|
|
56
43
|
@classmethod
|
|
57
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
58
|
-
"""
|
|
59
|
-
Get JSON schema for result.
|
|
60
|
-
|
|
61
|
-
Returns:
|
|
62
|
-
JSON schema
|
|
63
|
-
"""
|
|
64
|
-
return {
|
|
65
|
-
"type": "object",
|
|
66
|
-
"properties": {
|
|
67
|
-
"success": {"type": "boolean"},
|
|
68
|
-
"roles": {
|
|
69
|
-
"type": "array",
|
|
70
|
-
"items": {
|
|
71
|
-
"type": "object",
|
|
72
|
-
"properties": {
|
|
73
|
-
"name": {"type": "string"},
|
|
74
|
-
"description": {"type": "string"},
|
|
75
|
-
"allowed_servers": {
|
|
76
|
-
"type": "array",
|
|
77
|
-
"items": {"type": "string"},
|
|
78
|
-
},
|
|
79
|
-
"allowed_clients": {
|
|
80
|
-
"type": "array",
|
|
81
|
-
"items": {"type": "string"},
|
|
82
|
-
},
|
|
83
|
-
"permissions": {
|
|
84
|
-
"type": "array",
|
|
85
|
-
"items": {"type": "string"},
|
|
86
|
-
},
|
|
87
|
-
"priority": {"type": "integer"},
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
"total_count": {"type": "integer"},
|
|
92
|
-
},
|
|
93
|
-
}
|
|
94
44
|
|
|
95
45
|
|
|
96
46
|
class RolesCreateResult(SuccessResult):
|
|
@@ -111,35 +61,8 @@ class RolesCreateResult(SuccessResult):
|
|
|
111
61
|
self.role_name = role_name
|
|
112
62
|
self.role_config = role_config
|
|
113
63
|
|
|
114
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
115
|
-
"""
|
|
116
|
-
Convert to dictionary format.
|
|
117
|
-
|
|
118
|
-
Returns:
|
|
119
|
-
Dictionary representation
|
|
120
|
-
"""
|
|
121
|
-
return {
|
|
122
|
-
"success": self.success,
|
|
123
|
-
"role_name": self.role_name,
|
|
124
|
-
"role_config": self.role_config,
|
|
125
|
-
}
|
|
126
64
|
|
|
127
65
|
@classmethod
|
|
128
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
129
|
-
"""
|
|
130
|
-
Get JSON schema for result.
|
|
131
|
-
|
|
132
|
-
Returns:
|
|
133
|
-
JSON schema
|
|
134
|
-
"""
|
|
135
|
-
return {
|
|
136
|
-
"type": "object",
|
|
137
|
-
"properties": {
|
|
138
|
-
"success": {"type": "boolean"},
|
|
139
|
-
"role_name": {"type": "string"},
|
|
140
|
-
"role_config": {"type": "object"},
|
|
141
|
-
},
|
|
142
|
-
}
|
|
143
66
|
|
|
144
67
|
|
|
145
68
|
class RolesUpdateResult(SuccessResult):
|
|
@@ -160,35 +83,8 @@ class RolesUpdateResult(SuccessResult):
|
|
|
160
83
|
self.role_name = role_name
|
|
161
84
|
self.role_config = role_config
|
|
162
85
|
|
|
163
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
164
|
-
"""
|
|
165
|
-
Convert to dictionary format.
|
|
166
|
-
|
|
167
|
-
Returns:
|
|
168
|
-
Dictionary representation
|
|
169
|
-
"""
|
|
170
|
-
return {
|
|
171
|
-
"success": self.success,
|
|
172
|
-
"role_name": self.role_name,
|
|
173
|
-
"role_config": self.role_config,
|
|
174
|
-
}
|
|
175
86
|
|
|
176
87
|
@classmethod
|
|
177
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
178
|
-
"""
|
|
179
|
-
Get JSON schema for result.
|
|
180
|
-
|
|
181
|
-
Returns:
|
|
182
|
-
JSON schema
|
|
183
|
-
"""
|
|
184
|
-
return {
|
|
185
|
-
"type": "object",
|
|
186
|
-
"properties": {
|
|
187
|
-
"success": {"type": "boolean"},
|
|
188
|
-
"role_name": {"type": "string"},
|
|
189
|
-
"role_config": {"type": "object"},
|
|
190
|
-
},
|
|
191
|
-
}
|
|
192
88
|
|
|
193
89
|
|
|
194
90
|
class RolesDeleteResult(SuccessResult):
|
|
@@ -207,30 +103,8 @@ class RolesDeleteResult(SuccessResult):
|
|
|
207
103
|
self.success = True
|
|
208
104
|
self.role_name = role_name
|
|
209
105
|
|
|
210
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
211
|
-
"""
|
|
212
|
-
Convert to dictionary format.
|
|
213
|
-
|
|
214
|
-
Returns:
|
|
215
|
-
Dictionary representation
|
|
216
|
-
"""
|
|
217
|
-
return {"success": self.success, "role_name": self.role_name}
|
|
218
106
|
|
|
219
107
|
@classmethod
|
|
220
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
221
|
-
"""
|
|
222
|
-
Get JSON schema for result.
|
|
223
|
-
|
|
224
|
-
Returns:
|
|
225
|
-
JSON schema
|
|
226
|
-
"""
|
|
227
|
-
return {
|
|
228
|
-
"type": "object",
|
|
229
|
-
"properties": {
|
|
230
|
-
"success": {"type": "boolean"},
|
|
231
|
-
"role_name": {"type": "string"},
|
|
232
|
-
},
|
|
233
|
-
}
|
|
234
108
|
|
|
235
109
|
|
|
236
110
|
class RolesValidateResult(SuccessResult):
|
|
@@ -253,37 +127,8 @@ class RolesValidateResult(SuccessResult):
|
|
|
253
127
|
self.is_valid = is_valid
|
|
254
128
|
self.validation_errors = validation_errors
|
|
255
129
|
|
|
256
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
257
|
-
"""
|
|
258
|
-
Convert to dictionary format.
|
|
259
|
-
|
|
260
|
-
Returns:
|
|
261
|
-
Dictionary representation
|
|
262
|
-
"""
|
|
263
|
-
return {
|
|
264
|
-
"success": self.success,
|
|
265
|
-
"role_name": self.role_name,
|
|
266
|
-
"is_valid": self.is_valid,
|
|
267
|
-
"validation_errors": self.validation_errors,
|
|
268
|
-
}
|
|
269
130
|
|
|
270
131
|
@classmethod
|
|
271
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
272
|
-
"""
|
|
273
|
-
Get JSON schema for result.
|
|
274
|
-
|
|
275
|
-
Returns:
|
|
276
|
-
JSON schema
|
|
277
|
-
"""
|
|
278
|
-
return {
|
|
279
|
-
"type": "object",
|
|
280
|
-
"properties": {
|
|
281
|
-
"success": {"type": "boolean"},
|
|
282
|
-
"role_name": {"type": "string"},
|
|
283
|
-
"is_valid": {"type": "boolean"},
|
|
284
|
-
"validation_errors": {"type": "array", "items": {"type": "string"}},
|
|
285
|
-
},
|
|
286
|
-
}
|
|
287
132
|
|
|
288
133
|
|
|
289
134
|
class RolesManagementCommand(Command):
|
|
@@ -655,47 +500,3 @@ class RolesManagementCommand(Command):
|
|
|
655
500
|
return errors
|
|
656
501
|
|
|
657
502
|
@classmethod
|
|
658
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
659
|
-
"""
|
|
660
|
-
Get JSON schema for command parameters.
|
|
661
|
-
|
|
662
|
-
Returns:
|
|
663
|
-
JSON schema
|
|
664
|
-
"""
|
|
665
|
-
return {
|
|
666
|
-
"type": "object",
|
|
667
|
-
"properties": {
|
|
668
|
-
"action": {
|
|
669
|
-
"type": "string",
|
|
670
|
-
"enum": ["list", "create", "update", "delete", "validate"],
|
|
671
|
-
"description": "Action to perform",
|
|
672
|
-
},
|
|
673
|
-
"role_name": {"type": "string", "description": "Name of the role"},
|
|
674
|
-
"description": {"type": "string", "description": "Role description"},
|
|
675
|
-
"allowed_servers": {
|
|
676
|
-
"type": "array",
|
|
677
|
-
"items": {"type": "string"},
|
|
678
|
-
"description": "List of allowed servers",
|
|
679
|
-
},
|
|
680
|
-
"allowed_clients": {
|
|
681
|
-
"type": "array",
|
|
682
|
-
"items": {"type": "string"},
|
|
683
|
-
"description": "List of allowed clients",
|
|
684
|
-
},
|
|
685
|
-
"permissions": {
|
|
686
|
-
"type": "array",
|
|
687
|
-
"items": {"type": "string"},
|
|
688
|
-
"description": "List of permissions",
|
|
689
|
-
},
|
|
690
|
-
"priority": {"type": "integer", "description": "Role priority"},
|
|
691
|
-
"role_config": {
|
|
692
|
-
"type": "object",
|
|
693
|
-
"description": "Complete role configuration",
|
|
694
|
-
},
|
|
695
|
-
"filter": {"type": "string", "description": "Filter for list action"},
|
|
696
|
-
"limit": {"type": "integer", "description": "Limit for list action"},
|
|
697
|
-
"offset": {"type": "integer", "description": "Offset for list action"},
|
|
698
|
-
},
|
|
699
|
-
"required": ["action"],
|
|
700
|
-
"additionalProperties": False,
|
|
701
|
-
}
|
|
@@ -9,12 +9,8 @@ email: vasilyvz@gmail.com
|
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
11
|
import logging
|
|
12
|
-
from typing import Dict, Any, List, Optional
|
|
13
|
-
from pathlib import Path
|
|
14
12
|
|
|
15
13
|
from .base import Command
|
|
16
|
-
from .result import CommandResult, SuccessResult, ErrorResult
|
|
17
|
-
from mcp_proxy_adapter.core.security_integration import create_security_integration
|
|
18
14
|
|
|
19
15
|
from mcp_proxy_adapter.core.logging import get_global_logger
|
|
20
16
|
logger = logging.getLogger(__name__)
|
|
@@ -44,34 +40,8 @@ class SecurityResult(CommandResult):
|
|
|
44
40
|
self.data = data or {}
|
|
45
41
|
self.error = error
|
|
46
42
|
|
|
47
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
48
|
-
"""Convert to dictionary."""
|
|
49
|
-
return {
|
|
50
|
-
"operation": self.operation,
|
|
51
|
-
"success": self.success,
|
|
52
|
-
"data": self.data,
|
|
53
|
-
"error": self.error,
|
|
54
|
-
}
|
|
55
43
|
|
|
56
44
|
@classmethod
|
|
57
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
58
|
-
"""Get result schema."""
|
|
59
|
-
return {
|
|
60
|
-
"type": "object",
|
|
61
|
-
"properties": {
|
|
62
|
-
"operation": {
|
|
63
|
-
"type": "string",
|
|
64
|
-
"description": "Security operation performed",
|
|
65
|
-
},
|
|
66
|
-
"success": {
|
|
67
|
-
"type": "boolean",
|
|
68
|
-
"description": "Whether operation was successful",
|
|
69
|
-
},
|
|
70
|
-
"data": {"type": "object", "description": "Operation data"},
|
|
71
|
-
"error": {"type": "string", "description": "Error message if any"},
|
|
72
|
-
},
|
|
73
|
-
"required": ["operation", "success"],
|
|
74
|
-
}
|
|
75
45
|
|
|
76
46
|
|
|
77
47
|
class SecurityCommand(Command):
|
|
@@ -31,54 +31,8 @@ class SettingsResult:
|
|
|
31
31
|
self.all_settings = all_settings
|
|
32
32
|
self.error_message = error_message
|
|
33
33
|
|
|
34
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
35
|
-
"""Convert result to dictionary."""
|
|
36
|
-
result = {"success": self.success, "operation": self.operation}
|
|
37
|
-
|
|
38
|
-
if self.key is not None:
|
|
39
|
-
result["key"] = self.key
|
|
40
|
-
if self.value is not None:
|
|
41
|
-
result["value"] = self.value
|
|
42
|
-
if self.all_settings is not None:
|
|
43
|
-
result["all_settings"] = self.all_settings
|
|
44
|
-
if self.error_message is not None:
|
|
45
|
-
result["error_message"] = self.error_message
|
|
46
|
-
|
|
47
|
-
return result
|
|
48
34
|
|
|
49
35
|
@classmethod
|
|
50
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
51
|
-
"""Get schema for the result."""
|
|
52
|
-
return {
|
|
53
|
-
"type": "object",
|
|
54
|
-
"properties": {
|
|
55
|
-
"success": {
|
|
56
|
-
"type": "boolean",
|
|
57
|
-
"description": "Whether the operation was successful",
|
|
58
|
-
},
|
|
59
|
-
"operation": {
|
|
60
|
-
"type": "string",
|
|
61
|
-
"description": "Type of operation performed",
|
|
62
|
-
"enum": ["get", "set", "get_all", "reload"],
|
|
63
|
-
},
|
|
64
|
-
"key": {
|
|
65
|
-
"type": "string",
|
|
66
|
-
"description": "Configuration key (for get/set operations)",
|
|
67
|
-
},
|
|
68
|
-
"value": {
|
|
69
|
-
"description": "Configuration value (for get/set operations)"
|
|
70
|
-
},
|
|
71
|
-
"all_settings": {
|
|
72
|
-
"type": "object",
|
|
73
|
-
"description": "All configuration settings (for get_all operation)",
|
|
74
|
-
},
|
|
75
|
-
"error_message": {
|
|
76
|
-
"type": "string",
|
|
77
|
-
"description": "Error message if operation failed",
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
"required": ["success", "operation"],
|
|
81
|
-
}
|
|
82
36
|
|
|
83
37
|
|
|
84
38
|
class SettingsCommand(Command):
|
|
@@ -157,25 +111,3 @@ class SettingsCommand(Command):
|
|
|
157
111
|
)
|
|
158
112
|
|
|
159
113
|
@classmethod
|
|
160
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
161
|
-
"""Get schema for the command."""
|
|
162
|
-
return {
|
|
163
|
-
"type": "object",
|
|
164
|
-
"properties": {
|
|
165
|
-
"operation": {
|
|
166
|
-
"type": "string",
|
|
167
|
-
"description": "Operation to perform",
|
|
168
|
-
"enum": ["get", "set", "get_all", "reload"],
|
|
169
|
-
"default": "get_all",
|
|
170
|
-
},
|
|
171
|
-
"key": {
|
|
172
|
-
"type": "string",
|
|
173
|
-
"description": "Configuration key in dot notation (e.g., 'server.host', 'custom.feature_enabled')",
|
|
174
|
-
},
|
|
175
|
-
"value": {
|
|
176
|
-
"description": "Configuration value to set (for 'set' operation)"
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
"required": ["operation"],
|
|
180
|
-
"additionalProperties": False,
|
|
181
|
-
}
|
|
@@ -16,7 +16,6 @@ from mcp_proxy_adapter.core.logging import get_global_logger
|
|
|
16
16
|
try:
|
|
17
17
|
from mcp_security_framework.core.ssl_manager import SSLManager
|
|
18
18
|
from mcp_security_framework.schemas.config import SSLConfig
|
|
19
|
-
from mcp_security_framework.utils.cert_utils import validate_certificate_chain
|
|
20
19
|
|
|
21
20
|
SECURITY_FRAMEWORK_AVAILABLE = True
|
|
22
21
|
except ImportError:
|
|
@@ -303,46 +302,5 @@ class SSLSetupCommand(Command):
|
|
|
303
302
|
},
|
|
304
303
|
)
|
|
305
304
|
|
|
306
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
307
|
-
"""Convert command to dictionary."""
|
|
308
|
-
return {
|
|
309
|
-
"name": self.name,
|
|
310
|
-
"description": self.description,
|
|
311
|
-
"version": self.version,
|
|
312
|
-
"framework_available": SECURITY_FRAMEWORK_AVAILABLE,
|
|
313
|
-
}
|
|
314
305
|
|
|
315
306
|
@classmethod
|
|
316
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
317
|
-
"""Get command schema."""
|
|
318
|
-
return {
|
|
319
|
-
"type": "object",
|
|
320
|
-
"properties": {
|
|
321
|
-
"action": {
|
|
322
|
-
"type": "string",
|
|
323
|
-
"enum": ["get", "set", "update", "reset", "test"],
|
|
324
|
-
"description": "Action to perform",
|
|
325
|
-
},
|
|
326
|
-
"config_data": {
|
|
327
|
-
"type": "object",
|
|
328
|
-
"description": "SSL configuration data",
|
|
329
|
-
"properties": {
|
|
330
|
-
"enabled": {"type": "boolean"},
|
|
331
|
-
"cert_file": {"type": "string"},
|
|
332
|
-
"key_file": {"type": "string"},
|
|
333
|
-
"ca_file": {"type": "string"},
|
|
334
|
-
"verify_mode": {"type": "string"},
|
|
335
|
-
"cipher_suites": {"type": "array", "items": {"type": "string"}},
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
"cert_file": {
|
|
339
|
-
"type": "string",
|
|
340
|
-
"description": "Certificate file path for testing",
|
|
341
|
-
},
|
|
342
|
-
"key_file": {
|
|
343
|
-
"type": "string",
|
|
344
|
-
"description": "Private key file path for testing",
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
"required": ["action"],
|
|
348
|
-
}
|
|
@@ -4,9 +4,7 @@ Transport Management Command
|
|
|
4
4
|
This command provides transport management functionality for the MCP Proxy Adapter.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
from typing import Dict, Any, ClassVar
|
|
8
7
|
from mcp_proxy_adapter.commands.base import Command
|
|
9
|
-
from mcp_proxy_adapter.commands.result import SuccessResult, ErrorResult
|
|
10
8
|
from mcp_proxy_adapter.core.transport_manager import transport_manager
|
|
11
9
|
from mcp_proxy_adapter.core.logging import get_global_logger
|
|
12
10
|
|
|
@@ -40,24 +38,6 @@ class TransportManagementCommand(Command):
|
|
|
40
38
|
descr = "Manage and query transport configurations (HTTP, HTTPS, MTLS)"
|
|
41
39
|
|
|
42
40
|
@classmethod
|
|
43
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
44
|
-
"""
|
|
45
|
-
Get command schema.
|
|
46
|
-
|
|
47
|
-
Returns:
|
|
48
|
-
Command schema dictionary
|
|
49
|
-
"""
|
|
50
|
-
return {
|
|
51
|
-
"type": "object",
|
|
52
|
-
"properties": {
|
|
53
|
-
"action": {
|
|
54
|
-
"type": "string",
|
|
55
|
-
"enum": ["get_info", "validate", "reload"],
|
|
56
|
-
"description": "Action to perform",
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"required": ["action"],
|
|
60
|
-
}
|
|
61
41
|
|
|
62
42
|
async def execute(self, **params) -> TransportManagementResult:
|
|
63
43
|
"""
|
|
@@ -5,7 +5,6 @@ Module with unload command implementation.
|
|
|
5
5
|
from typing import Dict, Any, Optional, List
|
|
6
6
|
|
|
7
7
|
from mcp_proxy_adapter.commands.base import Command
|
|
8
|
-
from mcp_proxy_adapter.commands.result import CommandResult, SuccessResult
|
|
9
8
|
from mcp_proxy_adapter.commands.command_registry import registry
|
|
10
9
|
|
|
11
10
|
|
|
@@ -37,28 +36,6 @@ class UnloadResult(SuccessResult):
|
|
|
37
36
|
super().__init__(data=data, message=message)
|
|
38
37
|
|
|
39
38
|
@classmethod
|
|
40
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
41
|
-
"""
|
|
42
|
-
Get JSON schema for result validation.
|
|
43
|
-
|
|
44
|
-
Returns:
|
|
45
|
-
Dict[str, Any]: JSON schema
|
|
46
|
-
"""
|
|
47
|
-
return {
|
|
48
|
-
"type": "object",
|
|
49
|
-
"properties": {
|
|
50
|
-
"data": {
|
|
51
|
-
"type": "object",
|
|
52
|
-
"properties": {
|
|
53
|
-
"success": {"type": "boolean"},
|
|
54
|
-
"command_name": {"type": "string"},
|
|
55
|
-
"error": {"type": "string"},
|
|
56
|
-
},
|
|
57
|
-
"required": ["success", "command_name"],
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"required": ["data"],
|
|
61
|
-
}
|
|
62
39
|
|
|
63
40
|
|
|
64
41
|
class UnloadCommand(Command):
|
|
@@ -111,53 +88,5 @@ class UnloadCommand(Command):
|
|
|
111
88
|
)
|
|
112
89
|
|
|
113
90
|
@classmethod
|
|
114
|
-
def get_schema(cls) -> Dict[str, Any]:
|
|
115
|
-
"""
|
|
116
|
-
Get JSON schema for command parameters.
|
|
117
|
-
|
|
118
|
-
Returns:
|
|
119
|
-
Dict[str, Any]: JSON schema
|
|
120
|
-
"""
|
|
121
|
-
return {
|
|
122
|
-
"type": "object",
|
|
123
|
-
"properties": {
|
|
124
|
-
"command_name": {
|
|
125
|
-
"type": "string",
|
|
126
|
-
"description": "Name of the command to unload (must be a loaded command)",
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
"required": ["command_name"],
|
|
130
|
-
}
|
|
131
91
|
|
|
132
92
|
@classmethod
|
|
133
|
-
def _generate_examples(
|
|
134
|
-
cls, params: Dict[str, Dict[str, Any]]
|
|
135
|
-
) -> List[Dict[str, Any]]:
|
|
136
|
-
"""
|
|
137
|
-
Generate custom examples for unload command.
|
|
138
|
-
|
|
139
|
-
Args:
|
|
140
|
-
params: Information about command parameters
|
|
141
|
-
|
|
142
|
-
Returns:
|
|
143
|
-
List of examples
|
|
144
|
-
"""
|
|
145
|
-
examples = [
|
|
146
|
-
{
|
|
147
|
-
"command": cls.name,
|
|
148
|
-
"params": {"command_name": "test_command"},
|
|
149
|
-
"description": "Unload a previously loaded test command",
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"command": cls.name,
|
|
153
|
-
"params": {"command_name": "remote_command"},
|
|
154
|
-
"description": "Unload a command that was loaded from URL",
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
"command": cls.name,
|
|
158
|
-
"params": {"command_name": "custom_command"},
|
|
159
|
-
"description": "Unload a custom command loaded from local file",
|
|
160
|
-
},
|
|
161
|
-
]
|
|
162
|
-
|
|
163
|
-
return examples
|