modmex-lambda 0.7.0__tar.gz → 0.7.2__tar.gz

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 (272) hide show
  1. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/PKG-INFO +78 -6
  2. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/README.md +77 -5
  3. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/__init__.py +2 -0
  4. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/logging.py +1 -1
  5. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/mcp/__init__.py +8 -2
  6. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/mcp/middleware.py +46 -0
  7. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/mcp/server.py +13 -3
  8. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/mcp/tool.py +8 -4
  9. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/mcp/transport.py +131 -1
  10. modmex_lambda-0.7.2/modmex_lambda/mcp/web_adapter.py +155 -0
  11. modmex_lambda-0.7.2/modmex_lambda/mcp/web_adapter_launcher.py +34 -0
  12. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/pyproject.toml +1 -1
  13. modmex_lambda-0.7.2/tests/mcp/test_http.py +220 -0
  14. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/mcp/test_middleware.py +13 -0
  15. modmex_lambda-0.7.0/tests/mcp/test_http.py +0 -57
  16. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/.github/workflows/ci.yml +0 -0
  17. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/.github/workflows/release.yml +0 -0
  18. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/.gitignore +0 -0
  19. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/LICENSE +0 -0
  20. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/__init__.py +0 -0
  21. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/cloudwatch.py +0 -0
  22. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/dynamodb.py +0 -0
  23. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/eventbridge.py +0 -0
  24. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/eventbridge_scheduler.py +0 -0
  25. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/icloudwatch.py +0 -0
  26. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/idynamodb.py +0 -0
  27. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/ieventbridge.py +0 -0
  28. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/ieventbridge_scheduler.py +0 -0
  29. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/ilambda.py +0 -0
  30. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/is3.py +0 -0
  31. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/isns.py +0 -0
  32. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/isqs.py +0 -0
  33. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/lambda_.py +0 -0
  34. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/module.py +0 -0
  35. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/s3.py +0 -0
  36. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/sns.py +0 -0
  37. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/connectors/sqs.py +0 -0
  38. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/data_classes/__init__.py +0 -0
  39. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/data_classes/api_gateway_authorizer_event.py +0 -0
  40. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/data_classes/api_gateway_proxy_event.py +0 -0
  41. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/data_classes/api_gateway_websocket_event.py +0 -0
  42. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/data_classes/cognito_user_pool_event.py +0 -0
  43. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/data_classes/common.py +0 -0
  44. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/dependencies.py +0 -0
  45. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/__init__.py +0 -0
  46. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/api_gateway.py +0 -0
  47. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/constants.py +0 -0
  48. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/content_types.py +0 -0
  49. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/cors.py +0 -0
  50. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/dependencies/__init__.py +0 -0
  51. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/dependencies/compat.py +0 -0
  52. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/dependencies/dependant.py +0 -0
  53. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/dependencies/dependency_middleware.py +0 -0
  54. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/dependencies/depends.py +0 -0
  55. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/dependencies/params.py +0 -0
  56. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/dependencies/types.py +0 -0
  57. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/exception_handler.py +0 -0
  58. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/exceptions.py +0 -0
  59. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/gateway_response.py +0 -0
  60. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/middlewares.py +0 -0
  61. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/params.py +0 -0
  62. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/request.py +0 -0
  63. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/response.py +0 -0
  64. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/routing.py +0 -0
  65. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/routing_fallbacks.py +0 -0
  66. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_handler/types.py +0 -0
  67. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/event_sources.py +0 -0
  68. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/exceptions.py +0 -0
  69. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/mcp/prompt.py +0 -0
  70. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/mcp/protocol.py +0 -0
  71. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/mcp/registry.py +0 -0
  72. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/mcp/resource.py +0 -0
  73. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/mcp/schema.py +0 -0
  74. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/params.py +0 -0
  75. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/parser.py +0 -0
  76. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/persistence/__init__.py +0 -0
  77. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/persistence/dynamodb/__init__.py +0 -0
  78. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/persistence/dynamodb/expressions.py +0 -0
  79. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/persistence/dynamodb/keys.py +0 -0
  80. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/persistence/dynamodb/materialized_views.py +0 -0
  81. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/persistence/dynamodb/stream_fields.py +0 -0
  82. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/py.typed +0 -0
  83. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/request.py +0 -0
  84. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/resolver.py +0 -0
  85. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/response.py +0 -0
  86. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/routing.py +0 -0
  87. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/shared/__init__.py +0 -0
  88. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/shared/cookies.py +0 -0
  89. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/shared/headers_serializer.py +0 -0
  90. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/shared/json_encoder.py +0 -0
  91. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/shared/types.py +0 -0
  92. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/__init__.py +0 -0
  93. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/events/__init__.py +0 -0
  94. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/events/dynamodb.py +0 -0
  95. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/events/kinesis.py +0 -0
  96. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/events/s3.py +0 -0
  97. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/events/sns.py +0 -0
  98. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/events/sqs.py +0 -0
  99. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/filters/__init__.py +0 -0
  100. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/filters/content.py +0 -0
  101. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/filters/event_type.py +0 -0
  102. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/filters/latch.py +0 -0
  103. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/filters/skip.py +0 -0
  104. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/__init__.py +0 -0
  105. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/base_flavor.py +0 -0
  106. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/cdc.py +0 -0
  107. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/collect.py +0 -0
  108. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/correlate.py +0 -0
  109. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/evaluate.py +0 -0
  110. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/expired.py +0 -0
  111. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/iflavor.py +0 -0
  112. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/job.py +0 -0
  113. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/materialize.py +0 -0
  114. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/s3.py +0 -0
  115. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/schedule.py +0 -0
  116. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/sns.py +0 -0
  117. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/task.py +0 -0
  118. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/flavors/update.py +0 -0
  119. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/irules_registry.py +0 -0
  120. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/operators/__init__.py +0 -0
  121. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/operators/cloudwatch.py +0 -0
  122. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/operators/dynamodb.py +0 -0
  123. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/operators/ioperator.py +0 -0
  124. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/operators/lambda_.py +0 -0
  125. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/operators/publisher.py +0 -0
  126. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/operators/s3.py +0 -0
  127. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/operators/scheduler.py +0 -0
  128. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/operators/sns.py +0 -0
  129. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/operators/sqs.py +0 -0
  130. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/rules_registry.py +0 -0
  131. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/runner.py +0 -0
  132. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/schedulers.py +0 -0
  133. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/sources/__init__.py +0 -0
  134. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/sources/base.py +0 -0
  135. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/sources/dynamodb.py +0 -0
  136. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/sources/kinesis.py +0 -0
  137. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/sources/s3.py +0 -0
  138. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/sources/sns.py +0 -0
  139. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/sources/sqs.py +0 -0
  140. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/__init__.py +0 -0
  141. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/apigateway.py +0 -0
  142. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/aws.py +0 -0
  143. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/batch.py +0 -0
  144. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/cloudwatch.py +0 -0
  145. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/concurrency.py +0 -0
  146. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/contracts.py +0 -0
  147. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/data_classes/__init__.py +0 -0
  148. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/data_classes/dynamodb.py +0 -0
  149. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/decorators.py +0 -0
  150. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/dynamodb.py +0 -0
  151. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/eventbridge.py +0 -0
  152. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/faults.py +0 -0
  153. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/filters.py +0 -0
  154. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/json_encoder.py +0 -0
  155. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/lambda_.py +0 -0
  156. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/operators.py +0 -0
  157. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/pluralize.py +0 -0
  158. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/print.py +0 -0
  159. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/retry.py +0 -0
  160. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/s3.py +0 -0
  161. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/sns.py +0 -0
  162. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/split.py +0 -0
  163. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/sqs.py +0 -0
  164. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/tags.py +0 -0
  165. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/time.py +0 -0
  166. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/stream/utils/uow.py +0 -0
  167. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/tracing.py +0 -0
  168. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/modmex_lambda/validation.py +0 -0
  169. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/poetry.lock +0 -0
  170. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/__init__.py +0 -0
  171. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/conftest.py +0 -0
  172. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/connectors/__init__.py +0 -0
  173. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/connectors/conftest.py +0 -0
  174. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/connectors/test_cloudwatch.py +0 -0
  175. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/connectors/test_dynamodb.py +0 -0
  176. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/connectors/test_lazy_clients.py +0 -0
  177. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/connectors/test_s3.py +0 -0
  178. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/connectors/test_simple_connectors.py +0 -0
  179. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/connectors/test_sns.py +0 -0
  180. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/connectors/test_sqs.py +0 -0
  181. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/data_classes/__init__.py +0 -0
  182. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/data_classes/test_api_gateway_proxy_event.py +0 -0
  183. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/data_classes/test_cognito_user_pool_event.py +0 -0
  184. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/data_classes/test_common.py +0 -0
  185. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/event_handler/__init__.py +0 -0
  186. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/event_handler/test_api_gateway.py +0 -0
  187. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/event_handler/test_cors.py +0 -0
  188. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/event_handler/test_dependencies.py +0 -0
  189. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/event_handler/test_exception_handler.py +0 -0
  190. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/event_handler/test_gateway_response.py +0 -0
  191. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/event_handler/test_request.py +0 -0
  192. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/event_handler/test_response.py +0 -0
  193. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/event_handler/test_routing.py +0 -0
  194. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/mcp/__init__.py +0 -0
  195. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/mcp/helpers.py +0 -0
  196. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/mcp/test_resources_prompts.py +0 -0
  197. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/mcp/test_server.py +0 -0
  198. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/mcp/test_tools.py +0 -0
  199. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/mcp/test_transport.py +0 -0
  200. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/persistence/__init__.py +0 -0
  201. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/persistence/test_dynamodb_expressions.py +0 -0
  202. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/persistence/test_dynamodb_keys.py +0 -0
  203. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/persistence/test_dynamodb_materialized_views.py +0 -0
  204. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/persistence/test_dynamodb_stream_fields.py +0 -0
  205. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/shared/__init__.py +0 -0
  206. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/shared/test_cookies_headers.py +0 -0
  207. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/shared/test_json_encoder.py +0 -0
  208. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/__init__.py +0 -0
  209. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/conftest.py +0 -0
  210. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/events/__init__.py +0 -0
  211. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/events/test_dynamodb.py +0 -0
  212. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/events/test_kinesis.py +0 -0
  213. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/events/test_s3.py +0 -0
  214. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/events/test_sns.py +0 -0
  215. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/events/test_sqs.py +0 -0
  216. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/filters/__init__.py +0 -0
  217. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/filters/test_content.py +0 -0
  218. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/filters/test_event_type.py +0 -0
  219. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/filters/test_latch.py +0 -0
  220. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/filters/test_skip.py +0 -0
  221. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/__init__.py +0 -0
  222. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/source_events.py +0 -0
  223. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_base_flavor.py +0 -0
  224. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_cdc.py +0 -0
  225. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_collect.py +0 -0
  226. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_correlate.py +0 -0
  227. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_evaluate.py +0 -0
  228. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_expired.py +0 -0
  229. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_job.py +0 -0
  230. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_materialize.py +0 -0
  231. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_s3.py +0 -0
  232. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_schedule.py +0 -0
  233. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_sns.py +0 -0
  234. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_task.py +0 -0
  235. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/flavors/test_update.py +0 -0
  236. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/operators/test_scheduler.py +0 -0
  237. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/test_dependency_resolver.py +0 -0
  238. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/test_faults.py +0 -0
  239. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/test_rules_registry.py +0 -0
  240. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/test_runner.py +0 -0
  241. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/test_runner_pipeline.py +0 -0
  242. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/test_sources.py +0 -0
  243. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/__init__.py +0 -0
  244. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/faults.py +0 -0
  245. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_apigateway.py +0 -0
  246. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_aws.py +0 -0
  247. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_batch.py +0 -0
  248. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_cloudwatch.py +0 -0
  249. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_concurrency.py +0 -0
  250. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_decorators.py +0 -0
  251. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_dynamodb.py +0 -0
  252. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_eventbridge.py +0 -0
  253. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_filters.py +0 -0
  254. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_json_encoder.py +0 -0
  255. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_lambda.py +0 -0
  256. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_operators.py +0 -0
  257. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_pluralize.py +0 -0
  258. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_print.py +0 -0
  259. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_retry.py +0 -0
  260. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_s3.py +0 -0
  261. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_sns.py +0 -0
  262. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_split.py +0 -0
  263. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_sqs.py +0 -0
  264. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_tags.py +0 -0
  265. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_time.py +0 -0
  266. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/stream/utils/test_uow.py +0 -0
  267. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/test_lazy_imports.py +0 -0
  268. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/test_logging.py +0 -0
  269. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/test_parser_event_sources.py +0 -0
  270. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/test_reexports.py +0 -0
  271. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/test_tracing.py +0 -0
  272. {modmex_lambda-0.7.0 → modmex_lambda-0.7.2}/tests/test_validation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: modmex-lambda
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: Ultra-lightweight AWS Lambda utilities for API Gateway routing and event handling.
5
5
  Author: Modmex
