PyStreamMCP 3.2.0__tar.gz → 3.3.1__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 (92) hide show
  1. pystreammcp-3.3.1/LICENSE +202 -0
  2. pystreammcp-3.3.1/PKG-INFO +404 -0
  3. pystreammcp-3.3.1/README.md +341 -0
  4. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/pyproject.toml +6 -4
  5. pystreammcp-3.3.1/python/PyStreamMCP.egg-info/PKG-INFO +404 -0
  6. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/PyStreamMCP.egg-info/SOURCES.txt +5 -0
  7. pystreammcp-3.3.1/python/PyStreamMCP.egg-info/entry_points.txt +2 -0
  8. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/__init__.py +4 -2
  9. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/api.py +47 -4
  10. pystreammcp-3.3.1/python/pystreammcp/cli.py +136 -0
  11. pystreammcp-3.3.1/python/pystreammcp/discovery.py +216 -0
  12. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/integrations/langchain.py +20 -12
  13. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/integrations/llamaindex.py +4 -1
  14. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/integrations/semantic_kernel.py +4 -1
  15. pystreammcp-3.3.1/python/pystreammcp/mcp_server.py +330 -0
  16. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/multi_agent.py +2 -1
  17. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/orchestration/airflow.py +21 -12
  18. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/orchestration/nocode_rpa.py +15 -11
  19. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/orchestration/temporal.py +25 -15
  20. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/quality.py +6 -6
  21. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/server.py +3 -3
  22. pystreammcp-3.3.1/python/pystreammcp/testing.py +123 -0
  23. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/webhook_handlers.py +30 -30
  24. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/webhook_router.py +8 -8
  25. pystreammcp-3.3.1/tests/test_cli.py +60 -0
  26. pystreammcp-3.3.1/tests/test_discovery.py +118 -0
  27. pystreammcp-3.3.1/tests/test_mcp_server_resilience.py +172 -0
  28. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_sprint1_foundation.py +3 -2
  29. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_sprint2_langchain.py +12 -1
  30. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_sprint5_orchestration.py +78 -16
  31. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_statguardian_integration.py +2 -2
  32. pystreammcp-3.2.0/LICENSE +0 -22
  33. pystreammcp-3.2.0/PKG-INFO +0 -231
  34. pystreammcp-3.2.0/README.md +0 -167
  35. pystreammcp-3.2.0/python/PyStreamMCP.egg-info/PKG-INFO +0 -231
  36. pystreammcp-3.2.0/python/pystreammcp/cli.py +0 -285
  37. pystreammcp-3.2.0/python/pystreammcp/discovery.py +0 -82
  38. pystreammcp-3.2.0/python/pystreammcp/mcp_server.py +0 -283
  39. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/MANIFEST.in +0 -0
  40. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/PyStreamMCP.egg-info/dependency_links.txt +0 -0
  41. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/PyStreamMCP.egg-info/requires.txt +0 -0
  42. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/PyStreamMCP.egg-info/top_level.txt +0 -0
  43. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/_mcp_connector.py +0 -0
  44. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/_mcp_tools.py +0 -0
  45. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/adapters.py +0 -0
  46. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/agent.py +0 -0
  47. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/cli_daemon.py +0 -0
  48. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/cli_dashboard.py +0 -0
  49. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/context.py +0 -0
  50. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/decomposition.py +0 -0
  51. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/integrations/__init__.py +0 -0
  52. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/integrations/crewai.py +0 -0
  53. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/integrations/haystack.py +0 -0
  54. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/integrations/langsmith.py +0 -0
  55. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/integrations/pydantic_ai.py +0 -0
  56. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/ml/__init__.py +0 -0
  57. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/ml/relevance.py +0 -0
  58. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/ml/tagging.py +0 -0
  59. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/ml.py +0 -0
  60. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/observability/__init__.py +0 -0
  61. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/observability/metrics.py +0 -0
  62. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/okf_core.py +0 -0
  63. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/okf_discovery.py +0 -0
  64. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/okf_query_planner.py +0 -0
  65. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/optimization/__init__.py +0 -0
  66. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/optimization/advanced.py +0 -0
  67. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/optimization/decomposition.py +0 -0
  68. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/optimization.py +0 -0
  69. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/orchestration/__init__.py +0 -0
  70. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/qa/__init__.py +0 -0
  71. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/qa/validator.py +0 -0
  72. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/query.py +0 -0
  73. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/scripts/__init__.py +0 -0
  74. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/scripts/post_install.py +0 -0
  75. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/python/pystreammcp/streaming.py +0 -0
  76. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/setup.cfg +0 -0
  77. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/setup.py +0 -0
  78. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_integration_phase2.py +0 -0
  79. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_langchain_integration.py +0 -0
  80. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_llamaindex_integration.py +0 -0
  81. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_mcp_connector_discovery.py +0 -0
  82. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_mcp_tools_handler.py +0 -0
  83. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_okf_core.py +0 -0
  84. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_okf_discovery.py +0 -0
  85. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_okf_query_planner.py +0 -0
  86. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_phase3_advanced.py +0 -0
  87. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_phase3_items12.py +0 -0
  88. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_phase3_items345.py +0 -0
  89. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_sprint3_rag_frameworks.py +0 -0
  90. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_sprint4_agent_frameworks.py +0 -0
  91. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_webhook_hmac_auth.py +0 -0
  92. {pystreammcp-3.2.0 → pystreammcp-3.3.1}/tests/test_webhook_router.py +0 -0
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Georgi Mullassery
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,404 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyStreamMCP
3
+ Version: 3.3.1
4
+ Summary: Intelligent MCP orchestration hub - Intent understanding, capability matching, tool ranking with cohesive foundation
5
+ Author-email: Georgi Mammen Mullassery <mullassery@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Repository, https://github.com/Mullassery/PyStreamMCP
8
+ Project-URL: Issues, https://github.com/Mullassery/PyStreamMCP/issues
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: pydantic>=2.0
21
+ Requires-Dist: python-frontmatter>=1.0.0
22
+ Requires-Dist: click>=8.0
23
+ Requires-Dist: rich>=13.0
24
+ Requires-Dist: httpx>=0.24.0
25
+ Requires-Dist: toml>=0.10; python_version < "3.11"
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.0; extra == "dev"
28
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
29
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
30
+ Provides-Extra: api
31
+ Requires-Dist: fastapi>=0.104.0; extra == "api"
32
+ Requires-Dist: uvicorn[standard]>=0.24.0; extra == "api"
33
+ Requires-Dist: pydantic-settings>=2.0; extra == "api"
34
+ Requires-Dist: flask>=2.3.0; extra == "api"
35
+ Provides-Extra: mcp
36
+ Requires-Dist: mcp>=0.1.0; extra == "mcp"
37
+ Provides-Extra: langchain
38
+ Requires-Dist: langchain>=0.1.0; extra == "langchain"
39
+ Provides-Extra: llamaindex
40
+ Requires-Dist: llama-index>=0.9.0; extra == "llamaindex"
41
+ Provides-Extra: semantic-kernel
42
+ Requires-Dist: semantic-kernel>=0.4.0; extra == "semantic-kernel"
43
+ Provides-Extra: crewai
44
+ Requires-Dist: crewai>=0.1.0; extra == "crewai"
45
+ Provides-Extra: pydantic-ai
46
+ Requires-Dist: pydantic-ai>=0.1.0; extra == "pydantic-ai"
47
+ Provides-Extra: haystack
48
+ Requires-Dist: haystack-ai>=2.0.0; extra == "haystack"
49
+ Provides-Extra: temporal
50
+ Requires-Dist: temporalio>=1.0.0; extra == "temporal"
51
+ Provides-Extra: airflow
52
+ Requires-Dist: apache-airflow>=2.7.0; extra == "airflow"
53
+ Provides-Extra: all-integrations
54
+ Requires-Dist: langchain>=0.1.0; extra == "all-integrations"
55
+ Requires-Dist: llama-index>=0.9.0; extra == "all-integrations"
56
+ Requires-Dist: semantic-kernel>=0.4.0; extra == "all-integrations"
57
+ Requires-Dist: crewai>=0.1.0; extra == "all-integrations"
58
+ Requires-Dist: pydantic-ai>=0.1.0; extra == "all-integrations"
59
+ Requires-Dist: haystack-ai>=2.0.0; extra == "all-integrations"
60
+ Requires-Dist: temporalio>=1.0.0; extra == "all-integrations"
61
+ Requires-Dist: apache-airflow>=2.7.0; extra == "all-integrations"
62
+ Dynamic: license-file
63
+
64
+ # PyStreamMCP
65
+
66
+ [![CI](https://github.com/Mullassery/PyStreamMCP/actions/workflows/ci.yml/badge.svg)](https://github.com/Mullassery/PyStreamMCP/actions/workflows/ci.yml)
67
+
68
+ An AI-agent intelligence layer: query planning, context discovery, and
69
+ token-cost optimization, exposed both as a Python SDK and as an MCP
70
+ (Model Context Protocol) tool server, plus a small event-driven
71
+ orchestration/federation layer for coordinating multiple MCP endpoints.
72
+
73
+ Pure Python — `pip install` just works, no Rust toolchain or compiler
74
+ required.
75
+
76
+ ## Use cases
77
+
78
+ - **Giving an AI agent a query-planning layer over multiple data
79
+ sources**, exposed as real MCP tools rather than hand-rolled per-agent
80
+ glue code.
81
+ - **Coordinating multiple MCP endpoints** through the event-driven
82
+ orchestration/federation layer instead of wiring each one separately.
83
+ - **Tracking token-cost optimization** across agent queries.
84
+ - **Not yet a good fit for:** anything depending on the Rust workspace —
85
+ see [Rust workspace (not shipped)](#rust-workspace-not-shipped) below;
86
+ the published package is pure Python only.
87
+
88
+ ## Install
89
+
90
+ ```bash
91
+ pip install PyStreamMCP
92
+ ```
93
+
94
+ Optional extras, install what you actually need:
95
+
96
+ ```bash
97
+ pip install "PyStreamMCP[api]" # FastAPI + Flask HTTP servers
98
+ pip install "PyStreamMCP[mcp]" # MCP protocol client library
99
+ pip install "PyStreamMCP[langchain]" # LangChain adapter
100
+ pip install "PyStreamMCP[llamaindex]" # LlamaIndex adapter
101
+ pip install "PyStreamMCP[semantic-kernel]" # Semantic Kernel adapter
102
+ pip install "PyStreamMCP[all-integrations]" # every framework adapter
103
+ ```
104
+
105
+ Requires Python 3.9+ for the core SDK (`Agent`, `SourceRegistry`,
106
+ `Orchestrator`). The `mcp` and `semantic-kernel` extras require Python
107
+ 3.10+ — their upstream packages don't publish Python 3.9-compatible
108
+ releases, so `pip install` for those extras will fail on 3.9. CI tests
109
+ 3.10, 3.11, and 3.12 only; 3.9 is not covered by CI.
110
+
111
+ ## Quick start
112
+
113
+ ```python
114
+ from pystreammcp import Agent
115
+
116
+ agent = Agent(
117
+ agent_id="recommendation_engine",
118
+ name="Product Recommendation Engine",
119
+ optimization_strategy="token_efficient", # or "balanced" / "quality_first"
120
+ max_tokens=1000,
121
+ )
122
+
123
+ result = agent.query("What are the top 10 customers by lifetime value?")
124
+
125
+ print(f"Baseline tokens: {result.baseline_tokens}")
126
+ print(f"Optimized tokens: {result.optimized_tokens}")
127
+ print(f"Reduction: {result.cost_reduction_percent:.1f}%")
128
+ ```
129
+
130
+ Token counts are estimated from the actual query text (a standard
131
+ ~4-characters-per-token heuristic) and the reduction percentage is
132
+ computed from the selected `optimization_strategy` — not a fixed number
133
+ returned regardless of input. See [`examples/basic_usage.py`](examples/basic_usage.py)
134
+ for a full runnable walkthrough, including framework adapters for
135
+ LangChain, LlamaIndex, CrewAI, Semantic Kernel, PydanticAI, and Haystack
136
+ under [`pystreammcp.integrations`](python/pystreammcp/integrations/).
137
+
138
+ ## Data source discovery
139
+
140
+ `SourceRegistry` (`pystreammcp.SourceRegistry`) ranks *registered* data
141
+ sources by real word-overlap relevance to a query — not a fabricated or
142
+ hardcoded result:
143
+
144
+ ```python
145
+ from pystreammcp import SourceRegistry
146
+
147
+ registry = SourceRegistry()
148
+ registry.register(
149
+ "orders_db",
150
+ description="customer order history and revenue by quarter",
151
+ type="database",
152
+ tags=["orders", "revenue"],
153
+ )
154
+
155
+ results = registry.discover("customer revenue by quarter")
156
+ # [{"name": "orders_db", "type": "database", "relevance": 0.4444, "matched_terms": [...]}]
157
+ ```
158
+
159
+ The same registry backs `POST /discover` (REST), the `pystreammcp_discover`
160
+ MCP tool, and `LangchainAdapter.discover()` — register sources once via
161
+ `POST /sources` / `pystreammcp_register_source` / `registry.register()`,
162
+ then discover against them from any of the three surfaces. This is a
163
+ simple Jaccard token-overlap heuristic, not semantic/embedding search.
164
+
165
+ ## MCP orchestration & federation
166
+
167
+ `Orchestrator` (`pystreammcp.Orchestrator`) discovers and routes across
168
+ other MCP-enabled projects you configure in `pystreammcp.toml`:
169
+
170
+ ```toml
171
+ [federation]
172
+ endpoints = [
173
+ "http://localhost:8765/mcp",
174
+ "http://localhost:8766/mcp",
175
+ ]
176
+ ```
177
+
178
+ ```python
179
+ from pystreammcp import Orchestrator
180
+
181
+ orch = Orchestrator() # reads ./pystreammcp.toml
182
+ result = orch.discover_mcp_projects()
183
+ # {"projects": [{"project_name": ..., "endpoint": ..., "status": "healthy"|"unavailable", ...}], "total": N}
184
+ ```
185
+
186
+ This actually probes each configured endpoint's real `tools/list` MCP
187
+ method — with nothing configured, or nothing reachable, it honestly
188
+ reports zero/unavailable projects rather than a fixed fixture list.
189
+ `Orchestrator` also does lexical tool-relevance ranking
190
+ (`rank_tools_by_relevance`) and capability matching
191
+ (`detect_compatible_projects`) against whatever it actually discovers.
192
+
193
+ To expose these (plus tool-routing and webhook-event handling) as MCP
194
+ tools, `PyStreamMCPHandler` (`pystreammcp._mcp_tools`) wires the MCP
195
+ tool-call surface directly to a live `Orchestrator`/`EventRouter`
196
+ instance — every handler call is backed by real, inspectable state, not
197
+ a hardcoded response.
198
+
199
+ **Honest limitations**: a few orchestration capabilities are accepted at
200
+ the API level but not fully implemented yet — cross-project federated
201
+ query *execution* and cross-database joins currently report
202
+ `"status": "not_implemented"` with an explanation, rather than fabricated
203
+ result rows, because there's no real query engine behind them yet.
204
+
205
+ ## Webhook event server
206
+
207
+ `pystreammcp.server.create_flask_app()` exposes a small REST/webhook
208
+ surface for orchestration events (agent MCPs reporting `mcp.available`,
209
+ `tool.invoked`, health updates, etc. to `POST /orchestration/webhooks/events`).
210
+
211
+ ### Webhook security (HMAC-SHA256)
212
+
213
+ Inbound events to `/orchestration/webhooks/events` must be signed:
214
+
215
+ ```bash
216
+ export PYSTREAMMCP_WEBHOOK_SECRET="a long random shared secret"
217
+ ```
218
+
219
+ Senders compute `HMAC-SHA256(secret, raw_request_body)` and send it as:
220
+
221
+ ```
222
+ X-PyStreamMCP-Signature: sha256=<hex digest>
223
+ ```
224
+
225
+ ```python
226
+ from pystreammcp.server import compute_webhook_signature
227
+ import json, requests
228
+
229
+ body = json.dumps({"event_type": "mcp.available", "data": {...}}).encode()
230
+ signature = compute_webhook_signature(secret, body)
231
+
232
+ requests.post(
233
+ "http://localhost:8000/orchestration/webhooks/events",
234
+ data=body,
235
+ headers={
236
+ "Content-Type": "application/json",
237
+ "X-PyStreamMCP-Signature": signature,
238
+ },
239
+ )
240
+ ```
241
+
242
+ Requests with a missing or invalid signature are rejected with `401`. If
243
+ `PYSTREAMMCP_WEBHOOK_SECRET` isn't set at all, the endpoint fails closed
244
+ and rejects every request with `503` — there is no "accept unsigned
245
+ events" fallback.
246
+
247
+ ### Network defaults
248
+
249
+ The HTTP servers (`PyStreamMCPServer` / `create_flask_app()`,
250
+ `PyStreamMCPAPI.run`) bind to `127.0.0.1` (localhost-only) by default.
251
+ Pass `host="0.0.0.0"` explicitly if you need the server reachable from
252
+ other hosts — e.g. inside a container that already has its own network
253
+ boundary.
254
+
255
+ **The `pystreammcp` CLI**: `pip install PyStreamMCP` now installs a real
256
+ `pystreammcp` command (`[project.scripts]` in `pyproject.toml`) backed by
257
+ the Click group in `python/pystreammcp/cli.py`:
258
+ `query`/`server`/`version`/`dashboard`. `python -m pystreammcp.cli` reaches
259
+ the same Click group (the file's old, separate, smaller hand-rolled
260
+ command set has been removed). `server` lazy-imports `pystreammcp.api`, so
261
+ `pystreammcp version`/`query`/`dashboard` work without installing the
262
+ `api` extra; running `pystreammcp server` without it prints a clear
263
+ "install `pystreammcp[api]`" error instead of crashing with
264
+ `ModuleNotFoundError`. See [`ROADMAP_HONEST.md`](ROADMAP_HONEST.md) §2.2
265
+ (now marked fixed) for how this was previously broken.
266
+
267
+ ## Testing
268
+
269
+ ```bash
270
+ pip install -e ".[dev,api,mcp,langchain,llamaindex,semantic-kernel]"
271
+ pytest tests/ -v
272
+ ```
273
+
274
+ Note: this exact command needs Python 3.10+ (see [Install](#install)); on
275
+ 3.9 the `mcp` and `semantic-kernel` extras fail to resolve, so drop them
276
+ from the extras list if you're on 3.9.
277
+
278
+ ## Known Issues
279
+
280
+ **2026-10-11 pass — workspace-wide error sweep; the Rust backend now
281
+ compiles and its tests pass, Python `ruff` is clean, and a stale
282
+ integration test was rewritten against the real schema:**
283
+
284
+ - **The `core/` Rust workspace compiles again.** It had accumulated 43
285
+ `cargo check` errors: `orchestration/` (reranking/orchestrator referenced
286
+ a stale `stage2_decision` field, `RankingStrategy`/`FusionMethod` were
287
+ missing `Serialize`/`Deserialize`, `ContentSegment` was missing
288
+ `PartialEq`, `TokenBudget` was re-exported from the wrong module);
289
+ `metadata/` (cache eviction borrow-checker error, missing
290
+ `CacheStats.evictions`, `clear_cache`/`cache_stats` were not `async`);
291
+ `selective_retrieval/` (`QueryIntent` missing `PartialEq`,
292
+ struct-variant `BudgetTier` match patterns, a duplicated
293
+ `RerankerConfig`); `quality_gates/` (duplicated `ConfidenceConfig`/
294
+ `SLACheckResult`); and `observability/` (per-subsystem `*Config`
295
+ constructors resolved to a non-existent path). All fixed; `cargo test`
296
+ is green — **138 library + 29 integration tests, 0 failures**.
297
+ - Build note: `rust-toolchain.toml` still pins `channel = "1.81"`, which
298
+ cannot even parse the committed lockfile — transitive deps such as
299
+ `idna_adapter 1.2.2` require `edition2024`, i.e. Cargo ≥ 1.85. The pin
300
+ was intentionally **left unchanged**; build with
301
+ `RUSTUP_TOOLCHAIN=1.97 cargo ...` until the pin is revisited.
302
+ - **5 Python `F821` undefined-name errors fixed** in
303
+ `python/pystreammcp/integrations/{langchain,llamaindex,semantic_kernel}.py`
304
+ — the retriever/tool/plugin classes were referenced in annotations but
305
+ never imported. Added `TYPE_CHECKING`-guarded imports so the optional
306
+ dependency types are visible to type-checkers without forcing a hard
307
+ runtime import. `ruff check python/ --select E9,F63,F7,F82` is clean.
308
+ - **`core/tests/phase_v05_metadata_tests.rs` was dead code** — it had never
309
+ compiled (it referenced an aspirational `MetadataEntry`/profile schema
310
+ that exists nowhere in the tree) and so was never run. Rewritten against
311
+ the real metadata API (`DatabaseMetadata`/`MCPToolMetadata`,
312
+ `Metadata::Web/Database/Mcp`, profile keys `public_postgres`,
313
+ `bigquery_analytics`, `ml_inference`, …); all 29 tests pass.
314
+ - **3 pre-existing heuristic test failures fixed.**
315
+ `orchestration/complexity.rs`: a "very complex" query scored *lower* than
316
+ a merely "complex" one because reasoning terms (`analysis`, `correlation`,
317
+ `anomalies`, `pattern`, …) weren't recognised — added an
318
+ `analytical_terms()` signal and widened the `Complex` band.
319
+ `selective_retrieval/intent.rs`: added an enumeration (comma-list) signal
320
+ and raised the multi-entity weight so list-heavy and design-style queries
321
+ classify correctly. No production behaviour change (these tiers only feed
322
+ `budgets::assign_tier`, and the detectors are otherwise unused).
323
+
324
+ - ~~No end-to-end tests for LLM failure states~~ **Fixed.** PyStreamMCP's
325
+ own code never calls a model provider directly (no code path here to add
326
+ `except RateLimitError`/`APIError` handling *to* — see `AgentFrameworkAdapter`
327
+ below), so what's now tested is the part this repo actually owns: that the
328
+ MCP tool-call path doesn't crash when whatever it's orchestrating fails.
329
+ `pystreammcp.testing` exports `RateLimitError`, `ContextWindowExceededError`,
330
+ `MalformedModelResponseError`, and `FailingAgent`/`FailingAdapter` stand-ins
331
+ that raise them; `mcp_server.py`'s `call_tool`/`process_message` now catch
332
+ exceptions raised during tool execution and return a structured
333
+ `{"status": "error", "error_type": ..., "message": ...}` response instead
334
+ of propagating uncaught. See `tests/test_mcp_server_resilience.py`.
335
+ - ~~No Pydantic validation for the MCP tool protocol itself~~ **Fixed.**
336
+ Each of the four MCP tools now has a Pydantic arg model
337
+ (`QueryToolArgs`/`DiscoverToolArgs`/`RegisterSourceToolArgs`/`OptimizeToolArgs`
338
+ in `mcp_server.py`) validated in `call_tool` before dispatch (wrong types,
339
+ invalid enum values, and missing required fields all now return a
340
+ structured `validation_errors` response instead of reaching the handler
341
+ unchecked), and `MCPTool.input_schema` is generated from those same models
342
+ via `model_json_schema()` — the advertised schema and the schema actually
343
+ enforced can no longer drift apart the way a hand-duplicated dict could.
344
+ - ~~No shipped mock MCP server / mock LLM fixture~~ **Fixed.** Added
345
+ `tests/conftest.py` (centralizing the `sys.path` setup 5 test files were
346
+ duplicating, plus `mock_adapter`/`failing_agent`/`failing_adapter`/
347
+ `llm_failure` pytest fixtures) and `pystreammcp/testing.py`, exporting
348
+ `MockAdapter` (promoted from the old test-local copy) and the
349
+ failure-injection stand-ins above for downstream projects' own test
350
+ suites to import directly.
351
+ - **Per-query context discovery** now has a real implementation
352
+ (`pystreammcp.discovery.SourceRegistry`): register data sources (name,
353
+ description, type, tags), and `/discover` (REST), `pystreammcp_discover`
354
+ (MCP), and `LangchainAdapter.discover()` all rank *registered* sources
355
+ by real Jaccard token-overlap against the query — an empty registry or
356
+ a non-matching context returns an empty list, not fabricated data. This
357
+ is a simple word-overlap heuristic, not semantic/embedding search — if
358
+ you need that, wrap `SourceRegistry` with your own similarity scoring.
359
+ - ~~The `pystreammcp` CLI is dead code~~ **Fixed.** `pyproject.toml` now
360
+ has a `[project.scripts]` entry, and the module's `__main__` guard
361
+ invokes the real Click group. See [Network defaults](#network-defaults)
362
+ above and [`ROADMAP_HONEST.md`](ROADMAP_HONEST.md) §2.2.
363
+ - ~~Three orchestration-tool discovery adapters return fabricated
364
+ results~~ **Fixed.** `orchestration/temporal.py`'s
365
+ `TemporalDiscoveryActivity`/`TemporalWorkflow`, `airflow.py`'s
366
+ `PyStreamMCPDiscoveryOperator`, and `nocode_rpa.py`'s
367
+ `N8nWebhookTrigger` now take an optional shared `SourceRegistry` and
368
+ call its real `discover()` instead of synthesizing `source_0..
369
+ source_4`. With nothing registered they honestly return zero sources
370
+ (see [`ROADMAP_HONEST.md`](ROADMAP_HONEST.md) §2.1).
371
+ - `pip-audit` (run 2026-09-20 against the `dev,api,mcp,langchain,
372
+ llamaindex,semantic-kernel` extras) found 7 known CVEs in transitive
373
+ dependencies (`werkzeug` via `flask`, `nltk` via `llama-index`) — see
374
+ [`ROADMAP_HONEST.md`](ROADMAP_HONEST.md) §4. Not fixed this pass.
375
+ - No open GitHub issues as of this pass.
376
+
377
+ ## Documentation
378
+
379
+ - [`ROADMAP_HONEST.md`](ROADMAP_HONEST.md) — full, unhedged status:
380
+ what's tested, what's fabricated/broken, technical debt, what's
381
+ explicitly not built.
382
+ - [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) — how the shipped
383
+ package is structured, with a diagram.
384
+ - [`OKF_INTEGRATION.md`](OKF_INTEGRATION.md) — the OKF (Open Knowledge
385
+ Format) catalog/discovery/query-planner feature (real, tested, not
386
+ mentioned elsewhere in this README).
387
+ - [`CONTRIBUTING.md`](CONTRIBUTING.md), [`SECURITY.md`](SECURITY.md),
388
+ [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md),
389
+ [`CHANGELOG.md`](CHANGELOG.md).
390
+
391
+ ## Rust workspace (not shipped)
392
+
393
+ `core/` and `python/src/lib.rs` are an in-progress Rust workspace intended
394
+ as a future performance backend. **It is not part of the published PyPI
395
+ package** — the wheel built from `pyproject.toml` is pure Python. It now
396
+ compiles and its unit/integration tests pass (see the 2026-10-11 entry in
397
+ [Known Issues](#known-issues)), but note the `1.81` toolchain pin: build it
398
+ with `RUSTUP_TOOLCHAIN=1.97 cargo ...`. Don't rely on it as a shipped
399
+ artifact; it's tracked separately from the Python package described in this
400
+ README.
401
+
402
+ ## License
403
+
404
+ This project is licensed under the [Apache License 2.0](LICENSE).