mcp-proxy-adapter 6.9.43__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcp_proxy_adapter/__init__.py +47 -0
- mcp_proxy_adapter/__main__.py +13 -0
- mcp_proxy_adapter/api/__init__.py +0 -0
- mcp_proxy_adapter/api/app.py +66 -0
- mcp_proxy_adapter/api/core/__init__.py +18 -0
- mcp_proxy_adapter/api/core/app_factory.py +355 -0
- mcp_proxy_adapter/api/core/lifespan_manager.py +55 -0
- mcp_proxy_adapter/api/core/registration_context.py +356 -0
- mcp_proxy_adapter/api/core/registration_manager.py +266 -0
- mcp_proxy_adapter/api/core/registration_tasks.py +84 -0
- mcp_proxy_adapter/api/core/ssl_context_factory.py +88 -0
- mcp_proxy_adapter/api/handlers.py +181 -0
- mcp_proxy_adapter/api/middleware/__init__.py +21 -0
- mcp_proxy_adapter/api/middleware/base.py +54 -0
- mcp_proxy_adapter/api/middleware/command_permission_middleware.py +73 -0
- mcp_proxy_adapter/api/middleware/error_handling.py +76 -0
- mcp_proxy_adapter/api/middleware/factory.py +147 -0
- mcp_proxy_adapter/api/middleware/logging.py +31 -0
- mcp_proxy_adapter/api/middleware/performance.py +51 -0
- mcp_proxy_adapter/api/middleware/protocol_middleware.py +140 -0
- mcp_proxy_adapter/api/middleware/transport_middleware.py +87 -0
- mcp_proxy_adapter/api/middleware/unified_security.py +223 -0
- mcp_proxy_adapter/api/middleware/user_info_middleware.py +132 -0
- 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 +270 -0
- mcp_proxy_adapter/api/tool_integration.py +131 -0
- mcp_proxy_adapter/api/tools.py +163 -0
- 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 +35 -0
- mcp_proxy_adapter/cli/commands/config_validate.py +74 -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 +338 -0
- mcp_proxy_adapter/cli/validators.py +231 -0
- mcp_proxy_adapter/client/jsonrpc_client/__init__.py +9 -0
- mcp_proxy_adapter/client/jsonrpc_client/client.py +42 -0
- mcp_proxy_adapter/client/jsonrpc_client/command_api.py +45 -0
- mcp_proxy_adapter/client/jsonrpc_client/proxy_api.py +224 -0
- mcp_proxy_adapter/client/jsonrpc_client/queue_api.py +60 -0
- mcp_proxy_adapter/client/jsonrpc_client/transport.py +108 -0
- mcp_proxy_adapter/client/proxy.py +123 -0
- mcp_proxy_adapter/commands/__init__.py +66 -0
- mcp_proxy_adapter/commands/auth_validation_command.py +69 -0
- mcp_proxy_adapter/commands/base.py +389 -0
- mcp_proxy_adapter/commands/builtin_commands.py +30 -0
- 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 +97 -0
- mcp_proxy_adapter/commands/cert_monitor_command.py +552 -0
- mcp_proxy_adapter/commands/certificate_management_command.py +562 -0
- mcp_proxy_adapter/commands/command_registry.py +298 -0
- mcp_proxy_adapter/commands/config_command.py +102 -0
- mcp_proxy_adapter/commands/dependency_container.py +40 -0
- mcp_proxy_adapter/commands/dependency_manager.py +143 -0
- mcp_proxy_adapter/commands/echo_command.py +48 -0
- mcp_proxy_adapter/commands/health_command.py +142 -0
- mcp_proxy_adapter/commands/help_command.py +175 -0
- mcp_proxy_adapter/commands/hooks.py +172 -0
- mcp_proxy_adapter/commands/key_management_command.py +484 -0
- mcp_proxy_adapter/commands/load_command.py +123 -0
- mcp_proxy_adapter/commands/plugins_command.py +246 -0
- mcp_proxy_adapter/commands/protocol_management_command.py +216 -0
- mcp_proxy_adapter/commands/proxy_registration_command.py +319 -0
- mcp_proxy_adapter/commands/queue_commands.py +750 -0
- mcp_proxy_adapter/commands/registration_status_command.py +76 -0
- 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 +136 -0
- mcp_proxy_adapter/commands/result.py +157 -0
- mcp_proxy_adapter/commands/role_test_command.py +99 -0
- mcp_proxy_adapter/commands/roles_management_command.py +502 -0
- mcp_proxy_adapter/commands/security_command.py +472 -0
- mcp_proxy_adapter/commands/settings_command.py +113 -0
- mcp_proxy_adapter/commands/ssl_setup_command.py +306 -0
- mcp_proxy_adapter/commands/token_management_command.py +500 -0
- mcp_proxy_adapter/commands/transport_management_command.py +129 -0
- mcp_proxy_adapter/commands/unload_command.py +92 -0
- mcp_proxy_adapter/config.py +32 -0
- mcp_proxy_adapter/core/__init__.py +8 -0
- mcp_proxy_adapter/core/app_factory.py +560 -0
- mcp_proxy_adapter/core/app_runner.py +318 -0
- mcp_proxy_adapter/core/auth_validator.py +508 -0
- mcp_proxy_adapter/core/certificate/__init__.py +20 -0
- mcp_proxy_adapter/core/certificate/certificate_creator.py +372 -0
- mcp_proxy_adapter/core/certificate/certificate_extractor.py +185 -0
- mcp_proxy_adapter/core/certificate/certificate_utils.py +249 -0
- mcp_proxy_adapter/core/certificate/certificate_validator.py +388 -0
- mcp_proxy_adapter/core/certificate/ssl_context_manager.py +65 -0
- mcp_proxy_adapter/core/certificate_utils.py +249 -0
- mcp_proxy_adapter/core/client.py +608 -0
- mcp_proxy_adapter/core/client_manager.py +271 -0
- mcp_proxy_adapter/core/client_security.py +411 -0
- mcp_proxy_adapter/core/config/__init__.py +18 -0
- mcp_proxy_adapter/core/config/config.py +237 -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 +116 -0
- mcp_proxy_adapter/core/config/simple_config_generator.py +100 -0
- mcp_proxy_adapter/core/config/simple_config_validator.py +380 -0
- mcp_proxy_adapter/core/config_converter.py +252 -0
- mcp_proxy_adapter/core/config_validator.py +211 -0
- mcp_proxy_adapter/core/crl_utils.py +362 -0
- mcp_proxy_adapter/core/errors.py +276 -0
- mcp_proxy_adapter/core/job_manager.py +54 -0
- mcp_proxy_adapter/core/logging.py +250 -0
- mcp_proxy_adapter/core/mtls_asgi.py +140 -0
- mcp_proxy_adapter/core/mtls_asgi_app.py +187 -0
- mcp_proxy_adapter/core/mtls_proxy.py +229 -0
- mcp_proxy_adapter/core/mtls_server.py +154 -0
- mcp_proxy_adapter/core/protocol_manager.py +232 -0
- mcp_proxy_adapter/core/proxy/__init__.py +19 -0
- mcp_proxy_adapter/core/proxy/auth_manager.py +26 -0
- mcp_proxy_adapter/core/proxy/proxy_registration_manager.py +160 -0
- mcp_proxy_adapter/core/proxy/registration_client.py +186 -0
- mcp_proxy_adapter/core/proxy/ssl_manager.py +101 -0
- mcp_proxy_adapter/core/proxy_client.py +184 -0
- mcp_proxy_adapter/core/proxy_registration.py +80 -0
- mcp_proxy_adapter/core/role_utils.py +103 -0
- mcp_proxy_adapter/core/security_adapter.py +343 -0
- mcp_proxy_adapter/core/security_factory.py +96 -0
- mcp_proxy_adapter/core/security_integration.py +342 -0
- mcp_proxy_adapter/core/server_adapter.py +251 -0
- mcp_proxy_adapter/core/server_engine.py +217 -0
- mcp_proxy_adapter/core/settings.py +260 -0
- mcp_proxy_adapter/core/signal_handler.py +107 -0
- mcp_proxy_adapter/core/ssl_utils.py +161 -0
- mcp_proxy_adapter/core/transport_manager.py +153 -0
- mcp_proxy_adapter/core/unified_config_adapter.py +471 -0
- mcp_proxy_adapter/core/utils.py +101 -0
- mcp_proxy_adapter/core/validation/__init__.py +21 -0
- mcp_proxy_adapter/core/validation/config_validator.py +219 -0
- mcp_proxy_adapter/core/validation/file_validator.py +131 -0
- mcp_proxy_adapter/core/validation/protocol_validator.py +190 -0
- mcp_proxy_adapter/core/validation/security_validator.py +140 -0
- mcp_proxy_adapter/core/validation/validation_result.py +27 -0
- mcp_proxy_adapter/custom_openapi.py +58 -0
- mcp_proxy_adapter/examples/__init__.py +16 -0
- mcp_proxy_adapter/examples/basic_framework/__init__.py +9 -0
- mcp_proxy_adapter/examples/basic_framework/commands/__init__.py +4 -0
- mcp_proxy_adapter/examples/basic_framework/hooks/__init__.py +4 -0
- mcp_proxy_adapter/examples/basic_framework/main.py +52 -0
- mcp_proxy_adapter/examples/bugfix_certificate_config.py +261 -0
- mcp_proxy_adapter/examples/cert_manager_bugfix.py +203 -0
- mcp_proxy_adapter/examples/check_config.py +413 -0
- mcp_proxy_adapter/examples/client_usage_example.py +164 -0
- mcp_proxy_adapter/examples/commands/__init__.py +5 -0
- mcp_proxy_adapter/examples/config_builder.py +234 -0
- mcp_proxy_adapter/examples/config_cli.py +282 -0
- mcp_proxy_adapter/examples/create_test_configs.py +174 -0
- mcp_proxy_adapter/examples/debug_request_state.py +130 -0
- mcp_proxy_adapter/examples/debug_role_chain.py +191 -0
- mcp_proxy_adapter/examples/demo_client.py +287 -0
- mcp_proxy_adapter/examples/full_application/__init__.py +13 -0
- mcp_proxy_adapter/examples/full_application/commands/__init__.py +8 -0
- mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py +45 -0
- mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py +52 -0
- mcp_proxy_adapter/examples/full_application/commands/echo_command.py +32 -0
- mcp_proxy_adapter/examples/full_application/commands/help_command.py +54 -0
- mcp_proxy_adapter/examples/full_application/commands/list_command.py +57 -0
- mcp_proxy_adapter/examples/full_application/hooks/__init__.py +5 -0
- mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py +29 -0
- mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py +27 -0
- mcp_proxy_adapter/examples/full_application/main.py +264 -0
- mcp_proxy_adapter/examples/full_application/proxy_endpoints.py +81 -0
- mcp_proxy_adapter/examples/full_application/run_mtls.py +252 -0
- mcp_proxy_adapter/examples/full_application/run_simple.py +152 -0
- mcp_proxy_adapter/examples/full_application/test_minimal_server.py +45 -0
- mcp_proxy_adapter/examples/full_application/test_server.py +163 -0
- mcp_proxy_adapter/examples/full_application/test_simple_server.py +62 -0
- mcp_proxy_adapter/examples/generate_config.py +502 -0
- mcp_proxy_adapter/examples/proxy_registration_example.py +335 -0
- 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 +208 -0
- mcp_proxy_adapter/examples/run_example.py +77 -0
- mcp_proxy_adapter/examples/run_full_test_suite.py +619 -0
- mcp_proxy_adapter/examples/run_proxy_server.py +153 -0
- mcp_proxy_adapter/examples/run_security_tests_fixed.py +435 -0
- 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 +72 -0
- 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 +235 -0
- mcp_proxy_adapter/examples/simple_protocol_test.py +125 -0
- mcp_proxy_adapter/examples/test_chk_hostname_automated.py +211 -0
- mcp_proxy_adapter/examples/test_config.py +205 -0
- mcp_proxy_adapter/examples/test_config_builder.py +110 -0
- mcp_proxy_adapter/examples/test_examples.py +308 -0
- mcp_proxy_adapter/examples/test_framework_complete.py +267 -0
- mcp_proxy_adapter/examples/test_mcp_server.py +187 -0
- mcp_proxy_adapter/examples/test_protocol_examples.py +337 -0
- mcp_proxy_adapter/examples/universal_client.py +674 -0
- mcp_proxy_adapter/examples/update_config_certificates.py +135 -0
- mcp_proxy_adapter/examples/validate_generator_compatibility.py +385 -0
- mcp_proxy_adapter/examples/validate_generator_compatibility_simple.py +61 -0
- mcp_proxy_adapter/integrations/__init__.py +25 -0
- mcp_proxy_adapter/integrations/queuemgr_integration.py +462 -0
- mcp_proxy_adapter/main.py +313 -0
- mcp_proxy_adapter/openapi.py +375 -0
- mcp_proxy_adapter/schemas/base_schema.json +114 -0
- mcp_proxy_adapter/schemas/openapi_schema.json +314 -0
- mcp_proxy_adapter/schemas/roles.json +37 -0
- mcp_proxy_adapter/schemas/roles_schema.json +162 -0
- mcp_proxy_adapter/version.py +5 -0
- mcp_proxy_adapter-6.9.43.dist-info/METADATA +739 -0
- mcp_proxy_adapter-6.9.43.dist-info/RECORD +242 -0
- mcp_proxy_adapter-6.9.43.dist-info/WHEEL +5 -0
- mcp_proxy_adapter-6.9.43.dist-info/entry_points.txt +12 -0
- mcp_proxy_adapter-6.9.43.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-proxy-adapter
|
|
3
|
+
Version: 6.9.43
|
|
4
|
+
Summary: Powerful JSON-RPC microservices framework with built-in security, authentication, and proxy registration
|
|
5
|
+
Home-page: https://github.com/maverikod/mcp-proxy-adapter
|
|
6
|
+
Author: Vasiliy Zdanovskiy
|
|
7
|
+
Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
|
|
8
|
+
Maintainer: Vasiliy Zdanovskiy
|
|
9
|
+
Maintainer-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
Project-URL: Homepage, https://github.com/maverikod/mcp-proxy-adapter
|
|
12
|
+
Project-URL: Documentation, https://github.com/maverikod/mcp-proxy-adapter#readme
|
|
13
|
+
Project-URL: Source, https://github.com/maverikod/mcp-proxy-adapter
|
|
14
|
+
Project-URL: Tracker, https://github.com/maverikod/mcp-proxy-adapter/issues
|
|
15
|
+
Project-URL: PyPI, https://pypi.org/project/mcp-proxy-adapter/
|
|
16
|
+
Keywords: json-rpc,microservices,fastapi,security,authentication,authorization,proxy,mcp,mtls,ssl,rest,api
|
|
17
|
+
Classifier: Development Status :: 4 - Beta
|
|
18
|
+
Classifier: Intended Audience :: Developers
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Framework :: FastAPI
|
|
26
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
27
|
+
Classifier: Topic :: Security
|
|
28
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
29
|
+
Requires-Python: >=3.9
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
Requires-Dist: fastapi<1.0.0,>=0.95.0
|
|
32
|
+
Requires-Dist: pydantic>=2.0.0
|
|
33
|
+
Requires-Dist: hypercorn<1.0.0,>=0.15.0
|
|
34
|
+
Requires-Dist: docstring-parser<1.0.0,>=0.15
|
|
35
|
+
Requires-Dist: typing-extensions<5.0.0,>=4.5.0
|
|
36
|
+
Requires-Dist: jsonrpc>=1.2.0
|
|
37
|
+
Requires-Dist: psutil>=5.9.0
|
|
38
|
+
Requires-Dist: mcp_security_framework>=1.2.8
|
|
39
|
+
Requires-Dist: flask>=3.1.0
|
|
40
|
+
Requires-Dist: packaging>=20.0
|
|
41
|
+
Requires-Dist: aiohttp<4.0.0,>=3.8.0
|
|
42
|
+
Requires-Dist: httpx>=0.24.0
|
|
43
|
+
Requires-Dist: queuemgr>=1.0.5
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
46
|
+
Requires-Dist: pytest-asyncio>=0.20.0; extra == "dev"
|
|
47
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
48
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
49
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
50
|
+
Provides-Extra: test
|
|
51
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
52
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
|
|
53
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
|
54
|
+
Requires-Dist: httpx>=0.24.0; extra == "test"
|
|
55
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "test"
|
|
56
|
+
Provides-Extra: examples
|
|
57
|
+
Dynamic: author
|
|
58
|
+
Dynamic: home-page
|
|
59
|
+
Dynamic: maintainer
|
|
60
|
+
Dynamic: requires-python
|
|
61
|
+
|
|
62
|
+
# MCP Proxy Adapter
|
|
63
|
+
|
|
64
|
+
**Author:** Vasiliy Zdanovskiy
|
|
65
|
+
**Email:** vasilyvz@gmail.com
|
|
66
|
+
|
|
67
|
+
## Overview
|
|
68
|
+
|
|
69
|
+
MCP Proxy Adapter is a comprehensive framework for building JSON-RPC API servers with built-in security, SSL/TLS support, and proxy registration capabilities. It provides a unified interface for command execution, protocol management, and security enforcement.
|
|
70
|
+
|
|
71
|
+
## Features
|
|
72
|
+
|
|
73
|
+
- **JSON-RPC API**: Full JSON-RPC 2.0 support with built-in commands
|
|
74
|
+
- **Security Framework**: Integrated authentication, authorization, and SSL/TLS
|
|
75
|
+
- **Protocol Management**: HTTP, HTTPS, and mTLS protocol support
|
|
76
|
+
- **Proxy Registration**: Automatic registration with proxy servers
|
|
77
|
+
- **Command System**: Extensible command registry with built-in commands
|
|
78
|
+
- **Configuration Management**: Comprehensive configuration with environment variable overrides
|
|
79
|
+
|
|
80
|
+
## Quick Start
|
|
81
|
+
|
|
82
|
+
1. **Installation**:
|
|
83
|
+
```bash
|
|
84
|
+
pip install mcp-proxy-adapter
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
2. **Basic Configuration**:
|
|
88
|
+
```bash
|
|
89
|
+
# Use the comprehensive config with all options disabled by default
|
|
90
|
+
python -m mcp_proxy_adapter --config config.json
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
3. **Access the API**:
|
|
94
|
+
- Health check: `GET http://localhost:8000/health`
|
|
95
|
+
- JSON-RPC: `POST http://localhost:8000/api/jsonrpc`
|
|
96
|
+
- REST API: `POST http://localhost:8000/cmd`
|
|
97
|
+
- Documentation: `http://localhost:8000/docs`
|
|
98
|
+
|
|
99
|
+
## Configuration
|
|
100
|
+
|
|
101
|
+
The adapter uses a comprehensive JSON configuration file (`config.json`) that includes all available options. **All features are disabled by default** and must be explicitly enabled. The configuration system has **NO default values** - all configuration must be explicitly specified.
|
|
102
|
+
|
|
103
|
+
### Configuration Sections
|
|
104
|
+
|
|
105
|
+
#### 1. `uuid` (Root Level)
|
|
106
|
+
**Type**: `string` (UUID4 format)
|
|
107
|
+
**Required**: YES
|
|
108
|
+
**Description**: Unique identifier for the server instance
|
|
109
|
+
**Format**: `xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx`
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"uuid": "123e4567-e89b-42d3-a456-426614174000"
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### 2. `server` Section
|
|
118
|
+
**Required**: YES
|
|
119
|
+
**Description**: Core server configuration settings
|
|
120
|
+
|
|
121
|
+
| Field | Type | Required | Description | Allowed Values |
|
|
122
|
+
|-------|------|----------|-------------|----------------|
|
|
123
|
+
| `host` | string | YES | Server host address | Any valid IP or hostname |
|
|
124
|
+
| `port` | integer | YES | Server port number | 1-65535 |
|
|
125
|
+
| `protocol` | string | YES | Server protocol | `"http"`, `"https"`, `"mtls"` |
|
|
126
|
+
| `debug` | boolean | YES | Enable debug mode | `true`, `false` |
|
|
127
|
+
| `log_level` | string | YES | Logging level | `"DEBUG"`, `"INFO"`, `"WARNING"`, `"ERROR"` |
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"server": {
|
|
132
|
+
"host": "0.0.0.0",
|
|
133
|
+
"port": 8080,
|
|
134
|
+
"protocol": "http",
|
|
135
|
+
"debug": false,
|
|
136
|
+
"log_level": "INFO"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### 3. `logging` Section
|
|
142
|
+
**Required**: YES
|
|
143
|
+
**Description**: Logging configuration settings
|
|
144
|
+
|
|
145
|
+
| Field | Type | Required | Description |
|
|
146
|
+
|-------|------|----------|-------------|
|
|
147
|
+
| `level` | string | YES | Log level (`"INFO"`, `"DEBUG"`, `"WARNING"`, `"ERROR"`) |
|
|
148
|
+
| `log_dir` | string | YES | Directory for log files |
|
|
149
|
+
| `log_file` | string | YES | Main log file name |
|
|
150
|
+
| `error_log_file` | string | YES | Error log file name |
|
|
151
|
+
| `access_log_file` | string | YES | Access log file name |
|
|
152
|
+
| `max_file_size` | string/integer | YES | Maximum log file size (`"10MB"` or `10485760`) |
|
|
153
|
+
| `backup_count` | integer | YES | Number of backup log files |
|
|
154
|
+
| `format` | string | YES | Log message format (Python logging format string) |
|
|
155
|
+
| `date_format` | string | YES | Date format for logs |
|
|
156
|
+
| `console_output` | boolean | YES | Enable console logging |
|
|
157
|
+
| `file_output` | boolean | YES | Enable file logging |
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"logging": {
|
|
162
|
+
"level": "INFO",
|
|
163
|
+
"log_dir": "./logs",
|
|
164
|
+
"log_file": "mcp_proxy_adapter.log",
|
|
165
|
+
"error_log_file": "mcp_proxy_adapter_error.log",
|
|
166
|
+
"access_log_file": "mcp_proxy_adapter_access.log",
|
|
167
|
+
"max_file_size": "10MB",
|
|
168
|
+
"backup_count": 5,
|
|
169
|
+
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
170
|
+
"date_format": "%Y-%m-%d %H:%M:%S",
|
|
171
|
+
"console_output": true,
|
|
172
|
+
"file_output": true
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### 4. `commands` Section
|
|
178
|
+
**Required**: YES
|
|
179
|
+
**Description**: Command management configuration
|
|
180
|
+
|
|
181
|
+
| Field | Type | Required | Description |
|
|
182
|
+
|-------|------|----------|-------------|
|
|
183
|
+
| `auto_discovery` | boolean | YES | Enable automatic command discovery |
|
|
184
|
+
| `commands_directory` | string | YES | Directory for command files |
|
|
185
|
+
| `catalog_directory` | string | YES | Directory for command catalog |
|
|
186
|
+
| `plugin_servers` | array | YES | List of plugin server URLs |
|
|
187
|
+
| `auto_install_dependencies` | boolean | YES | Auto-install command dependencies |
|
|
188
|
+
| `enabled_commands` | array | YES | List of enabled commands |
|
|
189
|
+
| `disabled_commands` | array | YES | List of disabled commands |
|
|
190
|
+
| `custom_commands_path` | string | YES | Path to custom commands |
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"commands": {
|
|
195
|
+
"auto_discovery": true,
|
|
196
|
+
"commands_directory": "./commands",
|
|
197
|
+
"catalog_directory": "./catalog",
|
|
198
|
+
"plugin_servers": [],
|
|
199
|
+
"auto_install_dependencies": true,
|
|
200
|
+
"enabled_commands": ["health", "echo", "help"],
|
|
201
|
+
"disabled_commands": [],
|
|
202
|
+
"custom_commands_path": "./commands"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### 5. `transport` Section
|
|
208
|
+
**Required**: YES
|
|
209
|
+
**Description**: Transport layer configuration
|
|
210
|
+
|
|
211
|
+
| Field | Type | Required | Description | Allowed Values |
|
|
212
|
+
|-------|------|----------|-------------|----------------|
|
|
213
|
+
| `type` | string | YES | Transport type | `"http"`, `"https"`, `"mtls"` |
|
|
214
|
+
| `port` | integer/null | YES | Transport port (can be null) | 1-65535 or `null` |
|
|
215
|
+
| `verify_client` | boolean | YES | Enable client certificate verification | `true`, `false` |
|
|
216
|
+
| `chk_hostname` | boolean | YES | Enable hostname checking | `true`, `false` |
|
|
217
|
+
|
|
218
|
+
**Nested Section**: `transport.ssl` (when SSL/TLS is enabled)
|
|
219
|
+
|
|
220
|
+
| Field | Type | Required | Description |
|
|
221
|
+
|-------|------|----------|-------------|
|
|
222
|
+
| `enabled` | boolean | Conditional | Enable SSL/TLS |
|
|
223
|
+
| `cert_file` | string | Conditional | Path to SSL certificate file |
|
|
224
|
+
| `key_file` | string | Conditional | Path to SSL private key file |
|
|
225
|
+
| `ca_cert` | string | Optional | Path to CA certificate file |
|
|
226
|
+
| `verify_client` | boolean | Optional | Verify client certificates |
|
|
227
|
+
| `verify_ssl` | boolean | Optional | Verify SSL certificates |
|
|
228
|
+
| `verify_hostname` | boolean | Optional | Verify hostname in certificate |
|
|
229
|
+
| `verify_mode` | string | Optional | SSL verification mode: `"CERT_NONE"`, `"CERT_OPTIONAL"`, `"CERT_REQUIRED"` |
|
|
230
|
+
|
|
231
|
+
```json
|
|
232
|
+
{
|
|
233
|
+
"transport": {
|
|
234
|
+
"type": "https",
|
|
235
|
+
"port": 8443,
|
|
236
|
+
"verify_client": false,
|
|
237
|
+
"chk_hostname": true,
|
|
238
|
+
"ssl": {
|
|
239
|
+
"enabled": true,
|
|
240
|
+
"cert_file": "./certs/server.crt",
|
|
241
|
+
"key_file": "./certs/server.key",
|
|
242
|
+
"ca_cert": "./certs/ca.crt",
|
|
243
|
+
"verify_ssl": true,
|
|
244
|
+
"verify_hostname": true,
|
|
245
|
+
"verify_mode": "CERT_REQUIRED"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### 6. `ssl` Section (Root Level)
|
|
252
|
+
**Required**: Conditional (required for HTTPS/mTLS protocols)
|
|
253
|
+
**Description**: SSL/TLS configuration for server
|
|
254
|
+
|
|
255
|
+
| Field | Type | Required | Description |
|
|
256
|
+
|-------|------|----------|-------------|
|
|
257
|
+
| `enabled` | boolean | YES | Enable SSL/TLS |
|
|
258
|
+
| `cert_file` | string | YES | Path to SSL certificate file |
|
|
259
|
+
| `key_file` | string | YES | Path to SSL private key file |
|
|
260
|
+
| `ca_cert` | string | Optional | Path to CA certificate file (required for mTLS) |
|
|
261
|
+
|
|
262
|
+
```json
|
|
263
|
+
{
|
|
264
|
+
"ssl": {
|
|
265
|
+
"enabled": true,
|
|
266
|
+
"cert_file": "./certs/server.crt",
|
|
267
|
+
"key_file": "./certs/server.key",
|
|
268
|
+
"ca_cert": "./certs/ca.crt"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
#### 7. `proxy_registration` Section
|
|
274
|
+
**Required**: YES
|
|
275
|
+
**Description**: Proxy server registration configuration
|
|
276
|
+
|
|
277
|
+
| Field | Type | Required | Description |
|
|
278
|
+
|-------|------|----------|-------------|
|
|
279
|
+
| `enabled` | boolean | YES | Enable proxy registration |
|
|
280
|
+
| `proxy_url` | string | YES | Proxy server URL |
|
|
281
|
+
| `server_id` | string | YES | Unique server identifier |
|
|
282
|
+
| `server_name` | string | YES | Human-readable server name |
|
|
283
|
+
| `description` | string | YES | Server description |
|
|
284
|
+
| `version` | string | YES | Server version |
|
|
285
|
+
| `protocol` | string | Conditional | Registration protocol: `"http"`, `"https"`, `"mtls"` |
|
|
286
|
+
| `registration_timeout` | integer | YES | Registration timeout in seconds |
|
|
287
|
+
| `retry_attempts` | integer | YES | Number of retry attempts |
|
|
288
|
+
| `retry_delay` | integer | YES | Delay between retries in seconds |
|
|
289
|
+
| `auto_register_on_startup` | boolean | YES | Auto-register on startup |
|
|
290
|
+
| `auto_unregister_on_shutdown` | boolean | YES | Auto-unregister on shutdown |
|
|
291
|
+
| `uuid` | string | Optional | UUID for registration (UUID4 format) |
|
|
292
|
+
|
|
293
|
+
**Nested Section**: `proxy_registration.ssl` (when using HTTPS/mTLS)
|
|
294
|
+
|
|
295
|
+
| Field | Type | Required | Description |
|
|
296
|
+
|-------|------|----------|-------------|
|
|
297
|
+
| `enabled` | boolean | Conditional | Enable SSL for registration |
|
|
298
|
+
| `verify_ssl` | boolean | Conditional | Verify proxy SSL certificate |
|
|
299
|
+
| `verify_hostname` | boolean | Conditional | Verify proxy hostname |
|
|
300
|
+
| `verify_mode` | string | Conditional | SSL verification mode |
|
|
301
|
+
| `ca_cert` | string | Conditional | Path to CA certificate |
|
|
302
|
+
| `cert_file` | string | Conditional | Path to client certificate (for mTLS) |
|
|
303
|
+
| `key_file` | string | Conditional | Path to client key (for mTLS) |
|
|
304
|
+
|
|
305
|
+
**Nested Section**: `proxy_registration.heartbeat`
|
|
306
|
+
|
|
307
|
+
| Field | Type | Required | Description |
|
|
308
|
+
|-------|------|----------|-------------|
|
|
309
|
+
| `enabled` | boolean | Optional | Enable heartbeat |
|
|
310
|
+
| `interval` | integer | Optional | Heartbeat interval in seconds |
|
|
311
|
+
| `timeout` | integer | Optional | Heartbeat timeout in seconds |
|
|
312
|
+
| `retry_attempts` | integer | Optional | Number of retry attempts |
|
|
313
|
+
| `retry_delay` | integer | Optional | Delay between retries |
|
|
314
|
+
| `url` | string | Optional | Heartbeat endpoint URL |
|
|
315
|
+
|
|
316
|
+
```json
|
|
317
|
+
{
|
|
318
|
+
"proxy_registration": {
|
|
319
|
+
"enabled": true,
|
|
320
|
+
"proxy_url": "https://proxy.example.com:3005",
|
|
321
|
+
"server_id": "my-server-001",
|
|
322
|
+
"server_name": "My MCP Server",
|
|
323
|
+
"description": "Production MCP server",
|
|
324
|
+
"version": "1.0.0",
|
|
325
|
+
"protocol": "mtls",
|
|
326
|
+
"registration_timeout": 30,
|
|
327
|
+
"retry_attempts": 3,
|
|
328
|
+
"retry_delay": 5,
|
|
329
|
+
"auto_register_on_startup": true,
|
|
330
|
+
"auto_unregister_on_shutdown": true,
|
|
331
|
+
"ssl": {
|
|
332
|
+
"enabled": true,
|
|
333
|
+
"verify_ssl": true,
|
|
334
|
+
"verify_hostname": false,
|
|
335
|
+
"verify_mode": "CERT_REQUIRED",
|
|
336
|
+
"ca_cert": "./certs/ca.crt",
|
|
337
|
+
"cert_file": "./certs/client.crt",
|
|
338
|
+
"key_file": "./certs/client.key"
|
|
339
|
+
},
|
|
340
|
+
"heartbeat": {
|
|
341
|
+
"enabled": true,
|
|
342
|
+
"interval": 30,
|
|
343
|
+
"timeout": 10,
|
|
344
|
+
"retry_attempts": 3,
|
|
345
|
+
"retry_delay": 5,
|
|
346
|
+
"url": "/heartbeat"
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
#### 8. `security` Section
|
|
353
|
+
**Required**: YES
|
|
354
|
+
**Description**: Security framework configuration
|
|
355
|
+
|
|
356
|
+
| Field | Type | Required | Description |
|
|
357
|
+
|-------|------|----------|-------------|
|
|
358
|
+
| `enabled` | boolean | YES | Enable security framework |
|
|
359
|
+
| `tokens` | object | YES | Token-based authentication configuration |
|
|
360
|
+
| `roles` | object | YES | Role-based access control configuration |
|
|
361
|
+
| `roles_file` | string/null | YES | Path to roles configuration file |
|
|
362
|
+
|
|
363
|
+
**Nested Section**: `security.tokens`
|
|
364
|
+
|
|
365
|
+
| Field | Type | Description |
|
|
366
|
+
|-------|------|-------------|
|
|
367
|
+
| `admin` | string | Administrator token |
|
|
368
|
+
| `user` | string | User token |
|
|
369
|
+
| `readonly` | string | Read-only token |
|
|
370
|
+
| *(custom)* | string | Custom token names |
|
|
371
|
+
|
|
372
|
+
**Nested Section**: `security.roles`
|
|
373
|
+
|
|
374
|
+
| Field | Type | Description |
|
|
375
|
+
|-------|------|-------------|
|
|
376
|
+
| `admin` | array | Administrator role permissions |
|
|
377
|
+
| `user` | array | User role permissions |
|
|
378
|
+
| `readonly` | array | Read-only role permissions |
|
|
379
|
+
| *(custom)* | array | Custom role names |
|
|
380
|
+
|
|
381
|
+
```json
|
|
382
|
+
{
|
|
383
|
+
"security": {
|
|
384
|
+
"enabled": true,
|
|
385
|
+
"tokens": {
|
|
386
|
+
"admin": "admin-secret-key",
|
|
387
|
+
"user": "user-secret-key",
|
|
388
|
+
"readonly": "readonly-secret-key"
|
|
389
|
+
},
|
|
390
|
+
"roles": {
|
|
391
|
+
"admin": ["*"],
|
|
392
|
+
"user": ["health", "echo"],
|
|
393
|
+
"readonly": ["health"]
|
|
394
|
+
},
|
|
395
|
+
"roles_file": null
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
#### 9. `roles` Section
|
|
401
|
+
**Required**: YES
|
|
402
|
+
**Description**: Role-based access control configuration
|
|
403
|
+
|
|
404
|
+
| Field | Type | Required | Description |
|
|
405
|
+
|-------|------|----------|-------------|
|
|
406
|
+
| `enabled` | boolean | YES | Enable RBAC |
|
|
407
|
+
| `config_file` | string/null | YES | Path to roles configuration file |
|
|
408
|
+
| `default_policy` | object | YES | Default policy settings |
|
|
409
|
+
| `auto_load` | boolean | YES | Auto-load roles on startup |
|
|
410
|
+
| `validation_enabled` | boolean | YES | Enable role validation |
|
|
411
|
+
|
|
412
|
+
**Nested Section**: `roles.default_policy`
|
|
413
|
+
|
|
414
|
+
| Field | Type | Description |
|
|
415
|
+
|-------|------|-------------|
|
|
416
|
+
| `deny_by_default` | boolean | Deny access by default |
|
|
417
|
+
| `require_role_match` | boolean | Require exact role match |
|
|
418
|
+
| `case_sensitive` | boolean | Case-sensitive role matching |
|
|
419
|
+
| `allow_wildcard` | boolean | Allow wildcard permissions |
|
|
420
|
+
|
|
421
|
+
```json
|
|
422
|
+
{
|
|
423
|
+
"roles": {
|
|
424
|
+
"enabled": false,
|
|
425
|
+
"config_file": null,
|
|
426
|
+
"default_policy": {
|
|
427
|
+
"deny_by_default": true,
|
|
428
|
+
"require_role_match": true,
|
|
429
|
+
"case_sensitive": false,
|
|
430
|
+
"allow_wildcard": true
|
|
431
|
+
},
|
|
432
|
+
"auto_load": true,
|
|
433
|
+
"validation_enabled": true
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
#### 10. `debug` Section
|
|
439
|
+
**Required**: YES
|
|
440
|
+
**Description**: Debug mode configuration
|
|
441
|
+
|
|
442
|
+
| Field | Type | Required | Description | Allowed Values |
|
|
443
|
+
|-------|------|----------|-------------|----------------|
|
|
444
|
+
| `enabled` | boolean | YES | Enable debug mode | `true`, `false` |
|
|
445
|
+
| `level` | string | YES | Debug level | `"DEBUG"`, `"INFO"`, `"WARNING"`, `"ERROR"` |
|
|
446
|
+
|
|
447
|
+
```json
|
|
448
|
+
{
|
|
449
|
+
"debug": {
|
|
450
|
+
"enabled": false,
|
|
451
|
+
"level": "WARNING"
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Protocol-Specific Requirements
|
|
457
|
+
|
|
458
|
+
#### HTTP Protocol
|
|
459
|
+
**Required Sections**: `server`, `logging`, `commands`, `transport`, `debug`, `security`, `roles`
|
|
460
|
+
**SSL Required**: NO
|
|
461
|
+
**Client Verification**: NO
|
|
462
|
+
|
|
463
|
+
#### HTTPS Protocol
|
|
464
|
+
**Required Sections**: All sections + `ssl`
|
|
465
|
+
**SSL Required**: YES
|
|
466
|
+
**Client Verification**: NO
|
|
467
|
+
**Required Files**:
|
|
468
|
+
- `ssl.cert_file` - Server certificate
|
|
469
|
+
- `ssl.key_file` - Server private key
|
|
470
|
+
|
|
471
|
+
#### mTLS Protocol
|
|
472
|
+
**Required Sections**: All sections + `ssl`
|
|
473
|
+
**SSL Required**: YES
|
|
474
|
+
**Client Verification**: YES
|
|
475
|
+
**Required Files**:
|
|
476
|
+
- `ssl.cert_file` - Server certificate
|
|
477
|
+
- `ssl.key_file` - Server private key
|
|
478
|
+
- `ssl.ca_cert` - CA certificate for client verification
|
|
479
|
+
|
|
480
|
+
### Configuration Validation
|
|
481
|
+
|
|
482
|
+
The framework automatically validates configuration on load:
|
|
483
|
+
- **Required sections**: All mandatory configuration sections are present
|
|
484
|
+
- **Required keys**: All required keys within sections are present
|
|
485
|
+
- **Type validation**: All values have correct data types
|
|
486
|
+
- **File existence**: All referenced files exist (when features are enabled)
|
|
487
|
+
- **Feature dependencies**: All feature dependencies are satisfied
|
|
488
|
+
- **UUID format**: UUID4 format validation
|
|
489
|
+
- **Certificate validation**: Certificate format, expiration, key matching
|
|
490
|
+
|
|
491
|
+
### Complete Configuration Example
|
|
492
|
+
|
|
493
|
+
```json
|
|
494
|
+
{
|
|
495
|
+
"uuid": "123e4567-e89b-42d3-a456-426614174000",
|
|
496
|
+
"server": {
|
|
497
|
+
"host": "0.0.0.0",
|
|
498
|
+
"port": 8080,
|
|
499
|
+
"protocol": "mtls",
|
|
500
|
+
"debug": false,
|
|
501
|
+
"log_level": "INFO"
|
|
502
|
+
},
|
|
503
|
+
"logging": {
|
|
504
|
+
"level": "INFO",
|
|
505
|
+
"log_dir": "./logs",
|
|
506
|
+
"log_file": "mcp_proxy_adapter.log",
|
|
507
|
+
"error_log_file": "mcp_proxy_adapter_error.log",
|
|
508
|
+
"access_log_file": "mcp_proxy_adapter_access.log",
|
|
509
|
+
"max_file_size": "10MB",
|
|
510
|
+
"backup_count": 5,
|
|
511
|
+
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
512
|
+
"date_format": "%Y-%m-%d %H:%M:%S",
|
|
513
|
+
"console_output": true,
|
|
514
|
+
"file_output": true
|
|
515
|
+
},
|
|
516
|
+
"commands": {
|
|
517
|
+
"auto_discovery": true,
|
|
518
|
+
"commands_directory": "./commands",
|
|
519
|
+
"catalog_directory": "./catalog",
|
|
520
|
+
"plugin_servers": [],
|
|
521
|
+
"auto_install_dependencies": true,
|
|
522
|
+
"enabled_commands": ["health", "echo", "help"],
|
|
523
|
+
"disabled_commands": [],
|
|
524
|
+
"custom_commands_path": "./commands"
|
|
525
|
+
},
|
|
526
|
+
"transport": {
|
|
527
|
+
"type": "mtls",
|
|
528
|
+
"port": 8443,
|
|
529
|
+
"verify_client": true,
|
|
530
|
+
"chk_hostname": true,
|
|
531
|
+
"ssl": {
|
|
532
|
+
"enabled": true,
|
|
533
|
+
"cert_file": "./certs/server.crt",
|
|
534
|
+
"key_file": "./certs/server.key",
|
|
535
|
+
"ca_cert": "./certs/ca.crt",
|
|
536
|
+
"verify_ssl": true,
|
|
537
|
+
"verify_hostname": true,
|
|
538
|
+
"verify_mode": "CERT_REQUIRED"
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
"ssl": {
|
|
542
|
+
"enabled": true,
|
|
543
|
+
"cert_file": "./certs/server.crt",
|
|
544
|
+
"key_file": "./certs/server.key",
|
|
545
|
+
"ca_cert": "./certs/ca.crt"
|
|
546
|
+
},
|
|
547
|
+
"proxy_registration": {
|
|
548
|
+
"enabled": true,
|
|
549
|
+
"proxy_url": "https://proxy.example.com:3005",
|
|
550
|
+
"server_id": "my-server-001",
|
|
551
|
+
"server_name": "My MCP Server",
|
|
552
|
+
"description": "Production MCP server",
|
|
553
|
+
"version": "1.0.0",
|
|
554
|
+
"protocol": "mtls",
|
|
555
|
+
"registration_timeout": 30,
|
|
556
|
+
"retry_attempts": 3,
|
|
557
|
+
"retry_delay": 5,
|
|
558
|
+
"auto_register_on_startup": true,
|
|
559
|
+
"auto_unregister_on_shutdown": true,
|
|
560
|
+
"ssl": {
|
|
561
|
+
"enabled": true,
|
|
562
|
+
"verify_ssl": true,
|
|
563
|
+
"verify_hostname": false,
|
|
564
|
+
"verify_mode": "CERT_REQUIRED",
|
|
565
|
+
"ca_cert": "./certs/ca.crt",
|
|
566
|
+
"cert_file": "./certs/client.crt",
|
|
567
|
+
"key_file": "./certs/client.key"
|
|
568
|
+
},
|
|
569
|
+
"heartbeat": {
|
|
570
|
+
"enabled": true,
|
|
571
|
+
"interval": 30,
|
|
572
|
+
"timeout": 10,
|
|
573
|
+
"retry_attempts": 3,
|
|
574
|
+
"retry_delay": 5,
|
|
575
|
+
"url": "/heartbeat"
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
"debug": {
|
|
579
|
+
"enabled": false,
|
|
580
|
+
"level": "WARNING"
|
|
581
|
+
},
|
|
582
|
+
"security": {
|
|
583
|
+
"enabled": true,
|
|
584
|
+
"tokens": {
|
|
585
|
+
"admin": "admin-secret-key",
|
|
586
|
+
"user": "user-secret-key",
|
|
587
|
+
"readonly": "readonly-secret-key"
|
|
588
|
+
},
|
|
589
|
+
"roles": {
|
|
590
|
+
"admin": ["*"],
|
|
591
|
+
"user": ["health", "echo"],
|
|
592
|
+
"readonly": ["health"]
|
|
593
|
+
},
|
|
594
|
+
"roles_file": null
|
|
595
|
+
},
|
|
596
|
+
"roles": {
|
|
597
|
+
"enabled": false,
|
|
598
|
+
"config_file": null,
|
|
599
|
+
"default_policy": {
|
|
600
|
+
"deny_by_default": true,
|
|
601
|
+
"require_role_match": true,
|
|
602
|
+
"case_sensitive": false,
|
|
603
|
+
"allow_wildcard": true
|
|
604
|
+
},
|
|
605
|
+
"auto_load": true,
|
|
606
|
+
"validation_enabled": true
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
For more detailed configuration documentation, see `docs/EN/ALL_CONFIG_SETTINGS.md`.
|
|
612
|
+
|
|
613
|
+
## Built-in Commands
|
|
614
|
+
|
|
615
|
+
- `health` - Server health check
|
|
616
|
+
- `echo` - Echo test command
|
|
617
|
+
- `config` - Configuration management
|
|
618
|
+
- `help` - Command help and documentation
|
|
619
|
+
- `reload` - Configuration reload
|
|
620
|
+
- `settings` - Settings management
|
|
621
|
+
- `load`/`unload` - Command loading/unloading
|
|
622
|
+
- `plugins` - Plugin management
|
|
623
|
+
- `proxy_registration` - Proxy registration control
|
|
624
|
+
- `transport_management` - Transport protocol management
|
|
625
|
+
- `role_test` - Role-based access testing
|
|
626
|
+
|
|
627
|
+
## Security Features
|
|
628
|
+
|
|
629
|
+
- **Authentication**: API keys, JWT tokens, certificate-based auth
|
|
630
|
+
- **Authorization**: Role-based permissions with wildcard support
|
|
631
|
+
- **SSL/TLS**: Full SSL/TLS and mTLS support
|
|
632
|
+
- **Rate Limiting**: Configurable request rate limiting
|
|
633
|
+
- **Security Headers**: Automatic security header injection
|
|
634
|
+
|
|
635
|
+
## Examples
|
|
636
|
+
|
|
637
|
+
The `mcp_proxy_adapter/examples/` directory contains comprehensive examples for different use cases:
|
|
638
|
+
|
|
639
|
+
- **Basic Framework**: Simple HTTP server setup
|
|
640
|
+
- **Full Application**: Complete application with custom commands and hooks
|
|
641
|
+
- **Security Testing**: Comprehensive security test suite
|
|
642
|
+
- **Certificate Generation**: SSL/TLS certificate management
|
|
643
|
+
|
|
644
|
+
### Test Environment Setup
|
|
645
|
+
|
|
646
|
+
The framework includes a comprehensive test environment setup that automatically creates configurations, generates certificates, and runs tests:
|
|
647
|
+
|
|
648
|
+
```bash
|
|
649
|
+
# Create a complete test environment with all configurations and certificates
|
|
650
|
+
python -m mcp_proxy_adapter.examples.setup_test_environment
|
|
651
|
+
|
|
652
|
+
# Create test environment in a specific directory
|
|
653
|
+
python -m mcp_proxy_adapter.examples.setup_test_environment /path/to/test/dir
|
|
654
|
+
|
|
655
|
+
# Skip certificate generation (use existing certificates)
|
|
656
|
+
python -m mcp_proxy_adapter.examples.setup_test_environment --skip-certs
|
|
657
|
+
|
|
658
|
+
# Skip running tests (setup only)
|
|
659
|
+
python -m mcp_proxy_adapter.examples.setup_test_environment --skip-tests
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
### Configuration Generation
|
|
663
|
+
|
|
664
|
+
Generate test configurations from a comprehensive template:
|
|
665
|
+
|
|
666
|
+
```bash
|
|
667
|
+
# Generate all test configurations
|
|
668
|
+
python -m mcp_proxy_adapter.examples.create_test_configs
|
|
669
|
+
|
|
670
|
+
# Generate from specific comprehensive config
|
|
671
|
+
python -m mcp_proxy_adapter.examples.create_test_configs --comprehensive-config config.json
|
|
672
|
+
|
|
673
|
+
# Generate specific configuration types
|
|
674
|
+
python -m mcp_proxy_adapter.examples.create_test_configs --types http,https,mtls
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
### Certificate Generation
|
|
678
|
+
|
|
679
|
+
Generate SSL/TLS certificates for testing:
|
|
680
|
+
|
|
681
|
+
```bash
|
|
682
|
+
# Generate all certificates using mcp_security_framework
|
|
683
|
+
python -m mcp_proxy_adapter.examples.generate_all_certificates
|
|
684
|
+
|
|
685
|
+
# Generate certificates with custom configuration
|
|
686
|
+
python -m mcp_proxy_adapter.examples.generate_certificates_framework --config cert_config.json
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
### Security Testing
|
|
690
|
+
|
|
691
|
+
Run comprehensive security tests:
|
|
692
|
+
|
|
693
|
+
```bash
|
|
694
|
+
# Run all security tests
|
|
695
|
+
python -m mcp_proxy_adapter.examples.run_security_tests_fixed
|
|
696
|
+
|
|
697
|
+
# Run full test suite (includes setup, config generation, certificate generation, and testing)
|
|
698
|
+
python -m mcp_proxy_adapter.examples.run_full_test_suite
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
### Complete Workflow Example
|
|
702
|
+
|
|
703
|
+
```bash
|
|
704
|
+
# 1. Install the package
|
|
705
|
+
pip install mcp-proxy-adapter
|
|
706
|
+
|
|
707
|
+
# 2. Create test environment (automatically runs tests)
|
|
708
|
+
python -m mcp_proxy_adapter.examples.setup_test_environment
|
|
709
|
+
|
|
710
|
+
# 3. Or run individual steps:
|
|
711
|
+
# Generate certificates
|
|
712
|
+
python -m mcp_proxy_adapter.examples.generate_all_certificates
|
|
713
|
+
|
|
714
|
+
# Generate configurations
|
|
715
|
+
python -m mcp_proxy_adapter.examples.create_test_configs
|
|
716
|
+
|
|
717
|
+
# Run security tests
|
|
718
|
+
python -m mcp_proxy_adapter.examples.run_security_tests_fixed
|
|
719
|
+
|
|
720
|
+
# 4. Start server with generated configuration
|
|
721
|
+
python -m mcp_proxy_adapter --config configs/http_simple.json
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
## Development
|
|
725
|
+
|
|
726
|
+
The project follows a modular architecture:
|
|
727
|
+
|
|
728
|
+
- `mcp_proxy_adapter/api/` - FastAPI application and handlers
|
|
729
|
+
- `mcp_proxy_adapter/commands/` - Command system and built-in commands
|
|
730
|
+
- `mcp_proxy_adapter/core/` - Core functionality and utilities
|
|
731
|
+
- `mcp_proxy_adapter/config.py` - Configuration management
|
|
732
|
+
|
|
733
|
+
## License
|
|
734
|
+
|
|
735
|
+
This project is licensed under the MIT License.
|
|
736
|
+
|
|
737
|
+
## Support
|
|
738
|
+
|
|
739
|
+
For issues and questions, please contact vasilyvz@gmail.com.
|