mcp-proxy-adapter 6.8.2__py3-none-any.whl → 6.9.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.
@@ -1,13 +1,14 @@
1
1
  #!/usr/bin/env python3
2
2
  """
3
3
  Configuration Generator CLI for MCP Proxy Adapter
4
- Generates configurations based on command line flags.
4
+ Generates configurations based on command line flags with validation.
5
5
 
6
6
  Author: Vasiliy Zdanovskiy
7
7
  email: vasilyvz@gmail.com
8
8
  """
9
9
  import argparse
10
10
  import json
11
+ import os
11
12
  import sys
12
13
  from pathlib import Path
13
14
  from typing import Dict, Any, Optional
@@ -17,6 +18,14 @@ sys.path.insert(0, str(Path(__file__).parent))
17
18
 
18
19
  from config_builder import ConfigBuilder, ConfigFactory, Protocol, AuthMethod
19
20
 
21
+ # Import validation modules
22
+ try:
23
+ from mcp_proxy_adapter.core.config_validator import ConfigValidator, ValidationLevel
24
+ VALIDATION_AVAILABLE = True
25
+ except ImportError:
26
+ VALIDATION_AVAILABLE = False
27
+ print("Warning: Configuration validation not available. Install the package to enable validation.")
28
+
20
29
 
21
30
  def create_config_from_flags(
22
31
  protocol: str,
@@ -54,8 +63,8 @@ def create_config_from_flags(
54
63
  return enhanced_create_config(protocol, token, roles, port, proxy_registration, proxy_url, auto_registration, server_id)
55
64
 
56
65
 
57
- def save_config(config: Dict[str, Any], filename: str, output_dir: str) -> Path:
58
- """Save configuration to file."""
66
+ def save_config(config: Dict[str, Any], filename: str, output_dir: str, validate: bool = True) -> Path:
67
+ """Save configuration to file with optional validation."""
59
68
  output_path = Path(output_dir)
60
69
  output_path.mkdir(parents=True, exist_ok=True)
61
70
 
@@ -63,6 +72,27 @@ def save_config(config: Dict[str, Any], filename: str, output_dir: str) -> Path:
63
72
  with open(config_file, 'w', encoding='utf-8') as f:
64
73
  json.dump(config, f, indent=2, ensure_ascii=False)
65
74
 
75
+ # Validate configuration if requested and validation is available
76
+ if validate and VALIDATION_AVAILABLE:
77
+ print(f"🔍 Validating configuration: {config_file}")
78
+ validator = ConfigValidator()
79
+ validator.config_data = config
80
+ results = validator.validate_config()
81
+
82
+ if results:
83
+ print("⚠️ Validation issues found:")
84
+ for result in results:
85
+ level_symbol = {
86
+ ValidationLevel.ERROR: "❌",
87
+ ValidationLevel.WARNING: "⚠️",
88
+ ValidationLevel.INFO: "ℹ️"
89
+ }[result.level]
90
+ print(f" {level_symbol} {result.message}")
91
+ if result.suggestion:
92
+ print(f" Suggestion: {result.suggestion}")
93
+ else:
94
+ print("✅ Configuration validation passed!")
95
+
66
96
  return config_file
67
97
 
68
98
 
@@ -180,8 +210,8 @@ def generate_all_configs(output_dir: str = "./configs", host: str = "127.0.0.1")
180
210
  output_dir=output_dir
181
211
  )
182
212
 
183
- # Save configuration
184
- config_file = save_config(config, config_name, output_dir)
213
+ # Save configuration with validation
214
+ config_file = save_config(config, config_name, output_dir, validate=not args.no_validate)
185
215
  generated_files.append(config_file)
186
216
 
187
217
  print(f"✅ Created {config_name}.json (port {port})")
@@ -290,11 +320,34 @@ Examples:
290
320
  help="Output filename (without extension)")
291
321
  parser.add_argument("--stdout", action="store_true",
292
322
  help="Output to stdout instead of file")
323
+ parser.add_argument("--no-validate", action="store_true",
324
+ help="Skip configuration validation")
325
+ parser.add_argument("--validate-only", action="store_true",
326
+ help="Only validate existing configuration file")
293
327
 
294
328
  args = parser.parse_args()
295
329
 
296
330
  try:
