mcp-proxy-adapter 4.1.1__py3-none-any.whl → 6.1.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.
Files changed (253) hide show
  1. mcp_proxy_adapter/__main__.py +12 -0
  2. mcp_proxy_adapter/api/app.py +254 -33
  3. mcp_proxy_adapter/api/handlers.py +32 -6
  4. mcp_proxy_adapter/api/middleware/__init__.py +36 -30
  5. mcp_proxy_adapter/api/middleware/command_permission_middleware.py +148 -0
  6. mcp_proxy_adapter/api/middleware/error_handling.py +9 -0
  7. mcp_proxy_adapter/api/middleware/factory.py +243 -0
  8. mcp_proxy_adapter/api/middleware/logging.py +32 -6
  9. mcp_proxy_adapter/api/middleware/protocol_middleware.py +135 -0
  10. mcp_proxy_adapter/api/middleware/transport_middleware.py +122 -0
  11. mcp_proxy_adapter/api/middleware/unified_security.py +152 -0
  12. mcp_proxy_adapter/api/middleware/user_info_middleware.py +83 -0
  13. mcp_proxy_adapter/commands/__init__.py +19 -4
  14. mcp_proxy_adapter/commands/auth_validation_command.py +408 -0
  15. mcp_proxy_adapter/commands/base.py +66 -32
  16. mcp_proxy_adapter/commands/builtin_commands.py +95 -0
  17. mcp_proxy_adapter/commands/catalog_manager.py +838 -0
  18. mcp_proxy_adapter/commands/cert_monitor_command.py +620 -0
  19. mcp_proxy_adapter/commands/certificate_management_command.py +608 -0
  20. mcp_proxy_adapter/commands/command_registry.py +711 -354
  21. mcp_proxy_adapter/commands/dependency_manager.py +245 -0
  22. mcp_proxy_adapter/commands/echo_command.py +81 -0
  23. mcp_proxy_adapter/commands/health_command.py +7 -0
  24. mcp_proxy_adapter/commands/help_command.py +21 -14
  25. mcp_proxy_adapter/commands/hooks.py +200 -167
  26. mcp_proxy_adapter/commands/key_management_command.py +506 -0
  27. mcp_proxy_adapter/commands/load_command.py +176 -0
  28. mcp_proxy_adapter/commands/plugins_command.py +235 -0
  29. mcp_proxy_adapter/commands/protocol_management_command.py +232 -0
  30. mcp_proxy_adapter/commands/proxy_registration_command.py +409 -0
  31. mcp_proxy_adapter/commands/reload_command.py +48 -50
  32. mcp_proxy_adapter/commands/result.py +1 -0
  33. mcp_proxy_adapter/commands/role_test_command.py +141 -0
  34. mcp_proxy_adapter/commands/roles_management_command.py +697 -0
  35. mcp_proxy_adapter/commands/security_command.py +488 -0
  36. mcp_proxy_adapter/commands/ssl_setup_command.py +483 -0
  37. mcp_proxy_adapter/commands/token_management_command.py +529 -0
  38. mcp_proxy_adapter/commands/transport_management_command.py +144 -0
  39. mcp_proxy_adapter/commands/unload_command.py +158 -0
  40. mcp_proxy_adapter/config.py +159 -2
  41. mcp_proxy_adapter/core/app_factory.py +326 -0
  42. mcp_proxy_adapter/core/auth_validator.py +606 -0
  43. mcp_proxy_adapter/core/certificate_utils.py +827 -0
  44. mcp_proxy_adapter/core/client_security.py +384 -0
  45. mcp_proxy_adapter/core/config_converter.py +405 -0
  46. mcp_proxy_adapter/core/config_validator.py +218 -0
  47. mcp_proxy_adapter/core/logging.py +19 -3
  48. mcp_proxy_adapter/core/mtls_asgi.py +156 -0
  49. mcp_proxy_adapter/core/mtls_asgi_app.py +187 -0
  50. mcp_proxy_adapter/core/protocol_manager.py +235 -0
  51. mcp_proxy_adapter/core/proxy_client.py +602 -0
  52. mcp_proxy_adapter/core/proxy_registration.py +522 -0
  53. mcp_proxy_adapter/core/role_utils.py +426 -0
  54. mcp_proxy_adapter/core/security_adapter.py +370 -0
  55. mcp_proxy_adapter/core/security_factory.py +239 -0
  56. mcp_proxy_adapter/core/security_integration.py +277 -0
  57. mcp_proxy_adapter/core/server_adapter.py +345 -0
  58. mcp_proxy_adapter/core/server_engine.py +364 -0
  59. mcp_proxy_adapter/core/settings.py +1 -0
  60. mcp_proxy_adapter/core/ssl_utils.py +233 -0
  61. mcp_proxy_adapter/core/transport_manager.py +292 -0
  62. mcp_proxy_adapter/core/unified_config_adapter.py +579 -0
  63. mcp_proxy_adapter/custom_openapi.py +22 -11
  64. mcp_proxy_adapter/examples/README.md +230 -97
  65. mcp_proxy_adapter/examples/README_EN.md +258 -0
  66. mcp_proxy_adapter/examples/SECURITY_TESTING.md +455 -0
  67. mcp_proxy_adapter/examples/__pycache__/security_configurations.cpython-312.pyc +0 -0
  68. mcp_proxy_adapter/examples/__pycache__/security_test_client.cpython-312.pyc +0 -0
  69. mcp_proxy_adapter/examples/basic_framework/configs/http_auth.json +37 -0
  70. mcp_proxy_adapter/examples/basic_framework/configs/http_simple.json +23 -0
  71. mcp_proxy_adapter/examples/basic_framework/configs/https_auth.json +39 -0
  72. mcp_proxy_adapter/examples/basic_framework/configs/https_simple.json +25 -0
  73. mcp_proxy_adapter/examples/basic_framework/configs/mtls_no_roles.json +39 -0
  74. mcp_proxy_adapter/examples/basic_framework/configs/mtls_with_roles.json +45 -0
  75. mcp_proxy_adapter/examples/basic_framework/main.py +63 -0
  76. mcp_proxy_adapter/examples/basic_framework/roles.json +21 -0
  77. mcp_proxy_adapter/examples/cert_config.json +9 -0
  78. mcp_proxy_adapter/examples/certs/admin.crt +32 -0
  79. mcp_proxy_adapter/examples/certs/admin.key +52 -0
  80. mcp_proxy_adapter/examples/certs/admin_cert.pem +21 -0
  81. mcp_proxy_adapter/examples/certs/admin_key.pem +28 -0
  82. mcp_proxy_adapter/examples/certs/ca_cert.pem +23 -0
  83. mcp_proxy_adapter/examples/certs/ca_cert.srl +1 -0
  84. mcp_proxy_adapter/examples/certs/ca_key.pem +28 -0
  85. mcp_proxy_adapter/examples/certs/cert_config.json +9 -0
  86. mcp_proxy_adapter/examples/certs/client.crt +32 -0
  87. mcp_proxy_adapter/examples/certs/client.key +52 -0
  88. mcp_proxy_adapter/examples/certs/client_admin.crt +32 -0
  89. mcp_proxy_adapter/examples/certs/client_admin.key +52 -0
  90. mcp_proxy_adapter/examples/certs/client_user.crt +32 -0
  91. mcp_proxy_adapter/examples/certs/client_user.key +52 -0
  92. mcp_proxy_adapter/examples/certs/guest_cert.pem +21 -0
  93. mcp_proxy_adapter/examples/certs/guest_key.pem +28 -0
  94. mcp_proxy_adapter/examples/certs/mcp_proxy_adapter_ca_ca.crt +23 -0
  95. mcp_proxy_adapter/examples/certs/proxy_cert.pem +21 -0
  96. mcp_proxy_adapter/examples/certs/proxy_key.pem +28 -0
  97. mcp_proxy_adapter/examples/certs/readonly.crt +32 -0
  98. mcp_proxy_adapter/examples/certs/readonly.key +52 -0
  99. mcp_proxy_adapter/examples/certs/readonly_cert.pem +21 -0
  100. mcp_proxy_adapter/examples/certs/readonly_key.pem +28 -0
  101. mcp_proxy_adapter/examples/certs/server.crt +32 -0
  102. mcp_proxy_adapter/examples/certs/server.key +52 -0
  103. mcp_proxy_adapter/examples/certs/server_cert.pem +32 -0
  104. mcp_proxy_adapter/examples/certs/server_key.pem +52 -0
  105. mcp_proxy_adapter/examples/certs/test_ca_ca.crt +20 -0
  106. mcp_proxy_adapter/examples/certs/user.crt +32 -0
  107. mcp_proxy_adapter/examples/certs/user.key +52 -0
  108. mcp_proxy_adapter/examples/certs/user_cert.pem +21 -0
  109. mcp_proxy_adapter/examples/certs/user_key.pem +28 -0
  110. mcp_proxy_adapter/examples/client_configs/api_key_client.json +13 -0
  111. mcp_proxy_adapter/examples/client_configs/basic_auth_client.json +13 -0
  112. mcp_proxy_adapter/examples/client_configs/certificate_client.json +22 -0
  113. mcp_proxy_adapter/examples/client_configs/jwt_client.json +15 -0
  114. mcp_proxy_adapter/examples/client_configs/no_auth_client.json +9 -0
  115. mcp_proxy_adapter/examples/commands/__init__.py +1 -0
  116. mcp_proxy_adapter/examples/create_certificates_simple.py +307 -0
  117. mcp_proxy_adapter/examples/debug_request_state.py +144 -0
  118. mcp_proxy_adapter/examples/debug_role_chain.py +205 -0
  119. mcp_proxy_adapter/examples/demo_client.py +341 -0
  120. mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py +99 -0
  121. mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py +106 -0
  122. mcp_proxy_adapter/examples/full_application/configs/http_auth.json +37 -0
  123. mcp_proxy_adapter/examples/full_application/configs/http_simple.json +23 -0
  124. mcp_proxy_adapter/examples/full_application/configs/https_auth.json +39 -0
  125. mcp_proxy_adapter/examples/full_application/configs/https_simple.json +25 -0
  126. mcp_proxy_adapter/examples/full_application/configs/mtls_no_roles.json +39 -0
  127. mcp_proxy_adapter/examples/full_application/configs/mtls_with_roles.json +45 -0
  128. mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py +97 -0
  129. mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py +95 -0
  130. mcp_proxy_adapter/examples/full_application/main.py +138 -0
  131. mcp_proxy_adapter/examples/full_application/roles.json +21 -0
  132. mcp_proxy_adapter/examples/generate_all_certificates.py +429 -0
  133. mcp_proxy_adapter/examples/generate_certificates.py +121 -0
  134. mcp_proxy_adapter/examples/keys/ca_key.pem +28 -0
  135. mcp_proxy_adapter/examples/keys/mcp_proxy_adapter_ca_ca.key +28 -0
  136. mcp_proxy_adapter/examples/keys/test_ca_ca.key +28 -0
  137. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log +220 -0
  138. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.1 +1 -0
  139. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.2 +1 -0
  140. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.3 +1 -0
  141. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.4 +1 -0
  142. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.5 +1 -0
  143. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log +220 -0
  144. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.1 +1 -0
  145. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.2 +1 -0
  146. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.3 +1 -0
  147. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.4 +1 -0
  148. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.5 +1 -0
  149. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log +2 -0
  150. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.1 +1 -0
  151. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.2 +1 -0
  152. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.3 +1 -0
  153. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.4 +1 -0
  154. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.5 +1 -0
  155. mcp_proxy_adapter/examples/proxy_registration_example.py +401 -0
  156. mcp_proxy_adapter/examples/roles.json +38 -0
  157. mcp_proxy_adapter/examples/run_example.py +81 -0
  158. mcp_proxy_adapter/examples/run_security_tests.py +326 -0
  159. mcp_proxy_adapter/examples/run_security_tests_fixed.py +300 -0
  160. mcp_proxy_adapter/examples/security_test_client.py +743 -0
  161. mcp_proxy_adapter/examples/server_configs/config_basic_http.json +204 -0
  162. mcp_proxy_adapter/examples/server_configs/config_http_token.json +238 -0
  163. mcp_proxy_adapter/examples/server_configs/config_https.json +215 -0
  164. mcp_proxy_adapter/examples/server_configs/config_https_token.json +231 -0
  165. mcp_proxy_adapter/examples/server_configs/config_mtls.json +215 -0
  166. mcp_proxy_adapter/examples/server_configs/config_proxy_registration.json +250 -0
  167. mcp_proxy_adapter/examples/server_configs/config_simple.json +46 -0
  168. mcp_proxy_adapter/examples/server_configs/roles.json +38 -0
  169. mcp_proxy_adapter/examples/test_examples.py +344 -0
  170. mcp_proxy_adapter/examples/universal_client.py +628 -0
  171. mcp_proxy_adapter/main.py +186 -0
  172. mcp_proxy_adapter/utils/config_generator.py +639 -0
  173. mcp_proxy_adapter/version.py +2 -1
  174. mcp_proxy_adapter-6.1.0.dist-info/METADATA +205 -0
  175. mcp_proxy_adapter-6.1.0.dist-info/RECORD +193 -0
  176. mcp_proxy_adapter-6.1.0.dist-info/entry_points.txt +2 -0
  177. {mcp_proxy_adapter-4.1.1.dist-info → mcp_proxy_adapter-6.1.0.dist-info}/licenses/LICENSE +2 -2
  178. mcp_proxy_adapter/api/middleware/auth.py +0 -146
  179. mcp_proxy_adapter/api/middleware/rate_limit.py +0 -152
  180. mcp_proxy_adapter/commands/reload_settings_command.py +0 -125
  181. mcp_proxy_adapter/examples/__init__.py +0 -7
  182. mcp_proxy_adapter/examples/basic_server/README.md +0 -60
  183. mcp_proxy_adapter/examples/basic_server/__init__.py +0 -7
  184. mcp_proxy_adapter/examples/basic_server/basic_custom_settings.json +0 -39
  185. mcp_proxy_adapter/examples/basic_server/config.json +0 -35
  186. mcp_proxy_adapter/examples/basic_server/custom_settings_example.py +0 -238
  187. mcp_proxy_adapter/examples/basic_server/server.py +0 -103
  188. mcp_proxy_adapter/examples/custom_commands/README.md +0 -127
  189. mcp_proxy_adapter/examples/custom_commands/__init__.py +0 -27
  190. mcp_proxy_adapter/examples/custom_commands/advanced_hooks.py +0 -250
  191. mcp_proxy_adapter/examples/custom_commands/auto_commands/__init__.py +0 -6
  192. mcp_proxy_adapter/examples/custom_commands/auto_commands/auto_echo_command.py +0 -103
  193. mcp_proxy_adapter/examples/custom_commands/auto_commands/auto_info_command.py +0 -111
  194. mcp_proxy_adapter/examples/custom_commands/config.json +0 -35
  195. mcp_proxy_adapter/examples/custom_commands/custom_health_command.py +0 -169
  196. mcp_proxy_adapter/examples/custom_commands/custom_help_command.py +0 -215
  197. mcp_proxy_adapter/examples/custom_commands/custom_openapi_generator.py +0 -76
  198. mcp_proxy_adapter/examples/custom_commands/custom_settings.json +0 -96
  199. mcp_proxy_adapter/examples/custom_commands/custom_settings_manager.py +0 -241
  200. mcp_proxy_adapter/examples/custom_commands/data_transform_command.py +0 -135
  201. mcp_proxy_adapter/examples/custom_commands/echo_command.py +0 -122
  202. mcp_proxy_adapter/examples/custom_commands/hooks.py +0 -230
  203. mcp_proxy_adapter/examples/custom_commands/intercept_command.py +0 -123
  204. mcp_proxy_adapter/examples/custom_commands/manual_echo_command.py +0 -103
  205. mcp_proxy_adapter/examples/custom_commands/server.py +0 -228
  206. mcp_proxy_adapter/examples/custom_commands/test_hooks.py +0 -176
  207. mcp_proxy_adapter/examples/deployment/README.md +0 -49
  208. mcp_proxy_adapter/examples/deployment/__init__.py +0 -7
  209. mcp_proxy_adapter/examples/deployment/config.development.json +0 -8
  210. mcp_proxy_adapter/examples/deployment/config.json +0 -29
  211. mcp_proxy_adapter/examples/deployment/config.production.json +0 -12
  212. mcp_proxy_adapter/examples/deployment/config.staging.json +0 -11
  213. mcp_proxy_adapter/examples/deployment/docker-compose.yml +0 -31
  214. mcp_proxy_adapter/examples/deployment/run.sh +0 -43
  215. mcp_proxy_adapter/examples/deployment/run_docker.sh +0 -84
  216. mcp_proxy_adapter/schemas/base_schema.json +0 -114
  217. mcp_proxy_adapter/schemas/openapi_schema.json +0 -314
  218. mcp_proxy_adapter/tests/__init__.py +0 -0
  219. mcp_proxy_adapter/tests/api/__init__.py +0 -3
  220. mcp_proxy_adapter/tests/api/test_cmd_endpoint.py +0 -115
  221. mcp_proxy_adapter/tests/api/test_custom_openapi.py +0 -617
  222. mcp_proxy_adapter/tests/api/test_handlers.py +0 -522
  223. mcp_proxy_adapter/tests/api/test_middleware.py +0 -340
  224. mcp_proxy_adapter/tests/api/test_schemas.py +0 -546
  225. mcp_proxy_adapter/tests/api/test_tool_integration.py +0 -531
  226. mcp_proxy_adapter/tests/commands/__init__.py +0 -3
  227. mcp_proxy_adapter/tests/commands/test_config_command.py +0 -211
  228. mcp_proxy_adapter/tests/commands/test_echo_command.py +0 -127
  229. mcp_proxy_adapter/tests/commands/test_help_command.py +0 -136
  230. mcp_proxy_adapter/tests/conftest.py +0 -131
  231. mcp_proxy_adapter/tests/functional/__init__.py +0 -3
  232. mcp_proxy_adapter/tests/functional/test_api.py +0 -253
  233. mcp_proxy_adapter/tests/integration/__init__.py +0 -3
  234. mcp_proxy_adapter/tests/integration/test_cmd_integration.py +0 -129
  235. mcp_proxy_adapter/tests/integration/test_integration.py +0 -255
  236. mcp_proxy_adapter/tests/performance/__init__.py +0 -3
  237. mcp_proxy_adapter/tests/performance/test_performance.py +0 -189
  238. mcp_proxy_adapter/tests/stubs/__init__.py +0 -10
  239. mcp_proxy_adapter/tests/stubs/echo_command.py +0 -104
  240. mcp_proxy_adapter/tests/test_api_endpoints.py +0 -271
  241. mcp_proxy_adapter/tests/test_api_handlers.py +0 -289
  242. mcp_proxy_adapter/tests/test_base_command.py +0 -123
  243. mcp_proxy_adapter/tests/test_batch_requests.py +0 -117
  244. mcp_proxy_adapter/tests/test_command_registry.py +0 -281
  245. mcp_proxy_adapter/tests/test_config.py +0 -127
  246. mcp_proxy_adapter/tests/test_utils.py +0 -65
  247. mcp_proxy_adapter/tests/unit/__init__.py +0 -3
  248. mcp_proxy_adapter/tests/unit/test_base_command.py +0 -436
  249. mcp_proxy_adapter/tests/unit/test_config.py +0 -217
  250. mcp_proxy_adapter-4.1.1.dist-info/METADATA +0 -200
  251. mcp_proxy_adapter-4.1.1.dist-info/RECORD +0 -110
  252. {mcp_proxy_adapter-4.1.1.dist-info → mcp_proxy_adapter-6.1.0.dist-info}/WHEEL +0 -0
  253. {mcp_proxy_adapter-4.1.1.dist-info → mcp_proxy_adapter-6.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-proxy-adapter
3
+ Version: 6.1.0
4
+ Summary: Model Context Protocol Proxy Adapter with Security Framework
5
+ Home-page: https://github.com/maverikod/mcp-proxy-adapter
6
+ Author: Vasiliy Zdanovskiy
7
+ Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
8
+ Maintainer-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
9
+ License: MIT
10
+ Project-URL: Homepage, https://github.com/vasilyvz/mcp-proxy-adapter
11
+ Project-URL: Documentation, https://mcp-proxy-adapter.readthedocs.io/
12
+ Project-URL: Repository, https://github.com/vasilyvz/mcp-proxy-adapter.git
13
+ Project-URL: Bug Tracker, https://github.com/vasilyvz/mcp-proxy-adapter/issues
14
+ Project-URL: Security Policy, https://github.com/vasilyvz/mcp-proxy-adapter/security/policy
15
+ Keywords: mcp,proxy,adapter,json-rpc,microservice,security,fastapi
16
+ Classifier: Development Status :: 5 - Production/Stable
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.8
22
+ Classifier: Programming Language :: Python :: 3.9
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
28
+ Classifier: Topic :: Security
29
+ Classifier: Framework :: FastAPI
30
+ Requires-Python: >=3.9
31
+ Description-Content-Type: text/markdown
32
+ License-File: LICENSE
33
+ Requires-Dist: fastapi>=0.100.0
34
+ Requires-Dist: uvicorn[standard]>=0.20.0
35
+ Requires-Dist: pydantic>=2.0.0
36
+ Requires-Dist: mcp-security-framework>=0.1.0
37
+ Requires-Dist: python-multipart>=0.0.6
38
+ Requires-Dist: python-jose[cryptography]>=3.3.0
39
+ Requires-Dist: passlib[bcrypt]>=1.7.4
40
+ Requires-Dist: cryptography>=3.4.8
41
+ Requires-Dist: pyOpenSSL>=23.0.0
42
+ Requires-Dist: certifi>=2023.7.22
43
+ Requires-Dist: requests>=2.31.0
44
+ Requires-Dist: aiofiles>=23.1.0
45
+ Requires-Dist: python-dotenv>=1.0.0
46
+ Provides-Extra: dev
47
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
48
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
49
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
50
+ Requires-Dist: black>=23.0.0; extra == "dev"
51
+ Requires-Dist: isort>=5.12.0; extra == "dev"
52
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
53
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
54
+ Requires-Dist: pre-commit>=3.0.0; extra == "dev"
55
+ Requires-Dist: httpx>=0.24.0; extra == "dev"
56
+ Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
57
+ Provides-Extra: test
58
+ Requires-Dist: pytest>=7.0.0; extra == "test"
59
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
60
+ Requires-Dist: pytest-cov>=4.0.0; extra == "test"
61
+ Requires-Dist: httpx>=0.24.0; extra == "test"
62
+ Requires-Dist: pytest-mock>=3.10.0; extra == "test"
63
+ Provides-Extra: docs
64
+ Requires-Dist: mkdocs>=1.4.0; extra == "docs"
65
+ Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
66
+ Requires-Dist: mkdocstrings[python]>=0.20.0; extra == "docs"
67
+ Dynamic: author
68
+ Dynamic: home-page
69
+ Dynamic: license-file
70
+ Dynamic: requires-python
71
+
72
+ # MCP Proxy Adapter
73
+
74
+ A powerful framework for creating JSON-RPC-enabled microservices with built-in security, authentication, and proxy registration capabilities.
75
+
76
+ ## Features
77
+
78
+ - **JSON-RPC Framework**: Complete JSON-RPC 2.0 implementation
79
+ - **Security Integration**: Built-in support for mcp_security_framework
80
+ - **Authentication**: Multiple auth methods (API Key, JWT, Certificate, Basic Auth)
81
+ - **Proxy Registration**: Automatic registration and discovery of services
82
+ - **Command System**: Extensible command framework with role-based access control
83
+ - **SSL/TLS Support**: Full SSL/TLS support including mTLS
84
+ - **Async Support**: Built on FastAPI with full async support
85
+ - **Extensible**: Plugin system for custom commands and middleware
86
+
87
+ ## Quick Start
88
+
89
+ ### Installation
90
+
91
+ ```bash
92
+ pip install mcp-proxy-adapter
93
+ ```
94
+
95
+ ### Basic Usage
96
+
97
+ ```python
98
+ from mcp_proxy_adapter import create_app, Command, SuccessResult
99
+
100
+ # Create a custom command
101
+ class HelloCommand(Command):
102
+ name = "hello"
103
+ descr = "Say hello"
104
+
105
+ async def execute(self, **kwargs) -> SuccessResult:
106
+ name = kwargs.get("name", "World")
107
+ return SuccessResult(f"Hello, {name}!")
108
+
109
+ # Create and run the application
110
+ app = create_app()
111
+ ```
112
+
113
+ ### Configuration
114
+
115
+ ```json
116
+ {
117
+ "server": {
118
+ "host": "0.0.0.0",
119
+ "port": 8000
120
+ },
121
+ "security": {
122
+ "enabled": true,
123
+ "framework": "mcp_security_framework"
124
+ },
125
+ "commands": {
126
+ "auto_discovery": true,
127
+ "builtin_commands": ["echo", "health", "config"]
128
+ }
129
+ }
130
+ ```
131
+
132
+ ## Examples
133
+
134
+ ### Proxy Registration Example
135
+
136
+ ```python
137
+ # Example of proxy registration with authentication
138
+ import asyncio
139
+ from mcp_proxy_adapter.examples.proxy_registration_example import ProxyRegistrationExample
140
+
141
+ async def main():
142
+ async with ProxyRegistrationExample("http://localhost:8002", "your-token") as client:
143
+ result = await client.test_registration({
144
+ "server_id": "my-server",
145
+ "server_url": "http://localhost:8001",
146
+ "server_name": "My Server"
147
+ })
148
+ print(f"Registration result: {result}")
149
+
150
+ asyncio.run(main())
151
+ ```
152
+
153
+ ### Security Testing
154
+
155
+ The framework includes comprehensive security testing examples:
156
+
157
+ - HTTP with Token Authentication
158
+ - HTTPS with Certificate Authentication
159
+ - mTLS (Mutual TLS) Authentication
160
+ - Role-based Access Control
161
+ - Permission Validation
162
+
163
+ ## Documentation
164
+
165
+ For detailed documentation, examples, and API reference, see the [documentation](https://github.com/maverikod/mcp-proxy-adapter).
166
+
167
+ ## Development
168
+
169
+ ### Setup Development Environment
170
+
171
+ ```bash
172
+ git clone https://github.com/maverikod/mcp-proxy-adapter.git
173
+ cd mcp-proxy-adapter
174
+ python -m venv .venv
175
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
176
+ pip install -e ".[dev]"
177
+ ```
178
+
179
+ ### Running Tests
180
+
181
+ ```bash
182
+ pytest tests/
183
+ ```
184
+
185
+ ### Running Examples
186
+
187
+ ```bash
188
+ # Start server
189
+ python -m mcp_proxy_adapter.main --config examples/server_configs/config_simple.json
190
+
191
+ # Run proxy registration example
192
+ python examples/proxy_registration_example.py
193
+ ```
194
+
195
+ ## License
196
+
197
+ MIT License - see LICENSE file for details.
198
+
199
+ ## Author
200
+
201
+ **Vasiliy Zdanovskiy** - vasilyvz@gmail.com
202
+
203
+ ## Version
204
+
205
+ 6.1.0 - Major release with security framework integration and proxy registration capabilities.
@@ -0,0 +1,193 @@
1
+ mcp_proxy_adapter/__init__.py,sha256=B7m1YWyv_Wb87-Q-JqVpHQgwajnfIgDyZ_iIxzdTbBY,1021
2
+ mcp_proxy_adapter/__main__.py,sha256=GuX2ZMrX4PaoQ2sLTbURZyebVn721AS8tM36e0HEJAI,246
3
+ mcp_proxy_adapter/config.py,sha256=z4rUbJdxYj6vYw05OM_kMXs1Qn2HRQXGHI9PB4hgPd4,12867
4
+ mcp_proxy_adapter/custom_openapi.py,sha256=jYUrCy8C1mShh3sjKj-JkzSMLAvxDLTvtzSJFj5HUNg,15023
5
+ mcp_proxy_adapter/main.py,sha256=_a6_OryRZ3hGIKn-TinM8Zho_GT-JMduG6TVIFbmDkA,6135
6
+ mcp_proxy_adapter/openapi.py,sha256=36vOEbJjGnVZR6hUhl6mHCD29HYOEFKo2bL0JdGSm-4,13952
7
+ mcp_proxy_adapter/version.py,sha256=PzGbu7QClWRoxzGdeS8JiSgRgy-TDBDjKuW74h3p5JI,72
8
+ mcp_proxy_adapter/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ mcp_proxy_adapter/api/app.py,sha256=0fFyHkK7uYD9wy4xuwAK4BO34VAHpjtH0gaD7kFoPCc,27478
10
+ mcp_proxy_adapter/api/handlers.py,sha256=DcZT7MVBV33q-0EJ0iFqxE0VgBkFt6d_SqoRkntwyvc,8477
11
+ mcp_proxy_adapter/api/schemas.py,sha256=xOmiSwHaapY6myEFnLu7o-LWVPM7vwmLYZXFo2c6NfE,12381
12
+ mcp_proxy_adapter/api/tool_integration.py,sha256=MrtX7vUXCGBBuZuOs3C6EF67R_U_0xMfOmlmsAz-wuE,10245
13
+ mcp_proxy_adapter/api/tools.py,sha256=rRCRN2I8Odd2biBJZKByQS15rAWf0XwLRZEHDELc7Tg,8116
14
+ mcp_proxy_adapter/api/middleware/__init__.py,sha256=pswXvCNmKGvvF41erm2IFLzvDWb1GUgX0czhQS_p4K0,2104
15
+ mcp_proxy_adapter/api/middleware/base.py,sha256=aMV9YPLHkUnJECuQWYbnlEGaj6xUJFHZR_hJb0OKvu8,2282
16
+ mcp_proxy_adapter/api/middleware/command_permission_middleware.py,sha256=sSdHTZ-ZxtcV3fJmcweB3sqlQivrYO_FO0H835jnPFA,5076
17
+ mcp_proxy_adapter/api/middleware/error_handling.py,sha256=avIZTjXj1sNOT3ekKtLAYJKM7V4duX0BF9PW-j18dEY,7134
18
+ mcp_proxy_adapter/api/middleware/factory.py,sha256=yDo7f4E-YL7qQZgGApyk8HZfLYOnrpsNx-Eh3fJBikE,8404
19
+ mcp_proxy_adapter/api/middleware/logging.py,sha256=VvUUX7bN4davCzFO6GYbN1O4sgJjOspV-EBLE3xpwpc,4730
20
+ mcp_proxy_adapter/api/middleware/performance.py,sha256=dHBxTF43LEGXMKHMH3A8ybKmwAWURd_zswqq_oC4xbw,2454
21
+ mcp_proxy_adapter/api/middleware/protocol_middleware.py,sha256=ts9_XD7oI6ZPOAvRDwGKbduRL3MH1_wDP3ET7MnVwEE,4851
22
+ mcp_proxy_adapter/api/middleware/transport_middleware.py,sha256=Esy2gGKpEV5RoUTilr1YKKTDc5jh5RxsomD0VXyR2pE,4396
23
+ mcp_proxy_adapter/api/middleware/unified_security.py,sha256=zmRCfYZQ5sqOIboR-WvfiT4U8cLJxPCFqo0JUthtxvQ,4953
24
+ mcp_proxy_adapter/api/middleware/user_info_middleware.py,sha256=dQJWroIihEa5aZmrzrNAYE189K1Uy9OJyeOa9XpWaJk,2682
25
+ mcp_proxy_adapter/commands/__init__.py,sha256=r791wg4FKhWSi5rqA3vekDcGf5kr18pwF1woX-dnZKo,1525
26
+ mcp_proxy_adapter/commands/auth_validation_command.py,sha256=z612WJDVgZwaCrxdQhATwRc5i3qxH37MPuIV6SuZPn8,15083
27
+ mcp_proxy_adapter/commands/base.py,sha256=tunyrmt-LYJMQZslAZQor3KZvOrn1IYNpL5uOAnSdxc,15791
28
+ mcp_proxy_adapter/commands/builtin_commands.py,sha256=oloxk0itnY4Uy1a3ARXqHPm48RqkHxBbHqzXZ4bUGN8,3258
29
+ mcp_proxy_adapter/commands/catalog_manager.py,sha256=FVyF2Ky8DUmvFxjiem3YeC9ASFOzCZ9Lp2MsNobA1wI,34712
30
+ mcp_proxy_adapter/commands/cert_monitor_command.py,sha256=JWitmmHDeooWXt2fWLbcfAHDeHpsTL2AuBaoka7OWNE,24485
31
+ mcp_proxy_adapter/commands/certificate_management_command.py,sha256=4byTb1yCqTQCbNH_L4p_z3HithuugzI3a-H9gjiLDhg,24440
32
+ mcp_proxy_adapter/commands/command_registry.py,sha256=mPNhLnJ4L1lSyVzYXpUjeCBJkWIqEtlzpr9JcprHIf4,35260
33
+ mcp_proxy_adapter/commands/config_command.py,sha256=-Z6BGaEQTf859l56zZpHYBeZFeIVdpMYybDrd7LOPIg,3553
34
+ mcp_proxy_adapter/commands/dependency_container.py,sha256=Uz9OPRAUZN7tsVrMVgXgPQcsRD2N-e2Ixg9XarPOlnY,3410
35
+ mcp_proxy_adapter/commands/dependency_manager.py,sha256=lmY79MBkh-JRIPsYxSkdrUE9XHi4XBCbucaEMT0w6do,7683
36
+ mcp_proxy_adapter/commands/echo_command.py,sha256=R1oDNEAJSOIuODa4Nk3z4WJXhSxniNzaZtYHADlV310,2390
37
+ mcp_proxy_adapter/commands/health_command.py,sha256=uo6iND710oSUHEZm6ueT0TsKXRJKFbxUiVeSK57SBlE,4575
38
+ mcp_proxy_adapter/commands/help_command.py,sha256=PuanwvYmVs64DhB71gaI5rBRi_ozJ6x8afr18bRpTk4,13482
39
+ mcp_proxy_adapter/commands/hooks.py,sha256=Gu5TDSgA9EBHexWMWze8wgT63i6-dMEEwG8edWbrX3U,10060
40
+ mcp_proxy_adapter/commands/key_management_command.py,sha256=qin-iYXksIXOkZEfmJpclJSOyKaz9qRinj9uVa8hkdk,19339
41
+ mcp_proxy_adapter/commands/load_command.py,sha256=2zwPOCSBck6mr5KehyyH8lPRAqYYGeUeIIJdbxMSoZk,5984
42
+ mcp_proxy_adapter/commands/plugins_command.py,sha256=Te6YQH0ukJWIHAAEJE5DmdAilpjO1QMDa_PexhfQLH0,8531
43
+ mcp_proxy_adapter/commands/protocol_management_command.py,sha256=XSrNPGagopM4SinrSmNFW12KLng7-Oc9q6NpiInJ-QI,8485
44
+ mcp_proxy_adapter/commands/proxy_registration_command.py,sha256=yqPKgpv8oPP9mn1Blo-2VRVoWUpMcMJ29stqy2Di7hk,15394
45
+ mcp_proxy_adapter/commands/reload_command.py,sha256=6yJduQlIgXhtDSH4Q8qmfR8wZW1RVC1WT1eBIpxzCNo,7507
46
+ mcp_proxy_adapter/commands/result.py,sha256=9iFyoRRZ17q3d822XTMNyqnBvWypyoyV0NiHtM2bCd4,5604
47
+ mcp_proxy_adapter/commands/role_test_command.py,sha256=Hr45vB3W8tg_GQ4FfKOEOxW10eEb-pApo2nOPjru61M,4281
48
+ mcp_proxy_adapter/commands/roles_management_command.py,sha256=JSMkW9-Hq9ncltUvBjolQdvSeTa1FY2hoU0oD2mBon4,22471
49
+ mcp_proxy_adapter/commands/security_command.py,sha256=zKTVtb8vL_DafRHtrLqC2Mhk_DjOQ-3YwhIUh8NXJfQ,18206
50
+ mcp_proxy_adapter/commands/settings_command.py,sha256=hTBrFRABJDFYwnDf2ryfqoejUe06fM4XMOoiH0Exdyo,6407
51
+ mcp_proxy_adapter/commands/ssl_setup_command.py,sha256=SEszz2lurdT8FhY2ZVcpOvzzGrTENFVAx6tPLJYrvns,17407
52
+ mcp_proxy_adapter/commands/token_management_command.py,sha256=7sl_fRUjWMRuP7NXoLjpLTB9wEg_aZU9dp5Ji9hbThA,18147
53
+ mcp_proxy_adapter/commands/transport_management_command.py,sha256=yv2lqUqJliYGIbYW7t0HQTrt5Cu2Y02rUjVzdznLtPk,4692
54
+ mcp_proxy_adapter/commands/unload_command.py,sha256=mhRZ23sJtTwUfWkjZzH8KDRpwxUX0kdu8LbAXAURRJc,5079
55
+ mcp_proxy_adapter/core/__init__.py,sha256=Ch50cV5Nd8m-HO9rMnVModajjwDK-OdUy7hxISDFkAM,800
56
+ mcp_proxy_adapter/core/app_factory.py,sha256=Zo_Ao2OX5UKc4I8QNQ8pwkdQBzYnfit1NGbg0eD78_E,15182
57
+ mcp_proxy_adapter/core/auth_validator.py,sha256=lJxBVkoQWSk5CNtnPYMEJSsz4FhcXK-gB5QJ_OP9jEE,20937
58
+ mcp_proxy_adapter/core/certificate_utils.py,sha256=6wxTf8dYXb4pCDVkFqKkeJE0Zc_CyzefgmzQT6dTi1c,30448
59
+ mcp_proxy_adapter/core/client_security.py,sha256=8isHpvv-7H85QzI8K3Pfyr_KdvpE2xYyIT4wqWrttNU,13575
60
+ mcp_proxy_adapter/core/config_converter.py,sha256=FAA2zx-yRgqMgzg73o9Aq5CEEfodNCeaA8Yluto4wAs,16985
61
+ mcp_proxy_adapter/core/config_validator.py,sha256=qDVmkRatuDeWylIPLjMq02Vpzff6DDTE_CstpzqGi7o,7773
62
+ mcp_proxy_adapter/core/errors.py,sha256=s34OxiIR4NCJu_pYSigKXqrIvRjUUK2OWw0X4dpDjIA,5151
63
+ mcp_proxy_adapter/core/logging.py,sha256=jQlFz52Xwapef6UD4p0acmaGFumD9XuexwW4frDN_ZM,9626
64
+ mcp_proxy_adapter/core/mtls_asgi.py,sha256=X2lAj3wk3L85amRCp_-10sqvZa5wJf_diXhwrrQReSo,5311
65
+ mcp_proxy_adapter/core/mtls_asgi_app.py,sha256=VeolP08TTaqYU5fGeaZexj6EBWBDugoVrEGXzJW4PuM,6406
66
+ mcp_proxy_adapter/core/protocol_manager.py,sha256=xq0-bOKwFrdFGiUsfdfUktInDneLZ__UIWpS206kQc0,8452
67
+ mcp_proxy_adapter/core/proxy_client.py,sha256=shP373Yelz7Fja22U6XnH0kT9XtPtWEFwOFlYFO97gw,22511
68
+ mcp_proxy_adapter/core/proxy_registration.py,sha256=87ko1vw61nHJGo0-xrObXiyQhrYK2K6nKr8rXID-j8c,19424
69
+ mcp_proxy_adapter/core/role_utils.py,sha256=wMoTVz3gF5fM7jozNMwsEwPkp1tui26M-t_KH1Oz8gs,12880
70
+ mcp_proxy_adapter/core/security_adapter.py,sha256=wZ3OH1WzhUdpN8N8CrGJSFFVNi474DqdazIqQ1T8PN4,13343
71
+ mcp_proxy_adapter/core/security_factory.py,sha256=4r7qvBq30XfosGD_b1ZHyNVLN8rOQ3NAKuaCOCEK8jA,8262
72
+ mcp_proxy_adapter/core/security_integration.py,sha256=lQME1WqGHDz20VakoubTcNBEl9v2A7Z9A1vD9G8DArk,13379
73
+ mcp_proxy_adapter/core/server_adapter.py,sha256=6cnQTdOB9-Ugd7AnKLXaNRTzyeItR2g2yXKJt_cxpBg,12713
74
+ mcp_proxy_adapter/core/server_engine.py,sha256=9yosp80DaNd56_k4SiUiN82lYE6uOnf0GMkZSXvjTMw,13357
75
+ mcp_proxy_adapter/core/settings.py,sha256=ZfUnmqD1tjAuaQo2VAF8evC1oHUit7gTu4WkTF0IMYI,10628
76
+ mcp_proxy_adapter/core/ssl_utils.py,sha256=aBJZhc-5BX4Z9PaQMHEqbAJ8DWdDDZc9REY8MZTedfE,8197
77
+ mcp_proxy_adapter/core/transport_manager.py,sha256=sRDNK6yTUCfQjv2c9nIN2hZuneY3GQn8VPmCxkOmJu0,9506
78
+ mcp_proxy_adapter/core/unified_config_adapter.py,sha256=cpN_VrliIFGDH3JsfRkTlFdQvLcmuMYYedq0QEzlb0Y,22857
79
+ mcp_proxy_adapter/core/utils.py,sha256=ly8Ttg2v1OBukThJLxudRvmttU1hxJFLJUfat4b2dOI,3268
80
+ mcp_proxy_adapter/examples/README.md,sha256=yCz73REZ6nggA_nkpTtf03dgd9_g66QiFw5aX03hSBw,8807
81
+ mcp_proxy_adapter/examples/README_EN.md,sha256=NOD7PDWTCrTuB_xmH2r9fNNgSF-8AhQ2oO575d_mNbI,6399
82
+ mcp_proxy_adapter/examples/SECURITY_TESTING.md,sha256=_4AAz2lAN-ru9HicKpsVkCrPwy_CZeETJMYa9KNbjHQ,11585
83
+ mcp_proxy_adapter/examples/cert_config.json,sha256=reZCv73qWd1IzbTJizg70EgnuFb0xIOEJAOUlgIZxtM,338
84
+ mcp_proxy_adapter/examples/create_certificates_simple.py,sha256=aSpW8JnMqxCpOF37T7eXf-8ZufGu0GcjXVHvtWtA3bo,11016
85
+ mcp_proxy_adapter/examples/debug_request_state.py,sha256=WXrcti8cQpc1qizThz0_1i5jzSxgglelY71Mln28jXw,4475
86
+ mcp_proxy_adapter/examples/debug_role_chain.py,sha256=BuNIW8d0BFunu4Q8kkFEF-bd9iZcyDtQoz3UQJn397A,8665
87
+ mcp_proxy_adapter/examples/demo_client.py,sha256=gqHj3EVFS0MkPTzs6SWHLtUwgyJU6X9qDB84qcuH6xg,10674
88
+ mcp_proxy_adapter/examples/generate_all_certificates.py,sha256=ZUnpbU5NbqOPLVQydtBCN5aDvoxRaze9oLcH3h22BPM,17463
89
+ mcp_proxy_adapter/examples/generate_certificates.py,sha256=iP_eJD-Ar7RhYedXFIYBqYD9laMGhfz9OtG9Y4yfOz8,3723
90
+ mcp_proxy_adapter/examples/proxy_registration_example.py,sha256=jbeYqueeH0q5ac1ZOsCoDjyZJZzbwK23p2613z-TA8s,13177
91
+ mcp_proxy_adapter/examples/roles.json,sha256=fTHJwBXjuuOrLCPrVvOoc55H7xtAd4gIvRjXhYKXYCY,1030
92
+ mcp_proxy_adapter/examples/run_example.py,sha256=ZeT7JeJo2Z6gHvf0vwVQZqCbSc8pfeUaQCLO_v3La5I,2606
93
+ mcp_proxy_adapter/examples/run_security_tests.py,sha256=gye-jnvYLUvNW3dBwpRfA4flp8irW2MnvnQsjsAX_sM,11143
94
+ mcp_proxy_adapter/examples/run_security_tests_fixed.py,sha256=TmQFGW0dVDpYkeRqbaisqsDukYwBSHFF6Y2OR619M7E,11053
95
+ mcp_proxy_adapter/examples/security_test_client.py,sha256=VJUccM1SHd1m-z0uh4D93tssoTtop8jmwG48pXxMCVU,28921
96
+ mcp_proxy_adapter/examples/test_examples.py,sha256=PWJa7sKCyk_07PCvyaXSR-cR6ManzSPp8c0KouWmUKU,12695
97
+ mcp_proxy_adapter/examples/universal_client.py,sha256=PTzbnamgiMyr92-gL23YOcA47P4RReWaFJ5-KiB6sf8,22883
98
+ mcp_proxy_adapter/examples/__pycache__/security_configurations.cpython-312.pyc,sha256=EP7n7pfTRBDv7p-qy0jTFOqSy1ahSlO3L6uN3PhFA0g,1540
99
+ mcp_proxy_adapter/examples/__pycache__/security_test_client.cpython-312.pyc,sha256=2F1li-y3cgQ8EqOr4jn3Hx8DqTwCMU8VAo9lCFH_Tks,30547
100
+ mcp_proxy_adapter/examples/basic_framework/main.py,sha256=KQZ5m2OCduP2pFIb9RArLMMpVE0BG8wjcyM1yjDLfqk,1858
101
+ mcp_proxy_adapter/examples/basic_framework/roles.json,sha256=I0lSP3hfq1DESv3xsZ7-xOEdzaQGCb8b9YMK_AOPDsE,510
102
+ mcp_proxy_adapter/examples/basic_framework/configs/http_auth.json,sha256=ZT4YpPmjxZK-bMOp3J1retzLv7Ld22e6c9x8b9BW_Mg,832
103
+ mcp_proxy_adapter/examples/basic_framework/configs/http_simple.json,sha256=O0seimm3TaD0hNVuNJx5ZGC5sRenTY1bOxNSfPjOzqQ,432
104
+ mcp_proxy_adapter/examples/basic_framework/configs/https_auth.json,sha256=CQzZvEeHKg0F-GNymRmt-qFJr8U7jY5yLJ3yzFWwyzo,916
105
+ mcp_proxy_adapter/examples/basic_framework/configs/https_simple.json,sha256=UIcfFTwdZkj9FMydSTWwYytQKvNtu657OzX49qXb64A,516
106
+ mcp_proxy_adapter/examples/basic_framework/configs/mtls_no_roles.json,sha256=gLsZW3HqVDOOOzono88uIoW4nf5A9qEL2TykJg8wxec,928
107
+ mcp_proxy_adapter/examples/basic_framework/configs/mtls_with_roles.json,sha256=IkV5786XGfR8faN-6gMXQehDVrqxXWQlaNsmTnZ5hDY,1107
108
+ mcp_proxy_adapter/examples/certs/admin.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
109
+ mcp_proxy_adapter/examples/certs/admin.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
110
+ mcp_proxy_adapter/examples/certs/admin_cert.pem,sha256=duFr9LKheZSBpgki3qWNcpi7UULlIdjRWZojWrVflUc,1241
111
+ mcp_proxy_adapter/examples/certs/admin_key.pem,sha256=Be3jAcln4mtggN-wbc5PXO6SCatnS_49zXsCQDNDGvc,1704
112
+ mcp_proxy_adapter/examples/certs/ca_cert.pem,sha256=85TwLqcAM7FhqPq4O5yzwUTkLjtAaR3rYCPtKtCddCA,1379
113
+ mcp_proxy_adapter/examples/certs/ca_cert.srl,sha256=GKJtcm8Rkhl5-WEMKky5F_AuAwSifLPyqWzfc2W3DZE,41
114
+ mcp_proxy_adapter/examples/certs/ca_key.pem,sha256=jkqs2jlbEm5iPC_wJtdLLmnL8aFZDj26AS33aBbJd2U,1704
115
+ mcp_proxy_adapter/examples/certs/cert_config.json,sha256=o6wQw1s-0foQYs8w2Wsan_uc7MuIJ9FhuEbWUXl1_60,497
116
+ mcp_proxy_adapter/examples/certs/client.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
117
+ mcp_proxy_adapter/examples/certs/client.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
118
+ mcp_proxy_adapter/examples/certs/client_admin.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
119
+ mcp_proxy_adapter/examples/certs/client_admin.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
120
+ mcp_proxy_adapter/examples/certs/client_user.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
121
+ mcp_proxy_adapter/examples/certs/client_user.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
122
+ mcp_proxy_adapter/examples/certs/guest_cert.pem,sha256=6E7RiJ66K823hKbn4x95TJUy57RnFinAvJ3MIiJqd2U,1241
123
+ mcp_proxy_adapter/examples/certs/guest_key.pem,sha256=wqGSMyQE_xxiUgTgbtfvUiOYyYhNgwSMI3bwNqOLh8Y,1704
124
+ mcp_proxy_adapter/examples/certs/mcp_proxy_adapter_ca_ca.crt,sha256=85TwLqcAM7FhqPq4O5yzwUTkLjtAaR3rYCPtKtCddCA,1379
125
+ mcp_proxy_adapter/examples/certs/proxy_cert.pem,sha256=WG-mAtQTWTTLmRJPB4cnUaKwIk8wKWnOLyeY9zYOBeI,1241
126
+ mcp_proxy_adapter/examples/certs/proxy_key.pem,sha256=snrlu2B9GgPYBqApRlqD2hrPBxZ6IkMNegMr_j3kHTc,1704
127
+ mcp_proxy_adapter/examples/certs/readonly.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
128
+ mcp_proxy_adapter/examples/certs/readonly.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
129
+ mcp_proxy_adapter/examples/certs/readonly_cert.pem,sha256=9XzMVdQRP6q1imZe67k4nhX69y1EBD3htrrzKxugwCg,1245
130
+ mcp_proxy_adapter/examples/certs/readonly_key.pem,sha256=z7R1Xnucz6ns2gtivR4FC_pc5Msk5c-Q3bIGGmJq6Po,1708
131
+ mcp_proxy_adapter/examples/certs/server.crt,sha256=uTU6BJ_qJUHTnbCT2ku7GMAU3q-CJMOArYKmdq_nZRE,1988
132
+ mcp_proxy_adapter/examples/certs/server.key,sha256=tQAVnG6l4MAkl_UBbTFy92vbc5dhc4S_cYdqOihmSJc,3272
133
+ mcp_proxy_adapter/examples/certs/server_cert.pem,sha256=uTU6BJ_qJUHTnbCT2ku7GMAU3q-CJMOArYKmdq_nZRE,1988
134
+ mcp_proxy_adapter/examples/certs/server_key.pem,sha256=tQAVnG6l4MAkl_UBbTFy92vbc5dhc4S_cYdqOihmSJc,3272
135
+ mcp_proxy_adapter/examples/certs/test_ca_ca.crt,sha256=9WuY5A_FHGuFKmFto43uvs8lL3xGiFzEptSUyAHBwxA,1172
136
+ mcp_proxy_adapter/examples/certs/user.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
137
+ mcp_proxy_adapter/examples/certs/user.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
138
+ mcp_proxy_adapter/examples/certs/user_cert.pem,sha256=oAEattM1VuQQJ1Zi9BBrGDdiUWV-OwCprQ5-WgIqyvk,1237
139
+ mcp_proxy_adapter/examples/certs/user_key.pem,sha256=sRomoO8H6yTkBMT6fsw8E7SOo29rlLG8am35m3GkWVk,1704
140
+ mcp_proxy_adapter/examples/client_configs/api_key_client.json,sha256=cHWe-FdJESoyQrXNNR9lWmakp-4ea8nK35P4gFko94o,240
141
+ mcp_proxy_adapter/examples/client_configs/basic_auth_client.json,sha256=PRTU2kQri9cNp3CyR52OIV7GF9UBTkwEN0pdKrTURh0,239
142
+ mcp_proxy_adapter/examples/client_configs/certificate_client.json,sha256=xOLfBnW62s11zzGrrUoTh7S7oYLaKZPYr-sYUqYAtqM,515
143
+ mcp_proxy_adapter/examples/client_configs/jwt_client.json,sha256=MuzqtKOjMmuK6euW1gAVUf2y4FzRaD8r2Up46gw_d6w,301
144
+ mcp_proxy_adapter/examples/client_configs/no_auth_client.json,sha256=5S41azhMqRnDTwMC7FjZa1FXt8sT5XWr8sEjWqp0J8M,151
145
+ mcp_proxy_adapter/examples/commands/__init__.py,sha256=ghbOrq1GFnLWXunr5pAU9qerEcTEDfgPpwo-lNqN4po,19
146
+ mcp_proxy_adapter/examples/full_application/main.py,sha256=ZCXZtMPBH2_4JfvZZ-BJV1rfeEJqVGuukuNFK9xIrHY,4902
147
+ mcp_proxy_adapter/examples/full_application/roles.json,sha256=I0lSP3hfq1DESv3xsZ7-xOEdzaQGCb8b9YMK_AOPDsE,510
148
+ mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py,sha256=IN9sj4d_ba1Lekie1y1olDukPwtR5uM4dJhoWptCfLU,3182
149
+ mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py,sha256=w7BfJ5uFIrjPitAWSX1OSgivxokx8bKqi7RhguvVbXI,3551
150
+ mcp_proxy_adapter/examples/full_application/configs/http_auth.json,sha256=ZT4YpPmjxZK-bMOp3J1retzLv7Ld22e6c9x8b9BW_Mg,832
151
+ mcp_proxy_adapter/examples/full_application/configs/http_simple.json,sha256=O0seimm3TaD0hNVuNJx5ZGC5sRenTY1bOxNSfPjOzqQ,432
152
+ mcp_proxy_adapter/examples/full_application/configs/https_auth.json,sha256=CQzZvEeHKg0F-GNymRmt-qFJr8U7jY5yLJ3yzFWwyzo,916
153
+ mcp_proxy_adapter/examples/full_application/configs/https_simple.json,sha256=UIcfFTwdZkj9FMydSTWwYytQKvNtu657OzX49qXb64A,516
154
+ mcp_proxy_adapter/examples/full_application/configs/mtls_no_roles.json,sha256=gLsZW3HqVDOOOzono88uIoW4nf5A9qEL2TykJg8wxec,928
155
+ mcp_proxy_adapter/examples/full_application/configs/mtls_with_roles.json,sha256=IkV5786XGfR8faN-6gMXQehDVrqxXWQlaNsmTnZ5hDY,1107
156
+ mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py,sha256=rvAP7aNSLfGQebMeyl0bCWHlRsAXUKxvUGaaXgyqMEE,3579
157
+ mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py,sha256=gom94ucARnAOZ0V0woFLDWJoSt4sJ1noXnLqlScsdIQ,3119
158
+ mcp_proxy_adapter/examples/keys/ca_key.pem,sha256=DunYhEBcWUuU6coRBlBSVTDM1_jMQ-_j6JOTYppPndk,1704
159
+ mcp_proxy_adapter/examples/keys/mcp_proxy_adapter_ca_ca.key,sha256=jkqs2jlbEm5iPC_wJtdLLmnL8aFZDj26AS33aBbJd2U,1704
160
+ mcp_proxy_adapter/examples/keys/test_ca_ca.key,sha256=HT7C4AbZIHrNHtuV7BSw25Kxwyic3Q7_VmMnUNn2td8,1704
161
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log,sha256=VI_Zlk8Kbw90m1Fxo7_Yl7_Rmi3qB7Km8BA1h0uS0jk,18382
162
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.1,sha256=4OCUSxnTWGmItHiN6JrNZBhdgzkA9yN5qhJku9WI_3Y,93
163
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.2,sha256=Tvlemoipn8coC5_X_TrxRRkzTF5oMQyT67HQM7BmrZE,75
164
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.3,sha256=H7mrPVx3l4GceusilEnm6joEMj_QksXeD43fo7ifs1M,97
165
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.4,sha256=oNTSBeAAjvY_St_hxNEbGQA5VRscWli-_RVQm7W8dDs,93
166
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.5,sha256=OXE96BxxN1s5G_-xVaCO2GVViA1fiVDkoi8uJh3xi_A,254
167
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log,sha256=VI_Zlk8Kbw90m1Fxo7_Yl7_Rmi3qB7Km8BA1h0uS0jk,18382
168
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.1,sha256=4OCUSxnTWGmItHiN6JrNZBhdgzkA9yN5qhJku9WI_3Y,93
169
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.2,sha256=Tvlemoipn8coC5_X_TrxRRkzTF5oMQyT67HQM7BmrZE,75
170
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.3,sha256=H7mrPVx3l4GceusilEnm6joEMj_QksXeD43fo7ifs1M,97
171
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.4,sha256=oNTSBeAAjvY_St_hxNEbGQA5VRscWli-_RVQm7W8dDs,93
172
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.5,sha256=OXE96BxxN1s5G_-xVaCO2GVViA1fiVDkoi8uJh3xi_A,254
173
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log,sha256=E4BPdJ1fhxuwmjtAau7BuYHqYPUGQnYQGeE00duqJRE,187
174
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.1,sha256=oNTSBeAAjvY_St_hxNEbGQA5VRscWli-_RVQm7W8dDs,93
175
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.2,sha256=oNTSBeAAjvY_St_hxNEbGQA5VRscWli-_RVQm7W8dDs,93
176
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.3,sha256=IvB025kPzdIJw94oai_T7vHwTplte3GZujAJhSRq7M0,183
177
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.4,sha256=svRL8M0dLsmio58leIelYSMRQue5JmzbHqFeQU5cAf4,148
178
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.5,sha256=oNTSBeAAjvY_St_hxNEbGQA5VRscWli-_RVQm7W8dDs,93
179
+ mcp_proxy_adapter/examples/server_configs/config_basic_http.json,sha256=wqxfjlmjpARYbFfmtO0Ahdv-Pda9fcrfUrnM9ZdrksQ,4928
180
+ mcp_proxy_adapter/examples/server_configs/config_http_token.json,sha256=yzdRX5YG48DAg8Ad4WNQ5ma0G05BWiCU_amw02oXEkM,5952
181
+ mcp_proxy_adapter/examples/server_configs/config_https.json,sha256=zWCvibsTcBDnKj4YaEd_X1py-4XaKOEH3Qzq3ps2Hv4,5859
182
+ mcp_proxy_adapter/examples/server_configs/config_https_token.json,sha256=gBuSn8pRo-kpv58q3NeIui-rgjhShz8YSPVKri6ujUY,6317
183
+ mcp_proxy_adapter/examples/server_configs/config_mtls.json,sha256=pt4H_FzmduSmvI6cOicsVImMjle1-5OML-1hBzujYUc,5666
184
+ mcp_proxy_adapter/examples/server_configs/config_proxy_registration.json,sha256=e4r2q5o4_XY0R904NwT0EHO5Yxbwi89ju_vIiIMGVZA,6528
185
+ mcp_proxy_adapter/examples/server_configs/config_simple.json,sha256=aUYnxEFPTVWJPtQObRim-evdf0neIKULc6QrqAudnmU,922
186
+ mcp_proxy_adapter/examples/server_configs/roles.json,sha256=fTHJwBXjuuOrLCPrVvOoc55H7xtAd4gIvRjXhYKXYCY,1030
187
+ mcp_proxy_adapter/utils/config_generator.py,sha256=uTP5_RdP4eqoFZXTPGkfR_mRxiH9OdfWAqijuleH0Yw,27013
188
+ mcp_proxy_adapter-6.1.0.dist-info/licenses/LICENSE,sha256=6KdtUcTwmTRbJrAmYjVn7e6S-V42ubeDJ-AiVEzZ510,1075
189
+ mcp_proxy_adapter-6.1.0.dist-info/METADATA,sha256=yLBKgbevZJnV-ypXOOId_VEXehFuk1tQb0s75BntYLk,6295
190
+ mcp_proxy_adapter-6.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
191
+ mcp_proxy_adapter-6.1.0.dist-info/entry_points.txt,sha256=J3eV6ID0lt_VSp4lIdIgBFTqLCThgObNNxRCbyfiMHw,70
192
+ mcp_proxy_adapter-6.1.0.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
193
+ mcp_proxy_adapter-6.1.0.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mcp-proxy-adapter = mcp_proxy_adapter.__main__:main
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023-2024 Vasiliy VZ
3
+ Copyright (c) 2024 Vasiliy Zdanovskiy
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -1,146 +0,0 @@
1
- """
2
- Middleware for authentication.
3
- """
4
-
5
- import json
6
- from typing import Dict, List, Optional, Callable, Awaitable
7
-
8
- from fastapi import Request, Response
9
- from starlette.responses import JSONResponse
10
-
11
- from mcp_proxy_adapter.core.logging import logger
12
- from .base import BaseMiddleware
13
-
14
- class AuthMiddleware(BaseMiddleware):
15
- """
16
- Middleware for authenticating requests.
17
- """
18
-
19
- def __init__(self, app, api_keys: Dict[str, str] = None, public_paths: List[str] = None, auth_enabled: bool = True):
20
- """
21
- Initializes middleware for authentication.
22
-
23
- Args:
24
- app: FastAPI application
25
- api_keys: Dictionary with API keys (key: username)
26
- public_paths: List of paths accessible without authentication
27
- auth_enabled: Flag to enable/disable authentication
28
- """
29
- super().__init__(app)
30
- self.api_keys = api_keys or {}
31
- self.public_paths = public_paths or [
32
- "/docs",
33
- "/redoc",
34
- "/openapi.json",
35
- "/health"
36
- ]
37
- self.auth_enabled = auth_enabled
38
-
39
- async def dispatch(self, request: Request, call_next: Callable[[Request], Awaitable[Response]]) -> Response:
40
- """
41
- Processes request and checks authentication.
42
-
43
- Args:
44
- request: Request.
45
- call_next: Next handler.
46
-
47
- Returns:
48
- Response.
49
- """
50
- # Check if authentication is disabled
51
- if not self.auth_enabled:
52
- logger.debug("Authentication is disabled, skipping authentication check")
53
- return await call_next(request)
54
-
55
- # Check if path is public
56
- path = request.url.path
57
- if self._is_public_path(path):
58
- # If path is public, skip authentication
59
- return await call_next(request)
60
-
61
- # Check for API key in header
62
- api_key = request.headers.get("X-API-Key")
63
-
64
- if not api_key:
65
- # Check for API key in query parameters
66
- api_key = request.query_params.get("api_key")
67
-
68
- if not api_key and request.method in ["POST", "PUT", "PATCH"]:
69
- # Check for API key in JSON-RPC request body
70
- try:
71
- body = await request.body()
72
- if body:
73
- try:
74
- body_json = json.loads(body.decode("utf-8"))
75
- # Look for API key in params of JSON-RPC object
76
- if isinstance(body_json, dict) and "params" in body_json:
77
- api_key = body_json.get("params", {}).get("api_key")
78
- except json.JSONDecodeError:
79
- pass
80
- except Exception:
81
- pass
82
-
83
- # If API key not found, return error
84
- if not api_key:
85
- logger.warning(f"Authentication failed: API key not provided | Path: {path}")
86
- return self._create_error_response("API key not provided", 401)
87
-
88
- # Check if API key is valid
89
- username = self._validate_api_key(api_key)
90
- if not username:
91
- logger.warning(f"Authentication failed: Invalid API key | Path: {path}")
92
- return self._create_error_response("Invalid API key", 401)
93
-
94
- # If API key is valid, save user information in request state
95
- request.state.username = username
96
- logger.info(f"Authentication successful: {username} | Path: {path}")
97
-
98
- # Call the next middleware or main handler
99
- return await call_next(request)
100
-
101
- def _is_public_path(self, path: str) -> bool:
102
- """
103
- Checks if the path is public.
104
-
105
- Args:
106
- path: Path to check.
107
-
108
- Returns:
109
- True if path is public, False otherwise.
110
- """
111
- return any(path.startswith(public_path) for public_path in self.public_paths)
112
-
113
- def _validate_api_key(self, api_key: str) -> Optional[str]:
114
- """
115
- Validates API key.
116
-
117
- Args:
118
- api_key: API key to validate.
119
-
120
- Returns:
121
- Username if API key is valid, otherwise None.
122
- """
123
- return self.api_keys.get(api_key)
124
-
125
- def _create_error_response(self, message: str, status_code: int) -> Response:
126
- """
127
- Creates error response in JSON-RPC format.
128
-
129
- Args:
130
- message: Error message.
131
- status_code: HTTP status code.
132
-
133
- Returns:
134
- JSON response with error.
135
- """
136
- return JSONResponse(
137
- status_code=status_code,
138
- content={
139
- "jsonrpc": "2.0",
140
- "error": {
141
- "code": -32000,
142
- "message": message
143
- },
144
- "id": None
145
- }
146
- )