hatun-mcp 1.0.3__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 (65) hide show
  1. hatun_mcp-1.0.3/LICENSE +202 -0
  2. hatun_mcp-1.0.3/PKG-INFO +469 -0
  3. hatun_mcp-1.0.3/README.md +450 -0
  4. hatun_mcp-1.0.3/hatun_mcp/__init__.py +11 -0
  5. hatun_mcp-1.0.3/hatun_mcp/adapters/__init__.py +65 -0
  6. hatun_mcp-1.0.3/hatun_mcp/adapters/a11oy.py +42 -0
  7. hatun_mcp-1.0.3/hatun_mcp/adapters/anatomy.py +85 -0
  8. hatun_mcp-1.0.3/hatun_mcp/adapters/base.py +392 -0
  9. hatun_mcp-1.0.3/hatun_mcp/adapters/companion.py +66 -0
  10. hatun_mcp-1.0.3/hatun_mcp/adapters/immune.py +97 -0
  11. hatun_mcp-1.0.3/hatun_mcp/adapters/killinchu.py +36 -0
  12. hatun_mcp-1.0.3/hatun_mcp/adapters/llm.py +785 -0
  13. hatun_mcp-1.0.3/hatun_mcp/adapters/second_brain.py +577 -0
  14. hatun_mcp-1.0.3/hatun_mcp/backends.py +1226 -0
  15. hatun_mcp-1.0.3/hatun_mcp/console.py +13 -0
  16. hatun_mcp-1.0.3/hatun_mcp/console_v2.py +229 -0
  17. hatun_mcp-1.0.3/hatun_mcp/deployment.py +76 -0
  18. hatun_mcp-1.0.3/hatun_mcp/dsse.py +204 -0
  19. hatun_mcp-1.0.3/hatun_mcp/formula_receipts.py +137 -0
  20. hatun_mcp-1.0.3/hatun_mcp/formulas.py +461 -0
  21. hatun_mcp-1.0.3/hatun_mcp/governance.py +546 -0
  22. hatun_mcp-1.0.3/hatun_mcp/loop.py +190 -0
  23. hatun_mcp-1.0.3/hatun_mcp/payment_context.py +580 -0
  24. hatun_mcp-1.0.3/hatun_mcp/puriq.py +212 -0
  25. hatun_mcp-1.0.3/hatun_mcp/quorum.py +389 -0
  26. hatun_mcp-1.0.3/hatun_mcp/server.py +913 -0
  27. hatun_mcp-1.0.3/hatun_mcp/server_http.py +996 -0
  28. hatun_mcp-1.0.3/hatun_mcp/state.py +278 -0
  29. hatun_mcp-1.0.3/hatun_mcp/tools/__init__.py +27 -0
  30. hatun_mcp-1.0.3/hatun_mcp/tools/governance_tools.py +207 -0
  31. hatun_mcp-1.0.3/hatun_mcp.egg-info/PKG-INFO +469 -0
  32. hatun_mcp-1.0.3/hatun_mcp.egg-info/SOURCES.txt +63 -0
  33. hatun_mcp-1.0.3/hatun_mcp.egg-info/dependency_links.txt +1 -0
  34. hatun_mcp-1.0.3/hatun_mcp.egg-info/requires.txt +7 -0
  35. hatun_mcp-1.0.3/hatun_mcp.egg-info/top_level.txt +1 -0
  36. hatun_mcp-1.0.3/pyproject.toml +43 -0
  37. hatun_mcp-1.0.3/setup.cfg +4 -0
  38. hatun_mcp-1.0.3/tests/test_adapters.py +184 -0
  39. hatun_mcp-1.0.3/tests/test_bls_key_isolation.py +71 -0
  40. hatun_mcp-1.0.3/tests/test_chain_gate.py +169 -0
  41. hatun_mcp-1.0.3/tests/test_console_state.py +170 -0
  42. hatun_mcp-1.0.3/tests/test_dependency_contract.py +47 -0
  43. hatun_mcp-1.0.3/tests/test_formula_receipts.py +239 -0
  44. hatun_mcp-1.0.3/tests/test_formulas.py +96 -0
  45. hatun_mcp-1.0.3/tests/test_generic_validation.py +332 -0
  46. hatun_mcp-1.0.3/tests/test_github_estate_snapshot.py +647 -0
  47. hatun_mcp-1.0.3/tests/test_governance.py +333 -0
  48. hatun_mcp-1.0.3/tests/test_hf_deploy_contract.py +208 -0
  49. hatun_mcp-1.0.3/tests/test_http_admission.py +289 -0
  50. hatun_mcp-1.0.3/tests/test_http_payment_admission.py +368 -0
  51. hatun_mcp-1.0.3/tests/test_http_routes.py +460 -0
  52. hatun_mcp-1.0.3/tests/test_ledger_forward.py +47 -0
  53. hatun_mcp-1.0.3/tests/test_loop.py +156 -0
  54. hatun_mcp-1.0.3/tests/test_no_mock.py +49 -0
  55. hatun_mcp-1.0.3/tests/test_owned_model_preflight.py +67 -0
  56. hatun_mcp-1.0.3/tests/test_owned_models.py +264 -0
  57. hatun_mcp-1.0.3/tests/test_payment_context.py +490 -0
  58. hatun_mcp-1.0.3/tests/test_puriq_real.py +117 -0
  59. hatun_mcp-1.0.3/tests/test_quorum.py +377 -0
  60. hatun_mcp-1.0.3/tests/test_quorum_preflight.py +368 -0
  61. hatun_mcp-1.0.3/tests/test_receipt_ownership.py +107 -0
  62. hatun_mcp-1.0.3/tests/test_second_brain_anatomy.py +30 -0
  63. hatun_mcp-1.0.3/tests/test_second_brain_bounded.py +596 -0
  64. hatun_mcp-1.0.3/tests/test_second_brain_public_path.py +101 -0
  65. hatun_mcp-1.0.3/tests/test_server.py +467 -0