6
6
  License: MIT
@@ -1367,9 +1367,81 @@ def create_order(order: Order):
1367
1367
  enforce an Origin allowlist itself. Leaving it as `None` explicitly delegates
1368
1368
  Origin validation to API Gateway, WAF, or application middleware.
1369
1369
 
1370
- ### Transport boundary
1370
+ ### Buffered transport boundary
1371
1371
 
1372
- JSON is the required response mode. Buffered SSE is available when the client
1373
- requests `text/event-stream`, but this integration does not provide a
1374
- long-lived bidirectional stream or incremental Lambda response streaming.
1375
- Tasks, MRTR, subscriptions and real-time notifications are future extensions.
1372
+ This section applies to `APIGatewayRestResolver` and
1373
+ `APIGatewayHttpResolver`. JSON is the normal response mode, and the MCP HTTP
1374
+ transport can return a buffered SSE representation when the client requests
1375
+ `text/event-stream`. These resolvers do not provide incremental Lambda
1376
+ response streaming or a long-lived bidirectional connection.
1377
+
1378
+ For incremental response streaming, use `LambdaWebAdapterResolver` together
1379
+ with the `serverless-python-mcp` deployment plugin described below. That is a
1380
+ separate runtime path because Lambda Web Adapter owns the HTTP process and
1381
+ the response stream.
1382
+
1383
+ MCP request/response features such as pagination, `structuredContent`, MRTR
1384
+ result handling, resources and prompts are part of the protocol implementation
1385
+ and are independent of whether the response is buffered or streamed. Long-
1386
+ lived subscriptions and server-push notification sessions are not provided by
1387
+ these Lambda integrations.
1388
+
1389
+ ### Serverless deployment and response streaming
1390
+
1391
+ For Serverless Framework deployments, use the companion npm plugin
1392
+ [`serverless-python-mcp`](https://www.npmjs.com/package/serverless-python-mcp).
1393
+ The plugin synthesizes the Lambda functions and transport resources from
1394
+ `custom.pythonMcp`; the application still owns the resolver and middleware:
1395
+
1396
+ ```yaml
1397
+ plugins:
1398
+ - serverless-python-mcp
1399
+
1400
+ custom:
1401
+ pythonMcp:
1402
+ servers:
1403
+ orders:
1404
+ handler: app.handler
1405
+ transport: url # url, http, or httpApi
1406
+ streaming: true
1407
+ path: /mcp # optional; defaults to /mcp
1408
+ ```
1409
+
1410
+ The application entrypoint is deliberately the same shape as a regular
1411
+ Serverless Lambda handler:
1412
+
1413
+ ```python
1414
+ from modmex_lambda import LambdaWebAdapterResolver
1415
+
1416
+ from server import mcp
1417
+
1418
+
1419
+ app = LambdaWebAdapterResolver()
1420
+ app.include_mcp(mcp, path="/mcp")
1421
+ handler = app.handler
1422
+ ```
1423
+
1424
+ The configured value is `module.attribute`, such as `app.handler`. For
1425
+ buffered deployments Serverless invokes `handler(event, context)` directly.
1426
+ For streaming deployments the plugin stages a temporary launcher that imports
1427
+ the configured `LambdaWebAdapterHandler` and calls `handler.run()`; the
1428
+ launcher is removed after packaging. Application code never needs an
1429
+ `if __name__ == "__main__"` block or a permanent `run.sh` file.
1430
+
1431
+ Transport mapping:
1432
+
1433
+ - `url`: Lambda Function URL;
1434
+ - `http`: API Gateway REST API (v1);
1435
+ - `httpApi`: API Gateway HTTP API (v2).
1436
+
1437
+ `streaming: true` is supported by `url` and `http`; `httpApi` is buffered-only.
1438
+ With `streaming: false`, all three transports are supported. Function URL
1439
+ authorizers are limited to `aws_iam` or public access. HTTP API authorizers can
1440
+ be declared globally under `provider.httpApi.authorizers` and referenced by
1441
+ name, or declared inline on an individual MCP server using Serverless'
1442
+ compatible authorizer configuration.
1443
+
1444
+ The Lambda Web Adapter layer is attached only to streaming MCP functions and
1445
+ is selected by the function architecture (`x86_64` or `arm64`). The plugin
1446
+ uses the regional layer ARN through `AWS::Region`; it does not require a layer
1447
+ entry in the service's global `provider` configuration.
@@ -1344,9 +1344,81 @@ def create_order(order: Order):
1344
1344
  enforce an Origin allowlist itself. Leaving it as `None` explicitly delegates
1345
1345
  Origin validation to API Gateway, WAF, or application middleware.
1346
1346
 
1347
- ### Transport boundary
1347
+ ### Buffered transport boundary
1348
1348
 
1349
- JSON is the required response mode. Buffered SSE is available when the client
1350
- requests `text/event-stream`, but this integration does not provide a
1351
- long-lived bidirectional stream or incremental Lambda response streaming.
1352
- Tasks, MRTR, subscriptions and real-time notifications are future extensions.
1349
+ This section applies to `APIGatewayRestResolver` and
1350
+ `APIGatewayHttpResolver`. JSON is the normal response mode, and the MCP HTTP
1351
+ transport can return a buffered SSE representation when the client requests
1352
+ `text/event-stream`. These resolvers do not provide incremental Lambda
1353
+ response streaming or a long-lived bidirectional connection.
1354
+
1355
+ For incremental response streaming, use `LambdaWebAdapterResolver` together
1356
+ with the `serverless-python-mcp` deployment plugin described below. That is a
1357
+ separate runtime path because Lambda Web Adapter owns the HTTP process and
1358
+ the response stream.
1359
+
1360
+ MCP request/response features such as pagination, `structuredContent`, MRTR
1361
+ result handling, resources and prompts are part of the protocol implementation
1362
+ and are independent of whether the response is buffered or streamed. Long-
1363
+ lived subscriptions and server-push notification sessions are not provided by
1364
+ these Lambda integrations.
1365
+
1366
+ ### Serverless deployment and response streaming
1367
+
1368
+ For Serverless Framework deployments, use the companion npm plugin
1369
+ [`serverless-python-mcp`](https://www.npmjs.com/package/serverless-python-mcp).
1370
+ The plugin synthesizes the Lambda functions and transport resources from
1371
+ `custom.pythonMcp`; the application still owns the resolver and middleware:
1372
+
1373
+ ```yaml
1374
+ plugins:
1375
+ - serverless-python-mcp
1376
+
1377
+ custom:
1378
+ pythonMcp:
1379
+ servers:
1380
+ orders:
1381
+ handler: app.handler
1382
+ transport: url # url, http, or httpApi
1383
+ streaming: true
1384
+ path: /mcp # optional; defaults to /mcp
1385
+ ```
1386
+
1387
+ The application entrypoint is deliberately the same shape as a regular
1388
+ Serverless Lambda handler:
1389
+
1390
+ ```python
1391
+ from modmex_lambda import LambdaWebAdapterResolver
1392
+
1393
+ from server import mcp
1394
+
1395
+
1396
+ app = LambdaWebAdapterResolver()
1397
+ app.include_mcp(mcp, path="/mcp")
1398
+ handler = app.handler
1399
+ ```
1400
+
1401
+ The configured value is `module.attribute`, such as `app.handler`. For
1402
+ buffered deployments Serverless invokes `handler(event, context)` directly.
1403
+ For streaming deployments the plugin stages a temporary launcher that imports
1404
+ the configured `LambdaWebAdapterHandler` and calls `handler.run()`; the
1405
+ launcher is removed after packaging. Application code never needs an
1406
+ `if __name__ == "__main__"` block or a permanent `run.sh` file.
1407
+
1408
+ Transport mapping:
1409
+
1410
+ - `url`: Lambda Function URL;
1411
+ - `http`: API Gateway REST API (v1);
1412
+ - `httpApi`: API Gateway HTTP API (v2).
1413
+
1414
+ `streaming: true` is supported by `url` and `http`; `httpApi` is buffered-only.
1415
+ With `streaming: false`, all three transports are supported. Function URL
1416
+ authorizers are limited to `aws_iam` or public access. HTTP API authorizers can
1417
+ be declared globally under `provider.httpApi.authorizers` and referenced by
1418
+ name, or declared inline on an individual MCP server using Serverless'
1419
+ compatible authorizer configuration.
1420
+
1421
+ The Lambda Web Adapter layer is attached only to streaming MCP functions and
1422
+ is selected by the function architecture (`x86_64` or `arm64`). The plugin
1423
+ uses the regional layer ARN through `AWS::Region`; it does not require a layer
1424
+ entry in the service's global `provider` configuration.
@@ -19,6 +19,7 @@ __all__ = [
19
19
  "Tracer",
20
20
  "ModmexValidator",
21
21
  "ValidationError",
22
+ "LambdaWebAdapterResolver",
22
23
  ]
23
24
 
24
25
 
@@ -42,6 +43,7 @@ def __getattr__(name):
42
43
  "Tracer": ("modmex_lambda.tracing", "Tracer"),
43
44
  "ModmexValidator": ("modmex_lambda.validation", "ModmexValidator"),
44
45
  "ValidationError": ("modmex_lambda.validation", "ValidationError"),
46
+ "LambdaWebAdapterResolver": ("modmex_lambda.mcp.web_adapter", "LambdaWebAdapterResolver"),
45
47
  }.get(name)
46
48
  if target is None:
47
49
  raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
@@ -44,7 +44,7 @@ class Logger:
44
44
  correlation_id_header: str = "x-correlation-id",
45
45
  level: str | int | None = None,
46
46
  ) -> None:
