mcp-proxy-adapter 6.6.9__py3-none-any.whl → 6.7.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/api/app.py +60 -15
- mcp_proxy_adapter/commands/__init__.py +4 -0
- mcp_proxy_adapter/commands/registration_status_command.py +119 -0
- mcp_proxy_adapter/core/app_runner.py +29 -2
- mcp_proxy_adapter/core/async_proxy_registration.py +285 -0
- mcp_proxy_adapter/core/signal_handler.py +170 -0
- mcp_proxy_adapter/examples/config_builder.py +405 -61
- mcp_proxy_adapter/examples/generate_config.py +21 -16
- mcp_proxy_adapter/main.py +37 -1
- mcp_proxy_adapter/version.py +1 -1
- {mcp_proxy_adapter-6.6.9.dist-info → mcp_proxy_adapter-6.7.0.dist-info}/METADATA +1 -1
- {mcp_proxy_adapter-6.6.9.dist-info → mcp_proxy_adapter-6.7.0.dist-info}/RECORD +15 -12
- {mcp_proxy_adapter-6.6.9.dist-info → mcp_proxy_adapter-6.7.0.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-6.6.9.dist-info → mcp_proxy_adapter-6.7.0.dist-info}/entry_points.txt +0 -0
- {mcp_proxy_adapter-6.6.9.dist-info → mcp_proxy_adapter-6.7.0.dist-info}/top_level.txt +0 -0
@@ -12,10 +12,10 @@ import sys
|
|
12
12
|
from pathlib import Path
|
13
13
|
from typing import Dict, Any, Optional
|
14
14
|
|
15
|
-
# Add the
|
16
|
-
sys.path.insert(0, str(Path(__file__).parent
|
15
|
+
# Add the current directory to the path to import config_builder
|
16
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
17
17
|
|
18
|
-
from
|
18
|
+
from config_builder import ConfigBuilder, ConfigFactory, Protocol, AuthMethod
|
19
19
|
|
20
20
|
|
21
21
|
def create_config_from_flags(
|
@@ -28,7 +28,9 @@ def create_config_from_flags(
|
|
28
28
|
key_dir: str = "./keys",
|
29
29
|
output_dir: str = "./configs",
|
30
30
|
proxy_registration: bool = False,
|
31
|
-
proxy_url: str = "http://localhost:3004"
|
31
|
+
proxy_url: str = "http://localhost:3004",
|
32
|
+
auto_registration: bool = False,
|
33
|
+
server_id: str = "mcp_proxy_adapter"
|
32
34
|
) -> Dict[str, Any]:
|
33
35
|
"""
|
34
36
|
Create configuration based on command line flags.
|
@@ -46,10 +48,10 @@ def create_config_from_flags(
|
|
46
48
|
Returns:
|
47
49
|
Configuration dictionary
|
48
50
|
"""
|
49
|
-
# Use the
|
50
|
-
from config_builder import create_config_from_flags as
|
51
|
+
# Use the enhanced config builder
|
52
|
+
from config_builder import create_config_from_flags as enhanced_create_config
|
51
53
|
|
52
|
-
return
|
54
|
+
return enhanced_create_config(protocol, token, roles, port, proxy_registration, proxy_url, auto_registration, server_id)
|
53
55
|
|
54
56
|
|
55
57
|
def save_config(config: Dict[str, Any], filename: str, output_dir: str) -> Path:
|
@@ -262,6 +264,8 @@ Examples:
|
|
262
264
|
help="Proxy URL for registration (default: http://localhost:3004)")
|
263
265
|
parser.add_argument("--auto-registration", action="store_true",
|
264
266
|
help="Enable automatic proxy registration (same as --proxy-registration)")
|
267
|
+
parser.add_argument("--server-id", default="mcp_proxy_adapter",
|
268
|
+
help="Server ID for registration (default: mcp_proxy_adapter)")
|
265
269
|
parser.add_argument("--all", action="store_true",
|
266
270
|
help="Generate all standard configurations")
|
267
271
|
parser.add_argument("--full-config", action="store_true",
|
@@ -313,15 +317,16 @@ Examples:
|
|
313
317
|
print(f"✅ Full configuration saved to: {config_file}")
|
314
318
|
elif args.protocol:
|
315
319
|
# Generate specific configuration
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
320
|
+
config = create_config_from_flags(
|
321
|
+
protocol=args.protocol,
|
322
|
+
token=args.token,
|
323
|
+
roles=args.roles,
|
324
|
+
port=args.port,
|
325
|
+
proxy_registration=args.proxy_registration,
|
326
|
+
proxy_url=args.proxy_url,
|
327
|
+
auto_registration=args.auto_registration,
|
328
|
+
server_id=args.server_id
|
329
|
+
)
|
325
330
|
|
326
331
|
if args.stdout:
|
327
332
|
# Output to stdout
|
mcp_proxy_adapter/main.py
CHANGED
@@ -21,6 +21,7 @@ if not str(Path(__file__).parent.parent) in sys.path:
|
|
21
21
|
from mcp_proxy_adapter.api.app import create_app
|
22
22
|
from mcp_proxy_adapter.config import Config
|
23
23
|
from mcp_proxy_adapter.core.config_validator import ConfigValidator
|
24
|
+
from mcp_proxy_adapter.core.signal_handler import setup_signal_handling, is_shutdown_requested
|
24
25
|
|
25
26
|
|
26
27
|
def main():
|
@@ -52,6 +53,30 @@ def main():
|
|
52
53
|
sys.exit(1)
|
53
54
|
print("✅ Configuration validation passed")
|
54
55
|
|
56
|
+
# Setup signal handling for graceful shutdown
|
57
|
+
def shutdown_callback():
|
58
|
+
"""Callback for graceful shutdown with proxy unregistration."""
|
59
|
+
print("\n🛑 Graceful shutdown initiated...")
|
60
|
+
try:
|
61
|
+
from mcp_proxy_adapter.core.async_proxy_registration import (
|
62
|
+
stop_async_registration,
|
63
|
+
get_registration_status,
|
64
|
+
)
|
65
|
+
|
66
|
+
# Get final status
|
67
|
+
final_status = get_registration_status()
|
68
|
+
print(f"📊 Final registration status: {final_status}")
|
69
|
+
|
70
|
+
# Stop async registration (this will unregister from proxy)
|
71
|
+
stop_async_registration()
|
72
|
+
print("✅ Proxy unregistration completed")
|
73
|
+
|
74
|
+
except Exception as e:
|
75
|
+
print(f"❌ Error during shutdown: {e}")
|
76
|
+
|
77
|
+
setup_signal_handling(shutdown_callback)
|
78
|
+
print("🔧 Signal handling configured for graceful shutdown")
|
79
|
+
|
55
80
|
# Create application (pass config_path so reload uses same file)
|
56
81
|
app = create_app(app_config=config.get_all(), config_path=args.config)
|
57
82
|
|
@@ -170,9 +195,20 @@ def main():
|
|
170
195
|
print("🔐 Starting HTTPS server with hypercorn...")
|
171
196
|
else:
|
172
197
|
print("🌐 Starting HTTP server with hypercorn...")
|
198
|
+
|
199
|
+
print("🛑 Use Ctrl+C or send SIGTERM for graceful shutdown")
|
200
|
+
print("=" * 50)
|
173
201
|
|
174
202
|
# Run the server
|
175
|
-
|
203
|
+
try:
|
204
|
+
asyncio.run(hypercorn.asyncio.serve(app, config_hypercorn))
|
205
|
+
except KeyboardInterrupt:
|
206
|
+
print("\n🛑 Server stopped by user (Ctrl+C)")
|
207
|
+
if is_shutdown_requested():
|
208
|
+
print("✅ Graceful shutdown completed")
|
209
|
+
except Exception as e:
|
210
|
+
print(f"\n❌ Server error: {e}")
|
211
|
+
sys.exit(1)
|
176
212
|
|
177
213
|
|
178
214
|
if __name__ == "__main__":
|
mcp_proxy_adapter/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mcp-proxy-adapter
|
3
|
-
Version: 6.
|
3
|
+
Version: 6.7.0
|
4
4
|
Summary: Powerful JSON-RPC microservices framework with built-in security, authentication, and proxy registration
|
5
5
|
Home-page: https://github.com/maverikod/mcp-proxy-adapter
|
6
6
|
Author: Vasiliy Zdanovskiy
|
@@ -2,11 +2,11 @@ mcp_proxy_adapter/__init__.py,sha256=iH0EBBsRj_cfZJpAIsgN_8tTdfefhnl6uUKHjLHhWDQ
|
|
2
2
|
mcp_proxy_adapter/__main__.py,sha256=sq3tANRuTd18euamt0Bmn1sJeAyzXENZ5VvsMwbrDFA,579
|
3
3
|
mcp_proxy_adapter/config.py,sha256=QpoPaUKcWJ-eu6HYphhIZmkc2M-p1JgpLFAgolf_l5s,20161
|
4
4
|
mcp_proxy_adapter/custom_openapi.py,sha256=XRviX-C-ZkSKdBhORhDTdeN_1FWyEfXZADiASft3t9I,28149
|
5
|
-
mcp_proxy_adapter/main.py,sha256=
|
5
|
+
mcp_proxy_adapter/main.py,sha256=lafb36V8otAh6PNXRudAXiUiEOj--Kn-IWjKh6pjujI,7262
|
6
6
|
mcp_proxy_adapter/openapi.py,sha256=2UZOI09ZDRJuBYBjKbMyb2U4uASszoCMD5o_4ktRpvg,13480
|
7
|
-
mcp_proxy_adapter/version.py,sha256=
|
7
|
+
mcp_proxy_adapter/version.py,sha256=WYWxAMbc-M1fskDBD0wnKbYT9ZwhtTm6JJjeznQdI30,74
|
8
8
|
mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
mcp_proxy_adapter/api/app.py,sha256=
|
9
|
+
mcp_proxy_adapter/api/app.py,sha256=GGhA5X7HQPLJFxeaWHu5YUwi2ldPvPvJD2YcaL9Nbo0,37874
|
10
10
|
mcp_proxy_adapter/api/handlers.py,sha256=X-hcMNVeTAu4yVkKJEChEsj2bFptUS6sLNN-Wysjkow,10011
|
11
11
|
mcp_proxy_adapter/api/schemas.py,sha256=mevUvQnYgWQfkJAs3-vq3HalBzh6-Saa-Au1VVf0peE,12377
|
12
12
|
mcp_proxy_adapter/api/tool_integration.py,sha256=AeUyvJVN-c3FrX5fHdagHL51saRH5d1ZKqc2YEx0rTE,10147
|
@@ -22,7 +22,7 @@ mcp_proxy_adapter/api/middleware/protocol_middleware.py,sha256=lFqGuT5M-USCTIVvZ
|
|
22
22
|
mcp_proxy_adapter/api/middleware/transport_middleware.py,sha256=VG1rWyuh-O2pdc0kQ3SADFvyh286o5Wrnkt8OFQ0WQw,4274
|
23
23
|
mcp_proxy_adapter/api/middleware/unified_security.py,sha256=QX4WUde03-T002Z3TgzhX0Tj2x7BFULOvOkCftsWqw8,8114
|
24
24
|
mcp_proxy_adapter/api/middleware/user_info_middleware.py,sha256=-N6cZOc7z6FUE7xRZ8xGgI4PnMyrJq0Jzpde9VNq6Zs,11077
|
25
|
-
mcp_proxy_adapter/commands/__init__.py,sha256=
|
25
|
+
mcp_proxy_adapter/commands/__init__.py,sha256=3BOfAiep__ftpx2hMfwj96vtDFdcVf3P3nm-vZWGohE,1700
|
26
26
|
mcp_proxy_adapter/commands/auth_validation_command.py,sha256=p4UrAaHyoCxMy98G1BUUlFJWjoelEJzX3OAWIiQaGls,14593
|
27
27
|
mcp_proxy_adapter/commands/base.py,sha256=0_hu8t89-2vWBPFpEMokr27A-IifKI32rkQwZfc2Grk,15162
|
28
28
|
mcp_proxy_adapter/commands/builtin_commands.py,sha256=8kYLWIr4JvhZtqaVM9Jhqr_-ySPiy40njYUNxBUWtug,3316
|
@@ -42,6 +42,7 @@ mcp_proxy_adapter/commands/load_command.py,sha256=euv9KSeO2zjtQiYfnl4xhZYXARt4x1
|
|
42
42
|
mcp_proxy_adapter/commands/plugins_command.py,sha256=0FazJGI9_wK_Ac_eFfmzhJGRLxMzKdpLqNMu-mwsqMI,8763
|
43
43
|
mcp_proxy_adapter/commands/protocol_management_command.py,sha256=8Uv6WXrj_W1Sl9JCIT6hl8wo_qYuHWZYq-nBMYOQ4qw,8429
|
44
44
|
mcp_proxy_adapter/commands/proxy_registration_command.py,sha256=owKWQRN96vpEBj-yGF-q1T_FiS9wF525bNw08NfVixs,14774
|
45
|
+
mcp_proxy_adapter/commands/registration_status_command.py,sha256=oQkgjxiGFxkuaJ_DyO19LaWj0SecfwHwSAxYI2VsStI,4399
|
45
46
|
mcp_proxy_adapter/commands/reload_command.py,sha256=GrdmSRBrN77TaeXJak6csmSi_Wa8wwGSPzFD1NQjTKE,7508
|
46
47
|
mcp_proxy_adapter/commands/result.py,sha256=uWHdLCwwn2_ylXLtIn-yXGiXxWRcbzMSlkgGtpkXQCg,5470
|
47
48
|
mcp_proxy_adapter/commands/role_test_command.py,sha256=3y1pOKwrBFGpfqhQEWEBKxGkuMHa9MqHFlzaqPxM3ik,4181
|
@@ -54,7 +55,8 @@ mcp_proxy_adapter/commands/transport_management_command.py,sha256=HEnUyL4S014jhe
|
|
54
55
|
mcp_proxy_adapter/commands/unload_command.py,sha256=6CUM9B9c-mNxw7uvt2vcvZSnxMySfoMT5UmDhzNXq38,4984
|
55
56
|
mcp_proxy_adapter/core/__init__.py,sha256=3yt0CFZdsIG8Ln4bg-r4ISYzipm3ZUAxTn0twYTs9FI,867
|
56
57
|
mcp_proxy_adapter/core/app_factory.py,sha256=Ywq-RN2o5B86nJpqImnaXNf_g366lVK1fXeIbIr49DM,21625
|
57
|
-
mcp_proxy_adapter/core/app_runner.py,sha256=
|
58
|
+
mcp_proxy_adapter/core/app_runner.py,sha256=n8_rBojzKUpHLN5ksiXcR8UWoBYk6Tt5OtWk-X2kVPc,11868
|
59
|
+
mcp_proxy_adapter/core/async_proxy_registration.py,sha256=hM_ZV2YoKM8n0MakVMBd2KnYTJBh1igDeb4DYutfHnE,11387
|
58
60
|
mcp_proxy_adapter/core/auth_validator.py,sha256=q8TNkdolvP-gM6Bvecc6nrVG9al5J31pocdwhguhTBk,19742
|
59
61
|
mcp_proxy_adapter/core/certificate_utils.py,sha256=yeDwi-j42CxK_g-r5_ragGFY_HdSgDfTWHVUjDHF6nI,38480
|
60
62
|
mcp_proxy_adapter/core/client.py,sha256=qIbPl8prEwK2U65kl-vGJW2_imo1E4i6HxG_VpPeWpQ,21168
|
@@ -78,6 +80,7 @@ mcp_proxy_adapter/core/security_integration.py,sha256=-5I4i9so_yMjc-zuGO-7zzIsMX
|
|
78
80
|
mcp_proxy_adapter/core/server_adapter.py,sha256=jz8ztIfe82N5DE3XHRYpD6CwNcJy7ksh0l8l-towHBE,9755
|
79
81
|
mcp_proxy_adapter/core/server_engine.py,sha256=qmxdkBv-YsQsvxVVQ-_xiAyDshxtnrKBquPJoUjo2fw,9471
|
80
82
|
mcp_proxy_adapter/core/settings.py,sha256=D6cF4R_5gJ0XFGxzXUIzeqe-_muu6HL561TAei9wwZ0,10521
|
83
|
+
mcp_proxy_adapter/core/signal_handler.py,sha256=ryL4bLzV6ERrXPx19K4ApFGMzFI8iwlI0timj-GQ1YI,5324
|
81
84
|
mcp_proxy_adapter/core/ssl_utils.py,sha256=Rjl79d5LdhDzxiMtaIRd9OFh0hTeRANItYFXk-7c5pA,9498
|
82
85
|
mcp_proxy_adapter/core/transport_manager.py,sha256=eJbGa3gDVFUBFUzMK5KEmpbUDXOOShtzszUIEf7Jk0A,9292
|
83
86
|
mcp_proxy_adapter/core/unified_config_adapter.py,sha256=zBGYdLDZ3G8f3Y9tmtm0Ne0UXIfEaNHR4Ik2W3ErkLc,22814
|
@@ -86,14 +89,14 @@ mcp_proxy_adapter/examples/__init__.py,sha256=k1F-EotAFbJ3JvK_rNgiH4bUztmxIWtYn0
|
|
86
89
|
mcp_proxy_adapter/examples/bugfix_certificate_config.py,sha256=YGBE_SI6wYZUJLWl7-fP1OWXiSH4mHJAZHApgQWvG7s,10529
|
87
90
|
mcp_proxy_adapter/examples/cert_manager_bugfix.py,sha256=UWUwItjqHqSnOMHocsz40_3deoZE8-vdROLW9y2fEns,7259
|
88
91
|
mcp_proxy_adapter/examples/check_config.py,sha256=oDP3cymq76TqEpPztPihH-_sBktiEb2cG0MdVrY1Sj8,14104
|
89
|
-
mcp_proxy_adapter/examples/config_builder.py,sha256
|
92
|
+
mcp_proxy_adapter/examples/config_builder.py,sha256=U7nKfuNlSoJ6B8IN9QjBcvEJdpgC8I7NBJNLYYHjbrU,32298
|
90
93
|
mcp_proxy_adapter/examples/config_cli.py,sha256=ZhVG6XEpTFe5-MzELByVsUh0AD4bHPBZeoXnGWbqifs,11059
|
91
94
|
mcp_proxy_adapter/examples/create_test_configs.py,sha256=9TrvLa4-bWLPu0SB1JXwWuCsjj-4Vz3yAdowcHtCSSA,8228
|
92
95
|
mcp_proxy_adapter/examples/debug_request_state.py,sha256=Z3Gy2-fWtu7KIV9OkzGDLVz7TpL_h9V_99ica40uQBU,4489
|
93
96
|
mcp_proxy_adapter/examples/debug_role_chain.py,sha256=GLVXC2fJUwP8UJnXHchd1t-H53cjWLJI3RqTPrKmaak,8750
|
94
97
|
mcp_proxy_adapter/examples/demo_client.py,sha256=en2Rtb70B1sQmhL-vdQ4PDpKNNl_mfll2YCFT_jFCAg,10191
|
95
98
|
mcp_proxy_adapter/examples/generate_certificates.py,sha256=cIfTHBziGiOTy9vldAmaULD6bXBpl2a5KfB8MLIRSww,16391
|
96
|
-
mcp_proxy_adapter/examples/generate_config.py,sha256=
|
99
|
+
mcp_proxy_adapter/examples/generate_config.py,sha256=9zImMfIM88OQz12mE5k0_RnVV5ZmhlIKO2fRldiNCok,12709
|
97
100
|
mcp_proxy_adapter/examples/proxy_registration_example.py,sha256=vemRhftnjbiOBCJkmtDGqlWQ8syTG0a8755GCOnaQsg,12503
|
98
101
|
mcp_proxy_adapter/examples/required_certificates.py,sha256=YW9-V78oFiZ-FmHlGP-8FQFS569VdDVyq9hfvCv31pk,7133
|
99
102
|
mcp_proxy_adapter/examples/run_example.py,sha256=yp-a6HIrSk3ddQmbn0KkuKwErId0aNfj028TE6U-zmY,2626
|
@@ -130,8 +133,8 @@ mcp_proxy_adapter/schemas/base_schema.json,sha256=v9G9cGMd4dRhCZsOQ_FMqOi5VFyVbI
|
|
130
133
|
mcp_proxy_adapter/schemas/openapi_schema.json,sha256=C3yLkwmDsvnLW9B5gnKKdBGl4zxkeU-rEmjTrNVsQU0,8405
|
131
134
|
mcp_proxy_adapter/schemas/roles.json,sha256=pgf_ZyqKyXbfGUxvobpiLiSJz9zzxrMuoVWEkEpz3N8,764
|
132
135
|
mcp_proxy_adapter/schemas/roles_schema.json,sha256=deHgI7L6GwfBXacOlNtDgDJelDThppClC3Ti4Eh8rJY,5659
|
133
|
-
mcp_proxy_adapter-6.
|
134
|
-
mcp_proxy_adapter-6.
|
135
|
-
mcp_proxy_adapter-6.
|
136
|
-
mcp_proxy_adapter-6.
|
137
|
-
mcp_proxy_adapter-6.
|
136
|
+
mcp_proxy_adapter-6.7.0.dist-info/METADATA,sha256=Upk66n9c4K4EzBE7wRqh9V-dv_juyUZkUmYIJO6SJ-4,8510
|
137
|
+
mcp_proxy_adapter-6.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
138
|
+
mcp_proxy_adapter-6.7.0.dist-info/entry_points.txt,sha256=Bf-O5Aq80n22Ayu9fI9BgidzWqwzIVaqextAddTuHZw,563
|
139
|
+
mcp_proxy_adapter-6.7.0.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
|
140
|
+
mcp_proxy_adapter-6.7.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|