mcp-proxy-adapter 6.4.9__py3-none-any.whl → 6.4.11__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.
@@ -4,9 +4,9 @@ mcp_proxy_adapter/config.py,sha256=-7iVS0mUWWKNeao7nqTAFlUD6FcMwRlDkchN7OwYsr0,2
4
4
  mcp_proxy_adapter/custom_openapi.py,sha256=yLle4CntYK9wpivgn9NflZyJhy-YNrmWjJzt0ai5nP0,14672
5
5
  mcp_proxy_adapter/main.py,sha256=idp3KUR7CT7kTXLVPvvclJlNnt8d_HYl8_jY98uknmo,4677
6
6
  mcp_proxy_adapter/openapi.py,sha256=2UZOI09ZDRJuBYBjKbMyb2U4uASszoCMD5o_4ktRpvg,13480
7
- mcp_proxy_adapter/version.py,sha256=M0_ED6L7dh3NYxB_f0FBEygEWv8jYxx2b-62QHDeFIg,74
7
+ mcp_proxy_adapter/version.py,sha256=QSqFIalgBU1t8DL-yxneIQ7zVK8-re5PzA9QaBZSRjw,75
8
8
  mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- mcp_proxy_adapter/api/app.py,sha256=b3vZbyAUyE16Qfk5dn86FIcsj4UbR7gOQPvzroHfeqw,34049
9
+ mcp_proxy_adapter/api/app.py,sha256=UQ7_m-LbUzKuuPJPxS_69ahANUQ5rnPwoddQ2MMXNkg,33941
10
10
  mcp_proxy_adapter/api/handlers.py,sha256=iyFGoEuUS1wxbV1ELA0zmaxIyQR7j4zw-4MrD-uIO6E,8294
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
@@ -18,7 +18,7 @@ mcp_proxy_adapter/api/middleware/error_handling.py,sha256=bXui9rUn4Gem3PoXuxldSB
18
18
  mcp_proxy_adapter/api/middleware/factory.py,sha256=r0BXntUOxF6DiCVqqmAUb3JjargdR28aj2d9X5z-zX4,7987
19
19
  mcp_proxy_adapter/api/middleware/logging.py,sha256=iME87hrbvyTjI-RJro5Cwao7VlHUIuWubpVUabv-s1M,5229
20
20
  mcp_proxy_adapter/api/middleware/performance.py,sha256=-EvA7YIcTlxn8RuxlWlScJvX2EIoeEp3P5dKVWZHYRY,2357
21
- mcp_proxy_adapter/api/middleware/protocol_middleware.py,sha256=YiwgeWXaFjj-TvTpAyqOMu1Rql4UENmX6pAJ8vEb9T8,15449
21
+ mcp_proxy_adapter/api/middleware/protocol_middleware.py,sha256=lFqGuT5M-USCTIVvZMH6Fgh3hxQNAmAoDeyYOBPpcbk,9161
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=qjNPOCusMimXjEtjwyG6CgFieLm2T7O2e2QghqE_s3M,8313
24
24
  mcp_proxy_adapter/api/middleware/user_info_middleware.py,sha256=sUHHyy33xvZKRDtOWfzbndrIxDYLUFeVYfUbPIKawR8,10652
@@ -89,24 +89,21 @@ mcp_proxy_adapter/examples/demo_client.py,sha256=en2Rtb70B1sQmhL-vdQ4PDpKNNl_mfl
89
89
  mcp_proxy_adapter/examples/generate_all_certificates.py,sha256=lLP5RKmJwpSyprvrxQXFt_xcN4aiUzlIxk5WVdXx2Fk,19024
90
90
  mcp_proxy_adapter/examples/generate_certificates.py,sha256=VRJnT9Za2Wk_oKRT5g2SA7qcGeBSxZm9wPMOM5i50T0,6707
91
91
  mcp_proxy_adapter/examples/generate_certificates_and_tokens.py,sha256=hUCoJH3fy5WeR_YMHj-_W0mR0ZKUWqewH4FVN3yWyrM,17972
92
- mcp_proxy_adapter/examples/generate_comprehensive_config.py,sha256=2UyTGIUKxw3EdCFaOMwO1vB-OZjOQV0senU44JPuyH0,4787
93
92
  mcp_proxy_adapter/examples/generate_test_configs.py,sha256=FWg_QFJAWinI1lw05RccX4_VbhsCBEKPpZA6I9v6KAs,14379
