mcp-proxy-adapter 6.3.4__py3-none-any.whl → 6.3.6__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.
Files changed (131) hide show
  1. mcp_proxy_adapter/__init__.py +9 -5
  2. mcp_proxy_adapter/__main__.py +1 -1
  3. mcp_proxy_adapter/api/app.py +227 -176
  4. mcp_proxy_adapter/api/handlers.py +68 -60
  5. mcp_proxy_adapter/api/middleware/__init__.py +7 -5
  6. mcp_proxy_adapter/api/middleware/base.py +19 -16
  7. mcp_proxy_adapter/api/middleware/command_permission_middleware.py +44 -34
  8. mcp_proxy_adapter/api/middleware/error_handling.py +57 -67
  9. mcp_proxy_adapter/api/middleware/factory.py +50 -52
  10. mcp_proxy_adapter/api/middleware/logging.py +46 -30
  11. mcp_proxy_adapter/api/middleware/performance.py +19 -16
  12. mcp_proxy_adapter/api/middleware/protocol_middleware.py +80 -50
  13. mcp_proxy_adapter/api/middleware/transport_middleware.py +26 -24
  14. mcp_proxy_adapter/api/middleware/unified_security.py +70 -51
  15. mcp_proxy_adapter/api/middleware/user_info_middleware.py +43 -34
  16. mcp_proxy_adapter/api/schemas.py +69 -43
  17. mcp_proxy_adapter/api/tool_integration.py +83 -63
  18. mcp_proxy_adapter/api/tools.py +60 -50
  19. mcp_proxy_adapter/commands/__init__.py +15 -6
  20. mcp_proxy_adapter/commands/auth_validation_command.py +107 -110
  21. mcp_proxy_adapter/commands/base.py +108 -112
  22. mcp_proxy_adapter/commands/builtin_commands.py +28 -18
  23. mcp_proxy_adapter/commands/catalog_manager.py +394 -265
  24. mcp_proxy_adapter/commands/cert_monitor_command.py +222 -204
  25. mcp_proxy_adapter/commands/certificate_management_command.py +210 -213
  26. mcp_proxy_adapter/commands/command_registry.py +275 -226
  27. mcp_proxy_adapter/commands/config_command.py +48 -33
  28. mcp_proxy_adapter/commands/dependency_container.py +22 -23
  29. mcp_proxy_adapter/commands/dependency_manager.py +65 -56
  30. mcp_proxy_adapter/commands/echo_command.py +15 -15
  31. mcp_proxy_adapter/commands/health_command.py +31 -29
  32. mcp_proxy_adapter/commands/help_command.py +97 -61
  33. mcp_proxy_adapter/commands/hooks.py +65 -49
  34. mcp_proxy_adapter/commands/key_management_command.py +148 -147
  35. mcp_proxy_adapter/commands/load_command.py +58 -40
  36. mcp_proxy_adapter/commands/plugins_command.py +80 -54
  37. mcp_proxy_adapter/commands/protocol_management_command.py +60 -48
  38. mcp_proxy_adapter/commands/proxy_registration_command.py +107 -115
  39. mcp_proxy_adapter/commands/reload_command.py +43 -37
  40. mcp_proxy_adapter/commands/result.py +26 -33
  41. mcp_proxy_adapter/commands/role_test_command.py +26 -26
  42. mcp_proxy_adapter/commands/roles_management_command.py +176 -173
  43. mcp_proxy_adapter/commands/security_command.py +134 -122
  44. mcp_proxy_adapter/commands/settings_command.py +47 -56
  45. mcp_proxy_adapter/commands/ssl_setup_command.py +109 -129
  46. mcp_proxy_adapter/commands/token_management_command.py +129 -158
  47. mcp_proxy_adapter/commands/transport_management_command.py +41 -36
  48. mcp_proxy_adapter/commands/unload_command.py +42 -37
  49. mcp_proxy_adapter/config.py +36 -35
  50. mcp_proxy_adapter/core/__init__.py +19 -21
  51. mcp_proxy_adapter/core/app_factory.py +30 -9
  52. mcp_proxy_adapter/core/app_runner.py +81 -64
  53. mcp_proxy_adapter/core/auth_validator.py +176 -182
  54. mcp_proxy_adapter/core/certificate_utils.py +469 -426
  55. mcp_proxy_adapter/core/client.py +155 -126
  56. mcp_proxy_adapter/core/client_manager.py +60 -54
  57. mcp_proxy_adapter/core/client_security.py +120 -91
  58. mcp_proxy_adapter/core/config_converter.py +176 -143
  59. mcp_proxy_adapter/core/config_validator.py +12 -4
  60. mcp_proxy_adapter/core/crl_utils.py +21 -7
  61. mcp_proxy_adapter/core/errors.py +64 -20
  62. mcp_proxy_adapter/core/logging.py +34 -29
  63. mcp_proxy_adapter/core/mtls_asgi.py +29 -25
  64. mcp_proxy_adapter/core/mtls_asgi_app.py +66 -54
  65. mcp_proxy_adapter/core/protocol_manager.py +154 -104
  66. mcp_proxy_adapter/core/proxy_client.py +202 -144
  67. mcp_proxy_adapter/core/proxy_registration.py +7 -3
  68. mcp_proxy_adapter/core/role_utils.py +139 -125
  69. mcp_proxy_adapter/core/security_adapter.py +88 -77
  70. mcp_proxy_adapter/core/security_factory.py +50 -44
  71. mcp_proxy_adapter/core/security_integration.py +72 -24
  72. mcp_proxy_adapter/core/server_adapter.py +68 -64
  73. mcp_proxy_adapter/core/server_engine.py +71 -53
  74. mcp_proxy_adapter/core/settings.py +68 -58
  75. mcp_proxy_adapter/core/ssl_utils.py +69 -56
  76. mcp_proxy_adapter/core/transport_manager.py +72 -60
  77. mcp_proxy_adapter/core/unified_config_adapter.py +201 -150
  78. mcp_proxy_adapter/core/utils.py +4 -2
  79. mcp_proxy_adapter/custom_openapi.py +107 -99
  80. mcp_proxy_adapter/examples/basic_framework/main.py +9 -2
  81. mcp_proxy_adapter/examples/commands/__init__.py +1 -1
  82. mcp_proxy_adapter/examples/create_certificates_simple.py +182 -71
  83. mcp_proxy_adapter/examples/debug_request_state.py +38 -19
  84. mcp_proxy_adapter/examples/debug_role_chain.py +53 -20
  85. mcp_proxy_adapter/examples/demo_client.py +48 -36
  86. mcp_proxy_adapter/examples/examples/basic_framework/main.py +9 -2
  87. mcp_proxy_adapter/examples/examples/full_application/__init__.py +1 -0
  88. mcp_proxy_adapter/examples/examples/full_application/commands/custom_echo_command.py +22 -10
  89. mcp_proxy_adapter/examples/examples/full_application/commands/dynamic_calculator_command.py +24 -17
  90. mcp_proxy_adapter/examples/examples/full_application/hooks/application_hooks.py +16 -3
  91. mcp_proxy_adapter/examples/examples/full_application/hooks/builtin_command_hooks.py +13 -3
  92. mcp_proxy_adapter/examples/examples/full_application/main.py +27 -2
  93. mcp_proxy_adapter/examples/examples/full_application/proxy_endpoints.py +48 -14
  94. mcp_proxy_adapter/examples/full_application/__init__.py +1 -0
  95. mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py +22 -10
  96. mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py +24 -17
  97. mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py +16 -3
  98. mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py +13 -3
  99. mcp_proxy_adapter/examples/full_application/main.py +27 -2
  100. mcp_proxy_adapter/examples/full_application/proxy_endpoints.py +48 -14
  101. mcp_proxy_adapter/examples/generate_all_certificates.py +198 -73
  102. mcp_proxy_adapter/examples/generate_certificates.py +31 -16
  103. mcp_proxy_adapter/examples/generate_certificates_and_tokens.py +220 -74
  104. mcp_proxy_adapter/examples/generate_test_configs.py +68 -91
  105. mcp_proxy_adapter/examples/proxy_registration_example.py +76 -75
  106. mcp_proxy_adapter/examples/run_example.py +23 -5
  107. mcp_proxy_adapter/examples/run_full_test_suite.py +109 -71
  108. mcp_proxy_adapter/examples/run_proxy_server.py +22 -9
  109. mcp_proxy_adapter/examples/run_security_tests.py +103 -41
  110. mcp_proxy_adapter/examples/run_security_tests_fixed.py +72 -36
  111. mcp_proxy_adapter/examples/scripts/config_generator.py +288 -187
  112. mcp_proxy_adapter/examples/scripts/create_certificates_simple.py +185 -72
  113. mcp_proxy_adapter/examples/scripts/generate_certificates_and_tokens.py +220 -74
  114. mcp_proxy_adapter/examples/security_test_client.py +196 -127
  115. mcp_proxy_adapter/examples/setup_test_environment.py +17 -29
  116. mcp_proxy_adapter/examples/test_config.py +19 -4
  117. mcp_proxy_adapter/examples/test_config_generator.py +23 -7
  118. mcp_proxy_adapter/examples/test_examples.py +84 -56
  119. mcp_proxy_adapter/examples/universal_client.py +119 -62
  120. mcp_proxy_adapter/openapi.py +108 -115
  121. mcp_proxy_adapter/utils/config_generator.py +429 -274
  122. mcp_proxy_adapter/version.py +1 -2
  123. {mcp_proxy_adapter-6.3.4.dist-info → mcp_proxy_adapter-6.3.6.dist-info}/METADATA +1 -1
  124. mcp_proxy_adapter-6.3.6.dist-info/RECORD +144 -0
  125. mcp_proxy_adapter-6.3.6.dist-info/top_level.txt +2 -0
  126. mcp_proxy_adapter_issue_package/demonstrate_issue.py +178 -0
  127. mcp_proxy_adapter-6.3.4.dist-info/RECORD +0 -143
  128. mcp_proxy_adapter-6.3.4.dist-info/top_level.txt +0 -1
  129. {mcp_proxy_adapter-6.3.4.dist-info → mcp_proxy_adapter-6.3.6.dist-info}/WHEEL +0 -0
  130. {mcp_proxy_adapter-6.3.4.dist-info → mcp_proxy_adapter-6.3.6.dist-info}/entry_points.txt +0 -0
  131. {mcp_proxy_adapter-6.3.4.dist-info → mcp_proxy_adapter-6.3.6.dist-info}/licenses/LICENSE +0 -0
