mcp-proxy-adapter 6.3.4__py3-none-any.whl → 6.3.5__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 +9 -5
- mcp_proxy_adapter/__main__.py +1 -1
- mcp_proxy_adapter/api/app.py +227 -176
- mcp_proxy_adapter/api/handlers.py +68 -60
- mcp_proxy_adapter/api/middleware/__init__.py +7 -5
- mcp_proxy_adapter/api/middleware/base.py +19 -16
- mcp_proxy_adapter/api/middleware/command_permission_middleware.py +44 -34
- mcp_proxy_adapter/api/middleware/error_handling.py +57 -67
- mcp_proxy_adapter/api/middleware/factory.py +50 -52
- mcp_proxy_adapter/api/middleware/logging.py +46 -30
- mcp_proxy_adapter/api/middleware/performance.py +19 -16
- mcp_proxy_adapter/api/middleware/protocol_middleware.py +80 -50
- mcp_proxy_adapter/api/middleware/transport_middleware.py +26 -24
- mcp_proxy_adapter/api/middleware/unified_security.py +70 -51
- mcp_proxy_adapter/api/middleware/user_info_middleware.py +43 -34
- mcp_proxy_adapter/api/schemas.py +69 -43
- mcp_proxy_adapter/api/tool_integration.py +83 -63
- mcp_proxy_adapter/api/tools.py +60 -50
- mcp_proxy_adapter/commands/__init__.py +15 -6
- mcp_proxy_adapter/commands/auth_validation_command.py +107 -110
- mcp_proxy_adapter/commands/base.py +108 -112
- mcp_proxy_adapter/commands/builtin_commands.py +28 -18
- mcp_proxy_adapter/commands/catalog_manager.py +394 -265
- mcp_proxy_adapter/commands/cert_monitor_command.py +222 -204
- mcp_proxy_adapter/commands/certificate_management_command.py +210 -213
- mcp_proxy_adapter/commands/command_registry.py +275 -226
- mcp_proxy_adapter/commands/config_command.py +48 -33
- mcp_proxy_adapter/commands/dependency_container.py +22 -23
- mcp_proxy_adapter/commands/dependency_manager.py +65 -56
- mcp_proxy_adapter/commands/echo_command.py +15 -15
- mcp_proxy_adapter/commands/health_command.py +31 -29
- mcp_proxy_adapter/commands/help_command.py +97 -61
- mcp_proxy_adapter/commands/hooks.py +65 -49
- mcp_proxy_adapter/commands/key_management_command.py +148 -147
- mcp_proxy_adapter/commands/load_command.py +58 -40
- mcp_proxy_adapter/commands/plugins_command.py +80 -54
- mcp_proxy_adapter/commands/protocol_management_command.py +60 -48
- mcp_proxy_adapter/commands/proxy_registration_command.py +107 -115
- mcp_proxy_adapter/commands/reload_command.py +43 -37
- mcp_proxy_adapter/commands/result.py +26 -33
- mcp_proxy_adapter/commands/role_test_command.py +26 -26
- mcp_proxy_adapter/commands/roles_management_command.py +176 -173
- mcp_proxy_adapter/commands/security_command.py +134 -122
- mcp_proxy_adapter/commands/settings_command.py +47 -56
- mcp_proxy_adapter/commands/ssl_setup_command.py +109 -129
- mcp_proxy_adapter/commands/token_management_command.py +129 -158
- mcp_proxy_adapter/commands/transport_management_command.py +41 -36
- mcp_proxy_adapter/commands/unload_command.py +42 -37
- mcp_proxy_adapter/config.py +36 -35
- mcp_proxy_adapter/core/__init__.py +19 -21
- mcp_proxy_adapter/core/app_factory.py +30 -9
- mcp_proxy_adapter/core/app_runner.py +81 -64
- mcp_proxy_adapter/core/auth_validator.py +176 -182
- mcp_proxy_adapter/core/certificate_utils.py +469 -426
- mcp_proxy_adapter/core/client.py +155 -126
- mcp_proxy_adapter/core/client_manager.py +60 -54
- mcp_proxy_adapter/core/client_security.py +108 -88
- mcp_proxy_adapter/core/config_converter.py +176 -143
- mcp_proxy_adapter/core/config_validator.py +12 -4
- mcp_proxy_adapter/core/crl_utils.py +21 -7
- mcp_proxy_adapter/core/errors.py +64 -20
- mcp_proxy_adapter/core/logging.py +34 -29
- mcp_proxy_adapter/core/mtls_asgi.py +29 -25
- mcp_proxy_adapter/core/mtls_asgi_app.py +66 -54
- mcp_proxy_adapter/core/protocol_manager.py +154 -104
- mcp_proxy_adapter/core/proxy_client.py +202 -144
- mcp_proxy_adapter/core/proxy_registration.py +7 -3
- mcp_proxy_adapter/core/role_utils.py +139 -125
- mcp_proxy_adapter/core/security_adapter.py +88 -77
- mcp_proxy_adapter/core/security_factory.py +50 -44
- mcp_proxy_adapter/core/security_integration.py +72 -24
- mcp_proxy_adapter/core/server_adapter.py +68 -64
- mcp_proxy_adapter/core/server_engine.py +71 -53
- mcp_proxy_adapter/core/settings.py +68 -58
- mcp_proxy_adapter/core/ssl_utils.py +69 -56
- mcp_proxy_adapter/core/transport_manager.py +72 -60
- mcp_proxy_adapter/core/unified_config_adapter.py +201 -150
- mcp_proxy_adapter/core/utils.py +4 -2
- mcp_proxy_adapter/custom_openapi.py +107 -99
- mcp_proxy_adapter/examples/basic_framework/main.py +9 -2
- mcp_proxy_adapter/examples/commands/__init__.py +1 -1
- mcp_proxy_adapter/examples/create_certificates_simple.py +182 -71
- mcp_proxy_adapter/examples/debug_request_state.py +38 -19
- mcp_proxy_adapter/examples/debug_role_chain.py +53 -20
- mcp_proxy_adapter/examples/demo_client.py +48 -36
- mcp_proxy_adapter/examples/examples/basic_framework/main.py +9 -2
- mcp_proxy_adapter/examples/examples/full_application/__init__.py +1 -0
- mcp_proxy_adapter/examples/examples/full_application/commands/custom_echo_command.py +22 -10
- mcp_proxy_adapter/examples/examples/full_application/commands/dynamic_calculator_command.py +24 -17
- mcp_proxy_adapter/examples/examples/full_application/hooks/application_hooks.py +16 -3
- mcp_proxy_adapter/examples/examples/full_application/hooks/builtin_command_hooks.py +13 -3
- mcp_proxy_adapter/examples/examples/full_application/main.py +27 -2
- mcp_proxy_adapter/examples/examples/full_application/proxy_endpoints.py +48 -14
- mcp_proxy_adapter/examples/full_application/__init__.py +1 -0
- mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py +22 -10
- mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py +24 -17
- mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py +16 -3
- mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py +13 -3
- mcp_proxy_adapter/examples/full_application/main.py +27 -2
- mcp_proxy_adapter/examples/full_application/proxy_endpoints.py +48 -14
- mcp_proxy_adapter/examples/generate_all_certificates.py +198 -73
- mcp_proxy_adapter/examples/generate_certificates.py +31 -16
- mcp_proxy_adapter/examples/generate_certificates_and_tokens.py +220 -74
- mcp_proxy_adapter/examples/generate_test_configs.py +68 -91
- mcp_proxy_adapter/examples/proxy_registration_example.py +76 -75
- mcp_proxy_adapter/examples/run_example.py +23 -5
- mcp_proxy_adapter/examples/run_full_test_suite.py +109 -71
- mcp_proxy_adapter/examples/run_proxy_server.py +22 -9
- mcp_proxy_adapter/examples/run_security_tests.py +103 -41
- mcp_proxy_adapter/examples/run_security_tests_fixed.py +72 -36
- mcp_proxy_adapter/examples/scripts/config_generator.py +288 -187
- mcp_proxy_adapter/examples/scripts/create_certificates_simple.py +185 -72
- mcp_proxy_adapter/examples/scripts/generate_certificates_and_tokens.py +220 -74
- mcp_proxy_adapter/examples/security_test_client.py +196 -127
- mcp_proxy_adapter/examples/setup_test_environment.py +17 -29
- mcp_proxy_adapter/examples/test_config.py +19 -4
- mcp_proxy_adapter/examples/test_config_generator.py +23 -7
- mcp_proxy_adapter/examples/test_examples.py +84 -56
- mcp_proxy_adapter/examples/universal_client.py +119 -62
- mcp_proxy_adapter/openapi.py +108 -115
- mcp_proxy_adapter/utils/config_generator.py +429 -274
- mcp_proxy_adapter/version.py +1 -2
- {mcp_proxy_adapter-6.3.4.dist-info → mcp_proxy_adapter-6.3.5.dist-info}/METADATA +1 -1
- mcp_proxy_adapter-6.3.5.dist-info/RECORD +143 -0
- mcp_proxy_adapter-6.3.4.dist-info/RECORD +0 -143
- {mcp_proxy_adapter-6.3.4.dist-info → mcp_proxy_adapter-6.3.5.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-6.3.4.dist-info → mcp_proxy_adapter-6.3.5.dist-info}/entry_points.txt +0 -0
- {mcp_proxy_adapter-6.3.4.dist-info → mcp_proxy_adapter-6.3.5.dist-info}/licenses/LICENSE +0 -0
- {mcp_proxy_adapter-6.3.4.dist-info → mcp_proxy_adapter-6.3.5.dist-info}/top_level.txt +0 -0
@@ -30,15 +30,12 @@ def generate_http_simple_config(
|
|
30
30
|
"endpoints": {
|
31
31
|
"jsonrpc": "/api/jsonrpc",
|
32
32
|
"rest": "/cmd",
|
33
|
-
"health": "/health"
|
34
|
-
}
|
33
|
+
"health": "/health",
|
34
|
+
},
|
35
35
|
},
|
36
|
-
"heartbeat": {"enabled": True, "interval": 30}
|
36
|
+
"heartbeat": {"enabled": True, "interval": 30},
|
37
37
|
},
|
38
|
-
"protocols": {
|
39
|
-
"enabled": True,
|
40
|
-
"allowed_protocols": ["http"]
|
41
|
-
}
|
38
|
+
"protocols": {"enabled": True, "allowed_protocols": ["http"]},
|
42
39
|
}
|
43
40
|
|
44
41
|
|
@@ -46,7 +43,7 @@ def generate_http_token_config(
|
|
46
43
|
port: int = 20001,
|
47
44
|
certs_dir: str = "certs",
|
48
45
|
keys_dir: str = "keys",
|
49
|
-
roles_file: str = "configs/roles.json"
|
46
|
+
roles_file: str = "configs/roles.json",
|
50
47
|
) -> Dict[str, Any]:
|
51
48
|
"""Generate HTTP configuration with token authorization."""
|
52
49
|
return {
|
@@ -63,10 +60,10 @@ def generate_http_token_config(
|
|
63
60
|
"user-token-456": "user",
|
64
61
|
"readonly-token-123": "readonly",
|
65
62
|
"guest-token-123": "guest",
|
66
|
-
"proxy-token-123": "proxy"
|
67
|
-
}
|
63
|
+
"proxy-token-123": "proxy",
|
64
|
+
},
|
68
65
|
},
|
69
|
-
"permissions": {"enabled": True, "roles_file": roles_file}
|
66
|
+
"permissions": {"enabled": True, "roles_file": roles_file},
|
70
67
|
},
|
71
68
|
"registration": {
|
72
69
|
"enabled": True,
|
@@ -75,12 +72,9 @@ def generate_http_token_config(
|
|
75
72
|
"capabilities": ["http", "token_auth"],
|
76
73
|
"retry_count": 3,
|
77
74
|
"retry_delay": 5,
|
78
|
-
"heartbeat": {"enabled": True, "interval": 30}
|
75
|
+
"heartbeat": {"enabled": True, "interval": 30},
|
79
76
|
},
|
80
|
-
"protocols": {
|
81
|
-
"enabled": True,
|
82
|
-
"allowed_protocols": ["http"]
|
83
|
-
}
|
77
|
+
"protocols": {"enabled": True, "allowed_protocols": ["http"]},
|
84
78
|
}
|
85
79
|
|
86
80
|
|
@@ -93,7 +87,7 @@ def generate_https_simple_config(
|
|
93
87
|
"ssl": {
|
94
88
|
"enabled": True,
|
95
89
|
"cert_file": f"{certs_dir}/localhost_server.crt",
|
96
|
-
"key_file": f"{keys_dir}/localhost_server.key"
|
90
|
+
"key_file": f"{keys_dir}/localhost_server.key",
|
97
91
|
},
|
98
92
|
"security": {"enabled": False},
|
99
93
|
"registration": {
|
@@ -103,12 +97,9 @@ def generate_https_simple_config(
|
|
103
97
|
"capabilities": ["https"],
|
104
98
|
"retry_count": 3,
|
105
99
|
"retry_delay": 5,
|
106
|
-
"heartbeat": {"enabled": True, "interval": 30}
|
100
|
+
"heartbeat": {"enabled": True, "interval": 30},
|
107
101
|
},
|
108
|
-
"protocols": {
|
109
|
-
"enabled": True,
|
110
|
-
"allowed_protocols": ["http", "https"]
|
111
|
-
}
|
102
|
+
"protocols": {"enabled": True, "allowed_protocols": ["http", "https"]},
|
112
103
|
}
|
113
104
|
|
114
105
|
|
@@ -121,7 +112,7 @@ def generate_https_token_config(
|
|
121
112
|
"ssl": {
|
122
113
|
"enabled": True,
|
123
114
|
"cert_file": f"{certs_dir}/localhost_server.crt",
|
124
|
-
"key_file": f"{keys_dir}/localhost_server.key"
|
115
|
+
"key_file": f"{keys_dir}/localhost_server.key",
|
125
116
|
},
|
126
117
|
"security": {
|
127
118
|
"enabled": True,
|
@@ -133,10 +124,10 @@ def generate_https_token_config(
|
|
133
124
|
"user-token-456": "user",
|
134
125
|
"readonly-token-123": "readonly",
|
135
126
|
"guest-token-123": "guest",
|
136
|
-
"proxy-token-123": "proxy"
|
137
|
-
}
|
127
|
+
"proxy-token-123": "proxy",
|
128
|
+
},
|
138
129
|
},
|
139
|
-
"permissions": {"enabled": True, "roles_file": "./configs/roles.json"}
|
130
|
+
"permissions": {"enabled": True, "roles_file": "./configs/roles.json"},
|
140
131
|
},
|
141
132
|
"registration": {
|
142
133
|
"enabled": True,
|
@@ -145,12 +136,9 @@ def generate_https_token_config(
|
|
145
136
|
"capabilities": ["https", "token_auth"],
|
146
137
|
"retry_count": 3,
|
147
138
|
"retry_delay": 5,
|
148
|
-
"heartbeat": {"enabled": True, "interval": 30}
|
139
|
+
"heartbeat": {"enabled": True, "interval": 30},
|
149
140
|
},
|
150
|
-
"protocols": {
|
151
|
-
"enabled": True,
|
152
|
-
"allowed_protocols": ["http", "https"]
|
153
|
-
}
|
141
|
+
"protocols": {"enabled": True, "allowed_protocols": ["http", "https"]},
|
154
142
|
}
|
155
143
|
|
156
144
|
|
@@ -166,20 +154,15 @@ def generate_mtls_no_roles_config(
|
|
166
154
|
"key_file": f"{keys_dir}/localhost_server.key",
|
167
155
|
"ca_cert": f"{certs_dir}/mcp_proxy_adapter_ca_ca.crt",
|
168
156
|
"verify_client": True,
|
169
|
-
"client_cert_required": True
|
157
|
+
"client_cert_required": True,
|
170
158
|
},
|
171
159
|
"security": {
|
172
160
|
"enabled": True,
|
173
161
|
"auth": {"enabled": True, "methods": ["certificate"]},
|
174
|
-
"permissions": {"enabled": False}
|
162
|
+
"permissions": {"enabled": False},
|
175
163
|
},
|
176
|
-
"registration": {
|
177
|
-
|
178
|
-
},
|
179
|
-
"protocols": {
|
180
|
-
"enabled": True,
|
181
|
-
"allowed_protocols": ["https", "mtls"]
|
182
|
-
}
|
164
|
+
"registration": {"enabled": False},
|
165
|
+
"protocols": {"enabled": True, "allowed_protocols": ["https", "mtls"]},
|
183
166
|
}
|
184
167
|
|
185
168
|
|
@@ -187,7 +170,7 @@ def generate_mtls_with_roles_config(
|
|
187
170
|
port: int = 20005,
|
188
171
|
certs_dir: str = "certs",
|
189
172
|
keys_dir: str = "keys",
|
190
|
-
roles_file: str = "configs/roles.json"
|
173
|
+
roles_file: str = "configs/roles.json",
|
191
174
|
) -> Dict[str, Any]:
|
192
175
|
"""Generate mTLS configuration with roles."""
|
193
176
|
return {
|
@@ -197,7 +180,7 @@ def generate_mtls_with_roles_config(
|
|
197
180
|
"cert_file": f"{certs_dir}/localhost_server.crt",
|
198
181
|
"key_file": f"{keys_dir}/localhost_server.key",
|
199
182
|
"ca_cert": f"{certs_dir}/mcp_proxy_adapter_ca_ca.crt",
|
200
|
-
"verify_client": True
|
183
|
+
"verify_client": True,
|
201
184
|
},
|
202
185
|
"registration": {
|
203
186
|
"enabled": True,
|
@@ -210,20 +193,17 @@ def generate_mtls_with_roles_config(
|
|
210
193
|
"endpoints": {
|
211
194
|
"jsonrpc": "/api/jsonrpc",
|
212
195
|
"rest": "/cmd",
|
213
|
-
"health": "/health"
|
214
|
-
}
|
196
|
+
"health": "/health",
|
197
|
+
},
|
215
198
|
},
|
216
|
-
"heartbeat": {"enabled": True, "interval": 30}
|
199
|
+
"heartbeat": {"enabled": True, "interval": 30},
|
217
200
|
},
|
218
201
|
"security": {
|
219
202
|
"enabled": True,
|
220
203
|
"auth": {"enabled": True, "methods": ["certificate"]},
|
221
|
-
"permissions": {"enabled": True, "roles_file": roles_file}
|
204
|
+
"permissions": {"enabled": True, "roles_file": roles_file},
|
222
205
|
},
|
223
|
-
"protocols": {
|
224
|
-
"enabled": True,
|
225
|
-
"allowed_protocols": ["https", "mtls"]
|
226
|
-
}
|
206
|
+
"protocols": {"enabled": True, "allowed_protocols": ["https", "mtls"]},
|
227
207
|
}
|
228
208
|
|
229
209
|
|
@@ -241,9 +221,9 @@ def generate_roles_config() -> Dict[str, Any]:
|
|
241
221
|
"register",
|
242
222
|
"unregister",
|
243
223
|
"heartbeat",
|
244
|
-
"discover"
|
224
|
+
"discover",
|
245
225
|
],
|
246
|
-
"tokens": ["test-token-123"]
|
226
|
+
"tokens": ["test-token-123"],
|
247
227
|
},
|
248
228
|
"user": {
|
249
229
|
"description": "User role with limited access",
|
@@ -253,36 +233,25 @@ def generate_roles_config() -> Dict[str, Any]:
|
|
253
233
|
"register",
|
254
234
|
"unregister",
|
255
235
|
"heartbeat",
|
256
|
-
"discover"
|
236
|
+
"discover",
|
257
237
|
],
|
258
|
-
"tokens": ["user-token-456"]
|
238
|
+
"tokens": ["user-token-456"],
|
259
239
|
},
|
260
240
|
"readonly": {
|
261
241
|
"description": "Read-only role",
|
262
|
-
"permissions": [
|
263
|
-
|
264
|
-
"discover"
|
265
|
-
],
|
266
|
-
"tokens": ["readonly-token-123"]
|
242
|
+
"permissions": ["read", "discover"],
|
243
|
+
"tokens": ["readonly-token-123"],
|
267
244
|
},
|
268
245
|
"guest": {
|
269
246
|
"description": "Guest role with read-only access",
|
270
|
-
"permissions": [
|
271
|
-
|
272
|
-
"discover"
|
273
|
-
],
|
274
|
-
"tokens": ["guest-token-123"]
|
247
|
+
"permissions": ["read", "discover"],
|
248
|
+
"tokens": ["guest-token-123"],
|
275
249
|
},
|
276
250
|
"proxy": {
|
277
251
|
"description": "Proxy role for registration",
|
278
|
-
"permissions": [
|
279
|
-
|
280
|
-
|
281
|
-
"heartbeat",
|
282
|
-
"discover"
|
283
|
-
],
|
284
|
-
"tokens": ["proxy-token-123"]
|
285
|
-
}
|
252
|
+
"permissions": ["register", "unregister", "heartbeat", "discover"],
|
253
|
+
"tokens": ["proxy-token-123"],
|
254
|
+
},
|
286
255
|
}
|
287
256
|
|
288
257
|
|
@@ -290,7 +259,7 @@ def generate_all_configs(
|
|
290
259
|
output_dir: str,
|
291
260
|
certs_dir: str = "certs",
|
292
261
|
keys_dir: str = "keys",
|
293
|
-
roles_file: str = "configs/roles.json"
|
262
|
+
roles_file: str = "configs/roles.json",
|
294
263
|
) -> None:
|
295
264
|
"""Generate all 6 configuration types and save them to files."""
|
296
265
|
# Ensure output directory exists first
|
@@ -298,17 +267,21 @@ def generate_all_configs(
|
|
298
267
|
|
299
268
|
configs = {
|
300
269
|
"http_simple": generate_http_simple_config(20000, certs_dir, keys_dir),
|
301
|
-
"http_token": generate_http_token_config(
|
270
|
+
"http_token": generate_http_token_config(
|
271
|
+
20001, certs_dir, keys_dir, roles_file
|
272
|
+
),
|
302
273
|
"https_simple": generate_https_simple_config(20002, certs_dir, keys_dir),
|
303
274
|
"https_token": generate_https_token_config(20003, certs_dir, keys_dir),
|
304
275
|
"mtls_no_roles": generate_mtls_no_roles_config(20004, certs_dir, keys_dir),
|
305
|
-
"mtls_with_roles": generate_mtls_with_roles_config(
|
276
|
+
"mtls_with_roles": generate_mtls_with_roles_config(
|
277
|
+
20005, certs_dir, keys_dir, roles_file
|
278
|
+
),
|
306
279
|
}
|
307
280
|
|
308
281
|
# Generate each configuration
|
309
282
|
for name, config in configs.items():
|
310
283
|
filename = os.path.join(output_dir, f"{name}.json")
|
311
|
-
with open(filename,
|
284
|
+
with open(filename, "w", encoding="utf-8") as f:
|
312
285
|
json.dump(config, f, indent=2, ensure_ascii=False)
|
313
286
|
print(f"Generated: {filename}")
|
314
287
|
|
@@ -324,13 +297,13 @@ def generate_all_configs(
|
|
324
297
|
root_roles_filename = os.path.join(current_dir, "roles.json")
|
325
298
|
|
326
299
|
# Create roles.json in the current working directory
|
327
|
-
with open(root_roles_filename,
|
300
|
+
with open(root_roles_filename, "w", encoding="utf-8") as f:
|
328
301
|
json.dump(roles_config, f, indent=2, ensure_ascii=False)
|
329
302
|
print(f"Generated: {root_roles_filename}")
|
330
303
|
|
331
304
|
# Also create a copy in the output directory for reference
|
332
305
|
backup_roles_filename = os.path.join(output_dir, "roles_backup.json")
|
333
|
-
with open(backup_roles_filename,
|
306
|
+
with open(backup_roles_filename, "w", encoding="utf-8") as f:
|
334
307
|
json.dump(roles_config, f, indent=2, ensure_ascii=False)
|
335
308
|
print(f"Generated backup: {backup_roles_filename}")
|
336
309
|
|
@@ -341,10 +314,12 @@ def generate_all_configs(
|
|
341
314
|
|
342
315
|
# Also create roles.json in configs directory for reference
|
343
316
|
roles_filename = os.path.join(output_dir, "roles.json")
|
344
|
-
with open(roles_filename,
|
317
|
+
with open(roles_filename, "w", encoding="utf-8") as f:
|
345
318
|
json.dump(roles_config, f, indent=2, ensure_ascii=False)
|
346
319
|
print(f"Generated: {roles_filename}")
|
347
|
-
print(
|
320
|
+
print(
|
321
|
+
f"\nGenerated {len(configs)} configuration files and roles.json in {output_dir}"
|
322
|
+
)
|
348
323
|
|
349
324
|
print("\n" + "=" * 60)
|
350
325
|
print("✅ CONFIGURATION GENERATION COMPLETED SUCCESSFULLY")
|
@@ -353,9 +328,13 @@ def generate_all_configs(
|
|
353
328
|
print("1. Run security tests:")
|
354
329
|
print(" python -m mcp_proxy_adapter.examples.run_security_tests")
|
355
330
|
print("\n2. Start basic framework example:")
|
356
|
-
print(
|
331
|
+
print(
|
332
|
+
" python -m mcp_proxy_adapter.examples.basic_framework.main --config configs/https_simple.json"
|
333
|
+
)
|
357
334
|
print("\n3. Start full application example:")
|
358
|
-
print(
|
335
|
+
print(
|
336
|
+
" python -m mcp_proxy_adapter.examples.full_application.main --config configs/mtls_with_roles.json"
|
337
|
+
)
|
359
338
|
print("=" * 60)
|
360
339
|
|
361
340
|
|
@@ -367,27 +346,25 @@ def main() -> int:
|
|
367
346
|
parser.add_argument(
|
368
347
|
"--output-dir",
|
369
348
|
default="configs",
|
370
|
-
help="Output directory for configuration files (default: configs)"
|
349
|
+
help="Output directory for configuration files (default: configs)",
|
371
350
|
)
|
372
351
|
parser.add_argument(
|
373
|
-
"--certs-dir",
|
374
|
-
default="certs",
|
375
|
-
help="Certificates directory (default: certs)"
|
352
|
+
"--certs-dir", default="certs", help="Certificates directory (default: certs)"
|
376
353
|
)
|
377
354
|
parser.add_argument(
|
378
|
-
"--keys-dir",
|
379
|
-
default="keys",
|
380
|
-
help="Keys directory (default: keys)"
|
355
|
+
"--keys-dir", default="keys", help="Keys directory (default: keys)"
|
381
356
|
)
|
382
357
|
parser.add_argument(
|
383
358
|
"--roles-file",
|
384
359
|
default="configs/roles.json",
|
385
|
-
help="Roles file path (default: configs/roles.json)"
|
360
|
+
help="Roles file path (default: configs/roles.json)",
|
386
361
|
)
|
387
362
|
args = parser.parse_args()
|
388
363
|
|
389
364
|
try:
|
390
|
-
generate_all_configs(
|
365
|
+
generate_all_configs(
|
366
|
+
args.output_dir, args.certs_dir, args.keys_dir, args.roles_file
|
367
|
+
)
|
391
368
|
print("Configuration generation completed successfully!")
|
392
369
|
except Exception as e:
|
393
370
|
print(f"\n❌ CONFIGURATION GENERATION FAILED: {e}")
|