94
93
  mcp_proxy_adapter/examples/proxy_registration_example.py,sha256=vemRhftnjbiOBCJkmtDGqlWQ8syTG0a8755GCOnaQsg,12503
95
94
  mcp_proxy_adapter/examples/run_example.py,sha256=yp-a6HIrSk3ddQmbn0KkuKwErId0aNfj028TE6U-zmY,2626
96
- mcp_proxy_adapter/examples/run_full_test_suite.py,sha256=bR25OOrmWnLQccZno9cZhi_Ltk_6k8DFR2vXPCj1XQ4,12468
95
+ mcp_proxy_adapter/examples/run_full_test_suite.py,sha256=5tdmTKcgfUMfl_ZTaY0xBly3sTXXTjJJcpja_LN7V-0,17685
97
96
  mcp_proxy_adapter/examples/run_proxy_server.py,sha256=SBLSSY2F_VEBQD3MsCE_Pa9xFE6Sszr3vHdE9QOEN4Y,5242
98
97
  mcp_proxy_adapter/examples/run_security_tests.py,sha256=0vjaUdWC-rLyviQuNxM3PtfiU9TzSRuxGxWMehrFA_w,23311
99
98
  mcp_proxy_adapter/examples/run_security_tests_fixed.py,sha256=2BKMT0_-FhmcZA73hdQOt2XR7Cgb9Sq8qBI88BkwAAA,10934
100
99
  mcp_proxy_adapter/examples/security_test_client.py,sha256=K5gEVat1SJS2pBVxqLl5c9-uiiG12k8UT3ULQDXZ2Uc,35713
101
- mcp_proxy_adapter/examples/setup_test_environment.py,sha256=LR4kGneHELgk4lHMfA9k1yFZ1o3KEQelqOXua5oT88Q,34540
100
+ mcp_proxy_adapter/examples/setup_test_environment.py,sha256=4aYYwtEsUhjLWXTY5l_xklspJYdL3LYA3tD98SxTAdg,34658
102
101
  mcp_proxy_adapter/examples/test_config.py,sha256=ekEoUZe9q484vU_0IxOVhQdNMVJXG3IpmQpP--VmuDI,6491
103
102
  mcp_proxy_adapter/examples/test_config_generator.py,sha256=PBXk1V_awJ-iBlbE66Pme5sQwu6CJDxkmqgm8uPtM58,4091
104
103
  mcp_proxy_adapter/examples/test_examples.py,sha256=CYlVatdHUVC_rwv4NsvxFG3GXiKIyxPDUH43BOJHjrU,12330
105
- mcp_proxy_adapter/examples/test_mcp_adapter.py,sha256=hwxWwIiXXvyZuLrYB0SiKURRwqCXEmPGfl0mWIfvvz8,7830
106
104
  mcp_proxy_adapter/examples/universal_client.py,sha256=n1-cBPOiCipA86Zcc_mI_jMywDMZS1p3u5JT3AqTsrQ,27577
107
105
  mcp_proxy_adapter/examples/basic_framework/__init__.py,sha256=4aYD--R6hy9n9CUxj7Osb9HcdVUMJ6_cfpu4ujkbCwI,345
108
106
  mcp_proxy_adapter/examples/basic_framework/main.py,sha256=AkGUXW05_AK8SEKwlS_0isJKKqjulKBDPp7t36t9QJk,1787
109
- mcp_proxy_adapter/examples/basic_framework/roles.json,sha256=I0lSP3hfq1DESv3xsZ7-xOEdzaQGCb8b9YMK_AOPDsE,510
110
107
  mcp_proxy_adapter/examples/basic_framework/commands/__init__.py,sha256=_VQNLUEdsxUG-4yt9BZI_vtOxHAdGG0OUSsP6Wj-Vz4,76
111
108
  mcp_proxy_adapter/examples/basic_framework/hooks/__init__.py,sha256=IE_EIXMnkdXuakZn7wLD9kBFyfDF5lYi56ejgiBeb-A,70
112
109
  mcp_proxy_adapter/examples/commands/__init__.py,sha256=zvY_OpH_B1bVc_khrNIl6O8vqCw1FH6gGMAsJAkGWGY,170