@@ -5,12 +5,14 @@ for proxy registration with different authentication methods.
5
5
  Author: Vasiliy Zdanovskiy
6
6
  email: vasilyvz@gmail.com
7
7
  """
8
+
8
9
  import asyncio
9
10
  import json
10
11
  import sys
11
12
  import os
12
13
  from pathlib import Path
13
14
  from typing import Dict, Any, Optional
15
+
14
16
  # Add project root to path
15
17
  project_root = Path(__file__).parent.parent.parent
16
18
  sys.path.insert(0, str(project_root))
@@ -18,8 +20,11 @@ import aiohttp
18
20
  from aiohttp import ClientTimeout, TCPConnector
19
21
  import ssl
20
22
  from mcp_proxy_adapter.core.logging import logger
23
+
24
+
21
25
  class ProxyRegistrationExample:
22
26
  """Example client for testing proxy registration functionality."""
27
+
23
28
  def __init__(self, server_url: str, auth_token: Optional[str] = None):
24
29
  """
25
30
  Initialize example client.
@@ -42,10 +47,10 @@ class ProxyRegistrationExample:
42
47
  "endpoints": {
43
48
  "jsonrpc": "/api/jsonrpc",
44
49
  "rest": "/cmd",
45
- "health": "/health"
50
+ "health": "/health",
46
51
  },
