hypertopos-mcp 0.2.0__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 (44) hide show
  1. hypertopos_mcp-0.2.0/.gitignore +31 -0
  2. hypertopos_mcp-0.2.0/CHANGELOG.md +52 -0
  3. hypertopos_mcp-0.2.0/LICENSE +202 -0
  4. hypertopos_mcp-0.2.0/PKG-INFO +10 -0
  5. hypertopos_mcp-0.2.0/README.md +158 -0
  6. hypertopos_mcp-0.2.0/docs/images/mcp-lifecycle.svg +74 -0
  7. hypertopos_mcp-0.2.0/docs/mcp-spec.md +252 -0
  8. hypertopos_mcp-0.2.0/docs/tools.md +1536 -0
  9. hypertopos_mcp-0.2.0/pyproject.toml +21 -0
  10. hypertopos_mcp-0.2.0/src/hypertopos_mcp/__init__.py +5 -0
  11. hypertopos_mcp-0.2.0/src/hypertopos_mcp/enrichment.py +145 -0
  12. hypertopos_mcp-0.2.0/src/hypertopos_mcp/main.py +25 -0
  13. hypertopos_mcp-0.2.0/src/hypertopos_mcp/serializers.py +96 -0
  14. hypertopos_mcp-0.2.0/src/hypertopos_mcp/server.py +601 -0
  15. hypertopos_mcp-0.2.0/src/hypertopos_mcp/tools/__init__.py +2 -0
  16. hypertopos_mcp-0.2.0/src/hypertopos_mcp/tools/_guards.py +77 -0
  17. hypertopos_mcp-0.2.0/src/hypertopos_mcp/tools/aggregation.py +223 -0
  18. hypertopos_mcp-0.2.0/src/hypertopos_mcp/tools/analysis.py +1611 -0
  19. hypertopos_mcp-0.2.0/src/hypertopos_mcp/tools/detection.py +133 -0
  20. hypertopos_mcp-0.2.0/src/hypertopos_mcp/tools/geometry.py +207 -0
  21. hypertopos_mcp-0.2.0/src/hypertopos_mcp/tools/navigation.py +450 -0
  22. hypertopos_mcp-0.2.0/src/hypertopos_mcp/tools/observability.py +328 -0
  23. hypertopos_mcp-0.2.0/src/hypertopos_mcp/tools/session.py +404 -0
  24. hypertopos_mcp-0.2.0/src/hypertopos_mcp/tools/smart.py +1390 -0
  25. hypertopos_mcp-0.2.0/tests/conftest.py +37 -0
  26. hypertopos_mcp-0.2.0/tests/test_agent_trust.py +93 -0
  27. hypertopos_mcp-0.2.0/tests/test_aggregate_gbp_preslice.py +16 -0
  28. hypertopos_mcp-0.2.0/tests/test_anomaly_dimensions.py +65 -0
  29. hypertopos_mcp-0.2.0/tests/test_centroid_hint.py +55 -0
  30. hypertopos_mcp-0.2.0/tests/test_continuous_mode_note.py +99 -0
  31. hypertopos_mcp-0.2.0/tests/test_dead_dims.py +77 -0
  32. hypertopos_mcp-0.2.0/tests/test_detection_tools.py +168 -0
  33. hypertopos_mcp-0.2.0/tests/test_drift_stale_warning.py +79 -0
  34. hypertopos_mcp-0.2.0/tests/test_dynamic_tools.py +245 -0
  35. hypertopos_mcp-0.2.0/tests/test_enrichment.py +237 -0
  36. hypertopos_mcp-0.2.0/tests/test_guards_cap.py +55 -0
  37. hypertopos_mcp-0.2.0/tests/test_jump_polygon_continuous_mode.py +103 -0
  38. hypertopos_mcp-0.2.0/tests/test_pivot_labels.py +243 -0
  39. hypertopos_mcp-0.2.0/tests/test_polygon_temporal_hint.py +37 -0
  40. hypertopos_mcp-0.2.0/tests/test_serializers.py +345 -0
  41. hypertopos_mcp-0.2.0/tests/test_session_stats.py +103 -0
  42. hypertopos_mcp-0.2.0/tests/test_smart_coverage.py +64 -0
  43. hypertopos_mcp-0.2.0/tests/test_smart_tools.py +133 -0
  44. hypertopos_mcp-0.2.0/tests/test_tools.py +5271 -0
