mcp-proxy-adapter 6.0.0__py3-none-any.whl → 6.1.1__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 (264) hide show
  1. mcp_proxy_adapter/api/app.py +174 -80
  2. mcp_proxy_adapter/api/handlers.py +16 -5
  3. mcp_proxy_adapter/api/middleware/__init__.py +9 -4
  4. mcp_proxy_adapter/api/middleware/command_permission_middleware.py +148 -0
  5. mcp_proxy_adapter/api/middleware/factory.py +36 -12
  6. mcp_proxy_adapter/api/middleware/protocol_middleware.py +32 -13
  7. mcp_proxy_adapter/api/middleware/unified_security.py +160 -0
  8. mcp_proxy_adapter/api/middleware/user_info_middleware.py +83 -0
  9. mcp_proxy_adapter/commands/__init__.py +7 -1
  10. mcp_proxy_adapter/commands/base.py +7 -4
  11. mcp_proxy_adapter/commands/builtin_commands.py +8 -2
  12. mcp_proxy_adapter/commands/command_registry.py +8 -0
  13. mcp_proxy_adapter/commands/echo_command.py +81 -0
  14. mcp_proxy_adapter/commands/help_command.py +21 -14
  15. mcp_proxy_adapter/commands/proxy_registration_command.py +326 -185
  16. mcp_proxy_adapter/commands/role_test_command.py +141 -0
  17. mcp_proxy_adapter/commands/security_command.py +488 -0
  18. mcp_proxy_adapter/commands/ssl_setup_command.py +2 -2
  19. mcp_proxy_adapter/commands/token_management_command.py +1 -1
  20. mcp_proxy_adapter/config.py +81 -21
  21. mcp_proxy_adapter/core/app_factory.py +326 -0
  22. mcp_proxy_adapter/core/client_security.py +384 -0
  23. mcp_proxy_adapter/core/logging.py +8 -3
  24. mcp_proxy_adapter/core/mtls_asgi.py +156 -0
  25. mcp_proxy_adapter/core/mtls_asgi_app.py +187 -0
  26. mcp_proxy_adapter/core/protocol_manager.py +139 -8
  27. mcp_proxy_adapter/core/proxy_client.py +602 -0
  28. mcp_proxy_adapter/core/proxy_registration.py +299 -47
  29. mcp_proxy_adapter/core/security_adapter.py +12 -15
  30. mcp_proxy_adapter/core/security_integration.py +285 -0
  31. mcp_proxy_adapter/core/server_adapter.py +345 -0
  32. mcp_proxy_adapter/core/server_engine.py +364 -0
  33. mcp_proxy_adapter/core/unified_config_adapter.py +579 -0
  34. mcp_proxy_adapter/docs/EN/TROUBLESHOOTING.md +285 -0
  35. mcp_proxy_adapter/docs/RU/TROUBLESHOOTING.md +285 -0
  36. mcp_proxy_adapter/examples/README.md +230 -97
  37. mcp_proxy_adapter/examples/README_EN.md +258 -0
  38. mcp_proxy_adapter/examples/SECURITY_TESTING.md +455 -0
  39. mcp_proxy_adapter/examples/basic_framework/configs/http_auth.json +37 -0
  40. mcp_proxy_adapter/examples/basic_framework/configs/http_simple.json +23 -0
  41. mcp_proxy_adapter/examples/basic_framework/configs/https_auth.json +43 -0
  42. mcp_proxy_adapter/examples/basic_framework/configs/https_no_protocol_middleware.json +36 -0
  43. mcp_proxy_adapter/examples/basic_framework/configs/https_simple.json +29 -0
  44. mcp_proxy_adapter/examples/basic_framework/configs/mtls_no_protocol_middleware.json +34 -0
  45. mcp_proxy_adapter/examples/basic_framework/configs/mtls_no_roles.json +39 -0
  46. mcp_proxy_adapter/examples/basic_framework/configs/mtls_simple.json +35 -0
  47. mcp_proxy_adapter/examples/basic_framework/configs/mtls_with_roles.json +45 -0
  48. mcp_proxy_adapter/examples/basic_framework/main.py +63 -0
  49. mcp_proxy_adapter/examples/basic_framework/roles.json +21 -0
  50. mcp_proxy_adapter/examples/cert_config.json +9 -0
  51. mcp_proxy_adapter/examples/certs/admin.crt +32 -0
  52. mcp_proxy_adapter/examples/certs/admin.key +52 -0
  53. mcp_proxy_adapter/examples/certs/admin_cert.pem +21 -0
  54. mcp_proxy_adapter/examples/certs/admin_key.pem +28 -0
  55. mcp_proxy_adapter/examples/certs/ca_cert.pem +23 -0
  56. mcp_proxy_adapter/examples/certs/ca_cert.srl +1 -0
  57. mcp_proxy_adapter/examples/certs/ca_key.pem +28 -0
  58. mcp_proxy_adapter/examples/certs/cert_config.json +9 -0
  59. mcp_proxy_adapter/examples/certs/client.crt +32 -0
  60. mcp_proxy_adapter/examples/certs/client.key +52 -0
  61. mcp_proxy_adapter/examples/certs/client_admin.crt +32 -0
  62. mcp_proxy_adapter/examples/certs/client_admin.key +52 -0
  63. mcp_proxy_adapter/examples/certs/client_user.crt +32 -0
  64. mcp_proxy_adapter/examples/certs/client_user.key +52 -0
  65. mcp_proxy_adapter/examples/certs/guest_cert.pem +21 -0
  66. mcp_proxy_adapter/examples/certs/guest_key.pem +28 -0
  67. mcp_proxy_adapter/examples/certs/mcp_proxy_adapter_ca_ca.crt +23 -0
  68. mcp_proxy_adapter/examples/certs/proxy_cert.pem +21 -0
  69. mcp_proxy_adapter/examples/certs/proxy_key.pem +28 -0
  70. mcp_proxy_adapter/examples/certs/readonly.crt +32 -0
  71. mcp_proxy_adapter/examples/certs/readonly.key +52 -0
  72. mcp_proxy_adapter/examples/certs/readonly_cert.pem +21 -0
  73. mcp_proxy_adapter/examples/certs/readonly_key.pem +28 -0
  74. mcp_proxy_adapter/examples/certs/server.crt +32 -0
  75. mcp_proxy_adapter/examples/certs/server.key +52 -0
  76. mcp_proxy_adapter/examples/certs/server_cert.pem +32 -0
  77. mcp_proxy_adapter/examples/certs/server_key.pem +52 -0
  78. mcp_proxy_adapter/examples/certs/test_ca_ca.crt +20 -0
  79. mcp_proxy_adapter/examples/certs/user.crt +32 -0
  80. mcp_proxy_adapter/examples/certs/user.key +52 -0
  81. mcp_proxy_adapter/examples/certs/user_cert.pem +21 -0
  82. mcp_proxy_adapter/examples/certs/user_key.pem +28 -0
  83. mcp_proxy_adapter/examples/client_configs/api_key_client.json +13 -0
  84. mcp_proxy_adapter/examples/client_configs/basic_auth_client.json +13 -0
  85. mcp_proxy_adapter/examples/client_configs/certificate_client.json +22 -0
  86. mcp_proxy_adapter/examples/client_configs/jwt_client.json +15 -0
  87. mcp_proxy_adapter/examples/client_configs/no_auth_client.json +9 -0
  88. mcp_proxy_adapter/examples/commands/__init__.py +1 -0
  89. mcp_proxy_adapter/examples/create_certificates_simple.py +307 -0
  90. mcp_proxy_adapter/examples/debug_request_state.py +144 -0
  91. mcp_proxy_adapter/examples/debug_role_chain.py +205 -0
  92. mcp_proxy_adapter/examples/demo_client.py +341 -0
  93. mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py +99 -0
  94. mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py +106 -0
  95. mcp_proxy_adapter/examples/full_application/configs/http_auth.json +37 -0
  96. mcp_proxy_adapter/examples/full_application/configs/http_simple.json +23 -0
  97. mcp_proxy_adapter/examples/full_application/configs/https_auth.json +39 -0
  98. mcp_proxy_adapter/examples/full_application/configs/https_simple.json +25 -0
  99. mcp_proxy_adapter/examples/full_application/configs/mtls_no_roles.json +39 -0
  100. mcp_proxy_adapter/examples/full_application/configs/mtls_with_roles.json +45 -0
  101. mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py +97 -0
  102. mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py +95 -0
  103. mcp_proxy_adapter/examples/full_application/main.py +138 -0
  104. mcp_proxy_adapter/examples/full_application/roles.json +21 -0
  105. mcp_proxy_adapter/examples/generate_all_certificates.py +429 -0
  106. mcp_proxy_adapter/examples/generate_certificates.py +121 -0
  107. mcp_proxy_adapter/examples/keys/ca_key.pem +28 -0
  108. mcp_proxy_adapter/examples/keys/mcp_proxy_adapter_ca_ca.key +28 -0
  109. mcp_proxy_adapter/examples/keys/test_ca_ca.key +28 -0
  110. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log +220 -0
  111. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.1 +1 -0
  112. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.2 +1 -0
  113. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.3 +1 -0
  114. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.4 +1 -0
  115. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.5 +1 -0
  116. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log +220 -0
  117. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.1 +1 -0
  118. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.2 +1 -0
  119. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.3 +1 -0
  120. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.4 +1 -0
  121. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.5 +1 -0
  122. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log +2 -0
  123. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.1 +1 -0
  124. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.2 +1 -0
  125. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.3 +1 -0
  126. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.4 +1 -0
  127. mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.5 +1 -0
  128. mcp_proxy_adapter/examples/proxy_registration_example.py +401 -0
  129. mcp_proxy_adapter/examples/roles.json +38 -0
  130. mcp_proxy_adapter/examples/run_example.py +81 -0
  131. mcp_proxy_adapter/examples/run_security_tests.py +326 -0
  132. mcp_proxy_adapter/examples/run_security_tests_fixed.py +300 -0
  133. mcp_proxy_adapter/examples/security_test_client.py +743 -0
  134. mcp_proxy_adapter/examples/server_configs/config_basic_http.json +204 -0
  135. mcp_proxy_adapter/examples/server_configs/config_http_token.json +238 -0
  136. mcp_proxy_adapter/examples/server_configs/config_https.json +215 -0
  137. mcp_proxy_adapter/examples/server_configs/config_https_token.json +231 -0
  138. mcp_proxy_adapter/examples/server_configs/config_mtls.json +215 -0
  139. mcp_proxy_adapter/examples/server_configs/config_proxy_registration.json +250 -0
  140. mcp_proxy_adapter/examples/server_configs/config_simple.json +46 -0
  141. mcp_proxy_adapter/examples/server_configs/roles.json +38 -0
  142. mcp_proxy_adapter/examples/test_config_generator.py +110 -0
  143. mcp_proxy_adapter/examples/test_examples.py +344 -0
  144. mcp_proxy_adapter/examples/universal_client.py +628 -0
  145. mcp_proxy_adapter/main.py +21 -10
  146. mcp_proxy_adapter/utils/config_generator.py +727 -0
  147. mcp_proxy_adapter/version.py +5 -2
  148. mcp_proxy_adapter-6.1.1.dist-info/METADATA +205 -0
  149. mcp_proxy_adapter-6.1.1.dist-info/RECORD +197 -0
  150. mcp_proxy_adapter-6.1.1.dist-info/entry_points.txt +2 -0
  151. {mcp_proxy_adapter-6.0.0.dist-info → mcp_proxy_adapter-6.1.1.dist-info}/licenses/LICENSE +2 -2
  152. mcp_proxy_adapter/api/middleware/auth.py +0 -146
  153. mcp_proxy_adapter/api/middleware/auth_adapter.py +0 -235
  154. mcp_proxy_adapter/api/middleware/mtls_adapter.py +0 -305
  155. mcp_proxy_adapter/api/middleware/mtls_middleware.py +0 -296
  156. mcp_proxy_adapter/api/middleware/rate_limit.py +0 -152
  157. mcp_proxy_adapter/api/middleware/rate_limit_adapter.py +0 -241
  158. mcp_proxy_adapter/api/middleware/roles_adapter.py +0 -365
  159. mcp_proxy_adapter/api/middleware/roles_middleware.py +0 -381
  160. mcp_proxy_adapter/api/middleware/security.py +0 -376
  161. mcp_proxy_adapter/api/middleware/token_auth_middleware.py +0 -261
  162. mcp_proxy_adapter/examples/__init__.py +0 -7
  163. mcp_proxy_adapter/examples/basic_server/README.md +0 -60
  164. mcp_proxy_adapter/examples/basic_server/__init__.py +0 -7
  165. mcp_proxy_adapter/examples/basic_server/basic_custom_settings.json +0 -39
  166. mcp_proxy_adapter/examples/basic_server/config.json +0 -70
  167. mcp_proxy_adapter/examples/basic_server/config_all_protocols.json +0 -54
  168. mcp_proxy_adapter/examples/basic_server/config_http.json +0 -70
  169. mcp_proxy_adapter/examples/basic_server/config_http_only.json +0 -52
  170. mcp_proxy_adapter/examples/basic_server/config_https.json +0 -58
  171. mcp_proxy_adapter/examples/basic_server/config_mtls.json +0 -58
  172. mcp_proxy_adapter/examples/basic_server/config_ssl.json +0 -46
  173. mcp_proxy_adapter/examples/basic_server/custom_settings_example.py +0 -238
  174. mcp_proxy_adapter/examples/basic_server/server.py +0 -114
  175. mcp_proxy_adapter/examples/custom_commands/README.md +0 -127
  176. mcp_proxy_adapter/examples/custom_commands/__init__.py +0 -27
  177. mcp_proxy_adapter/examples/custom_commands/advanced_hooks.py +0 -566
  178. mcp_proxy_adapter/examples/custom_commands/auto_commands/__init__.py +0 -6
  179. mcp_proxy_adapter/examples/custom_commands/auto_commands/auto_echo_command.py +0 -103
  180. mcp_proxy_adapter/examples/custom_commands/auto_commands/auto_info_command.py +0 -111
  181. mcp_proxy_adapter/examples/custom_commands/auto_commands/test_command.py +0 -105
  182. mcp_proxy_adapter/examples/custom_commands/catalog/commands/test_command.py +0 -129
  183. mcp_proxy_adapter/examples/custom_commands/config.json +0 -118
  184. mcp_proxy_adapter/examples/custom_commands/config_all_protocols.json +0 -46
  185. mcp_proxy_adapter/examples/custom_commands/config_https_only.json +0 -46
  186. mcp_proxy_adapter/examples/custom_commands/config_https_transport.json +0 -33
  187. mcp_proxy_adapter/examples/custom_commands/config_mtls_only.json +0 -46
  188. mcp_proxy_adapter/examples/custom_commands/config_mtls_transport.json +0 -33
  189. mcp_proxy_adapter/examples/custom_commands/config_single_transport.json +0 -33
  190. mcp_proxy_adapter/examples/custom_commands/custom_health_command.py +0 -169
  191. mcp_proxy_adapter/examples/custom_commands/custom_help_command.py +0 -215
  192. mcp_proxy_adapter/examples/custom_commands/custom_openapi_generator.py +0 -76
  193. mcp_proxy_adapter/examples/custom_commands/custom_settings.json +0 -96
  194. mcp_proxy_adapter/examples/custom_commands/custom_settings_manager.py +0 -241
  195. mcp_proxy_adapter/examples/custom_commands/data_transform_command.py +0 -135
  196. mcp_proxy_adapter/examples/custom_commands/echo_command.py +0 -122
  197. mcp_proxy_adapter/examples/custom_commands/full_help_response.json +0 -1
  198. mcp_proxy_adapter/examples/custom_commands/generated_openapi.json +0 -629
  199. mcp_proxy_adapter/examples/custom_commands/get_openapi.py +0 -103
  200. mcp_proxy_adapter/examples/custom_commands/hooks.py +0 -230
  201. mcp_proxy_adapter/examples/custom_commands/intercept_command.py +0 -123
  202. mcp_proxy_adapter/examples/custom_commands/loadable_commands/test_ignored.py +0 -129
  203. mcp_proxy_adapter/examples/custom_commands/manual_echo_command.py +0 -103
  204. mcp_proxy_adapter/examples/custom_commands/proxy_connection_manager.py +0 -278
  205. mcp_proxy_adapter/examples/custom_commands/server.py +0 -252
  206. mcp_proxy_adapter/examples/custom_commands/simple_openapi_server.py +0 -75
  207. mcp_proxy_adapter/examples/custom_commands/start_server_with_proxy_manager.py +0 -299
  208. mcp_proxy_adapter/examples/custom_commands/start_server_with_registration.py +0 -278
  209. mcp_proxy_adapter/examples/custom_commands/test_hooks.py +0 -176
  210. mcp_proxy_adapter/examples/custom_commands/test_openapi.py +0 -27
  211. mcp_proxy_adapter/examples/custom_commands/test_registry.py +0 -23
  212. mcp_proxy_adapter/examples/custom_commands/test_simple.py +0 -19
  213. mcp_proxy_adapter/examples/custom_project_example/README.md +0 -103
  214. mcp_proxy_adapter/examples/custom_project_example/README_EN.md +0 -103
  215. mcp_proxy_adapter/examples/deployment/README.md +0 -49
  216. mcp_proxy_adapter/examples/deployment/__init__.py +0 -7
  217. mcp_proxy_adapter/examples/deployment/config.development.json +0 -8
  218. mcp_proxy_adapter/examples/deployment/config.json +0 -29
  219. mcp_proxy_adapter/examples/deployment/config.production.json +0 -12
  220. mcp_proxy_adapter/examples/deployment/config.staging.json +0 -11
  221. mcp_proxy_adapter/examples/deployment/docker-compose.yml +0 -31
  222. mcp_proxy_adapter/examples/deployment/run.sh +0 -43
  223. mcp_proxy_adapter/examples/deployment/run_docker.sh +0 -84
  224. mcp_proxy_adapter/examples/simple_custom_commands/README.md +0 -149
  225. mcp_proxy_adapter/examples/simple_custom_commands/README_EN.md +0 -149
  226. mcp_proxy_adapter/schemas/base_schema.json +0 -114
  227. mcp_proxy_adapter/schemas/openapi_schema.json +0 -314
  228. mcp_proxy_adapter/schemas/roles_schema.json +0 -162
  229. mcp_proxy_adapter/tests/__init__.py +0 -0
  230. mcp_proxy_adapter/tests/api/__init__.py +0 -3
  231. mcp_proxy_adapter/tests/api/test_cmd_endpoint.py +0 -115
  232. mcp_proxy_adapter/tests/api/test_custom_openapi.py +0 -617
  233. mcp_proxy_adapter/tests/api/test_handlers.py +0 -522
  234. mcp_proxy_adapter/tests/api/test_middleware.py +0 -340
  235. mcp_proxy_adapter/tests/api/test_schemas.py +0 -546
  236. mcp_proxy_adapter/tests/api/test_tool_integration.py +0 -531
  237. mcp_proxy_adapter/tests/commands/__init__.py +0 -3
  238. mcp_proxy_adapter/tests/commands/test_config_command.py +0 -211
  239. mcp_proxy_adapter/tests/commands/test_echo_command.py +0 -127
  240. mcp_proxy_adapter/tests/commands/test_help_command.py +0 -136
  241. mcp_proxy_adapter/tests/conftest.py +0 -131
  242. mcp_proxy_adapter/tests/functional/__init__.py +0 -3
  243. mcp_proxy_adapter/tests/functional/test_api.py +0 -253
  244. mcp_proxy_adapter/tests/integration/__init__.py +0 -3
  245. mcp_proxy_adapter/tests/integration/test_cmd_integration.py +0 -129
  246. mcp_proxy_adapter/tests/integration/test_integration.py +0 -255
  247. mcp_proxy_adapter/tests/performance/__init__.py +0 -3
  248. mcp_proxy_adapter/tests/performance/test_performance.py +0 -189
  249. mcp_proxy_adapter/tests/stubs/__init__.py +0 -10
  250. mcp_proxy_adapter/tests/stubs/echo_command.py +0 -104
  251. mcp_proxy_adapter/tests/test_api_endpoints.py +0 -271
  252. mcp_proxy_adapter/tests/test_api_handlers.py +0 -289
  253. mcp_proxy_adapter/tests/test_base_command.py +0 -123
  254. mcp_proxy_adapter/tests/test_batch_requests.py +0 -117
  255. mcp_proxy_adapter/tests/test_command_registry.py +0 -281
  256. mcp_proxy_adapter/tests/test_config.py +0 -127
  257. mcp_proxy_adapter/tests/test_utils.py +0 -65
  258. mcp_proxy_adapter/tests/unit/__init__.py +0 -3
  259. mcp_proxy_adapter/tests/unit/test_base_command.py +0 -436
  260. mcp_proxy_adapter/tests/unit/test_config.py +0 -270
  261. mcp_proxy_adapter-6.0.0.dist-info/METADATA +0 -201
  262. mcp_proxy_adapter-6.0.0.dist-info/RECORD +0 -179
  263. {mcp_proxy_adapter-6.0.0.dist-info → mcp_proxy_adapter-6.1.1.dist-info}/WHEEL +0 -0
  264. {mcp_proxy_adapter-6.0.0.dist-info → mcp_proxy_adapter-6.1.1.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,6 @@
1
- """Version information for MCP Microservice."""
1
+ """
2
+ Version information for MCP Proxy Adapter.
3
+ """
4
+
5
+ __version__ = "6.1.1"
2
6
 
3
- __version__ = "5.0.0"
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-proxy-adapter
3
+ Version: 6.1.1
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,197 @@
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=An3YihuEp4-HZwPwkX4H02AGLXR1iYz9gDTeFLlukKw,75
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=f3bUYU6iaPsVe1acsRHip0RgLhX3X2qjKWzgO-Ej998,2131
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=RwXBew04AatChvcmyuOOPCOkyJ2_RwCpnZWbKKn4XPM,5547
22
+ mcp_proxy_adapter/api/middleware/transport_middleware.py,sha256=Esy2gGKpEV5RoUTilr1YKKTDc5jh5RxsomD0VXyR2pE,4396
23
+ mcp_proxy_adapter/api/middleware/unified_security.py,sha256=32BWiQaFyWgEgdIlj-La_4GUgD180zB4jh1O7-DkHDE,5377
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=a3-JiCWLDUejg0MAdfmi5xQ5TZrCMqLfV1tKVUiRe38,13174
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=yAAgL9Y7-VUMPhOLbDpBT2rRHDmmUWv1xolBrxbX29o,13601
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/docs/EN/TROUBLESHOOTING.md,sha256=0gqPZGKViuKReGchK8hH9SnleQXCCCQ8t6hA-y9fIUo,7011
81
+ mcp_proxy_adapter/docs/RU/TROUBLESHOOTING.md,sha256=5vTy8HjRvYXpY3F-G7BzjMqhsrY4BhQVRuQjIISmqeU,9260
82
+ mcp_proxy_adapter/examples/README.md,sha256=yCz73REZ6nggA_nkpTtf03dgd9_g66QiFw5aX03hSBw,8807
83
+ mcp_proxy_adapter/examples/README_EN.md,sha256=NOD7PDWTCrTuB_xmH2r9fNNgSF-8AhQ2oO575d_mNbI,6399
84
+ mcp_proxy_adapter/examples/SECURITY_TESTING.md,sha256=_4AAz2lAN-ru9HicKpsVkCrPwy_CZeETJMYa9KNbjHQ,11585
85
+ mcp_proxy_adapter/examples/cert_config.json,sha256=reZCv73qWd1IzbTJizg70EgnuFb0xIOEJAOUlgIZxtM,338
86
+ mcp_proxy_adapter/examples/create_certificates_simple.py,sha256=aSpW8JnMqxCpOF37T7eXf-8ZufGu0GcjXVHvtWtA3bo,11016
87
+ mcp_proxy_adapter/examples/debug_request_state.py,sha256=WXrcti8cQpc1qizThz0_1i5jzSxgglelY71Mln28jXw,4475
88
+ mcp_proxy_adapter/examples/debug_role_chain.py,sha256=BuNIW8d0BFunu4Q8kkFEF-bd9iZcyDtQoz3UQJn397A,8665
89
+ mcp_proxy_adapter/examples/demo_client.py,sha256=gqHj3EVFS0MkPTzs6SWHLtUwgyJU6X9qDB84qcuH6xg,10674
90
+ mcp_proxy_adapter/examples/generate_all_certificates.py,sha256=ZUnpbU5NbqOPLVQydtBCN5aDvoxRaze9oLcH3h22BPM,17463
91
+ mcp_proxy_adapter/examples/generate_certificates.py,sha256=iP_eJD-Ar7RhYedXFIYBqYD9laMGhfz9OtG9Y4yfOz8,3723
92
+ mcp_proxy_adapter/examples/proxy_registration_example.py,sha256=jbeYqueeH0q5ac1ZOsCoDjyZJZzbwK23p2613z-TA8s,13177
93
+ mcp_proxy_adapter/examples/roles.json,sha256=fTHJwBXjuuOrLCPrVvOoc55H7xtAd4gIvRjXhYKXYCY,1030
94
+ mcp_proxy_adapter/examples/run_example.py,sha256=ZeT7JeJo2Z6gHvf0vwVQZqCbSc8pfeUaQCLO_v3La5I,2606
95
+ mcp_proxy_adapter/examples/run_security_tests.py,sha256=gye-jnvYLUvNW3dBwpRfA4flp8irW2MnvnQsjsAX_sM,11143
96
+ mcp_proxy_adapter/examples/run_security_tests_fixed.py,sha256=TmQFGW0dVDpYkeRqbaisqsDukYwBSHFF6Y2OR619M7E,11053
97
+ mcp_proxy_adapter/examples/security_test_client.py,sha256=VJUccM1SHd1m-z0uh4D93tssoTtop8jmwG48pXxMCVU,28921
98
+ mcp_proxy_adapter/examples/test_config_generator.py,sha256=woULWHkcaR-awh0d1YEUvMq0O4hJAAjutPSzKQPI0P4,4060
99
+ mcp_proxy_adapter/examples/test_examples.py,sha256=PWJa7sKCyk_07PCvyaXSR-cR6ManzSPp8c0KouWmUKU,12695
100
+ mcp_proxy_adapter/examples/universal_client.py,sha256=PTzbnamgiMyr92-gL23YOcA47P4RReWaFJ5-KiB6sf8,22883
101
+ mcp_proxy_adapter/examples/basic_framework/main.py,sha256=KQZ5m2OCduP2pFIb9RArLMMpVE0BG8wjcyM1yjDLfqk,1858
102
+ mcp_proxy_adapter/examples/basic_framework/roles.json,sha256=I0lSP3hfq1DESv3xsZ7-xOEdzaQGCb8b9YMK_AOPDsE,510
103
+ mcp_proxy_adapter/examples/basic_framework/configs/http_auth.json,sha256=ZT4YpPmjxZK-bMOp3J1retzLv7Ld22e6c9x8b9BW_Mg,832
104
+ mcp_proxy_adapter/examples/basic_framework/configs/http_simple.json,sha256=O0seimm3TaD0hNVuNJx5ZGC5sRenTY1bOxNSfPjOzqQ,432
105
+ mcp_proxy_adapter/examples/basic_framework/configs/https_auth.json,sha256=vi0lNGYkDIzBMXCRIPXfL6Jy7QEe3lnUnxLhduJ9pt4,1014
106
+ mcp_proxy_adapter/examples/basic_framework/configs/https_no_protocol_middleware.json,sha256=yImK8WiC4CgtJ_p0AiZyaR8OGjUYTsCp4iAfo2b7zPk,795
107
+ mcp_proxy_adapter/examples/basic_framework/configs/https_simple.json,sha256=jawEgxYdkzL-qeZVuIndHoXWYvDhpm5Y-5PncBU34QU,614
108
+ mcp_proxy_adapter/examples/basic_framework/configs/mtls_no_protocol_middleware.json,sha256=llz1UI6MZ7fpuiIqZfLQ9bbqYaW4gh0fMVf-kGS5ssQ,731
109
+ mcp_proxy_adapter/examples/basic_framework/configs/mtls_no_roles.json,sha256=gLsZW3HqVDOOOzono88uIoW4nf5A9qEL2TykJg8wxec,928
110
+ mcp_proxy_adapter/examples/basic_framework/configs/mtls_simple.json,sha256=0nnWb_4XqGC1ytkn7dvXB5L_RBxVvDApH3Jm3LmqOdY,778
111
+ mcp_proxy_adapter/examples/basic_framework/configs/mtls_with_roles.json,sha256=IkV5786XGfR8faN-6gMXQehDVrqxXWQlaNsmTnZ5hDY,1107
112
+ mcp_proxy_adapter/examples/certs/admin.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
113
+ mcp_proxy_adapter/examples/certs/admin.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
114
+ mcp_proxy_adapter/examples/certs/admin_cert.pem,sha256=duFr9LKheZSBpgki3qWNcpi7UULlIdjRWZojWrVflUc,1241
115
+ mcp_proxy_adapter/examples/certs/admin_key.pem,sha256=Be3jAcln4mtggN-wbc5PXO6SCatnS_49zXsCQDNDGvc,1704
116
+ mcp_proxy_adapter/examples/certs/ca_cert.pem,sha256=85TwLqcAM7FhqPq4O5yzwUTkLjtAaR3rYCPtKtCddCA,1379
117
+ mcp_proxy_adapter/examples/certs/ca_cert.srl,sha256=GKJtcm8Rkhl5-WEMKky5F_AuAwSifLPyqWzfc2W3DZE,41
118
+ mcp_proxy_adapter/examples/certs/ca_key.pem,sha256=jkqs2jlbEm5iPC_wJtdLLmnL8aFZDj26AS33aBbJd2U,1704
119
+ mcp_proxy_adapter/examples/certs/cert_config.json,sha256=o6wQw1s-0foQYs8w2Wsan_uc7MuIJ9FhuEbWUXl1_60,497
120
+ mcp_proxy_adapter/examples/certs/client.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
121
+ mcp_proxy_adapter/examples/certs/client.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
122
+ mcp_proxy_adapter/examples/certs/client_admin.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
123
+ mcp_proxy_adapter/examples/certs/client_admin.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
124
+ mcp_proxy_adapter/examples/certs/client_user.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
125
+ mcp_proxy_adapter/examples/certs/client_user.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
126
+ mcp_proxy_adapter/examples/certs/guest_cert.pem,sha256=6E7RiJ66K823hKbn4x95TJUy57RnFinAvJ3MIiJqd2U,1241
127
+ mcp_proxy_adapter/examples/certs/guest_key.pem,sha256=wqGSMyQE_xxiUgTgbtfvUiOYyYhNgwSMI3bwNqOLh8Y,1704
128
+ mcp_proxy_adapter/examples/certs/mcp_proxy_adapter_ca_ca.crt,sha256=85TwLqcAM7FhqPq4O5yzwUTkLjtAaR3rYCPtKtCddCA,1379
129
+ mcp_proxy_adapter/examples/certs/proxy_cert.pem,sha256=WG-mAtQTWTTLmRJPB4cnUaKwIk8wKWnOLyeY9zYOBeI,1241
130
+ mcp_proxy_adapter/examples/certs/proxy_key.pem,sha256=snrlu2B9GgPYBqApRlqD2hrPBxZ6IkMNegMr_j3kHTc,1704
131
+ mcp_proxy_adapter/examples/certs/readonly.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
132
+ mcp_proxy_adapter/examples/certs/readonly.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
133
+ mcp_proxy_adapter/examples/certs/readonly_cert.pem,sha256=9XzMVdQRP6q1imZe67k4nhX69y1EBD3htrrzKxugwCg,1245
134
+ mcp_proxy_adapter/examples/certs/readonly_key.pem,sha256=z7R1Xnucz6ns2gtivR4FC_pc5Msk5c-Q3bIGGmJq6Po,1708
135
+ mcp_proxy_adapter/examples/certs/server.crt,sha256=uTU6BJ_qJUHTnbCT2ku7GMAU3q-CJMOArYKmdq_nZRE,1988
136
+ mcp_proxy_adapter/examples/certs/server.key,sha256=tQAVnG6l4MAkl_UBbTFy92vbc5dhc4S_cYdqOihmSJc,3272
137
+ mcp_proxy_adapter/examples/certs/server_cert.pem,sha256=uTU6BJ_qJUHTnbCT2ku7GMAU3q-CJMOArYKmdq_nZRE,1988
138
+ mcp_proxy_adapter/examples/certs/server_key.pem,sha256=tQAVnG6l4MAkl_UBbTFy92vbc5dhc4S_cYdqOihmSJc,3272
139
+ mcp_proxy_adapter/examples/certs/test_ca_ca.crt,sha256=9WuY5A_FHGuFKmFto43uvs8lL3xGiFzEptSUyAHBwxA,1172
140
+ mcp_proxy_adapter/examples/certs/user.crt,sha256=W7T93DjtAfqUO0Is-ZneUcQOOtMcyQ7rRYGsEdFd0p0,1980
141
+ mcp_proxy_adapter/examples/certs/user.key,sha256=r0BGq0ECrXd4wAbAEjZE_5kGkv559w_zYIFiIHTquWA,3272
142
+ mcp_proxy_adapter/examples/certs/user_cert.pem,sha256=oAEattM1VuQQJ1Zi9BBrGDdiUWV-OwCprQ5-WgIqyvk,1237
143
+ mcp_proxy_adapter/examples/certs/user_key.pem,sha256=sRomoO8H6yTkBMT6fsw8E7SOo29rlLG8am35m3GkWVk,1704
144
+ mcp_proxy_adapter/examples/client_configs/api_key_client.json,sha256=cHWe-FdJESoyQrXNNR9lWmakp-4ea8nK35P4gFko94o,240
145
+ mcp_proxy_adapter/examples/client_configs/basic_auth_client.json,sha256=PRTU2kQri9cNp3CyR52OIV7GF9UBTkwEN0pdKrTURh0,239
146
+ mcp_proxy_adapter/examples/client_configs/certificate_client.json,sha256=xOLfBnW62s11zzGrrUoTh7S7oYLaKZPYr-sYUqYAtqM,515
147
+ mcp_proxy_adapter/examples/client_configs/jwt_client.json,sha256=MuzqtKOjMmuK6euW1gAVUf2y4FzRaD8r2Up46gw_d6w,301
148
+ mcp_proxy_adapter/examples/client_configs/no_auth_client.json,sha256=5S41azhMqRnDTwMC7FjZa1FXt8sT5XWr8sEjWqp0J8M,151
149
+ mcp_proxy_adapter/examples/commands/__init__.py,sha256=ghbOrq1GFnLWXunr5pAU9qerEcTEDfgPpwo-lNqN4po,19
150
+ mcp_proxy_adapter/examples/full_application/main.py,sha256=ZCXZtMPBH2_4JfvZZ-BJV1rfeEJqVGuukuNFK9xIrHY,4902
151
+ mcp_proxy_adapter/examples/full_application/roles.json,sha256=I0lSP3hfq1DESv3xsZ7-xOEdzaQGCb8b9YMK_AOPDsE,510
152
+ mcp_proxy_adapter/examples/full_application/commands/custom_echo_command.py,sha256=IN9sj4d_ba1Lekie1y1olDukPwtR5uM4dJhoWptCfLU,3182
153
+ mcp_proxy_adapter/examples/full_application/commands/dynamic_calculator_command.py,sha256=w7BfJ5uFIrjPitAWSX1OSgivxokx8bKqi7RhguvVbXI,3551
154
+ mcp_proxy_adapter/examples/full_application/configs/http_auth.json,sha256=ZT4YpPmjxZK-bMOp3J1retzLv7Ld22e6c9x8b9BW_Mg,832
155
+ mcp_proxy_adapter/examples/full_application/configs/http_simple.json,sha256=O0seimm3TaD0hNVuNJx5ZGC5sRenTY1bOxNSfPjOzqQ,432
156
+ mcp_proxy_adapter/examples/full_application/configs/https_auth.json,sha256=CQzZvEeHKg0F-GNymRmt-qFJr8U7jY5yLJ3yzFWwyzo,916
157
+ mcp_proxy_adapter/examples/full_application/configs/https_simple.json,sha256=UIcfFTwdZkj9FMydSTWwYytQKvNtu657OzX49qXb64A,516
158
+ mcp_proxy_adapter/examples/full_application/configs/mtls_no_roles.json,sha256=gLsZW3HqVDOOOzono88uIoW4nf5A9qEL2TykJg8wxec,928
159
+ mcp_proxy_adapter/examples/full_application/configs/mtls_with_roles.json,sha256=IkV5786XGfR8faN-6gMXQehDVrqxXWQlaNsmTnZ5hDY,1107
160
+ mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py,sha256=rvAP7aNSLfGQebMeyl0bCWHlRsAXUKxvUGaaXgyqMEE,3579
161
+ mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py,sha256=gom94ucARnAOZ0V0woFLDWJoSt4sJ1noXnLqlScsdIQ,3119
162
+ mcp_proxy_adapter/examples/keys/ca_key.pem,sha256=DunYhEBcWUuU6coRBlBSVTDM1_jMQ-_j6JOTYppPndk,1704
163
+ mcp_proxy_adapter/examples/keys/mcp_proxy_adapter_ca_ca.key,sha256=jkqs2jlbEm5iPC_wJtdLLmnL8aFZDj26AS33aBbJd2U,1704
164
+ mcp_proxy_adapter/examples/keys/test_ca_ca.key,sha256=HT7C4AbZIHrNHtuV7BSw25Kxwyic3Q7_VmMnUNn2td8,1704
165
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log,sha256=VI_Zlk8Kbw90m1Fxo7_Yl7_Rmi3qB7Km8BA1h0uS0jk,18382
166
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.1,sha256=4OCUSxnTWGmItHiN6JrNZBhdgzkA9yN5qhJku9WI_3Y,93
167
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.2,sha256=Tvlemoipn8coC5_X_TrxRRkzTF5oMQyT67HQM7BmrZE,75
168
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.3,sha256=H7mrPVx3l4GceusilEnm6joEMj_QksXeD43fo7ifs1M,97
169
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.4,sha256=oNTSBeAAjvY_St_hxNEbGQA5VRscWli-_RVQm7W8dDs,93
170
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter.log.5,sha256=OXE96BxxN1s5G_-xVaCO2GVViA1fiVDkoi8uJh3xi_A,254
171
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log,sha256=VI_Zlk8Kbw90m1Fxo7_Yl7_Rmi3qB7Km8BA1h0uS0jk,18382
172
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.1,sha256=4OCUSxnTWGmItHiN6JrNZBhdgzkA9yN5qhJku9WI_3Y,93
173
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.2,sha256=Tvlemoipn8coC5_X_TrxRRkzTF5oMQyT67HQM7BmrZE,75
174
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.3,sha256=H7mrPVx3l4GceusilEnm6joEMj_QksXeD43fo7ifs1M,97
175
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.4,sha256=oNTSBeAAjvY_St_hxNEbGQA5VRscWli-_RVQm7W8dDs,93
176
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_access.log.5,sha256=OXE96BxxN1s5G_-xVaCO2GVViA1fiVDkoi8uJh3xi_A,254
177
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log,sha256=E4BPdJ1fhxuwmjtAau7BuYHqYPUGQnYQGeE00duqJRE,187
178
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.1,sha256=oNTSBeAAjvY_St_hxNEbGQA5VRscWli-_RVQm7W8dDs,93
179
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.2,sha256=oNTSBeAAjvY_St_hxNEbGQA5VRscWli-_RVQm7W8dDs,93
180
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.3,sha256=IvB025kPzdIJw94oai_T7vHwTplte3GZujAJhSRq7M0,183
181
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.4,sha256=svRL8M0dLsmio58leIelYSMRQue5JmzbHqFeQU5cAf4,148
182
+ mcp_proxy_adapter/examples/logs/mcp_proxy_adapter_error.log.5,sha256=oNTSBeAAjvY_St_hxNEbGQA5VRscWli-_RVQm7W8dDs,93
183
+ mcp_proxy_adapter/examples/server_configs/config_basic_http.json,sha256=wqxfjlmjpARYbFfmtO0Ahdv-Pda9fcrfUrnM9ZdrksQ,4928
184
+ mcp_proxy_adapter/examples/server_configs/config_http_token.json,sha256=yzdRX5YG48DAg8Ad4WNQ5ma0G05BWiCU_amw02oXEkM,5952
185
+ mcp_proxy_adapter/examples/server_configs/config_https.json,sha256=zWCvibsTcBDnKj4YaEd_X1py-4XaKOEH3Qzq3ps2Hv4,5859
186
+ mcp_proxy_adapter/examples/server_configs/config_https_token.json,sha256=gBuSn8pRo-kpv58q3NeIui-rgjhShz8YSPVKri6ujUY,6317
187
+ mcp_proxy_adapter/examples/server_configs/config_mtls.json,sha256=pt4H_FzmduSmvI6cOicsVImMjle1-5OML-1hBzujYUc,5666
188
+ mcp_proxy_adapter/examples/server_configs/config_proxy_registration.json,sha256=e4r2q5o4_XY0R904NwT0EHO5Yxbwi89ju_vIiIMGVZA,6528
189
+ mcp_proxy_adapter/examples/server_configs/config_simple.json,sha256=aUYnxEFPTVWJPtQObRim-evdf0neIKULc6QrqAudnmU,922
190
+ mcp_proxy_adapter/examples/server_configs/roles.json,sha256=fTHJwBXjuuOrLCPrVvOoc55H7xtAd4gIvRjXhYKXYCY,1030
191
+ mcp_proxy_adapter/utils/config_generator.py,sha256=9vFN2UqUXkO-DgztZSnA0cH3cmMQar6WdtTOzz6xBio,32074
192
+ mcp_proxy_adapter-6.1.1.dist-info/licenses/LICENSE,sha256=6KdtUcTwmTRbJrAmYjVn7e6S-V42ubeDJ-AiVEzZ510,1075
193
+ mcp_proxy_adapter-6.1.1.dist-info/METADATA,sha256=KNqX7yZ4Ok6M8fF8zJcPBbJLxYA0wJ6OxUo9brs77H4,6295
194
+ mcp_proxy_adapter-6.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
195
+ mcp_proxy_adapter-6.1.1.dist-info/entry_points.txt,sha256=J3eV6ID0lt_VSp4lIdIgBFTqLCThgObNNxRCbyfiMHw,70
196
+ mcp_proxy_adapter-6.1.1.dist-info/top_level.txt,sha256=JZT7vPLBYrtroX-ij68JBhJYbjDdghcV-DFySRy-Nnw,18
197
+ mcp_proxy_adapter-6.1.1.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
- )