47
52
  "auth_method": "api_key",
48
- "security_enabled": True
53
+ "security_enabled": True,
49
54
  },
50
55
  {
51
56
  "server_id": "example-server-2",
@@ -57,12 +62,13 @@ class ProxyRegistrationExample:
57
62
  "endpoints": {
58
63
  "jsonrpc": "/api/jsonrpc",
59
64
  "rest": "/cmd",
60
- "health": "/health"
65
+ "health": "/health",
61
66
  },
62
67
  "auth_method": "certificate",
63
- "security_enabled": True
64
- }
68
+ "security_enabled": True,
69
+ },
65
70
  ]
71
+
66
72
  async def __aenter__(self):
67
73
  """Async context manager entry."""
68
74
  # Create SSL context for HTTPS
@@ -75,23 +81,21 @@ class ProxyRegistrationExample:
75
81
  connector = TCPConnector(ssl=ssl_context) if ssl_context else None
76
82
  # Create session
77
83
  timeout = ClientTimeout(total=30)
78
- self.session = aiohttp.ClientSession(
79
- connector=connector,
80
- timeout=timeout
81
- )
84
+ self.session = aiohttp.ClientSession(connector=connector, timeout=timeout)
82
85
  return self
86
+
83
87
  async def __aexit__(self, exc_type, exc_val, exc_tb):