@@ -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 [yyyy] [name of copyright owner]
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,469 @@
1
+ Metadata-Version: 2.4
2
+ Name: hatun-mcp
3
+ Version: 1.0.3
4
+ Summary: Governed MCP gateway: policy gate on every tool call, hash-chained DSSE receipt on every result.
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://a-11-oy.com
7
+ Project-URL: Source, https://github.com/szl-holdings/hatun-mcp
8
+ Requires-Python: >=3.12
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: mcp<3,>=2.3.0
12
+ Requires-Dist: httpx>=0.28.1
13
+ Requires-Dist: starlette>=1.10.0
14
+ Requires-Dist: uvicorn[standard]>=0.54.0
15
+ Requires-Dist: cryptography>=50.0.2
16
+ Requires-Dist: PyJWT<3,>=2.15.1
17
+ Requires-Dist: py_ecc>=8.0.0
18
+ Dynamic: license-file
19
+
20
+ ---
21
+ title: Hatun MCP — Governed Agent Gateway
22
+ emoji: 🪢
23
+ colorFrom: indigo
24
+ colorTo: blue
25
+ sdk: docker
26
+ app_port: 7860
27
+ pinned: false
28
+ license: apache-2.0
29
+ short_description: Source-bound MCP gateway with governance receipts
30
+ ---
31
+
32
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
33
+ [![Doctrine v11 LOCKED](https://img.shields.io/badge/Doctrine-v11_LOCKED-d4a444.svg)](https://github.com/szl-holdings/lutar-lean)
34
+ [![CI](https://github.com/szl-holdings/hatun-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/szl-holdings/hatun-mcp/actions/workflows/ci.yml)
35
+ [![SLSA](https://img.shields.io/badge/SLSA-L1_honest_%C2%B7_L2_roadmap-22c55e.svg)](https://slsa.dev/spec/v1.0/levels)
36
+
37
+ <div align="center">
38
+
39
+ # 🪢 hatun-mcp
40
+
41
+ **The great context protocol** — *hatun* (Quechua) = "big / great".
42
+
43
+ The **one MCP endpoint** that aggregates the SZL backend services — the
44
+ **a11oy** command platform (and its live immune, companion and llm-router organs)
45
+ plus **killinchu** (drones & vessels) — under PURIQ governance and re-exposes their
46
+ tools to any MCP client. Receipts are DSSE-signed only when an operator signing key
47
+ is configured; without one the signer runs in explicit `PLACEHOLDER` mode and
48
+ `/readyz` reports `not_ready` (see [signing](docs/DSSE_KEY_INJECTION.md)).
49
+
50
+ [Hatun Gateway](https://a-11-oy.com/wires) ·
51
+ [GitHub Org](https://github.com/szl-holdings) ·
52
+ [LLM Router](https://github.com/szl-holdings/szl-router)
53
+
54
+ </div>
55
+
56
+ > **Canonical runtime source.** This repository owns the Python gateway, governed tool
57
+ > catalog, Streamable HTTP transport, and container contract. The standalone Hatun Hugging
58
+ > Face publisher was retired on September 3, 2026; `hf-deploy` must not be recreated.
59
+ > The public product experience is [Hatun Gateway](https://a-11-oy.com/wires), which is not
60
+ > itself proof that this package's `/mcp/` endpoint or a newly added tool is deployed.
61
+ > See the [surface contract](docs/HATUN_SURFACE_CONTRACT.md). The monorepo copy at
62
+ > [`platform/packages/hatun-mcp`](https://github.com/szl-holdings/platform/tree/main/packages/hatun-mcp)
63
+ > is a **non-canonical embedded copy** (it carries `CANONICAL.md` pointing here) that exposes a
64
+ > smaller tool set for local imports and must not diverge from this server's contracts. Folding
65
+ > the platform copy in is a later founder step; repos are **not deleted** here. Λ = **Conjecture
66
+ > 1** (advisory) is preserved verbatim.
67
+
68
+ <!-- szl:header v1 -->
69
+ <!-- Native identity: szl-brand@4309f6fce89179331b0b3ed8c99494e76c5be256; Orbit v2 icon. -->
70
+ <p>
71
+ <a href="https://github.com/szl-holdings">
72
+ <img src="https://raw.githubusercontent.com/szl-holdings/szl-brand/4309f6fce89179331b0b3ed8c99494e76c5be256/kit/logos/orbit-v2/suite/szl-icon-32.svg" alt="SZL Holdings — Orbit v2" width="32" height="32" />
73
+ </a>
74
+ </p>
75
+
76
+ **Control before action. Evidence after.**
77
+
78
+ [Product](https://a-11-oy.com) · [Proof](https://a11oy.net) · [GitHub organization](https://github.com/szl-holdings)
79
+ <!-- /szl:header -->
80
+
81
+ <div align="center">
82
+
83
+ `receipts.in ≡ receipts.out`
84
+
85
+ </div>
86
+
87
+ ---
88
+
89
+ ## What this is
90
+
91
+ A **real, operational** Model Context Protocol server built on the official `mcp`
92
+ Python SDK 2.x (`mcp.server.mcpserver.MCPServer`, formerly `FastMCP`). Every tool call is governed by the PURIQ
93
+ formula:
94
+
95
+ 1. **Authenticate** the client (SZL API key → `client_id`, or, when the operator enables it,
96
+ a Cloudflare x402 `PAYMENT-CONTEXT` verified at this origin → `x402:<digest>`); anonymous
97
+ calls are declined.
98
+ 2. **Yuyay-13 gate** on the input (input-as-data; OWASP MCP06 injection defense).
99
+ 3. **Reputation** factor `Hatun_MCP(client) ∈ [0,1]`.
100
+ 4. **2-person Yuyay gate** for state-changing tools (e.g. `killinchu_cue`, `halt_drone`).
101
+ 5. Call the **real organ backend** within a latency budget.
102
+ 6. Mint a **Khipu receipt** on success **and** failure (append-only sha256 DAG).
103
+ 7. Return a **DSSE-signed** response — the client receives the **receipt hash**.
104
+
105
+ ### Choose your route
106
+
107
+ | Audience | Start here | Evidence boundary |
108
+ |----------|------------|-------------------|
109
+ | **Developer** | [Run locally](#run-locally-stdio), then inspect `tools/list` | Local startup proves only the local process; backend reachability is separate |
110
+ | **Integrator** | [MCP client setup](#mcp-client-setup) | The checked-in client configuration is **SAMPLE** and does not include credentials |
111
+ | **Evaluator** | [Hosted health contracts](#evaluate-the-hosted-contract), then [Tests](#tests) | `/healthz` is liveness; `/readyz` is signed-release readiness; neither is an uptime guarantee |
112
+
113
+ ### KANCHAY status contract
114
+
115
+ - **LIVE**: a runtime-backed route with source and observation time. It never means perpetual
116
+ availability.
117
+ - **PARTIAL**: Hatun is locally ready, but one or more required upstream organ observations are
118
+ missing, stale, or degraded.
119
+ - **SAMPLE**: checked-in configuration, payload, or transcript for reuse; not observed runtime
120
+ evidence.
121
+ - **SIMULATED**: a mocked backend or hermetic test fixture. CI intentionally uses these where
122
+ external services would make tests nondeterministic.
123
+ - **UNAVAILABLE**: the dependency or readiness check cannot produce a usable result. Preserve the
124
+ reason and do not substitute sample data.
125
+
126
+ ### Tools exposed
127
+
128
+ - **29 static tools** registered at import (verifiable: `tools/list` returns 29 with
129
+ `HATUN_MCP_DISABLE_DYNAMIC=true`):
130
+ - **23 `szl_*` tools** — `szl_a11oy_code_chat`, `szl_a11oy_operator_reason`, `szl_a11oy_sentinel_scan`,
131
+ `szl_anatomy_3d_render`, `szl_doctrine_lookup`, `szl_drone_lookup`,
132
+ `szl_battery_score`, `szl_formula_evaluate`, `szl_frontier_chain_read`, `szl_github_estate_snapshot`, `szl_holo_cells`, `szl_khipu_verify`, `szl_killinchu_cue`,
133
+ `szl_killinchu_detect`, `szl_lean_verify`, `szl_puriq_evaluate`,
134
+ `szl_companion_reason`, `szl_immune_scan`, `szl_thesis_query`, `szl_wayra_recent`,
135
+ `szl_yachay_dome_predict`, `szl_yuyay_score`, and **`szl_lambda_quorum`** (Byzantine Λ verdict).
136
+ > Two tools were **renamed 2026-06-16** to honest organ names —
137
+ > `szl_immune_scan` (was the retired codename scan tool) and
138
+ > `szl_companion_reason` (was the retired codename reason tool). See
139
+ > [`DEPRECATED.md`](DEPRECATED.md) for the old→new mapping. The old names are
140
+ > **not** served (they are not registered in `tools/list`).
141
+ - **6 governance tools** — `yuyay_gate_check`, `khipu_append_and_verify`,
142
+ `dsse_sign`, `mesh_quorum_status`, `puriq_master_tool`, `governance_pacbayes_bound`.
143
+ - **Service-derived tools** registered *dynamically* at startup from each backend
144
+ service's live catalog at `/api/<service>/v1/mcp/tools`, named `<service>_<tool>`. The
145
+ dynamic count is **probe-dependent**: it equals 29 + (whatever the reachable services
146
+ publish), and is 0 extra when dynamic registration is disabled or all services are
147
+ unreachable.
148
+
149
+ ### Frontier chain + receipt organism (v8)
150
+
151
+ Three fixed-endpoint frontier tools (2026-11-15):
152
+
153
+ - **`szl_frontier_chain_read`** — bounded GET against the fixed public
154
+ `SZLHOLDINGS/frontier-54-runs` dataset tree API (path-validated sub-tree,
155
+ byte budget, canonical digest). Accepts no URL, token, or mutation.
156
+ - **`szl_battery_score`** — reads one estate-battery receipt from the same fixed
157
+ dataset and returns the score **AS MEASURED** under a typed contract
158
+ (`kind: szl.estate-battery/mass-training`, `state: MEASURED`, string score).
159
+ A receipt that fails the contract is an honest mismatch, never a guess.
160
+ - **`szl_holo_cells`** — pure local deterministic port of the anatomy v4 Λ·HOLO
161
+ cell math (FNV-1a hash onto the declared trefoil spine; Λ = Conjecture 1
162
+ stays a conjecture). No network call: the same chain renders the same
163
+ organism — the picture is the hash. The port is pinned by a parity test
164
+ against the deployed `v4_holo.js` executed under node.
165
+
166
+ ### Public GitHub estate evidence
167
+
168
+ Call `szl_github_estate_snapshot` with `{}` to observe the fixed public
169
+ `szl-holdings` organization. This is a structural inventory tool, not an LLM
170
+ answer or a merge bot. It accepts no organization, URL, token, cursor, or other
171
+ argument. GitHub access uses tokenless, redirect-disabled GETs to a fixed
172
+ origin; environment credentials and proxies are not inherited by that client.
173
+
174
+ The observer reports repository identities and default-branch names, bounded
175
+ open-PR base/head SHAs, draft state, and check runs queried at those exact head
176
+ SHAs. Citations include request paths and parameters, response byte lengths and
177
+ SHA-256 digests. A canonical snapshot digest is included in the Khipu receipt
178
+ and its DSSE payload; a configured P-256 key signs that receipt. Without a key,
179
+ the envelope remains explicitly `PLACEHOLDER` with no signatures. A digest or a
180
+ complete inventory is not an independent witness or a cryptographic signature.
181
+
182
+ Hard per-call limits: 15 seconds, 20 requests, 3 repository pages (300 records),
183
+ 50 open PR search results, 100 check runs per PR, 1 MiB of accepted response-body
184
+ data per response and 4 MiB accepted across the call. Exhaustion stops queued
185
+ requests and further body acceptance. These are application acceptance limits,
186
+ not a measurement of wire traffic or transport prefetch; already-delivered but
187
+ rejected bytes are not counted as accepted. Overflow, timeouts, rate limits, malformed
188
+ records, stale PR search evidence, and absent or unrecognized check results
189
+ produce explicit gaps and `INCOMPLETE` or `UNAVAILABLE`. Zero checks are
190
+ `UNKNOWN`, never success. `COMPLETE` means the declared observation scope was
191
+ covered; failed CI may still be completely observed. It does not mean the
192
+ estate is operational or safe to merge.
193
+
194
+ This v1 deliberately does not attest private repositories, resolved default
195
+ branch heads, legacy commit-status contexts, reviews, protection rules, merge
196
+ eligibility, HF publication, model quality/training, or deployed runtime health.
197
+ Its multiple requests are not an atomic provider snapshot. Each response is
198
+ input data, not instructions. Normal Hatun authentication and receipt handling
199
+ still apply, including optional operator-configured `SZL_RECEIPT_SINK`
200
+ forwarding; the GitHub observer performs no provider mutations.
201
+
202
+ > **Naming note.** The three previously-codenamed backends were **purged**; their
203
+ > capabilities are now served directly by the **live honest a11oy organs** on
204
+ > `a-11-oy.com`: the **immune** organ (egress policy/gates inspector — *Hukulla*),
205
+ > the **companion** organ (operator / reasoning console), and the **llm** organ
206
+ > (open-LLM tier router). Hatun-MCP addresses them by these honest role names; the
207
+ > live routes are published in `/openapi.json`.
208
+
209
+ ### Recorded reachability snapshot (HONESTY OVER CHECKLIST)
210
+
211
+ The table below records repository evidence dated **2026-06-16**. It is not a current health
212
+ probe. `/healthz` and `/readyz` establish Hatun's local process, receipt chain, and signer only;
213
+ they do not probe the upstream organs. Before presenting any row as currently **LIVE**, make a
214
+ separate bounded, read-only probe of that row's listed route (or a documented non-mutating
215
+ readiness route), and record the response status, source, and observation timestamp. For
216
+ POST-only or state-changing surfaces, use a pre-authorized non-mutating contract probe or a
217
+ timestamped receipt; never trigger an action merely to claim availability. If any required
218
+ upstream observation is missing, stale, or unusable, present that row as **PARTIAL** or
219
+ **UNAVAILABLE**.
220
+
221
+ | Backend organ | Catalog route | Recorded state (2026-06-16) |
222
+ |-----------------|---------------|-------------------|
223
+ | a11oy — **llm** open-LLM tier router | `GET /api/a11oy/v1/llm/tiers` | **LIVE (200)** — `llm_tiers` derived from the live tier catalog |
224
+ | killinchu | `/api/killinchu/v1/mcp/tools` | **LIVE** — 4 tools (cue/halt_drone are 2-person) |
225
+ | a11oy — **companion** operator / reasoning console | `/api/a11oy/v1/companion/{ask,act,recommend}` | **LIVE (200)** — 3 tools derived from live action routes (no JSON `/v1/mcp/tools` catalog) |
226
+ | a11oy — **immune** (Hukulla) egress policy inspector | `GET /api/a11oy/v1/immune/gates` | **LIVE (200, gates-derived)** — gates + `screen`/`verdict`; the immune *screen* is the signed `/immune/verdict` route (there is no separate `/screen`) |
227
+ | a11oy — command / flagship | `/api/a11oy/v1/mcp/tools` | Registers a11oy-flagship tools when the JSON catalog is exposed, else one honest `a11oy_status` tool. **Self-heals** on the next server restart once the catalog returns 200 — no code change, no fabricated stubs. |
228
+
229
+ > **Purge note (2026-06-16).** The three previously-codenamed backends were purged
230
+ > (their old routes now 404). Hatun-MCP was repointed to the **live honest a11oy
231
+ > twins** above and verified 200 before wiring. No tool is ever pointed at a 404;
232
+ > where a sub-route does not exist (e.g. `/immune/screen`) the tool maps to the
233
+ > closest real route (`/immune/verdict`) and the mapping is disclosed in the
234
+ > adapter docstring and the catalog `reason`.
235
+
236
+ ### Byzantine quorum + BLS aggregate
237
+
238
+ `szl_lambda_quorum` fans a governance-critical Λ verdict out to the five backend services
239
+ and decides under a **Byzantine n ≥ 3f+1 quorum (n=5, f=1)**: ≥ 4 services must be reachable
240
+ and ≥ 3 must agree. Participating receipts are **BLS12-381 aggregated** (`py_ecc`;
241
+ honest sha256 Merkle-root fallback if the BLS backend is absent). If any organ's
242
+ policy route is not live, quorum degrades gracefully (n=4 still satisfies n ≥ 3f+1)
243
+ and discloses the degradation in `governance.quorum`.
244
+
245
+ The BLS keys are held by the **gateway process**, which signs its observations
246
+ under per-organ key labels. This is not a collection of independently signed
247
+ organ attestations. Without `HATUN_MCP_BLS_SEED`, each aggregator instance uses
248
+ a random ephemeral seed; its identity changes on restart. Responses include
249
+ ordered `public_keys`, `key_source`, and `ephemeral` so consumers can distinguish
250
+ signature verification from trusted identity. Pin or authenticate the public
251
+ keys separately before relying on origin claims. For a persistent identity,
252
+ supply a private, high-entropy seed through the secret store; never use the
253
+ retired public default `hatun-mcp-doctrine-v11` as a configured secret. Receipts
254
+ made with that historical default cannot establish an exclusive signer identity.
255
+
256
+ ---
257
+
258
+ ## Run locally (stdio)
259
+
260
+ ```bash
261
+ pip install -r requirements.txt
262
+ python -m hatun_mcp.server # stdio mode for Claude Desktop / Codex
263
+ ```
264
+
265
+ ## Run hosted (Streamable HTTP)
266
+
267
+ ```bash
268
+ uvicorn hatun_mcp.server_http:app --host 0.0.0.0 --port 7860
269
+ # MCP endpoint: http://127.0.0.1:7860/mcp/ (stateless Streamable HTTP)
270
+ # Process liveness: http://127.0.0.1:7860/healthz
271
+ # Signed-release and operator-binding readiness: http://127.0.0.1:7860/readyz
272
+ ```
273
+
274
+ Configure an existing admitted operator key using the explicit scope binding in
275
+ [HTTP operator admission](docs/HTTP_AUTHENTICATION.md). HTTP exposes only the
276
+ three documented read capabilities and the locked-doctrine resource; the full
277
+ local package catalog is not HTTP permission. Legacy SSE and message endpoints
278
+ are disabled: admitted requests to `/sse` or `/messages` return `410`, and
279
+ discovery reports `sse_endpoint: null`. Use `/mcp/` for hosted clients.
280
+
281
+ The DSSE signing key is injected at runtime via the `HATUN_MCP_SIGNING_KEY` (PEM)
282
+ operator-managed secret; without it the signer runs in honest `PLACEHOLDER` mode (clearly
283
+ labeled, never a fake signature).
284
+
285
+ `/healthz` proves that the process and local receipt chain can answer. `/readyz`
286
+ is the fail-closed investor/deployment contract: it returns `200` only when the
287
+ receipt chain verifies, a non-placeholder signing key is active, and an explicit
288
+ operator scope binding is configured; otherwise it
289
+ returns `503` with the failing check named. The public server card advertises only
290
+ the schemes this process accepts: `apiKey`, plus `x402` when payment admission is on.
291
+
292
+ Optional x402 payment admission lets a request that Cloudflare Monetization Gateway
293
+ charged use the same read-only HTTP profile. Hatun verifies the gateway's Ed25519
294
+ `PAYMENT-CONTEXT` JWT against the pinned JWKS and refuses the request if the keys
295
+ cannot be fetched (fail closed). For `upto` it reports `PAYMENT-SETTLEMENT`. It is off
296
+ unless `HATUN_MCP_X402_SCHEME` is set. The settings, admission rules, settlement
297
+ behaviour and proof boundary are in
298
+ [HTTP operator admission](docs/HTTP_AUTHENTICATION.md#x402-payment-admission-cloudflare-monetization-gateway).
299
+
300
+ ### MCP manifest attestation
301
+
302
+ `GET /.well-known/mcp-manifest-attestation` returns a cached integrity binding for
303
+ the exact raw bytes served by `GET /.well-known/mcp` (all server-card aliases serve
304
+ those same bytes). It contains a deterministic
305
+ [`https://in-toto.io/Statement/v1`](https://in-toto.io/Statement/v1) with SHA-256
306
+ subject digest and the custom predicate type
307
+ `https://szlholdings.com/attestations/mcp-manifest/v1`. When the existing P-256
308
+ signing key is configured, the statement is carried in a real DSSE envelope whose
309
+ `payloadType` is `application/vnd.in-toto+json`. Without that key, the response is
310
+ explicitly `signing.state=UNSIGNED` with `dsseEnvelope=null`; an empty signature is
311
+ never presented as signed.
312
+
313
+ The artifact is built once at process start and accepts no caller-supplied signing
314
+ payload. It does not mint a Khipu receipt. Its scope is byte integrity only: it does
315
+ not attest runtime tool parity, upstream availability, or the behavior behind the
316
+ card. The MCP server card and this well-known route are an SZL **DRAFT extension**,
317
+ not a claim of a ratified MCP discovery standard. `keyid` is only a hint; verifiers
318
+ must establish trust in the P-256 public key out of band (the same-origin `/pubkey`
319
+ route is not an independent trust anchor). Transparency-log inclusion remains
320
+ explicitly unavailable.
321
+
322
+ ## Evaluate the hosted contract
323
+
324
+ ```bash
325
+ curl -i http://127.0.0.1:7860/healthz
326
+ curl -i http://127.0.0.1:7860/readyz
327
+ curl -s http://127.0.0.1:7860/api/console-state
328
+ ```
329
+
330
+ `/api/console-state` (`hatun_mcp/state.py`) is the read behind the human console at `/`.
331
+ The commands above target your locally started server. For a deployment, use
332
+ its admitted operator-provided origin, not the retired standalone Space host.
333
+ It is assembled in-request from this process only: the tool catalogue is enumerated from
334
+ the LIVE FastMCP registry (not a hand-maintained list), the receipt depth and head hash
335
+ come from the live Khipu chain, and `card_parity` reports a MEASURED comparison between
336
+ the published server card and that runtime registry. Anything it cannot read is returned
337
+ with an honest label (`UNAVAILABLE`) and no number — there is no seeded snapshot, so the
338
+ console shows `UNAVAILABLE` rather than a stale value when a reading fails. It mints no
339
+ receipt and attests nothing beyond the reading itself.
340
+
341
+ Record the response status and observation time. Report `healthz=200` as Hatun process liveness
342
+ only. Report `readyz=200` as Hatun's repository-defined local receipt-chain and signer readiness
343
+ only. These checks do not establish killinchu or a11oy organ availability. Before labeling any
344
+ upstream row **LIVE**, separately run a bounded, read-only probe of its listed route (or a
345
+ documented non-mutating readiness route) and record the route, response status, source, and
346
+ observation timestamp. For POST-only or state-changing surfaces, require a pre-authorized
347
+ non-mutating contract probe or timestamped receipt instead of triggering an action. If Hatun is
348
+ ready but an upstream observation is missing, stale, or unusable, report that row as **PARTIAL**
349
+ or **UNAVAILABLE**. Never fall back to the sample client configuration.
350
+
351
+ ---
352
+
353
+ ## MCP client setup
354
+
355
+ ### Claude Desktop
356
+ The snippets below are **SAMPLE local-server configurations**. Start the HTTP
357
+ server first, configure an accepted API key, and replace `szl_YOUR_KEY`. For a
358
+ remote deployment, substitute the admitted operator-provided HTTPS MCP URL.
359
+ Drop `examples/claude-desktop-config.json` into
360
+ `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) /
361
+ `%APPDATA%\Claude\claude_desktop_config.json` (Windows), replacing `szl_YOUR_KEY`:
362
+
363
+ ```json
364
+ {
365
+ "mcpServers": {
366
+ "hatun-mcp": {
367
+ "command": "npx",
368
+ "args": ["-y", "mcp-remote",
369
+ "http://127.0.0.1:7860/mcp/",
370
+ "--header", "Authorization: Bearer szl_YOUR_KEY"]
371
+ }
372
+ }
373
+ }
374
+ ```
375
+
376
+ ### Codex (`~/.codex/config.toml`)
377
+ ```toml
378
+ [mcp_servers.hatun-mcp]
379
+ command = "npx"
380
+ args = ["-y", "mcp-remote", "http://127.0.0.1:7860/mcp/",
381
+ "--header", "Authorization: Bearer szl_YOUR_KEY"]
382
+ ```
383
+
384
+ ### Continue (`~/.continue/config.json`)
385
+ ```json
386
+ {
387
+ "experimental": {
388
+ "modelContextProtocolServers": [
389
+ {
390
+ "transport": {
391
+ "type": "stdio",
392
+ "command": "npx",
393
+ "args": ["-y", "mcp-remote",
394
+ "http://127.0.0.1:7860/mcp/",
395
+ "--header", "Authorization: Bearer szl_YOUR_KEY"]
396
+ }
397
+ }
398
+ ]
399
+ }
400
+ }
401
+ ```
402
+
403
+ ---
404
+
405
+ ## Tests
406
+
407
+ ```bash
408
+ HATUN_MCP_DISABLE_DYNAMIC=true python -m pytest tests/ -q
409
+ # tests/test_server.py — list tools, call a tool, assert response shape
410
+ # tests/test_github_estate_snapshot.py — bounded public GitHub observer, mocked provider
411
+ # tests/test_quorum.py — quorum math + threshold edge cases + BLS aggregate
412
+ # tests/test_adapters.py — mocked organ endpoints, adapter wiring + honest gaps
413
+ # tests/test_governance.py— Khipu chain, Yuyay gate, PURIQ factor (pre-existing)
414
+ # tests/test_http_routes.py — exact-byte card attestation + public HTTP contracts
415
+ # tests/test_payment_context.py — PAYMENT-CONTEXT verifier, pinned JWKS cache, fail-closed outage
416
+ # tests/test_http_payment_admission.py — x402 admission, refusals and upto settlement over real MCP
417
+ ```
418
+
419
+ The server tests also import the estate regression class so the existing
420
+ explicit-file hosted CI gate exercises it. They verify real in-memory MCP
421
+ discovery/calls, argument rejection, canonical digest binding, and an ephemeral
422
+ P-256 signature. Provider responses in these tests are **SIMULATED**; passing
423
+ them does not publish the new tool or establish current GitHub/HF health.
424
+
425
+ `python tests/proof_inmemory.py` exercises the real in-memory MCP protocol and
426
+ checks exact static runtime/server-card name parity. The proof disables dynamic
427
+ catalog probing and receipt-sink forwarding in its own process. CI also runs it
428
+ from an unrelated working directory to verify the documented direct command.
429
+
430
+ ## The Ouroboros loop (doctrine cross-reference)
431
+
432
+ hatun-mcp does **not** implement the estate's Ouroboros bounded-recursion kernel itself; its
433
+ PURIQ orchestrator is a **bounded, single-pass per-tool-call flow**, not recursion. This
434
+ section is a **doctrine cross-reference** plus an honest note on how that flow embodies the
435
+ loop's receipt-closed identity (`receipts.in ≡ receipts.out`, already carried in this README).
436
+
437
+ The canonical definition is the receipt-closed kernel
438
+ [`szl-holdings/ouroboros` → `src/loop-kernel.ts`](https://github.com/szl-holdings/ouroboros/blob/main/src/loop-kernel.ts) (`runLoop`): *bounded recursion with measurable convergence* that MUST terminate on one
439
+ of four exit conditions — `converged | consistent | aborted | budgetExhausted` — and emits a
440
+ governance receipt for every run. **The trace is the product.**
441
+
442
+ How hatun-mcp embodies that primitive (in `hatun_mcp/puriq.py`):
443
+
444
+ - **Bounded & terminating.** Each tool call is a finite pipeline — Yuyay-13 gate → mesh
445
+ quorum (Byzantine n ≥ 3f+1) → HUKLLA tripwire → Khipu append → DSSE-sign → compose the
446
+ master-formula scalar — that always terminates within a latency budget and returns a
447
+ receipt hash. There is no unbounded loop.
448
+ - **Receipt-closed.** Every call mints a Khipu link on an append-only sha256 DAG and the
449
+ client receives the **receipt hash**. That is this repo's live realization of the header
450
+ identity `receipts.in ≡ receipts.out` — a **metaphor (doctrine, not math)**, where each
451
+ signed receipt is fed back into the DAG as an auditable input.
452
+
453
+ **Honesty (Doctrine v11 · 749/14/163):** Λ is consumed here as an input scalar in [0,1] and
454
+ is **Conjecture 1** — advisory, *never* a proven theorem. This is a *bounded, terminating*
455
+ governance flow — it makes **no** perpetual-motion or zero-cost claim.
456
+
457
+ ---
458
+
459
+ <sub>
460
+
461
+ **Doctrine v11 LOCKED — 749 / 14 / 163 · Λ = Conjecture 1 (NOT a theorem) · SLSA L1 honest · L2 verified-provenance on roadmap (L3 not claimed)**
462
+ `receipts.in ≡ receipts.out`
463
+
464
+ Signed-off-by: Yachay &lt;yachay@szlholdings.ai&gt;
465
+ Co-Authored-By: Perplexity Computer Agent &lt;agent@perplexity.ai&gt;
466
+
467
+ </sub>
468
+
469
+ Estate on Hugging Face: models, datasets and Spaces are published under the [SZLHOLDINGS](https://huggingface.co/SZLHOLDINGS) org.