mcp-proxy-adapter 6.2.24__py3-none-any.whl → 6.2.26__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 (33) hide show
  1. mcp_proxy_adapter/api/app.py +0 -3
  2. mcp_proxy_adapter/api/middleware/protocol_middleware.py +10 -10
  3. mcp_proxy_adapter/commands/health_command.py +1 -1
  4. mcp_proxy_adapter/config.py +234 -23
  5. mcp_proxy_adapter/core/protocol_manager.py +9 -9
  6. mcp_proxy_adapter/examples/create_certificates_simple.py +7 -17
  7. mcp_proxy_adapter/examples/examples/basic_framework/__init__.py +9 -0
  8. mcp_proxy_adapter/examples/examples/basic_framework/commands/__init__.py +4 -0
  9. mcp_proxy_adapter/examples/examples/basic_framework/hooks/__init__.py +4 -0
  10. mcp_proxy_adapter/examples/examples/basic_framework/main.py +44 -0
  11. mcp_proxy_adapter/examples/examples/full_application/__init__.py +12 -0
  12. mcp_proxy_adapter/examples/examples/full_application/commands/__init__.py +7 -0
  13. mcp_proxy_adapter/examples/examples/full_application/commands/custom_echo_command.py +80 -0
  14. mcp_proxy_adapter/examples/examples/full_application/commands/dynamic_calculator_command.py +90 -0
  15. mcp_proxy_adapter/examples/examples/full_application/hooks/__init__.py +7 -0
  16. mcp_proxy_adapter/examples/examples/full_application/hooks/application_hooks.py +75 -0
  17. mcp_proxy_adapter/examples/examples/full_application/hooks/builtin_command_hooks.py +71 -0
  18. mcp_proxy_adapter/examples/examples/full_application/main.py +173 -0
  19. mcp_proxy_adapter/examples/examples/full_application/proxy_endpoints.py +154 -0
  20. mcp_proxy_adapter/examples/generate_test_configs.py +70 -33
  21. mcp_proxy_adapter/examples/run_full_test_suite.py +302 -109
  22. mcp_proxy_adapter/examples/run_security_tests.py +14 -5
  23. mcp_proxy_adapter/examples/scripts/config_generator.py +740 -0
  24. mcp_proxy_adapter/examples/scripts/create_certificates_simple.py +560 -0
  25. mcp_proxy_adapter/examples/scripts/generate_certificates_and_tokens.py +369 -0
  26. mcp_proxy_adapter/main.py +0 -2
  27. mcp_proxy_adapter/utils/config_generator.py +275 -7
  28. {mcp_proxy_adapter-6.2.24.dist-info → mcp_proxy_adapter-6.2.26.dist-info}/METADATA +1 -1
  29. {mcp_proxy_adapter-6.2.24.dist-info → mcp_proxy_adapter-6.2.26.dist-info}/RECORD +33 -17
  30. {mcp_proxy_adapter-6.2.24.dist-info → mcp_proxy_adapter-6.2.26.dist-info}/WHEEL +0 -0
  31. {mcp_proxy_adapter-6.2.24.dist-info → mcp_proxy_adapter-6.2.26.dist-info}/entry_points.txt +0 -0
  32. {mcp_proxy_adapter-6.2.24.dist-info → mcp_proxy_adapter-6.2.26.dist-info}/licenses/LICENSE +0 -0
  33. {mcp_proxy_adapter-6.2.24.dist-info → mcp_proxy_adapter-6.2.26.dist-info}/top_level.txt +0 -0
@@ -81,11 +81,15 @@ class SecurityTestRunner:
81
81
  def _pids_on_port(self, port: int) -> List[int]:
82
82
  pids: List[int] = []
83
83
  try:
84
- for proc in psutil.process_iter(attrs=["pid", "connections"]):
85
- for c in proc.connections(kind="inet"):
86
- if c.laddr and c.laddr.port == port:
87
- pids.append(proc.pid)
88
- break
84
+ for proc in psutil.process_iter(attrs=["pid"]):
85
+ try:
86
+ connections = proc.connections(kind="inet")
87
+ for c in connections:
88
+ if c.laddr and c.laddr.port == port:
89
+ pids.append(proc.pid)
90
+ break
91
+ except (psutil.NoSuchProcess, psutil.AccessDenied):
92
+ pass
89
93
  except Exception:
90
94
  pass
91
95
  return list(set(pids))
@@ -187,7 +191,12 @@ class SecurityTestRunner:
187
191
  "certs/localhost_server.crt",
188
192
  "keys/localhost_server.key"
189
193
  ]
194
+
190
195
  missing_certs = []
196
+ # Check if roles.json exists
197
+ roles_file = "configs/roles.json"
198
+ if not os.path.exists(roles_file):
199
+ missing_certs.append(f"Missing roles file: {roles_file}")
191
200
  for cert_file in cert_files:
192
201
  if not Path(cert_file).exists():
193
202
  missing_certs.append(cert_file)