84
88
  """Async context manager exit."""
85
89
  if self.session:
86
90
  await self.session.close()
91
+
87
92
  def _get_headers(self) -> Dict[str, str]:
88
93
  """Get request headers with authentication."""
89
- headers = {
90
- "Content-Type": "application/json"
91
- }
94
+ headers = {"Content-Type": "application/json"}
92
95
  if self.auth_token:
93
96
  headers["X-API-Key"] = self.auth_token
94
97
  return headers
98
+
95
99
  async def test_registration(self, server_data: Dict[str, Any]) -> Dict[str, Any]:
96
100
  """
97
101
  Test registration with authentication.
@@ -106,18 +110,13 @@ class ProxyRegistrationExample:
106
110
  "jsonrpc": "2.0",
107
111
  "id": 1,
108
112
  "method": "proxy_registration",
109
- "params": {
110
- "operation": "register",
111
- **server_data
112
- }
113
+ "params": {"operation": "register", **server_data},
113
114
  }
114
115
  logger.info(f"Testing registration for server: {server_data['server_id']}")
115
116
  logger.debug(f"Request data: {json.dumps(request_data, indent=2)}")
116
117
  # Make request
117
118
  async with self.session.post(
118
- f"{self.server_url}/cmd",
119
- json=request_data,
120
- headers=self._get_headers()
119
+ f"{self.server_url}/cmd", json=request_data, headers=self._get_headers()
121
120
  ) as response:
122
121
  result = await response.json()
123
122
  logger.info(f"Response status: {response.status}")
@@ -126,15 +125,16 @@ class ProxyRegistrationExample:
126
125
  "success": response.status == 200,
127
126
  "status_code": response.status,
128
127
  "result": result,
129
- "server_id": server_data["server_id"]
128
+ "server_id": server_data["server_id"],
130
129
  }
131
130
  except Exception as e:
132
131
  logger.error(f"Registration test failed: {e}")
133
132
  return {
134
133
  "success": False,
135
134
  "error": str(e),
136
- "server_id": server_data["server_id"]
135
+ "server_id": server_data["server_id"],
137
136
  }
137
+
138
138
  async def test_discovery(self) -> Dict[str, Any]:
139
139
  """