@@ -126,7 +123,6 @@ mcp_proxy_adapter/examples/examples/full_application/hooks/builtin_command_hooks
126
123
  mcp_proxy_adapter/examples/full_application/__init__.py,sha256=xGiPYhRAzs1Fh9wA8HoowV-Gg9QMLaMZn-OamExq1TI,320
127
124
  mcp_proxy_adapter/examples/full_application/main.py,sha256=ogL3Bil_5puGnwvMh3YNOjrW76FIzzoggKEp-04HSfo,7855
128
125
  mcp_proxy_adapter/examples/full_application/proxy_endpoints.py,sha256=Kt_WAsG61HLTMkKQ1mQqjvlX9I4TcfwYq0NaRR9HKvM,6179
129
- mcp_proxy_adapter/examples/full_application/roles.json,sha256=I0lSP3hfq1DESv3xsZ7-xOEdzaQGCb8b9YMK_AOPDsE,510
130
126
  mcp_proxy_adapter/examples/full_application/commands/__init__.py,sha256=yQHxVSFkAyFLUOdk42QOebUODPlQV9IbydPgF3UKsGM,217
131
127
  mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py,sha256=H7FPJmVJNWT61rPWxep06-7hsYRt8XYBUSBiwqpBurU,3096
132
128
  mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py,sha256=DFTqVnIDt6nBdZ27-vD_f1X2cFcDInVQiCEq9ltw4lA,3428
@@ -136,12 +132,8 @@ mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py,sha25
136
132
  mcp_proxy_adapter/examples/scripts/config_generator.py,sha256=SKFlRRCE_pEHGbfjDuzfKpvV2DMwG6lRfK90uJwRlJM,33410
137
133
  mcp_proxy_adapter/examples/scripts/create_certificates_simple.py,sha256=yCWdUIhMSDPwoPhuLR9rhPdf7jLN5hCjzNfYYgVyHnw,27769
138
134
  mcp_proxy_adapter/examples/scripts/generate_certificates_and_tokens.py,sha256=hUCoJH3fy5WeR_YMHj-_W0mR0ZKUWqewH4FVN3yWyrM,17972