@@ -0,0 +1,31 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ .venv/
9
+ venv/
10
+
11
+ # Testing
12
+ .pytest_cache/
13
+ .coverage
14
+ htmlcov/
15
+
16
+ # Type checking
17
+ .mypy_cache/
18
+
19
+ # Linting
20
+ .ruff_cache/
21
+
22
+ # IDE
23
+ .idea/
24
+ .vscode/
25
+ .cursor/
26
+ *.iml
27
+
28
+ # Claude Code
29
+ .claude/
30
+ .worktrees/
31
+ .agents/
@@ -0,0 +1,52 @@
1
+ # Changelog
2
+
3
+ All notable changes to `hypertopos-mcp` will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
+
7
+ ## [0.2.0] — 2026-04-10
8
+
9
+ ### Added
10
+
11
+ - `find_geometric_path` — path finding with geometric coherence scoring (+ amount mode)
12
+ - `discover_chains` — runtime chain discovery without pre-built chain lines
13
+ - `edge_stats` — edge table statistics (row count, degree, timestamp/amount range)
14
+ - `entity_flow` — net flow analysis per counterparty
15
+ - `contagion_score` — anomaly neighborhood scoring for single entity
16
+ - `contagion_score_batch` — batch anomaly neighborhood scoring
17
+ - `degree_velocity` — temporal connection velocity
18
+ - `investigation_coverage` — agent guidance for investigation coverage
19
+ - `propagate_influence` — BFS influence propagation with geometric decay
20
+ - `cluster_bridges` — geometry+graph fusion cluster bridge analysis
21
+ - `anomalous_edges` — event-level edge scoring between entity pairs
22
+ - Output cap (top 20 paths / top 100 influenced) with warning when truncated
23
+
24
+ ### Changed
25
+
26
+ - `find_counterparties` — edge table fast path with BTREE lookup and amount aggregates when `pattern_id` is given
27
+ - `detect_pattern` — edge table tools integrated into smart detection step handlers
28
+ - 3-phase visibility updated: Phase 2 now includes 11 edge table tools after `open_sphere`
29
+
30
+ ---
31
+
32
+ ## [0.1.0] — 2026-04-07
33
+
34
+ First release. 55 MCP tools wrapping hypertopos core library.
35
+
36
+ ### Added
37
+
38
+ - 3-phase tool visibility (always → gateway → full manual)
39
+ - `detect_pattern` meta-tool with 39 step handlers and dependency resolution
40
+ - Session management: `open_sphere`, `close_sphere`, `get_session_stats`
41
+ - Navigation: goto, walk, jump, dive, emerge, position
42
+ - Geometry: polygon, solid, event polygons
43
+ - Anomaly detection: find anomalies, summary, batch check, explain
44
+ - Similarity & comparison: similar entities, pairwise compare, common relations
45
+ - Aggregation with filters, sampling, pivots
46
+ - Population analysis: contrast, centroids, clusters, boundary
47
+ - Hub & network: hubs, neighborhood, counterparties, chains
48
+ - Temporal: solid, hub history, drift, trajectory similarity, time windows, regime changes
49
+ - Risk profiling: cross-pattern profile, composite risk, passive scan
50
+ - `sphere_overview` gateway to full manual mode
51
+
52
+ Apache-2.0 licensed.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Karol Kędzia
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: hypertopos-mcp
3
+ Version: 0.2.0
4
+ Summary: MCP server for hypertopos geometric data sphere
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12
8
+ Requires-Dist: hypertopos
9
+ Requires-Dist: mcp[cli]>=1.20
10
+ Requires-Dist: tzdata>=2024.1
@@ -0,0 +1,158 @@
1
+ # hypertopos-mcp
2
+
3
+ > **MCP server for hypertopos geometric data sphere.**
4
+
5
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
6
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-green.svg)](LICENSE)
7
+ [![MCP](https://img.shields.io/badge/MCP-compatible-green.svg)](https://modelcontextprotocol.io)
8
+ [![Version](https://img.shields.io/badge/version-0.2.0-blue.svg)](pyproject.toml)
9
+
10
+ **hypertopos-mcp** gives AI agents a safe, stateful way to explore Geometric Data Spheres without writing SQL or touching the storage layer. It wraps the [hypertopos](https://github.com/hypertopos/hypertopos-py) core library into 66 MCP tools with automatic context management, 3-phase tool visibility, smart detection recipes, and graph+geometry fusion — runtime graph traversal scored by population-relative geometry, anomaly contagion tracing, influence propagation, and cluster bridge discovery.
11
+
12
+ ## Quick Start
13
+
14
+ ```bash
15
+ pip install hypertopos-mcp
16
+ ```
17
+
18
+ Run the server:
19
+
20
+ ```bash
21
+ hypertopos-mcp
22
+ ```
23
+
24
+ Or as a module:
25
+
26
+ ```bash
27
+ python -m hypertopos_mcp.main
28
+ ```
29
+
30
+ ## Configuration
31
+
32
+ Set `HYPERTOPOS_SPHERE_PATH` so the first tool call can open the sphere automatically.
33
+
34
+ ```json
35
+ {
36
+ "mcpServers": {
37
+ "hypertopos": {
38
+ "command": "hypertopos-mcp",
39
+ "env": {
40
+ "PYTHONPATH": "/path/to/hypertopos-mcp/src:/path/to/hypertopos",
41
+ "HYPERTOPOS_SPHERE_PATH": "/path/to/gds/sphere"
42
+ }
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ Use relative sphere paths when calling `open_sphere`. Absolute Windows paths are not supported.
49
+
50
+ ## Smart Detection
51
+
52
+ The primary entry point after opening a sphere is `detect_pattern(query)` — a meta-tool that plans and executes detection workflows server-side. Describe what you want to find in natural language; the server selects from 39 step handlers, chains them with dependency resolution, and returns filtered, interpreted results in a single round-trip.
53
+
54
+ For manual exploration, call `sphere_overview()` first to unlock granular tools.
55
+
56
+ ## 3-Phase Tool Visibility
57
+
58
+ ![MCP Lifecycle](docs/images/mcp-lifecycle.svg)
59
+
60
+ Tool registration is dynamic to minimize token consumption:
61
+
62
+ | Phase | Trigger | Tools visible |
63
+ |-------|---------|---------------|
64
+ | **Phase 1** | Server start | 3 tools (`open_sphere`, `close_sphere`, `get_session_stats`) |
65
+ | **Phase 2** | `open_sphere` | 16 tools (Phase 1 + gateway + 11 edge table tools) |
66
+ | **Phase 3** | `sphere_overview` | 40-66 tools (full manual toolset, capability-dependent) |
67
+
68
+ ## Recommended First Calls
69
+
70
+ ```python
71
+ open_sphere("benchmark/berka/sphere/gds_berka_banking")
72
+ detect_pattern("find anomalous accounts and explain top findings")
73
+ # — or for manual exploration —
74
+ sphere_overview()
75
+ ```
76
+
77
+ ## Using The MCP
78
+
79
+ ### Claude Code
80
+
81
+ Run `hypertopos-mcp` in the same environment as `hypertopos`, then point your agent session at the workspace that contains the sphere data.
82
+
83
+ ### Claude.ai
84
+
85
+ 1. Install the package in the environment that powers the agent.
86
+ 2. Configure the MCP server command.
87
+ 3. Point `HYPERTOPOS_SPHERE_PATH` at a local sphere directory.
88
+
89
+ ### Cursor
90
+
91
+ Use the package as a local MCP target and keep the sphere path available in the workspace environment. The quickest loop is `open_sphere()` followed by `get_sphere_info()`.
92
+
93
+ ### Codex and other CLI agents
94
+
95
+ Launch `hypertopos-mcp` alongside the agent process and make sure the same Python environment can import `hypertopos_mcp`. The server works best when the sphere path is set before the first tool call.
96
+
97
+ ### Other platforms
98
+
99
+ If the platform supports MCP, wire it to `hypertopos-mcp` and keep a local sphere path available. If it only supports Markdown instructions, pair it with the README plus the relevant `benchmark/` notes for the sphere you are using.
100
+
101
+ ## Tool Groups (66 tools)
102
+
103
+ | Group | Tools | What it covers |
104
+ |-------|:-----:|----------------|
105
+ | Session & Discovery | 10 | Open/close sphere, schema, search (exact, FTS, hybrid), recalibrate |
106
+ | Health & Observability | 6 | Population summary, alerts, data quality, geometry stats, π11/π12 |
107
+ | Navigation | 6 | goto, walk, jump, dive, emerge, position |
108
+ | Geometry | 3 | Polygon, solid, event polygons |
109
+ | Anomaly Detection | 5 | Find anomalies (π5), summary, batch check, explain |
110
+ | Similarity & Comparison | 3 | Similar entities, pairwise compare, common relations |
111
+ | Aggregation | 1 | Count, sum, avg, min, max, median, percentiles, pivots, filters |
112
+ | Population Analysis | 4 | Contrast populations, centroids, clusters (π8), boundary (π6) |
113
+ | Hub & Network | 14 | Hubs (π7), neighborhood, counterparties, chains, flow, contagion, velocity, coverage, influence, bridges, anomalous edges |
114
+ | Temporal | 8 | Solid (dive, get), hub history, drift (π9), trajectory similarity (π10), time windows, regime changes |
115
+ | Risk Profiling | 4 | Cross-pattern profile, composite risk, passive scan |
116
+ | Detection Recipes | 2 | `detect_pattern` meta-tool + `sphere_overview` |
117
+
118
+ Full parameter reference: [docs/tools.md](docs/tools.md)
119
+
120
+ ## Project Layout
121
+
122
+ ```text
123
+ src/hypertopos_mcp/
124
+ |-- __init__.py
125
+ |-- main.py # entry point
126
+ |-- server.py # FastMCP instance and state management
127
+ |-- serializers.py # model to JSON serialization
128
+ |-- enrichment.py # response enrichment helpers
129
+ `-- tools/
130
+ |-- __init__.py
131
+ |-- _guards.py # response-size guards shared across tools
132
+ |-- session.py # sphere, entity discovery, search, calibration
133
+ |-- navigation.py # navigation primitives (pi1-pi6), anomaly scan
134
+ |-- geometry.py # polygon, solid, event polygons
135
+ |-- analysis.py # similarity, risk, counterparties, passive scan
136
+ |-- aggregation.py # fact aggregation with filters and sampling
137
+ |-- observability.py # health checks, alerts, calibration
138
+ |-- detection.py # single-call anomaly category recipes
139
+ `-- smart.py # detect_pattern meta-tool and step handlers
140
+ ```
141
+
142
+ ## Documentation
143
+
144
+ | | |
145
+ |---|---|
146
+ | **[MCP Specification](docs/mcp-spec.md)** | Full server spec: 3-phase loading, 39 step handlers, sampling, resources, prompts |
147
+ | **[Tool Reference](docs/tools.md)** | All MCP tool parameters, return shapes, filters |
148
+ | **[Core Concepts](https://github.com/hypertopos/hypertopos-py/blob/main/docs/concepts.md)** | GDS mental model, objects, mathematical foundation |
149
+ | **[API Reference](https://github.com/hypertopos/hypertopos-py/blob/main/docs/api-reference.md)** | Python API — classes, methods, navigation primitives |
150
+
151
+ ## Notes
152
+
153
+ - `open_sphere` returns status information only; call `get_sphere_info` right after to learn the full schema.
154
+ - Every tool response includes `elapsed_ms` for quick performance checks.
155
+
156
+ ## License
157
+
158
+ [Apache License 2.0](LICENSE)
@@ -0,0 +1,74 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 280" font-family="'Segoe UI', system-ui, -apple-system, sans-serif">
2
+ <defs>
3
+ <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0%" stop-color="#0a0e27"/>
5
+ <stop offset="100%" stop-color="#1a1a3e"/>
6
+ </linearGradient>
7
+ </defs>
8
+
9
+ <rect width="760" height="280" fill="url(#bg)" rx="12"/>
10
+
11
+ <!-- Phase 1 -->
12
+ <g transform="translate(30, 30)">
13
+ <rect x="0" y="0" width="200" height="110" rx="10" fill="#0f2040" stroke="#3b82f6" stroke-width="1.5"/>
14
+ <text x="100" y="26" fill="#60a5fa" font-size="14" font-weight="700" text-anchor="middle">Phase 1</text>
15
+ <text x="100" y="44" fill="#93c5fd" font-size="10" text-anchor="middle">Server start</text>
16
+ <line x1="20" y1="52" x2="180" y2="52" stroke="#1e3a5f" stroke-width="0.5"/>
17
+ <text x="100" y="70" fill="#ccd6f6" font-size="10" text-anchor="middle">3 tools</text>
18
+ <text x="100" y="86" fill="#8892b0" font-size="8" text-anchor="middle">open_sphere</text>
19
+ <text x="100" y="98" fill="#8892b0" font-size="8" text-anchor="middle">close_sphere · get_session_stats</text>
20
+ </g>
21
+
22
+ <!-- Arrow 1→2 -->
23
+ <g transform="translate(238, 85)">
24
+ <line x1="0" y1="0" x2="44" y2="0" stroke="#f59e0b" stroke-width="2"/>
25
+ <polygon points="44,-5 54,0 44,5" fill="#f59e0b"/>
26
+ <text x="27" y="-8" fill="#fbbf24" font-size="9" font-weight="600" text-anchor="middle">open_sphere</text>
27
+ </g>
28
+
29
+ <!-- Phase 2 -->
30
+ <g transform="translate(300, 30)">
31
+ <rect x="0" y="0" width="200" height="110" rx="10" fill="#1a1500" stroke="#f59e0b" stroke-width="1.5"/>
32
+ <text x="100" y="26" fill="#fbbf24" font-size="14" font-weight="700" text-anchor="middle">Phase 2</text>
33
+ <text x="100" y="44" fill="#fcd34d" font-size="10" text-anchor="middle">Sphere open</text>
34
+ <line x1="20" y1="52" x2="180" y2="52" stroke="#3a2a00" stroke-width="0.5"/>
35
+ <text x="100" y="70" fill="#ccd6f6" font-size="10" text-anchor="middle">16 tools</text>
36
+ <text x="100" y="86" fill="#8892b0" font-size="8" text-anchor="middle">detect_pattern (smart mode)</text>
37
+ <text x="100" y="98" fill="#8892b0" font-size="8" text-anchor="middle">sphere_overview (manual mode)</text>
38
+ </g>
39
+
40
+ <!-- Arrow 2→3 -->
41
+ <g transform="translate(508, 85)">
42
+ <line x1="0" y1="0" x2="44" y2="0" stroke="#2ed573" stroke-width="2"/>
43
+ <polygon points="44,-5 54,0 44,5" fill="#2ed573"/>
44
+ <text x="27" y="-8" fill="#2ed573" font-size="9" font-weight="600" text-anchor="middle">sphere_overview</text>
45
+ </g>
46
+
47
+ <!-- Phase 3 -->
48
+ <g transform="translate(570, 30)">
49
+ <rect x="0" y="0" width="170" height="110" rx="10" fill="#001a0a" stroke="#2ed573" stroke-width="1.5"/>
50
+ <text x="85" y="26" fill="#2ed573" font-size="14" font-weight="700" text-anchor="middle">Phase 3</text>
51
+ <text x="85" y="44" fill="#6ee7b7" font-size="10" text-anchor="middle">Full manual</text>
52
+ <line x1="15" y1="52" x2="155" y2="52" stroke="#003a1a" stroke-width="0.5"/>
53
+ <text x="85" y="70" fill="#ccd6f6" font-size="10" text-anchor="middle">40–66 tools</text>
54
+ <text x="85" y="86" fill="#8892b0" font-size="8" text-anchor="middle">navigation · geometry</text>
55
+ <text x="85" y="98" fill="#8892b0" font-size="8" text-anchor="middle">analysis · detection · ...</text>
56
+ </g>
57
+
58
+ <!-- Bottom: Smart vs Manual -->
59
+ <g transform="translate(30, 165)">
60
+ <rect x="0" y="0" width="340" height="85" rx="10" fill="#1a1500" stroke="#f59e0b" stroke-width="1"/>
61
+ <text x="170" y="24" fill="#fbbf24" font-size="13" font-weight="700" text-anchor="middle">Smart Mode</text>
62
+ <text x="170" y="42" fill="#ccd6f6" font-size="10" text-anchor="middle">detect_pattern("find anomalous accounts")</text>
63
+ <text x="170" y="58" fill="#8892b0" font-size="9" text-anchor="middle">39 step handlers · server-side chaining</text>
64
+ <text x="170" y="72" fill="#8892b0" font-size="9" text-anchor="middle">1 round-trip → filtered, interpreted results</text>
65
+ </g>
66
+
67
+ <g transform="translate(390, 165)">
68
+ <rect x="0" y="0" width="340" height="85" rx="10" fill="#001a0a" stroke="#2ed573" stroke-width="1"/>
69
+ <text x="170" y="24" fill="#2ed573" font-size="13" font-weight="700" text-anchor="middle">Manual Mode</text>
70
+ <text x="170" y="42" fill="#ccd6f6" font-size="10" text-anchor="middle">sphere_overview → find_anomalies → explain</text>
71
+ <text x="170" y="58" fill="#8892b0" font-size="9" text-anchor="middle">66 tools · agent-driven exploration</text>
72
+ <text x="170" y="72" fill="#8892b0" font-size="9" text-anchor="middle">full control over each step</text>
73
+ </g>
74
+ </svg>