140
140
  Test discovery operation.
@@ -147,16 +147,12 @@ class ProxyRegistrationExample:
147
147
  "jsonrpc": "2.0",
148
148
  "id": 1,
149
149
  "method": "proxy_registration",
150
- "params": {
151
- "operation": "discover"
152
- }
150
+ "params": {"operation": "discover"},
153
151
  }
154
152
  logger.info("Testing discovery operation")
155
153
  # Make request
156
154
  async with self.session.post(
157
- f"{self.server_url}/cmd",
158
- json=request_data,
159
- headers=self._get_headers()
155
+ f"{self.server_url}/cmd", json=request_data, headers=self._get_headers()
160
156
  ) as response:
161
157
  result = await response.json()
162
158
  logger.info(f"Response status: {response.status}")
@@ -164,14 +160,12 @@ class ProxyRegistrationExample:
164
160
  return {
165
161
  "success": response.status == 200,
166
162
  "status_code": response.status,
167
- "result": result
163
+ "result": result,
168
164
  }
169
165
  except Exception as e:
170
166
  logger.error(f"Discovery test failed: {e}")
171
- return {
172
- "success": False,
173
- "error": str(e)
174
- }
167
+ return {"success": False, "error": str(e)}
168
+
175
169
  async def test_heartbeat(self, server_key: str) -> Dict[str, Any]:
176
170
  """
177
171
  Test heartbeat operation.
@@ -190,15 +184,13 @@ class ProxyRegistrationExample:
190
184
  "operation": "heartbeat",
191
185
  "server_key": server_key,
192
186
  "timestamp": 1234567890,
193
- "status": "healthy"
194
- }
187
+ "status": "healthy",
188
+ },
195
189
  }
196
190
  logger.info(f"Testing heartbeat for server: {server_key}")
197
191
  # Make request
198
192
  async with self.session.post(
199
- f"{self.server_url}/cmd",
200
- json=request_data,
201
- headers=self._get_headers()
193
+ f"{self.server_url}/cmd", json=request_data, headers=self._get_headers()
202
194
  ) as response:
203
195
  result = await response.json()
204
196
  logger.info(f"Response status: {response.status}")
@@ -207,15 +199,13 @@ class ProxyRegistrationExample:
207
199
  "success": response.status == 200,
208
200
  "status_code": response.status,
209
201
  "result": result,
210
- "server_key": server_key
202
+ "server_key": server_key,
211
203
  }
212
204
  except Exception as e:
213
205
  logger.error(f"Heartbeat test failed: {e}")
214
- return {
215
- "success": False,
216
- "error": str(e),
217
- "server_key": server_key
218
- }
206
+ return {"success": False, "error": str(e), "server_key": server_key}
207
+
208
+
219
209
  async def run_proxy_registration_example():
220
210
  """Run proxy registration example."""
221
211
  logger.info("šŸš€ Starting proxy registration example")
@@ -224,18 +214,18 @@ async def run_proxy_registration_example():
224
214
  {
225
215
  "name": "Admin Token",
226
216
  "server_url": "http://localhost:8002",
227
- "auth_token": "test-token-123"
217
+ "auth_token": "test-token-123",
228
218
  },
229
219
  {
230
220
  "name": "User Token",
231
221
  "server_url": "http://localhost:8002",
232
- "auth_token": "user-token-456"
222
+ "auth_token": "user-token-456",
233
223
  },
234
224
  {
235
225
  "name": "Readonly Token",
236
226
  "server_url": "http://localhost:8002",
237
- "auth_token": "readonly-token-123"
238
- }
227
+ "auth_token": "readonly-token-123",
228
+ },
239
229
  ]
240
230
  results = []
241
231
  for config in test_configs:
@@ -243,47 +233,51 @@ async def run_proxy_registration_example():
243
233
  logger.info(f"Server URL: {config['server_url']}")
244
234
  logger.info(f"Auth Token: {config['auth_token']}")
245
235
  async with ProxyRegistrationExample(
246
- config['server_url'],
247
- config['auth_token']
236
+ config["server_url"], config["auth_token"]
248
237
  ) as client:
249
238
  # Test registration
250
239
  for server_data in client.test_servers:
251
240
  result = await client.test_registration(server_data)
252
- results.append({
253
- "test": f"{config['name']} - Registration",
254
- "server_id": server_data["server_id"],
255
- **result
256
- })
241
+ results.append(
242
+ {
243
+ "test": f"{config['name']} - Registration",
244
+ "server_id": server_data["server_id"],
245
+ **result,
246
+ }
247
+ )
257
248
  # If registration successful, test heartbeat
258
249
  if result["success"] and "result" in result:
259
250
  server_key = result["result"].get("result", {}).get("server_key")
260
251
  if server_key:
261
252
  heartbeat_result = await client.test_heartbeat(server_key)
262
- results.append({
263
- "test": f"{config['name']} - Heartbeat",
264
- "server_key": server_key,
265
- **heartbeat_result
266
- })
253
+ results.append(
254
+ {
255
+ "test": f"{config['name']} - Heartbeat",
256
+ "server_key": server_key,
257
+ **heartbeat_result,
258
+ }
259
+ )
267
260
  # Test discovery
268
261
  discovery_result = await client.test_discovery()
269
- results.append({
270
- "test": f"{config['name']} - Discovery",
271
- **discovery_result
272
- })
262
+ results.append(
263
+ {"test": f"{config['name']} - Discovery", **discovery_result}
264
+ )
273
265
  # Test without authentication
274
266
  logger.info(f"\nšŸ“‹ Testing: No Authentication")
275
267
  async with ProxyRegistrationExample("http://localhost:8002") as client:
276
268
  for server_data in client.test_servers:
277
269
  result = await client.test_registration(server_data)
278
- results.append({
279
- "test": "No Auth - Registration",
280
- "server_id": server_data["server_id"],
281
- **result
282
- })
270
+ results.append(
271
+ {
272
+ "test": "No Auth - Registration",
273
+ "server_id": server_data["server_id"],
274
+ **result,
275
+ }
276
+ )
283
277
  # Print results
284
- logger.info("\n" + "="*80)
278
+ logger.info("\n" + "=" * 80)
285
279
  logger.info("šŸ“Š EXAMPLE RESULTS")
286
- logger.info("="*80)
280
+ logger.info("=" * 80)
287
281
  passed = 0
288
282
  failed = 0
289
283
  for result in results:
@@ -305,24 +299,29 @@ async def run_proxy_registration_example():
305
299
  logger.info(f" Server Key: {api_result['server_key']}")
306
300
  if "message" in api_result:
307
301
  logger.info(f" Message: {api_result['message']}")
308
- logger.info("\n" + "="*80)
302
+ logger.info("\n" + "=" * 80)
309
303
  logger.info(f"šŸ“ˆ SUMMARY: {passed} passed, {failed} failed")
310
- logger.info("="*80)
304
+ logger.info("=" * 80)
311
305
  return passed, failed
306
+
307
+
312
308
  def main():
313
309
  """Main function for the example."""
314
310
  logger.info("šŸ”§ MCP Proxy Adapter - Proxy Registration Example")
315
- logger.info("="*60)
311
+ logger.info("=" * 60)
316
312
  # Check if server is running
317
313
  import socket
314
+
318
315
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
319
- result = sock.connect_ex(('localhost', 8002))
316
+ result = sock.connect_ex(("localhost", 8002))
320
317
  sock.close()
321
318
  if result != 0:
322
319
  logger.error("āŒ Server is not running on localhost:8002")
323
320
  logger.info("šŸ’” Please start the server first:")
324
321
  logger.info(" cd mcp_proxy_adapter/examples")
325
- logger.info(" python -m mcp_proxy_adapter.main --config server_configs/config_proxy_registration.json")
322
+ logger.info(
323
+ " python -m mcp_proxy_adapter.main --config server_configs/config_proxy_registration.json"
324
+ )
326
325
  sys.exit(1)
327
326
  logger.info("āœ… Server is running on localhost:8002")
328
327
  logger.info("šŸš€ Starting proxy registration example...")
@@ -330,5 +329,7 @@ def main():
330
329
  passed, failed = asyncio.run(run_proxy_registration_example())
331
330
  # Exit with appropriate code
332
331
  sys.exit(0 if failed == 0 else 1)
332
+
333
+
333
334
  if __name__ == "__main__":
334
335
  main()
@@ -9,9 +9,13 @@ import sys
9
9
  import subprocess
10
10
  import argparse
11
11
  from pathlib import Path
12
+
13
+
12
14
  def run_basic_example(config_name: str, port: int = None):
13
15
  """Run basic framework example."""
14
- config_path = Path(__file__).parent / "basic_framework" / "configs" / f"{config_name}.json"
16
+ config_path = (
17
+ Path(__file__).parent / "basic_framework" / "configs" / f"{config_name}.json"
18
+ )
15
19
  main_script = Path(__file__).parent / "basic_framework" / "main.py"
16
20
  if not config_path.exists():
17
21
  print(f"āŒ Configuration file not found: {config_path}")
@@ -21,9 +25,13 @@ def run_basic_example(config_name: str, port: int = None):
21
25
  cmd.extend(["--port", str(port)])
22
26
  print(f"šŸš€ Running basic framework example with {config_name} configuration...")
23
27
  return subprocess.run(cmd).returncode == 0
28
+
29
+
24
30
  def run_full_example(config_name: str, port: int = None):
25
31
  """Run full application example."""
26
- config_path = Path(__file__).parent / "full_application" / "configs" / f"{config_name}.json"
32
+ config_path = (
33
+ Path(__file__).parent / "full_application" / "configs" / f"{config_name}.json"
34
+ )
27
35
  main_script = Path(__file__).parent / "full_application" / "main.py"
28
36
  if not config_path.exists():
29
37
  print(f"āŒ Configuration file not found: {config_path}")
@@ -33,17 +41,25 @@ def run_full_example(config_name: str, port: int = None):
33
41
  cmd.extend(["--port", str(port)])
34
42
  print(f"šŸš€ Running full application example with {config_name} configuration...")
35
43
  return subprocess.run(cmd).returncode == 0
44
+
45
+
36
46
  def main():
37
47
  """Main function."""
38
48
  parser = argparse.ArgumentParser(description="Run MCP Proxy Adapter Examples")
39
49
  parser.add_argument("example", choices=["basic", "full"], help="Example type")
40
- parser.add_argument("config", help="Configuration name (e.g., http_simple, https_auth)")
50
+ parser.add_argument(
51
+ "config", help="Configuration name (e.g., http_simple, https_auth)"
52
+ )
41
53
  parser.add_argument("--port", type=int, help="Override port")
42
54
  args = parser.parse_args()
43
55
  # Available configurations
44
56
  configs = [
45
- "http_simple", "https_simple", "http_auth",
46
- "https_auth", "mtls_no_roles", "mtls_with_roles"
57
+ "http_simple",
58
+ "https_simple",
59
+ "http_auth",
60
+ "https_auth",
61
+ "mtls_no_roles",
62
+ "mtls_with_roles",
47
63
  ]
48
64
  if args.config not in configs:
49
65
  print(f"āŒ Unknown configuration: {args.config}")
@@ -55,5 +71,7 @@ def main():
55
71
  else:
56
72
  success = run_full_example(args.config, args.port)
57
73
  return 0 if success else 1
74
+
75
+
58
76
  if __name__ == "__main__":
59
77
  sys.exit(main())