47
- self._service = service or os.getenv("SERVICE_NAME") or os.getenv("AWS_LAMBDA_FUNCTION_NAME") or "service"
47
+ self._service = service or os.getenv("SERVICE_NAME") or os.getenv("SERVICE") or os.getenv("AWS_LAMBDA_FUNCTION_NAME") or "service"
48
48
  self._stream = stream or sys.stdout
49
49
  self._serialize = json_serializer or self._serialize_payload
50
50
  self._correlation_id_header = correlation_id_header.lower()
@@ -11,8 +11,9 @@ from modmex_lambda.mcp.server import MCPError, MCPServer
11
11
  from modmex_lambda.mcp.tool import MCPTool
12
12
  from modmex_lambda.mcp.resource import MCPResource
13
13
  from modmex_lambda.mcp.prompt import MCPPrompt
14
- from modmex_lambda.mcp.transport import MCPHttpTransport, SSEEvent, encode_sse, encode_sse_stream, MCP_JSON_CONTENT_TYPE, MCP_SSE_CONTENT_TYPE
15
- from modmex_lambda.mcp.middleware import MCPContext, MCPMiddleware, MCPNextMiddleware
14
+ from modmex_lambda.mcp.transport import MCPHttpTransport, MCPStreamingHttpTransport, StreamingHTTPResponse, SSEEvent, encode_sse, encode_sse_stream, MCP_JSON_CONTENT_TYPE, MCP_SSE_CONTENT_TYPE
15
+ from modmex_lambda.mcp.middleware import MCPContext, MCPMiddleware, MCPNextMiddleware, MCPProgressReporter, MCPCancellationToken
16
+ from modmex_lambda.mcp.web_adapter import LambdaWebAdapterResolver
16
17
 