297
- if args.all:
331
+ if args.validate_only:
332
+ # Validate existing configuration file
333
+ if not VALIDATION_AVAILABLE:
334
+ print("❌ Validation not available. Install the package to enable validation.")
335
+ return 1
336
+
337
+ config_file = args.output or "config.json"
338
+ if not os.path.exists(config_file):
339
+ print(f"❌ Configuration file not found: {config_file}")
340
+ return 1
341
+
342
+ print(f"🔍 Validating configuration file: {config_file}")
343
+ validator = ConfigValidator(config_file)
344
+ validator.load_config()
345
+ validator.validate_config()
346
+ validator.print_validation_report()
347
+
348
+ return 0 if validator.get_validation_summary()["is_valid"] else 1
349
+
350
+ elif args.all:
298
351
  # Generate all configurations
299
352
  generate_all_configs(
300
353
  output_dir=args.output_dir,
@@ -313,7 +366,7 @@ Examples:
313
366
  else:
314
367
  # Save to file
315
368
  filename = args.output or "full_config"
316
- config_file = save_config(config, filename, args.output_dir)
369
+ config_file = save_config(config, filename, args.output_dir, validate=not args.no_validate)
317
370
  print(f"✅ Full configuration saved to: {config_file}")
318
371
  elif args.protocol:
319
372
  # Generate specific configuration
@@ -344,7 +397,7 @@ Examples:
344
397
  name_parts.append("roles")
345
398
  filename = "_".join(name_parts)
346
399
 
347
- config_file = save_config(config, filename, args.output_dir)
400
+ config_file = save_config(config, filename, args.output_dir, validate=not args.no_validate)
348
401
  print(f"✅ Configuration saved to: {config_file}")
349
402
  else:
350
403
  parser.print_help()
@@ -28,9 +28,50 @@ except ImportError:
28
28
  sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../.."))
29
29
 
30
30
 
31
+ def validate_config_with_new_system(config: Dict[str, Any]) -> bool:
32
+ """
33
+ Validate configuration using the new validation system.
34
+ Args:
35
+ config: Configuration dictionary
36
+ Returns:
37
+ True if validation passed, False otherwise
38
+ """
39
+ try:
40
+ from mcp_proxy_adapter.core.config_validator import ConfigValidator
41
+ from mcp_proxy_adapter.core.errors import ConfigError
42
+
43
+ print("🔍 Validating configuration with new validation system...")
44
+ validator = ConfigValidator()
45
+ validator.config_data = config
46
+ results = validator.validate_config()
47
+
48
+ if results:
49
+ print("⚠️ Validation issues found:")
50
+ for result in results:
51
+ level_symbol = {
52
+ "error": "❌",
53
+ "warning": "⚠️",
54
+ "info": "ℹ️"
55
+ }[result.level]
56
+ print(f" {level_symbol} {result.message}")
57
+ if result.suggestion:
58
+ print(f" Suggestion: {result.suggestion}")
59
+ return False
60
+ else:
61
+ print("✅ Configuration validation passed!")
62
+ return True
63
+
64
+ except ImportError:
65
+ print("⚠️ New validation system not available")
66
+ return True
67
+ except Exception as e:
68
+ print(f"❌ Validation error: {e}")
69
+ return False
70
+
71
+
31
72
  def validate_security_config(config: Dict[str, Any]) -> bool:
32
73
  """
33
- Validate security configuration using mcp_security_framework.
74
+ Validate security configuration using mcp_security_framework (legacy).
34
75
  Args:
35
76
  config: Configuration dictionary
36
77
  Returns:
@@ -102,7 +143,11 @@ def test_configuration(config_path: str, timeout: int = 30) -> bool:
102
143
  print(f" - {error}")
103
144
  return False
104
145
  print("✅ Configuration validation passed")
105
- # Validate security configuration
146
+ # Validate configuration with new system
147
+ if not validate_config_with_new_system(config):
148
+ return False
149
+
150
+ # Validate security configuration (legacy)
106
151
  if not validate_security_config(config):
107
152
  return False
108
153
  # Test server startup (without actually starting)
@@ -2,4 +2,4 @@
2
2
  Version information for MCP Proxy Adapter.
3
3
  """
4
4
 
5
- __version__ = "6.8.2"
5
+ __version__ = "6.9.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-proxy-adapter
3
- Version: 6.8.2
3
+ Version: 6.9.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
@@ -1,10 +1,10 @@
1
1
  mcp_proxy_adapter/__init__.py,sha256=iH0EBBsRj_cfZJpAIsgN_8tTdfefhnl6uUKHjLHhWDQ,1037
2
2
  mcp_proxy_adapter/__main__.py,sha256=sq3tANRuTd18euamt0Bmn1sJeAyzXENZ5VvsMwbrDFA,579
3
- mcp_proxy_adapter/config.py,sha256=QpoPaUKcWJ-eu6HYphhIZmkc2M-p1JgpLFAgolf_l5s,20161
3
+ mcp_proxy_adapter/config.py,sha256=1Ngxri2IPGoytYdCF5pXzbLUXsWcf6qYENkaDkAppg0,25323
4
4
  mcp_proxy_adapter/custom_openapi.py,sha256=XRviX-C-ZkSKdBhORhDTdeN_1FWyEfXZADiASft3t9I,28149
5
5
  mcp_proxy_adapter/main.py,sha256=NFcSW7WaEnimRWe5zj28D0CH9otHlRZ92d2Um6XiGjE,10399
6
6
  mcp_proxy_adapter/openapi.py,sha256=2UZOI09ZDRJuBYBjKbMyb2U4uASszoCMD5o_4ktRpvg,13480
7
- mcp_proxy_adapter/version.py,sha256=OEfccELgZ6-0XnzegM2csJXSalgxcwzWErYhq7b1c-8,74
7
+ mcp_proxy_adapter/version.py,sha256=yX54-cNu3WDv2Y6PxrAvGEH5Ju4EUsUaVQ0KC0Y_zqk,74
8
8
  mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  mcp_proxy_adapter/api/app.py,sha256=PQ1Ch5ydJIHp3Z6gcMCzKkTsXPQAuZ9weHtQ-EXnNGY,37134
10
10
  mcp_proxy_adapter/api/handlers.py,sha256=X-hcMNVeTAu4yVkKJEChEsj2bFptUS6sLNN-Wysjkow,10011
@@ -62,10 +62,10 @@ mcp_proxy_adapter/core/client.py,sha256=qIbPl8prEwK2U65kl-vGJW2_imo1E4i6HxG_VpPe
62
62
  mcp_proxy_adapter/core/client_manager.py,sha256=yD8HZJlOwmDbVU49YfzSbh1XZ-Vib8qfcLVAaH03Jdg,8832
63
63
  mcp_proxy_adapter/core/client_security.py,sha256=siUaYorcDbpZsEIKgLfg-jBKkp7z_Er8wsO63mDD3Is,13127
64
64
  mcp_proxy_adapter/core/config_converter.py,sha256=Wnnsrbw7DxtgDfLG-IyyzK-hkKu0_1yp7-7dW87tu_4,17422
65
- mcp_proxy_adapter/core/config_validator.py,sha256=7Xs4T85Xwc3sQaaG1ZHnp6MUT4ZU3Zmlp0HNCYVa43A,8755
65
+ mcp_proxy_adapter/core/config_validator.py,sha256=jsTZJA8oxWtmbDAoTfrQX38e6pZ9RIVepwWlk8gP91c,43873
66
66
  mcp_proxy_adapter/core/crl_utils.py,sha256=Jnwq2UN52IoCDZCwByRP3XNMOJexftb-mVaH6zes6Fc,11706
67
- mcp_proxy_adapter/core/errors.py,sha256=UNEfdmK0zPGJrWH1zUMRjHIJMcoVDcBO4w8xxKHBv4w,5356
68
- mcp_proxy_adapter/core/logging.py,sha256=gNI6vfPQC7jrUtVu6NeDsmU72JPlrRRBhtJipL1eVrI,9560
67
+ mcp_proxy_adapter/core/errors.py,sha256=uXm0zslc1iyvuu-aEfX5euEHPWaQn8LZUwgQGKVWe8U,6825
68
+ mcp_proxy_adapter/core/logging.py,sha256=VIpiC6QTGLukRjiJoVpq3VEoLKhUeLNl8IdfljpW6ZU,9654
69
69
  mcp_proxy_adapter/core/mtls_asgi.py,sha256=tvk0P9024s18dcCHY9AaQIecT4ojOTv21EuQWXwooU0,5200
70
70
  mcp_proxy_adapter/core/mtls_asgi_app.py,sha256=DT_fTUH1RkvBa3ThbyCyNb-XUHyCb4DqaKA1gcZC6z4,6538
71
71
  mcp_proxy_adapter/core/mtls_proxy.py,sha256=5APlWs0ImiHGEC65W_7F-PbVO3NZ2BVSj9r14AcUtTE,6011
@@ -89,13 +89,13 @@ mcp_proxy_adapter/examples/__init__.py,sha256=k1F-EotAFbJ3JvK_rNgiH4bUztmxIWtYn0
89
89
  mcp_proxy_adapter/examples/bugfix_certificate_config.py,sha256=YGBE_SI6wYZUJLWl7-fP1OWXiSH4mHJAZHApgQWvG7s,10529
90
90
  mcp_proxy_adapter/examples/cert_manager_bugfix.py,sha256=UWUwItjqHqSnOMHocsz40_3deoZE8-vdROLW9y2fEns,7259
91
91
  mcp_proxy_adapter/examples/check_config.py,sha256=oDP3cymq76TqEpPztPihH-_sBktiEb2cG0MdVrY1Sj8,14104
92
- mcp_proxy_adapter/examples/config_builder.py,sha256=U7nKfuNlSoJ6B8IN9QjBcvEJdpgC8I7NBJNLYYHjbrU,32298
92
+ mcp_proxy_adapter/examples/config_builder.py,sha256=1Q84iq2JH6QTyHMUaykjTrdub6-P4jnMcLxfrVkbLSA,6831
93
93
  mcp_proxy_adapter/examples/config_cli.py,sha256=ZhVG6XEpTFe5-MzELByVsUh0AD4bHPBZeoXnGWbqifs,11059
94
94
  mcp_proxy_adapter/examples/create_test_configs.py,sha256=9TrvLa4-bWLPu0SB1JXwWuCsjj-4Vz3yAdowcHtCSSA,8228
95
95
  mcp_proxy_adapter/examples/debug_request_state.py,sha256=Z3Gy2-fWtu7KIV9OkzGDLVz7TpL_h9V_99ica40uQBU,4489
96
96
  mcp_proxy_adapter/examples/debug_role_chain.py,sha256=GLVXC2fJUwP8UJnXHchd1t-H53cjWLJI3RqTPrKmaak,8750
97
97
  mcp_proxy_adapter/examples/demo_client.py,sha256=en2Rtb70B1sQmhL-vdQ4PDpKNNl_mfll2YCFT_jFCAg,10191
98
- mcp_proxy_adapter/examples/generate_config.py,sha256=9zImMfIM88OQz12mE5k0_RnVV5ZmhlIKO2fRldiNCok,12709
98
+ mcp_proxy_adapter/examples/generate_config.py,sha256=45noGYcZbkFGJNf3Qq5T17bL-PDLh5f9o0UE-dNo0eM,15169
99
99
  mcp_proxy_adapter/examples/proxy_registration_example.py,sha256=vemRhftnjbiOBCJkmtDGqlWQ8syTG0a8755GCOnaQsg,12503
100
100
  mcp_proxy_adapter/examples/required_certificates.py,sha256=YW9-V78oFiZ-FmHlGP-8FQFS569VdDVyq9hfvCv31pk,7133
101
101
  mcp_proxy_adapter/examples/run_example.py,sha256=yp-a6HIrSk3ddQmbn0KkuKwErId0aNfj028TE6U-zmY,2626
@@ -106,7 +106,7 @@ mcp_proxy_adapter/examples/security_test_client.py,sha256=ukrzMSJz6AhXp-ZKSMfS53
106
106
  mcp_proxy_adapter/examples/setup_test_environment.py,sha256=JkMqLpH5ZmkNKE7-WT52_kYMxEKLFOyQWbtip29TeiU,51629
107
107
  mcp_proxy_adapter/examples/simple_protocol_test.py,sha256=BzFUZvK9Fih3aG4IFLQTZPyPe_s6YjpZfB6uZmQ76rw,3969
108
108
  mcp_proxy_adapter/examples/test_chk_hostname_automated.py,sha256=nN0FEevzP6UP3q40zq4lw_GiT050FYomu7rWFPOMF2U,7002
109
- mcp_proxy_adapter/examples/test_config.py,sha256=ekEoUZe9q484vU_0IxOVhQdNMVJXG3IpmQpP--VmuDI,6491
109
+ mcp_proxy_adapter/examples/test_config.py,sha256=mNLScwBj2szzYXBr9iAz7gOTupd4CdA7Lir5RkoW8Yo,8057
110
110
  mcp_proxy_adapter/examples/test_config_builder.py,sha256=SAcWIC54vzO0mrb1L9xZKK2IhNkZuSx7_cMEkC1Lm60,21607
111
111
  mcp_proxy_adapter/examples/test_examples.py,sha256=CYlVatdHUVC_rwv4NsvxFG3GXiKIyxPDUH43BOJHjrU,12330
112
112
  mcp_proxy_adapter/examples/test_framework_complete.py,sha256=9EvJL9hgjYddzGTavjp7M7xlcO8SJvDvbobOHDxRHs8,9622
@@ -120,8 +120,11 @@ mcp_proxy_adapter/examples/basic_framework/commands/__init__.py,sha256=_VQNLUEds
120
120
  mcp_proxy_adapter/examples/basic_framework/hooks/__init__.py,sha256=IE_EIXMnkdXuakZn7wLD9kBFyfDF5lYi56ejgiBeb-A,70
121
121
  mcp_proxy_adapter/examples/commands/__init__.py,sha256=zvY_OpH_B1bVc_khrNIl6O8vqCw1FH6gGMAsJAkGWGY,170
122
122
  mcp_proxy_adapter/examples/full_application/__init__.py,sha256=xGiPYhRAzs1Fh9wA8HoowV-Gg9QMLaMZn-OamExq1TI,320
123
- mcp_proxy_adapter/examples/full_application/main.py,sha256=ZJmXe6WU-4q-U0AKIAdDm9HNREBgWwZz26ohY511xHs,5603
123
+ mcp_proxy_adapter/examples/full_application/main.py,sha256=uQBvnIBu6C2Y9P2j5hg0-2Vkp5-AaRXn3D891-kA04Y,5959
124
124
  mcp_proxy_adapter/examples/full_application/proxy_endpoints.py,sha256=Kt_WAsG61HLTMkKQ1mQqjvlX9I4TcfwYq0NaRR9HKvM,6179
125
+ mcp_proxy_adapter/examples/full_application/run_mtls.py,sha256=neYnzO9lfCEEruv-R__dHey18DXav5RG6hNKwu54G6Y,9455
126
+ mcp_proxy_adapter/examples/full_application/run_simple.py,sha256=Rnmsi68EfiFEWrXx5DfUnxSks9uhmJR-ERlo-BOm9tQ,5163
127
+ mcp_proxy_adapter/examples/full_application/test_server.py,sha256=VRAxvx7rnhUxTgm_5muXYtTrxS7nTolYc7h0WyLmU9s,7600
125
128
  mcp_proxy_adapter/examples/full_application/commands/__init__.py,sha256=yQHxVSFkAyFLUOdk42QOebUODPlQV9IbydPgF3UKsGM,217
126
129
  mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py,sha256=H7FPJmVJNWT61rPWxep06-7hsYRt8XYBUSBiwqpBurU,3096
127
130
  mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py,sha256=DFTqVnIDt6nBdZ27-vD_f1X2cFcDInVQiCEq9ltw4lA,3428
@@ -132,8 +135,8 @@ mcp_proxy_adapter/schemas/base_schema.json,sha256=v9G9cGMd4dRhCZsOQ_FMqOi5VFyVbI
132
135
  mcp_proxy_adapter/schemas/openapi_schema.json,sha256=C3yLkwmDsvnLW9B5gnKKdBGl4zxkeU-rEmjTrNVsQU0,8405
133
136
  mcp_proxy_adapter/schemas/roles.json,sha256=pgf_ZyqKyXbfGUxvobpiLiSJz9zzxrMuoVWEkEpz3N8,764
134
137
  mcp_proxy_adapter/schemas/roles_schema.json,sha256=deHgI7L6GwfBXacOlNtDgDJelDThppClC3Ti4Eh8rJY,5659
135
- mcp_proxy_adapter-6.8.2.dist-info/METADATA,sha256=FArztS0ceC3b9QHI4XVE7VEymGLyojujMixaZKhr1PU,8510
136
- mcp_proxy_adapter-6.8.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
137
- mcp_proxy_adapter-6.8.2.dist-info/entry_points.txt,sha256=Bf-O5Aq80n22Ayu9fI9BgidzWqwzIVaqextAddTuHZw,563
138
- mcp_proxy_adapter-6.8.2.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
139
- mcp_proxy_adapter-6.8.2.dist-info/RECORD,,
138
+ mcp_proxy_adapter-6.9.0.dist-info/METADATA,sha256=uEnRinAvORlAl_2fXmaDEt8Hy8UuwNniFTw-sijCn1s,8510
139
+ mcp_proxy_adapter-6.9.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
140
+ mcp_proxy_adapter-6.9.0.dist-info/entry_points.txt,sha256=Bf-O5Aq80n22Ayu9fI9BgidzWqwzIVaqextAddTuHZw,563
141
+ mcp_proxy_adapter-6.9.0.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
142
+ mcp_proxy_adapter-6.9.0.dist-info/RECORD,,