mcp-proxy-adapter 6.1.0__py3-none-any.whl → 6.2.0__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/__main__.py +27 -7
- mcp_proxy_adapter/api/app.py +18 -7
- mcp_proxy_adapter/api/middleware/__init__.py +2 -2
- mcp_proxy_adapter/api/middleware/protocol_middleware.py +32 -13
- mcp_proxy_adapter/api/middleware/unified_security.py +12 -4
- mcp_proxy_adapter/commands/ssl_setup_command.py +234 -351
- mcp_proxy_adapter/core/app_factory.py +87 -3
- mcp_proxy_adapter/core/app_runner.py +272 -0
- mcp_proxy_adapter/core/certificate_utils.py +291 -73
- mcp_proxy_adapter/core/client.py +574 -0
- mcp_proxy_adapter/core/client_manager.py +284 -0
- mcp_proxy_adapter/core/protocol_manager.py +132 -10
- mcp_proxy_adapter/core/security_integration.py +19 -11
- mcp_proxy_adapter/core/server_adapter.py +17 -80
- mcp_proxy_adapter/core/server_engine.py +5 -99
- mcp_proxy_adapter/core/ssl_utils.py +13 -12
- mcp_proxy_adapter/core/transport_manager.py +5 -5
- mcp_proxy_adapter/examples/__init__.py +16 -0
- mcp_proxy_adapter/examples/basic_framework/__init__.py +7 -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 +21 -40
- mcp_proxy_adapter/examples/commands/__init__.py +5 -1
- mcp_proxy_adapter/examples/create_certificates_simple.py +260 -75
- mcp_proxy_adapter/examples/debug_request_state.py +4 -36
- mcp_proxy_adapter/examples/debug_role_chain.py +2 -49
- mcp_proxy_adapter/examples/demo_client.py +0 -66
- mcp_proxy_adapter/examples/full_application/__init__.py +11 -0
- mcp_proxy_adapter/examples/full_application/commands/__init__.py +7 -0
- mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py +0 -19
- mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py +0 -16
- mcp_proxy_adapter/examples/full_application/hooks/__init__.py +7 -0
- mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py +0 -22
- mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py +0 -24
- mcp_proxy_adapter/examples/full_application/main.py +65 -44
- mcp_proxy_adapter/examples/full_application/proxy_endpoints.py +154 -0
- mcp_proxy_adapter/examples/generate_all_certificates.py +0 -67
- mcp_proxy_adapter/examples/generate_certificates.py +0 -15
- mcp_proxy_adapter/examples/generate_certificates_and_tokens.py +369 -0
- mcp_proxy_adapter/examples/generate_test_configs.py +204 -0
- mcp_proxy_adapter/examples/proxy_registration_example.py +3 -70
- mcp_proxy_adapter/examples/run_example.py +1 -23
- mcp_proxy_adapter/examples/run_security_tests.py +2 -60
- mcp_proxy_adapter/examples/run_security_tests_fixed.py +0 -53
- mcp_proxy_adapter/examples/security_test_client.py +18 -123
- mcp_proxy_adapter/examples/setup_test_environment.py +179 -0
- mcp_proxy_adapter/examples/test_config.py +148 -0
- mcp_proxy_adapter/examples/test_config_generator.py +86 -0
- mcp_proxy_adapter/examples/test_examples.py +4 -67
- mcp_proxy_adapter/examples/universal_client.py +154 -162
- mcp_proxy_adapter/main.py +51 -161
- mcp_proxy_adapter/utils/config_generator.py +90 -2
- mcp_proxy_adapter/version.py +4 -2
- mcp_proxy_adapter-6.2.0.dist-info/METADATA +687 -0
- mcp_proxy_adapter-6.2.0.dist-info/RECORD +122 -0
- mcp_proxy_adapter/examples/README.md +0 -257
- mcp_proxy_adapter/examples/README_EN.md +0 -258
- mcp_proxy_adapter/examples/SECURITY_TESTING.md +0 -455
- mcp_proxy_adapter/examples/__pycache__/security_configurations.cpython-312.pyc +0 -0
- mcp_proxy_adapter/examples/__pycache__/security_test_client.cpython-312.pyc +0 -0
- mcp_proxy_adapter/examples/basic_framework/configs/http_auth.json +0 -37
- mcp_proxy_adapter/examples/basic_framework/configs/http_simple.json +0 -23
- mcp_proxy_adapter/examples/basic_framework/configs/https_auth.json +0 -39
- mcp_proxy_adapter/examples/basic_framework/configs/https_simple.json +0 -25
- mcp_proxy_adapter/examples/basic_framework/configs/mtls_no_roles.json +0 -39
- mcp_proxy_adapter/examples/basic_framework/configs/mtls_with_roles.json +0 -45
- mcp_proxy_adapter/examples/basic_framework/roles.json +0 -21
- mcp_proxy_adapter/examples/cert_config.json +0 -9
- mcp_proxy_adapter/examples/certs/admin.crt +0 -32
- mcp_proxy_adapter/examples/certs/admin.key +0 -52
- mcp_proxy_adapter/examples/certs/admin_cert.pem +0 -21
- mcp_proxy_adapter/examples/certs/admin_key.pem +0 -28
- mcp_proxy_adapter/examples/certs/ca_cert.pem +0 -23
- mcp_proxy_adapter/examples/certs/ca_cert.srl +0 -1
- mcp_proxy_adapter/examples/certs/ca_key.pem +0 -28
- mcp_proxy_adapter/examples/certs/cert_config.json +0 -9
- mcp_proxy_adapter/examples/certs/client.crt +0 -32
- mcp_proxy_adapter/examples/certs/client.key +0 -52
- mcp_proxy_adapter/examples/certs/client_admin.crt +0 -32
- mcp_proxy_adapter/examples/certs/client_admin.key +0 -52
- mcp_proxy_adapter/examples/certs/client_user.crt +0 -32
- mcp_proxy_adapter/examples/certs/client_user.key +0 -52
- mcp_proxy_adapter/examples/certs/guest_cert.pem +0 -21
- mcp_proxy_adapter/examples/certs/guest_key.pem +0 -28
- mcp_proxy_adapter/examples/certs/mcp_proxy_adapter_ca_ca.crt +0 -23
- mcp_proxy_adapter/examples/certs/proxy_cert.pem +0 -21
- mcp_proxy_adapter/examples/certs/proxy_key.pem +0 -28
- mcp_proxy_adapter/examples/certs/readonly.crt +0 -32
- mcp_proxy_adapter/examples/certs/readonly.key +0 -52
- mcp_proxy_adapter/examples/certs/readonly_cert.pem +0 -21
- mcp_proxy_adapter/examples/certs/readonly_key.pem +0 -28
- mcp_proxy_adapter/examples/certs/server.crt +0 -32
- mcp_proxy_adapter/examples/certs/server.key +0 -52
- mcp_proxy_adapter/examples/certs/server_cert.pem +0 -32
- mcp_proxy_adapter/examples/certs/server_key.pem +0 -52
- mcp_proxy_adapter/examples/certs/test_ca_ca.crt +0 -20
- mcp_proxy_adapter/examples/certs/user.crt +0 -32
- mcp_proxy_adapter/examples/certs/user.key +0 -52
- mcp_proxy_adapter/examples/certs/user_cert.pem +0 -21
- mcp_proxy_adapter/examples/certs/user_key.pem +0 -28
- mcp_proxy_adapter/examples/client_configs/api_key_client.json +0 -13
- mcp_proxy_adapter/examples/client_configs/basic_auth_client.json +0 -13
- mcp_proxy_adapter/examples/client_configs/certificate_client.json +0 -22
- mcp_proxy_adapter/examples/client_configs/jwt_client.json +0 -15
- mcp_proxy_adapter/examples/client_configs/no_auth_client.json +0 -9
- mcp_proxy_adapter/examples/full_application/configs/http_auth.json +0 -37
- mcp_proxy_adapter/examples/full_application/configs/http_simple.json +0 -23
- mcp_proxy_adapter/examples/full_application/configs/https_auth.json +0 -39
- mcp_proxy_adapter/examples/full_application/configs/https_simple.json +0 -25
- mcp_proxy_adapter/examples/full_application/configs/mtls_no_roles.json +0 -39
- mcp_proxy_adapter/examples/full_application/configs/mtls_with_roles.json +0 -45
- mcp_proxy_adapter/examples/full_application/roles.json +0 -21
- mcp_proxy_adapter/examples/keys/ca_key.pem +0 -28
- mcp_proxy_adapter/examples/keys/mcp_proxy_adapter_ca_ca.key +0 -28
- mcp_proxy_adapter/examples/keys/test_ca_ca.key +0 -28
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log +0 -220
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.1 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.2 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.3 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.4 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.5 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log +0 -220
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.1 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.2 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.3 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.4 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.5 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log +0 -2
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.1 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.2 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.3 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.4 +0 -1
- mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.5 +0 -1
- mcp_proxy_adapter/examples/roles.json +0 -38
- mcp_proxy_adapter/examples/server_configs/config_basic_http.json +0 -204
- mcp_proxy_adapter/examples/server_configs/config_http_token.json +0 -238
- mcp_proxy_adapter/examples/server_configs/config_https.json +0 -215
- mcp_proxy_adapter/examples/server_configs/config_https_token.json +0 -231
- mcp_proxy_adapter/examples/server_configs/config_mtls.json +0 -215
- mcp_proxy_adapter/examples/server_configs/config_proxy_registration.json +0 -250
- mcp_proxy_adapter/examples/server_configs/config_simple.json +0 -46
- mcp_proxy_adapter/examples/server_configs/roles.json +0 -38
- mcp_proxy_adapter-6.1.0.dist-info/METADATA +0 -205
- mcp_proxy_adapter-6.1.0.dist-info/RECORD +0 -193
- {mcp_proxy_adapter-6.1.0.dist-info → mcp_proxy_adapter-6.2.0.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-6.1.0.dist-info → mcp_proxy_adapter-6.2.0.dist-info}/entry_points.txt +0 -0
- {mcp_proxy_adapter-6.1.0.dist-info → mcp_proxy_adapter-6.2.0.dist-info}/licenses/LICENSE +0 -0
- {mcp_proxy_adapter-6.1.0.dist-info → mcp_proxy_adapter-6.2.0.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
"""
|
2
2
|
Server Engine Abstraction
|
3
3
|
|
4
|
-
This module provides an abstraction layer for
|
5
|
-
|
4
|
+
This module provides an abstraction layer for the hypercorn ASGI server engine,
|
5
|
+
providing full mTLS support and SSL capabilities.
|
6
6
|
|
7
7
|
Author: Vasiliy Zdanovskiy
|
8
8
|
email: vasilyvz@gmail.com
|
@@ -74,97 +74,6 @@ class ServerEngine(ABC):
|
|
74
74
|
pass
|
75
75
|
|
76
76
|
|
77
|
-
class UvicornEngine(ServerEngine):
|
78
|
-
"""
|
79
|
-
Uvicorn server engine implementation.
|
80
|
-
|
81
|
-
Provides basic SSL/TLS support but limited mTLS capabilities.
|
82
|
-
"""
|
83
|
-
|
84
|
-
def get_name(self) -> str:
|
85
|
-
return "uvicorn"
|
86
|
-
|
87
|
-
def get_supported_features(self) -> Dict[str, bool]:
|
88
|
-
return {
|
89
|
-
"ssl_tls": True,
|
90
|
-
"mtls_client_certs": False, # Limited support
|
91
|
-
"ssl_scope_info": False, # No SSL info in request scope
|
92
|
-
"client_cert_verification": False,
|
93
|
-
"websockets": True,
|
94
|
-
"http2": True,
|
95
|
-
"reload": True
|
96
|
-
}
|
97
|
-
|
98
|
-
def get_config_schema(self) -> Dict[str, Any]:
|
99
|
-
return {
|
100
|
-
"host": {"type": "string", "default": "127.0.0.1"},
|
101
|
-
"port": {"type": "integer", "default": 8000},
|
102
|
-
"log_level": {"type": "string", "default": "info"},
|
103
|
-
"ssl_certfile": {"type": "string", "optional": True},
|
104
|
-
"ssl_keyfile": {"type": "string", "optional": True},
|
105
|
-
"ssl_ca_certs": {"type": "string", "optional": True},
|
106
|
-
"ssl_cert_reqs": {"type": "integer", "optional": True},
|
107
|
-
"reload": {"type": "boolean", "default": False},
|
108
|
-
"workers": {"type": "integer", "optional": True}
|
109
|
-
}
|
110
|
-
|
111
|
-
def validate_config(self, config: Dict[str, Any]) -> bool:
|
112
|
-
"""Validate uvicorn configuration."""
|
113
|
-
required_fields = ["host", "port"]
|
114
|
-
|
115
|
-
for field in required_fields:
|
116
|
-
if field not in config:
|
117
|
-
logger.error(f"Missing required field: {field}")
|
118
|
-
return False
|
119
|
-
|
120
|
-
# Validate SSL files exist if specified
|
121
|
-
ssl_files = ["ssl_certfile", "ssl_keyfile", "ssl_ca_certs"]
|
122
|
-
for ssl_file in ssl_files:
|
123
|
-
if ssl_file in config and config[ssl_file]:
|
124
|
-
if not Path(config[ssl_file]).exists():
|
125
|
-
logger.error(f"SSL file not found: {config[ssl_file]}")
|
126
|
-
return False
|
127
|
-
|
128
|
-
return True
|
129
|
-
|
130
|
-
def run_server(self, app: Any, config: Dict[str, Any]) -> None:
|
131
|
-
"""Run uvicorn server."""
|
132
|
-
try:
|
133
|
-
import uvicorn
|
134
|
-
|
135
|
-
# Prepare uvicorn config
|
136
|
-
uvicorn_config = {
|
137
|
-
"host": config.get("host", "127.0.0.1"),
|
138
|
-
"port": config.get("port", 8000),
|
139
|
-
"log_level": config.get("log_level", "info").lower(),
|
140
|
-
"reload": config.get("reload", False)
|
141
|
-
}
|
142
|
-
|
143
|
-
# Add SSL configuration if provided
|
144
|
-
if "ssl_certfile" in config and config["ssl_certfile"]:
|
145
|
-
uvicorn_config["ssl_certfile"] = config["ssl_certfile"]
|
146
|
-
if "ssl_keyfile" in config and config["ssl_keyfile"]:
|
147
|
-
uvicorn_config["ssl_keyfile"] = config["ssl_keyfile"]
|
148
|
-
if "ssl_ca_certs" in config and config["ssl_ca_certs"]:
|
149
|
-
uvicorn_config["ssl_ca_certs"] = config["ssl_ca_certs"]
|
150
|
-
if "ssl_cert_reqs" in config and config["ssl_cert_reqs"]:
|
151
|
-
uvicorn_config["ssl_cert_reqs"] = config["ssl_cert_reqs"]
|
152
|
-
|
153
|
-
# Add workers if specified
|
154
|
-
if "workers" in config and config["workers"]:
|
155
|
-
uvicorn_config["workers"] = config["workers"]
|
156
|
-
|
157
|
-
logger.info(f"Starting uvicorn server with config: {uvicorn_config}")
|
158
|
-
uvicorn.run(app, **uvicorn_config)
|
159
|
-
|
160
|
-
except ImportError:
|
161
|
-
logger.error("uvicorn not installed. Install with: pip install uvicorn[standard]")
|
162
|
-
raise
|
163
|
-
except Exception as e:
|
164
|
-
logger.error(f"Failed to start uvicorn server: {e}")
|
165
|
-
raise
|
166
|
-
|
167
|
-
|
168
77
|
class HypercornEngine(ServerEngine):
|
169
78
|
"""
|
170
79
|
Hypercorn server engine implementation.
|
@@ -347,17 +256,14 @@ class ServerEngineFactory:
|
|
347
256
|
@classmethod
|
348
257
|
def initialize_default_engines(cls) -> None:
|
349
258
|
"""Initialize default server engines."""
|
350
|
-
#
|
259
|
+
# Register hypercorn engine (only supported engine)
|
351
260
|
try:
|
352
261
|
import hypercorn
|
353
262
|
cls.register_engine(HypercornEngine())
|
354
263
|
logger.info("Hypercorn engine registered (full mTLS support available)")
|
355
264
|
except ImportError:
|
356
|
-
logger.
|
357
|
-
|
358
|
-
# Register uvicorn engine as fallback
|
359
|
-
cls.register_engine(UvicornEngine())
|
360
|
-
logger.info("Uvicorn engine registered (fallback)")
|
265
|
+
logger.error("Hypercorn not available - this is required for the framework")
|
266
|
+
raise
|
361
267
|
|
362
268
|
|
363
269
|
# Initialize default engines
|
@@ -201,33 +201,34 @@ class SSLUtils:
|
|
201
201
|
return min_tls <= max_tls
|
202
202
|
|
203
203
|
@staticmethod
|
204
|
-
def
|
204
|
+
def get_ssl_config_for_hypercorn(ssl_config: Dict[str, Any]) -> Dict[str, Any]:
|
205
205
|
"""
|
206
|
-
Get SSL configuration for
|
206
|
+
Get SSL configuration for hypercorn from transport configuration.
|
207
207
|
|
208
208
|
Args:
|
209
209
|
ssl_config: SSL configuration from transport manager
|
210
210
|
|
211
211
|
Returns:
|
212
|
-
Configuration for
|
212
|
+
Configuration for hypercorn
|
213
213
|
"""
|
214
|
-
|
214
|
+
hypercorn_ssl = {}
|
215
215
|
|
216
216
|
if not ssl_config:
|
217
|
-
return
|
217
|
+
return hypercorn_ssl
|
218
218
|
|
219
219
|
# Basic SSL parameters
|
220
220
|
if ssl_config.get("cert_file"):
|
221
|
-
|
221
|
+
hypercorn_ssl["certfile"] = ssl_config["cert_file"]
|
222
222
|
|
223
223
|
if ssl_config.get("key_file"):
|
224
|
-
|
224
|
+
hypercorn_ssl["keyfile"] = ssl_config["key_file"]
|
225
225
|
|
226
226
|
if ssl_config.get("ca_cert"):
|
227
|
-
|
227
|
+
hypercorn_ssl["ca_certs"] = ssl_config["ca_cert"]
|
228
228
|
|
229
|
-
#
|
230
|
-
|
229
|
+
# Client verification mode
|
230
|
+
if ssl_config.get("verify_client", False):
|
231
|
+
hypercorn_ssl["verify_mode"] = "CERT_REQUIRED"
|
231
232
|
|
232
|
-
logger.info(f"Generated
|
233
|
-
return
|
233
|
+
logger.info(f"Generated hypercorn SSL config: {hypercorn_ssl}")
|
234
|
+
return hypercorn_ssl
|
@@ -265,12 +265,12 @@ class TransportManager:
|
|
265
265
|
logger.info(f"All SSL files validated successfully: {files_to_check}")
|
266
266
|
return True
|
267
267
|
|
268
|
-
def
|
268
|
+
def get_hypercorn_config(self) -> Dict[str, Any]:
|
269
269
|
"""
|
270
|
-
Get configuration for
|
270
|
+
Get configuration for hypercorn.
|
271
271
|
|
272
272
|
Returns:
|
273
|
-
|
273
|
+
Hypercorn configuration dictionary
|
274
274
|
"""
|
275
275
|
config = {
|
276
276
|
"host": "0.0.0.0", # Can be moved to settings
|
@@ -282,8 +282,8 @@ class TransportManager:
|
|
282
282
|
ssl_config = self.get_ssl_config()
|
283
283
|
if ssl_config:
|
284
284
|
from mcp_proxy_adapter.core.ssl_utils import SSLUtils
|
285
|
-
|
286
|
-
config.update(
|
285
|
+
hypercorn_ssl = SSLUtils.get_ssl_config_for_hypercorn(ssl_config)
|
286
|
+
config.update(hypercorn_ssl)
|
287
287
|
|
288
288
|
return config
|
289
289
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"""MCP Proxy Adapter Examples Package.
|
2
|
+
|
3
|
+
This package contains comprehensive examples demonstrating various
|
4
|
+
features and usage patterns of the MCP Proxy Adapter framework.
|
5
|
+
|
6
|
+
Examples include:
|
7
|
+
- Basic framework usage
|
8
|
+
- Full application with proxy registration
|
9
|
+
- Security configurations (HTTP, HTTPS, mTLS)
|
10
|
+
- Client implementations
|
11
|
+
- Command creation and registration
|
12
|
+
|
13
|
+
For detailed documentation, see the main README.md file.
|
14
|
+
"""
|
15
|
+
|
16
|
+
__version__ = "6.2.0"
|
@@ -1,63 +1,44 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
2
|
"""
|
3
|
-
Basic Framework Example
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
Basic Framework Example
|
4
|
+
This example demonstrates the basic usage of the MCP Proxy Adapter framework
|
5
|
+
with minimal configuration and built-in commands.
|
7
6
|
Author: Vasiliy Zdanovskiy
|
8
7
|
email: vasilyvz@gmail.com
|
9
8
|
"""
|
10
|
-
|
11
9
|
import sys
|
12
10
|
import argparse
|
13
11
|
from pathlib import Path
|
14
|
-
|
15
12
|
# Add the framework to the path
|
16
13
|
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
17
|
-
|
18
|
-
from mcp_proxy_adapter.api.app import create_app
|
19
|
-
from mcp_proxy_adapter.config import Config
|
20
|
-
|
21
|
-
|
14
|
+
from mcp_proxy_adapter.core.app_factory import create_and_run_server
|
22
15
|
def main():
|
23
16
|
"""Main entry point for the basic framework example."""
|
24
17
|
parser = argparse.ArgumentParser(description="Basic Framework Example")
|
25
18
|
parser.add_argument("--config", "-c", required=True, help="Path to configuration file")
|
26
|
-
parser.add_argument("--host",
|
27
|
-
parser.add_argument("--port", type=int, help="Server port
|
19
|
+
parser.add_argument("--host", help="Server host")
|
20
|
+
parser.add_argument("--port", type=int, help="Server port")
|
28
21
|
parser.add_argument("--debug", action="store_true", help="Enable debug mode")
|
29
|
-
|
30
22
|
args = parser.parse_args()
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# Override port if specified
|
23
|
+
# Override configuration if specified
|
24
|
+
config_overrides = {}
|
25
|
+
if args.host:
|
26
|
+
config_overrides["host"] = args.host
|
36
27
|
if args.port:
|
37
|
-
|
38
|
-
|
39
|
-
# Override debug if specified
|
28
|
+
config_overrides["port"] = args.port
|
40
29
|
if args.debug:
|
41
|
-
|
42
|
-
|
43
|
-
# Create application
|
44
|
-
app = create_app(app_config=config)
|
45
|
-
|
46
|
-
# Get server configuration
|
47
|
-
host = config.get("server.host", "0.0.0.0")
|
48
|
-
port = config.get("server.port", 8000)
|
49
|
-
debug = config.get("server.debug", False)
|
50
|
-
|
30
|
+
config_overrides["debug"] = True
|
51
31
|
print(f"🚀 Starting Basic Framework Example")
|
52
32
|
print(f"📋 Configuration: {args.config}")
|
53
|
-
print(f"🌐 Server: {host}:{port}")
|
54
|
-
print(f"🔧 Debug: {debug}")
|
55
33
|
print("=" * 50)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
34
|
+
# Use the factory method to create and run the server
|
35
|
+
create_and_run_server(
|
36
|
+
config_path=args.config,
|
37
|
+
title="Basic Framework Example",
|
38
|
+
description="Basic MCP Proxy Adapter with minimal configuration",
|
39
|
+
version="1.0.0",
|
40
|
+
host=config_overrides.get("host", "0.0.0.0"),
|
41
|
+
log_level="debug" if config_overrides.get("debug", False) else "info"
|
42
|
+
)
|
62
43
|
if __name__ == "__main__":
|
63
44
|
main()
|