17
18
  __all__ = [
18
19
  "JSONRPCError",
@@ -23,6 +24,8 @@ __all__ = [
23
24
  "MCPServer",
24
25
  "MCPError",
25
26
  "MCPHttpTransport",
27
+ "MCPStreamingHttpTransport",
28
+ "StreamingHTTPResponse",
26
29
  "MCPTool",
27
30
  "MCPResource",
28
31
  "MCPPrompt",
@@ -34,4 +37,7 @@ __all__ = [
34
37
  "MCPContext",
35
38
  "MCPMiddleware",
36
39
  "MCPNextMiddleware",
40
+ "MCPProgressReporter",
41
+ "MCPCancellationToken",
42
+ "LambdaWebAdapterResolver",
37
43
  ]
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import inspect
6
+ import threading
6
7
  from dataclasses import dataclass, field
7
8
  from typing import TYPE_CHECKING, Callable, Protocol, TypeAlias, Union, Any
8
9
 
@@ -22,6 +23,35 @@ JSONValue: TypeAlias = Union[
22
23
  ]
23
24
 
24
25
 
26
+ @dataclass
27
+ class MCPCancellationToken:
28
+ """Cooperative cancellation state for a streaming MCP operation."""
29
+
30
+ _event: threading.Event = field(default_factory=threading.Event)
31
+
32
+ @property
33
+ def cancelled(self) -> bool:
34
+ return self._event.is_set()
35
+
36
+ def cancel(self) -> None:
37
+ self._event.set()
38
+
39
+
40
+ @dataclass
41
+ class MCPProgressReporter:
42
+ """Cooperative progress publisher available to a running MCP operation."""
43
+
44
+ publish: Callable[[dict[str, JSONValue]], None]
45
+
46
+ def report(self, progress: float, *, total: float | None = None, message: str | None = None) -> None:
47
+ event: dict[str, JSONValue] = {"progress": progress}
48
+ if total is not None:
49
+ event["total"] = total
50
+ if message is not None:
51
+ event["message"] = message
52
+ self.publish(event)
53
+
54
+
25
55
  @dataclass
26
56
  class MCPContext:
27
57
  request: "Request | None"
@@ -29,8 +59,24 @@ class MCPContext:
29
59
  capability: str
30
60
  name: str
31
61
  arguments: dict[str, JSONValue]
62
+ context: dict[str, Any] = field(default_factory=dict)
32
63
  state: dict[str, object] = field(default_factory=dict)
33
64
 
65
+ def __post_init__(self) -> None:
66
+ request_context = getattr(self.request, "context", None)
67
+ if isinstance(request_context, dict):
68
+ self.context = request_context
69
+
70
+ @property
71
+ def progress(self) -> MCPProgressReporter | None:
72
+ value = self.state.get("progress_reporter")
73
+ return value if isinstance(value, MCPProgressReporter) else None
74
+
75
+ @property
76
+ def cancelled(self) -> bool:
77
+ value = self.state.get("cancellation_token")
78
+ return isinstance(value, MCPCancellationToken) and value.cancelled
79
+
34
80
 
35
81
  class MCPNextMiddleware(Protocol):
36
82
  def __call__(self, context: MCPContext) -> object: ...
@@ -17,7 +17,7 @@ from modmex_lambda.mcp.registry import MCPPromptRegistry, MCPResourceRegistry
17
17
  from modmex_lambda.mcp.prompt import MCPPrompt
18
18
  from modmex_lambda.mcp.resource import MCPResource
19
19
  from modmex_lambda.mcp.tool import MCPTool
20
- from modmex_lambda.mcp.middleware import MCPContext, MCPMiddleware
20
+ from modmex_lambda.mcp.middleware import MCPContext, MCPMiddleware, MCPProgressReporter, MCPCancellationToken
21
21
 
22
22
  from modmex_lambda.mcp.protocol import MCP_PROTOCOL_VERSION
23
23
 
@@ -314,7 +314,7 @@ class MCPServer:
314
314
  arguments = params.get("arguments", {})
315
315
  if not isinstance(arguments, dict):
316
316
  raise ValueError("tools/call 'arguments' must be an object")
317
- output = tool.invoke(arguments, request=context, middlewares=self.middlewares, middleware_context=MCPContext(request=context, server=self, capability="tools", name=name, arguments=arguments))
317
+ output = tool.invoke(arguments, request=context, middlewares=self.middlewares, middleware_context=self._tool_context(context, name, arguments))
318
318
  return _tool_result(output)
319
319
 
320
320
  def _resources_list(self, params: dict[str, Any], *, context: Any = None) -> dict[str, Any]:
@@ -361,7 +361,7 @@ class MCPServer:
361
361
  arguments = params.get("arguments", {})
362
362
  if not isinstance(arguments, dict):
363
363
  raise ValueError("tools/call 'arguments' must be an object")
364
- output = await tool.ainvoke(arguments, request=context, middlewares=self.middlewares, middleware_context=MCPContext(request=context, server=self, capability="tools", name=name, arguments=arguments))
364
+ output = await tool.ainvoke(arguments, request=context, middlewares=self.middlewares, middleware_context=self._tool_context(context, name, arguments))
365
365
  return _tool_result(output)
366
366
 
367
367
  async def _resources_read_async(self, params: dict[str, Any], *, context: Any = None) -> dict[str, Any]:
@@ -386,6 +386,16 @@ class MCPServer:
386
386
  raise ValueError("prompts/get 'arguments' must be an object")
387
387
  return {"resultType": "complete", **await prompt.aget(arguments, context=context, server=self, middlewares=self.middlewares), "ttlMs": 300000, "cacheScope": "private"}
388
388
 
389
+ def _tool_context(self, request: Any, name: str, arguments: dict[str, Any]) -> MCPContext:
390
+ state: dict[str, object] = {}
391
+ reporter = getattr(request, "progress_reporter", None)
392
+ if isinstance(reporter, MCPProgressReporter):
393
+ state["progress_reporter"] = reporter
394
+ token = getattr(request, "cancellation_token", None)
395
+ if isinstance(token, MCPCancellationToken):
396
+ state["cancellation_token"] = token
397
+ return MCPContext(request=request, server=self, capability="tools", name=name, arguments=arguments, state=state)
398
+
389
399
 
390
400
  def _json_text(value: Any) -> str:
391
401
  if isinstance(value, str):
@@ -91,9 +91,11 @@ class MCPTool:
91
91
  dependency_overrides=dependency_overrides,
92
92
  dependency_resolver=dependency_resolver,
93
93
  )
94
- for name in ("request", "context", "ctx"):
94
+ if "request" in parameters and "request" not in values:
95
+ values["request"] = request
96
+ for name in ("context", "ctx"):
95
97
  if name in parameters and name not in values:
96
- values[name] = request
98
+ values[name] = ctx
97
99
  values.update(arguments)
98
100
  return self.handler(**values)
99
101
 
@@ -120,9 +122,11 @@ class MCPTool:
120
122
 
121
123
  def endpoint(ctx: MCPContext) -> Any:
122
124
  values = solve_dependencies(dependant=self.dependant, request=request, dependency_overrides=kwargs.get("dependency_overrides"), dependency_resolver=kwargs.get("dependency_resolver"))
123
- for name in ("request", "context", "ctx"):
125
+ if "request" in parameters and "request" not in values:
126
+ values["request"] = request
127
+ for name in ("context", "ctx"):
124
128
  if name in parameters and name not in values:
125
- values[name] = request
129
+ values[name] = ctx
126
130
  values.update(arguments)
127
131
  return self.handler(**values)
128
132
 
@@ -4,9 +4,11 @@ from __future__ import annotations
4
4
 
5
5
  import json
6
6
  import base64
7
+ import queue
8
+ import threading
7
9
  from dataclasses import dataclass
8
10
  from http import HTTPStatus
9
- from typing import Any, Iterable
11
+ from typing import Any, Iterable, Iterator
10
12
 
11
13
 
12
14
  MCP_JSON_CONTENT_TYPE = "application/json"
@@ -21,6 +23,17 @@ class SSEEvent:
21
23
  retry: int | None = None
22
24
 
23
25
 
26
+ @dataclass(frozen=True)
27
+ class StreamingHTTPResponse:
28
+ """HTTP metadata plus a lazily-produced body for streaming adapters."""
29
+
30
+ status_code: int
31
+ content_type: str
32
+ headers: dict[str, str]
33
+ body: Iterator[str]
34
+ cancellation_token: Any = None
35
+
36
+
24
37
  def encode_sse(event: SSEEvent | Any) -> str:
25
38
  """Encode one event according to the SSE wire format."""
26
39
  if not isinstance(event, SSEEvent):
@@ -120,6 +133,45 @@ class MCPHttpTransport:
120
133
  if "io.modelcontextprotocol/clientCapabilities" not in metadata:
121
134
  response = JSONRPCResponse.failure(payload.get("id"), JSONRPCErrorCode.INVALID_PARAMS, "Missing clientCapabilities")
122
135
  return Response(body=self._model_dict(response), status_code=HTTPStatus.BAD_REQUEST, content_type=content_types.APPLICATION_JSON)
136
+ if method == "tools/call":
137
+ mismatch = self._validate_tool_parameter_headers(payload, headers)
138
+ if mismatch is not None:
139
+ return self._header_mismatch(payload, mismatch)
140
+ return None
141
+
142
+ def _validate_tool_parameter_headers(self, payload: dict[str, Any], headers: Any) -> str | None:
143
+ params = payload.get("params") or {}
144
+ tool = self.server.tools.get(params.get("name")) if isinstance(params.get("name"), str) else None
145
+ if tool is None:
146
+ return None
147
+ schema = tool.definition().get("inputSchema")
148
+ arguments = params.get("arguments") or {}
149
+ expected: dict[str, str] = {}
150
+
151
+ def visit(node: Any, value: Any) -> None:
152
+ if not isinstance(node, dict) or not isinstance(value, dict):
153
+ return
154
+ for name, property_schema in (node.get("properties") or {}).items():
155
+ if not isinstance(property_schema, dict):
156
+ continue
157
+ header_name = property_schema.get("x-mcp-header")
158
+ if isinstance(header_name, str) and name in value:
159
+ item = value[name]
160
+ serialized = str(item).lower() if isinstance(item, bool) else str(item)
161
+ expected[f"mcp-param-{header_name}".lower()] = serialized
162
+ if property_schema.get("type") == "object":
163
+ visit(property_schema, value.get(name))
164
+
165
+ visit(schema, arguments)
166
+ actual = {str(key).lower(): value for key, value in headers.items()}
167
+ for header_name, expected_value in expected.items():
168
+ if header_name not in actual:
169
+ return f"Missing {header_name} header"
170
+ if self._decode_header(actual[header_name]) != expected_value:
171
+ return f"{header_name} does not match tool argument"
172
+ for header_name in actual:
173
+ if header_name.startswith("mcp-param-") and header_name not in expected:
174
+ return f"Unexpected {header_name} header"
123
175
  return None
124
176
 
125
177
  def _header_mismatch(self, payload: dict[str, Any], message: str) -> Any:
@@ -157,6 +209,84 @@ class MCPHttpTransport:
157
209
  )