139
- mcp_proxy_adapter/schemas/base_schema.json,sha256=v9G9cGMd4dRhCZsOQ_FMqOi5VFyVbI6Cf3fyIvOT9dc,2881
140
- mcp_proxy_adapter/schemas/openapi_schema.json,sha256=C3yLkwmDsvnLW9B5gnKKdBGl4zxkeU-rEmjTrNVsQU0,8405
141
- mcp_proxy_adapter/utils/config_generator.py,sha256=UXxuxxAyKTesAS3DOofQ26e20v771inA7EfBV8PZD1c,47543
142
- mcp_proxy_adapter_issue_package/demonstrate_issue.py,sha256=O54fwWQvUAjEGiHhQGm1JLnARkhVCwAqjBk_89HyRbY,7894
143
- mcp_proxy_adapter-6.4.9.dist-info/METADATA,sha256=UZNooeeevfQIqOlQ6I1OWDg1xkMmd17_02EeKrzpEIo,22403
144
- mcp_proxy_adapter-6.4.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
145
- mcp_proxy_adapter-6.4.9.dist-info/entry_points.txt,sha256=J3eV6ID0lt_VSp4lIdIgBFTqLCThgObNNxRCbyfiMHw,70
146
- mcp_proxy_adapter-6.4.9.dist-info/top_level.txt,sha256=CHk-Mc-AxjO-tRheegA2qLiQnU4vZRnxuTF81So6SAc,50
147
- mcp_proxy_adapter-6.4.9.dist-info/RECORD,,
135
+ mcp_proxy_adapter-6.4.11.dist-info/METADATA,sha256=wMmu8wxnHQ5yesrOKSu-Aapi8J4xmOnvC5AfTvGQYV8,6087
136
+ mcp_proxy_adapter-6.4.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
137
+ mcp_proxy_adapter-6.4.11.dist-info/entry_points.txt,sha256=J3eV6ID0lt_VSp4lIdIgBFTqLCThgObNNxRCbyfiMHw,70
138
+ mcp_proxy_adapter-6.4.11.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
139
+ mcp_proxy_adapter-6.4.11.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ mcp_proxy_adapter
@@ -1,21 +0,0 @@
1
- {
2
- "roles": {
3
- "admin": {
4
- "permissions": ["*"],
5
- "description": "Administrator with full access"
6
- },
7
- "user": {
8
- "permissions": ["read", "write"],
9
- "description": "Regular user with read/write access"
10
- },
11
- "readonly": {
12
- "permissions": ["read"],
13
- "description": "Read-only user"
14
- }
15
- },
16
- "user_roles": {
17
- "admin": "admin",
18
- "user": "user",
19
- "readonly": "readonly"
20
- }
21
- }
@@ -1,21 +0,0 @@
1
- {
2
- "roles": {
3
- "admin": {
4
- "permissions": ["*"],
5
- "description": "Administrator with full access"
6
- },
7
- "user": {
8
- "permissions": ["read", "write"],
9
- "description": "Regular user with read/write access"
10
- },
11
- "readonly": {
12
- "permissions": ["read"],
13
- "description": "Read-only user"
14
- }
15
- },
16
- "user_roles": {
17
- "admin": "admin",
18
- "user": "user",
19
- "readonly": "readonly"
20
- }
21
- }
@@ -1,177 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Author: Vasiliy Zdanovskiy
4
- email: vasilyvz@gmail.com
5
- Script for generating comprehensive HTTP configuration for MCP Proxy Adapter.
6
- Generates single comprehensive configuration with all features enabled.
7
- """
8
- import json
9
- import os
10
- import argparse
11
- import uuid
12
- from typing import Dict, Any
13
-
14
-
15
- def generate_comprehensive_http_config(
16
- port: int = 20001,
17
- roles_file: str = "configs/roles.json",
18
- ) -> Dict[str, Any]:
19
- """Generate comprehensive HTTP configuration with all features."""
20
- return {
21
- "uuid": str(uuid.uuid4()),
22
- "server": {
23
- "host": "127.0.0.1",
24
- "port": port,
25
- "debug": False,
26
- "log_level": "INFO",
27
- "workers": 1,
28
- "reload": False
29
- },
30
- "ssl": {
31
- "enabled": False
32
- },
33
- "security": {
34
- "enabled": True,
35
- "auth": {
36
- "enabled": True,
37
- "methods": [
38
- "api_key"
39
- ],
40
- "api_keys": {
41
- "admin-token-123": "admin",
42
- "user-token-456": "user",
43
- "readonly-token-789": "readonly",
44
- "guest-token-abc": "guest",
45
- "proxy-token-def": "proxy"
46
- }
47
- },
48
- "permissions": {
49
- "enabled": True,
50
- "roles_file": roles_file
51
- }
52
- },
53
- "registration": {
54
- "enabled": True,
55
- "url": "http://127.0.0.1:3004/proxy",
56
- "name": "comprehensive_http_adapter",
57
- "capabilities": [
58
- "http",
59
- "token_auth",
60
- "roles",
61
- "registration",
62
- "heartbeat"
63
- ],
64
- "retry_count": 3,
65
- "retry_delay": 5,
66
- "heartbeat": {
67
- "enabled": True,
68
- "interval": 30
69
- }
70
- },
71
- "protocols": {
72
- "enabled": True,
73
- "allowed_protocols": [
74
- "http"
75
- ]
76
- }
77
- }
78
-
79
-
80
- def generate_roles_config() -> Dict[str, Any]:
81
- """Generate comprehensive roles configuration."""
82
- return {
83
- "admin": {
84
- "description": "Full administrative access",
85
- "permissions": [
86
- "read",
87
- "write",
88
- "execute",
89
- "delete",
90
- "admin"
91
- ],
92
- "inherits": []
93
- },
94
- "user": {
95
- "description": "Standard user access",
96
- "permissions": [
97
- "read",
98
- "write",
99
- "execute"
100
- ],
101
- "inherits": []
102
- },
103
- "readonly": {
104
- "description": "Read-only access",
105
- "permissions": [
106
- "read"
107
- ],
108
- "inherits": []
109
- },
110
- "guest": {
111
- "description": "Limited guest access",
112
- "permissions": [
113
- "read"
114
- ],
115
- "inherits": []
116
- },
117
- "proxy": {
118
- "description": "Proxy registration access",
119
- "permissions": [
120
- "read",
121
- "register",
122
- "heartbeat"
123
- ],
124
- "inherits": []
125
- }
126
- }
127
-
128
-
129
- def main():
130
- """Generate comprehensive configuration."""
131
- parser = argparse.ArgumentParser(description="Generate comprehensive HTTP configuration")
132
- parser.add_argument(
133
- "--output-dir",
134
- default="configs",
135
- help="Output directory for configuration files"
136
- )
137
- parser.add_argument(
138
- "--port",
139
- type=int,
140
- default=20001,
141
- help="Server port"
142
- )
143
-
144
- args = parser.parse_args()
145
-
146
- # Create output directory
147
- os.makedirs(args.output_dir, exist_ok=True)
148
-
149
- # Generate comprehensive HTTP configuration
150
- config = generate_comprehensive_http_config(port=args.port)
151
- config_file = os.path.join(args.output_dir, "comprehensive_http.json")
152
-
153
- with open(config_file, 'w') as f:
154
- json.dump(config, f, indent=2)
155
-
156
- print(f"Generated: {config_file}")
157
-
158
- # Generate roles configuration
159
- roles = generate_roles_config()
160
- roles_file = os.path.join(args.output_dir, "roles.json")
161
-
162
- with open(roles_file, 'w') as f:
163
- json.dump(roles, f, indent=2)
164
-
165
- print(f"Generated: {roles_file}")
166
-
167
- print(f"\nGenerated comprehensive configuration in {args.output_dir}/")
168
- print("Configuration includes:")
169
- print("- HTTP server with token authentication")
170
- print("- Role-based permissions")
171
- print("- Proxy registration")
172
- print("- Heartbeat monitoring")
173
- print("- 5 predefined tokens with roles")
174
-
175
-
176
- if __name__ == "__main__":
177
- main()
@@ -1,207 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- One-Command Test Runner for MCP Proxy Adapter
4
- This script creates a fresh test environment and runs all tests.
5
- Author: Vasiliy Zdanovskiy
6
- email: vasilyvz@gmail.com
7
-
8
- Usage:
9
- python test_mcp_adapter.py
10
- """
11
- import asyncio
12
- import os
13
- import subprocess
14
- import sys
15
- import time
16
- from pathlib import Path
17
-
18
-
19
- def run_command(cmd, description, cwd=None, timeout=300):
20
- """Run a command and return success status."""
21
- print(f"🚀 {description}...")
22
- try:
23
- result = subprocess.run(
24
- cmd,
25
- shell=True,
26
- cwd=cwd,
27
- capture_output=True,
28
- text=True,
29
- timeout=timeout
30
- )
31
- if result.returncode == 0:
32
- print(f"✅ {description} completed successfully")
33
- return True
34
- else:
35
- print(f"❌ {description} failed")
36
- if result.stderr.strip():
37
- print(f"🔍 Error: {result.stderr.strip()}")
38
- return False
39
- except subprocess.TimeoutExpired:
40
- print(f"⏰ {description} timed out after {timeout} seconds")
41
- return False
42
- except Exception as e:
43
- print(f"❌ {description} failed with exception: {e}")
44
- return False
45
-
46
-
47
- def main():
48
- """Main function to run complete test suite."""
49
- print("=" * 80)
50
- print("🎯 MCP PROXY ADAPTER - ONE-COMMAND TEST SUITE")
51
- print("=" * 80)
52
- print("This script will create a fresh test environment and run all tests.")
53
- print("=" * 80)
54
-
55
- # Get current directory
56
- current_dir = Path.cwd()
57
- print(f"📁 Working directory: {current_dir}")
58
-
59
- # Clean up any existing test environment
60
- test_env_dir = current_dir / "test_environment"
61
- if test_env_dir.exists():
62
- print("🧹 Cleaning up existing test environment...")
63
- import shutil
64
- shutil.rmtree(test_env_dir)
65
- print("✅ Cleaned up existing test environment")
66
-
67
- # Step 1: Setup test environment
68
- print("\n" + "=" * 60)
69
- print("STEP 1: SETTING UP TEST ENVIRONMENT")
70
- print("=" * 60)
71
-
72
- setup_cmd = "python -m mcp_proxy_adapter.examples.setup_test_environment --output-dir test_environment"
73
- if not run_command(setup_cmd, "Setting up test environment"):
74
- print("❌ Failed to setup test environment. Aborting.")
75
- return False
76
-
77
- # Step 2: Generate test configurations
78
- print("\n" + "=" * 60)
79
- print("STEP 2: GENERATING TEST CONFIGURATIONS")
80
- print("=" * 60)
81
-
82
- config_cmd = "python -m mcp_proxy_adapter.examples.generate_test_configs --output-dir test_environment/configs"
83
- if not run_command(config_cmd, "Generating test configurations"):
84
- print("❌ Failed to generate configurations. Aborting.")
85
- return False
86
-
87
- # Step 3: Fix mTLS configurations and certificates
88
- print("\n" + "=" * 60)
89
- print("STEP 3: FIXING mTLS CONFIGURATIONS AND CERTIFICATES")
90
- print("=" * 60)
91
-
92
- # Fix certificate naming
93
- cert_fixes = [
94
- "ln -sf mcp_proxy_adapter_test_ca_ca.crt certs/mcp_proxy_adapter_ca_ca.crt",
95
- "ln -sf admin-client_client.crt certs/admin_cert.pem",
96
- "ln -sf admin-client_client.key certs/admin_key.pem",
97
- "ln -sf admin-client_client.crt certs/user_cert.pem",
98
- "ln -sf admin-client_client.key certs/user_key.pem"
99
- ]
100
-
101
- for fix_cmd in cert_fixes:
102
- run_command(fix_cmd, f"Fixing certificate: {fix_cmd.split()[-1]}", cwd=test_env_dir)
103
-
104
- # Fix mTLS configurations
105
- print("🔧 Fixing mTLS configurations...")
106
-
107
- # Read and fix mtls_with_roles.json
108
- mtls_with_roles_path = test_env_dir / "configs" / "mtls_with_roles.json"
109
- if mtls_with_roles_path.exists():
110
- try:
111
- import json
112
- with open(mtls_with_roles_path, 'r') as f:
113
- config = json.load(f)
114
-
115
- # Add default_protocol if missing
116
- if "protocols" in config and "default_protocol" not in config["protocols"]:
117
- config["protocols"]["default_protocol"] = "mtls"
118
-
119
- # Add client certificate paths if missing
120
- if "ssl" in config:
121
- if "client_cert_file" not in config["ssl"]:
122
- config["ssl"]["client_cert_file"] = "certs/admin_cert.pem"
123
- if "client_key_file" not in config["ssl"]:
124
- config["ssl"]["client_key_file"] = "certs/admin_key.pem"
125
-
126
- with open(mtls_with_roles_path, 'w') as f:
127
- json.dump(config, f, indent=2)
128
- print("✅ Fixed mtls_with_roles.json")
129
- except Exception as e:
130
- print(f"⚠️ Warning: Failed to fix mtls_with_roles.json: {e}")
131
-
132
- # Read and fix mtls_no_roles.json
133
- mtls_no_roles_path = test_env_dir / "configs" / "mtls_no_roles.json"
134
- if mtls_no_roles_path.exists():
135
- try:
136
- import json
137
- with open(mtls_no_roles_path, 'r') as f:
138
- config = json.load(f)
139
-
140
- # Add UUID if missing
141
- if "uuid" not in config:
142
- import uuid
143
- config["uuid"] = str(uuid.uuid4())
144
-
145
- # Add default_protocol if missing
146
- if "protocols" in config and "default_protocol" not in config["protocols"]:
147
- config["protocols"]["default_protocol"] = "mtls"
148
-
149
- # Fix certificate paths in security.ssl section
150
- if "security" in config and "ssl" in config["security"]:
151
- ssl_config = config["security"]["ssl"]
152
- ssl_config["server_cert_file"] = "certs/localhost_server.crt"
153
- ssl_config["server_key_file"] = "keys/localhost_server.key"
154
- ssl_config["ca_cert_file"] = "certs/mcp_proxy_adapter_test_ca_ca.crt"
155
- ssl_config["client_cert_file"] = "certs/admin_cert.pem"
156
- ssl_config["client_key_file"] = "certs/admin_key.pem"
157
-
158
- with open(mtls_no_roles_path, 'w') as f:
159
- json.dump(config, f, indent=2)
160
- print("✅ Fixed mtls_no_roles.json")
161
- except Exception as e:
162
- print(f"⚠️ Warning: Failed to fix mtls_no_roles.json: {e}")
163
-
164
- # Step 4: Run security tests
165
- print("\n" + "=" * 60)
166
- print("STEP 4: RUNNING SECURITY TESTS")
167
- print("=" * 60)
168
-
169
- test_cmd = "python -m mcp_proxy_adapter.examples.run_security_tests"
170
- test_success = run_command(test_cmd, "Running security tests", cwd=test_env_dir, timeout=600)
171
-
172
- # Step 5: Show final results
173
- print("\n" + "=" * 80)
174
- print("🎉 ONE-COMMAND TEST SUITE FINISHED")
175
- print("=" * 80)
176
- print("📋 SUMMARY:")
177
- print("✅ Test environment created successfully")
178
- print("✅ Configurations generated successfully")
179
- print("✅ Certificates generated and fixed")
180
- print("✅ Security tests executed")
181
- print(f"📁 Test environment location: {test_env_dir}")
182
- print("\n🔧 Available configurations:")
183
- print(" - HTTP: test_environment/configs/http_simple.json")
184
- print(" - HTTP + Token: test_environment/configs/http_token.json")
185
- print(" - HTTPS: test_environment/configs/https_simple.json")
186
- print(" - HTTPS + Token: test_environment/configs/https_token.json")
187
- print(" - mTLS: test_environment/configs/mtls_with_roles.json")
188
- print("\n📊 Test Results:")
189
- if test_success:
190
- print("✅ All tests completed successfully")
191
- else:
192
- print("⚠️ Some tests failed (check output above for details)")
193
- print("=" * 80)
194
-
195
- return test_success
196
-
197
-
198
- if __name__ == "__main__":
199
- try:
200
- success = main()
201
- sys.exit(0 if success else 1)
202
- except KeyboardInterrupt:
203
- print("\n⚠️ Interrupted by user")
204
- sys.exit(1)
205
- except Exception as e:
206
- print(f"\n❌ Unexpected error: {e}")
207
- sys.exit(1)
@@ -1,114 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "title": "Base Schema",
4
- "description": "Basic schema for validating commands and results",
5
- "definitions": {
6
- "command": {
7
- "type": "object",
8
- "properties": {
9
- "jsonrpc": {
10
- "type": "string",
11
- "enum": ["2.0"],
12
- "description": "JSON-RPC version"
13
- },
14
- "method": {
15
- "type": "string",
16
- "description": "Command name"
17
- },
18
- "params": {
19
- "type": "object",
20
- "description": "Command parameters"
21
- },
22
- "id": {
23
- "oneOf": [
24
- {"type": "string"},
25
- {"type": "integer"},
26
- {"type": "null"}
27
- ],
28
- "description": "Request ID"
29
- }
30
- },
31
- "required": ["jsonrpc", "method"]
32
- },
33
- "success_response": {
34
- "type": "object",
35
- "properties": {
36
- "jsonrpc": {
37
- "type": "string",
38
- "enum": ["2.0"],
39
- "description": "JSON-RPC version"
40
- },
41
- "result": {
42
- "type": "object",
43
- "properties": {
44
- "success": {
45
- "type": "boolean",
46
- "enum": [true],
47
- "description": "Success flag"
48
- },
49
- "data": {
50
- "type": "object",
51
- "description": "Response data"
52
- },
53
- "message": {
54
- "type": "string",
55
- "description": "Response message"
56
- }
57
- },
58
- "required": ["success"]
59
- },
60
- "id": {
61
- "oneOf": [
62
- {"type": "string"},
63
- {"type": "integer"},
64
- {"type": "null"}
65
- ],
66
- "description": "Request ID"
67
- }
68
- },
69
- "required": ["jsonrpc", "result"]
70
- },
71
- "error_response": {
72
- "type": "object",
73
- "properties": {
74
- "jsonrpc": {
75
- "type": "string",
76
- "enum": ["2.0"],
77
- "description": "JSON-RPC version"
78
- },
79
- "error": {
80
- "type": "object",
81
- "properties": {
82
- "code": {
83
- "type": "integer",
84
- "description": "Error code"
85
- },
86
- "message": {
87
- "type": "string",
88
- "description": "Error message"
89
- },
90
- "details": {
91
- "type": "object",
92
- "description": "Detailed error information"
93
- }
94
- },
95
- "required": ["code", "message"]
96
- },
97
- "id": {
98
- "oneOf": [
99
- {"type": "string"},
100
- {"type": "integer"},
101
- {"type": "null"}
102
- ],
103
- "description": "Request ID"
104
- }
105
- },
106
- "required": ["jsonrpc", "error"]
107
- }
108
- },
109
- "oneOf": [
110
- {"$ref": "#/definitions/command"},
111
- {"$ref": "#/definitions/success_response"},
112
- {"$ref": "#/definitions/error_response"}
113
- ]
114
- }