158
210
 
159
211
 
212
+ class MCPStreamingHttpTransport:
213
+ """Produce MCP responses through an incremental SSE HTTP body.
214
+
215
+ The transport is adapter-neutral. A web server owns the socket and
216
+ consumes ``StreamingHTTPResponse.body``; a disconnected writer should
217
+ propagate its socket exception so the generator stops immediately.
218
+ """
219
+
220
+ def __init__(self, server: Any, *, allowed_origins: list[str] | None = None) -> None:
221
+ self.server = server
222
+ self._http = MCPHttpTransport(server, allowed_origins=allowed_origins)
223
+
224
+ def handle(self, request: Any) -> StreamingHTTPResponse:
225
+ """Return a lazy SSE response for one MCP HTTP request."""
226
+ validation = self._http._validate_headers(request.json_body, request.headers)
227
+ if validation is not None:
228
+ body = validation.body
229
+ status = validation.status_code
230
+ content_type = validation.content_type
231
+ return StreamingHTTPResponse(status, content_type, {}, iter((encode_sse(body),)))
232
+
233
+ payload = request.json_body
234
+ if payload.get("method") == "tools/call":
235
+ return self._handle_tool_call(request, payload)
236
+ response = self.server.handle(payload, context=request)
237
+
238
+ def body() -> Iterator[str]:
239
+ if response is not None:
240
+ yield encode_sse(self._http._model_dict(response))
241
+
242
+ return StreamingHTTPResponse(
243
+ status_code=202 if response is None else 200,
244
+ content_type=MCP_SSE_CONTENT_TYPE,
245
+ headers={"Cache-Control": "no-cache", "Connection": "keep-alive"},
246
+ body=body(),
247
+ )
248
+
249
+ def _handle_tool_call(self, request: Any, payload: dict[str, Any]) -> StreamingHTTPResponse:
250
+ from modmex_lambda.mcp.middleware import MCPProgressReporter
251
+ from modmex_lambda.mcp.middleware import MCPCancellationToken
252
+
253
+ events: queue.Queue[tuple[str, Any]] = queue.Queue()
254
+ cancellation_token = MCPCancellationToken()
255
+ request.cancellation_token = cancellation_token
256
+ request.progress_reporter = MCPProgressReporter(lambda value: events.put(("progress", value)))
257
+
258
+ def run() -> None:
259
+ try:
260
+ events.put(("result", self.server.handle(payload, context=request)))
261
+ except BaseException as exc:
262
+ events.put(("exception", exc))
263
+ finally:
264
+ events.put(("done", None))
265
+
266
+ threading.Thread(target=run, daemon=True).start()
267
+
268
+ def body() -> Iterator[str]:
269
+ while True:
270
+ kind, value = events.get()
271
+ if kind == "progress":
272
+ yield encode_sse(SSEEvent(data=value, event="progress"))
273
+ elif kind == "result":
274
+ if value is not None:
275
+ yield encode_sse(self._http._model_dict(value))
276
+ elif kind == "exception":
277
+ raise value
278
+ elif kind == "done":
279
+ return
280
+
281
+ return StreamingHTTPResponse(
282
+ status_code=200,
283
+ content_type=MCP_SSE_CONTENT_TYPE,
284
+ headers={"Cache-Control": "no-cache", "Connection": "keep-alive"},
285
+ body=body(),
286
+ cancellation_token=cancellation_token,
287
+ )
288
+
289
+
160
290
  def _serialize(value: Any) -> Any:
161
291
  if hasattr(value, "model_dump"):
162
292
  return value.model_dump()