alloc-context 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. alloc_context-0.1.0.dist-info/METADATA +154 -0
  2. alloc_context-0.1.0.dist-info/RECORD +85 -0
  3. alloc_context-0.1.0.dist-info/WHEEL +5 -0
  4. alloc_context-0.1.0.dist-info/entry_points.txt +4 -0
  5. alloc_context-0.1.0.dist-info/licenses/LICENSE +21 -0
  6. alloc_context-0.1.0.dist-info/top_level.txt +1 -0
  7. alloccontext/__init__.py +3 -0
  8. alloccontext/__main__.py +149 -0
  9. alloccontext/config.py +415 -0
  10. alloccontext/horizon.py +30 -0
  11. alloccontext/ingest/__init__.py +1 -0
  12. alloccontext/ingest/cf_benchmarks.py +38 -0
  13. alloccontext/ingest/cf_history.py +65 -0
  14. alloccontext/ingest/coinbase_client.py +234 -0
  15. alloccontext/ingest/coinbase_portfolio.py +53 -0
  16. alloccontext/ingest/coingecko.py +148 -0
  17. alloccontext/ingest/coinmarketcap.py +135 -0
  18. alloccontext/ingest/env_keys.py +12 -0
  19. alloccontext/ingest/etf_flows.py +282 -0
  20. alloccontext/ingest/exchange/__init__.py +4 -0
  21. alloccontext/ingest/exchange/coinbase_adapter.py +64 -0
  22. alloccontext/ingest/exchange/kraken_adapter.py +66 -0
  23. alloccontext/ingest/exchange/live.py +95 -0
  24. alloccontext/ingest/exchange/portfolio.py +8 -0
  25. alloccontext/ingest/exchange/registry.py +27 -0
  26. alloccontext/ingest/exchange/types.py +5 -0
  27. alloccontext/ingest/exchange_http.py +28 -0
  28. alloccontext/ingest/fear_greed.py +89 -0
  29. alloccontext/ingest/fred.py +138 -0
  30. alloccontext/ingest/http_errors.py +29 -0
  31. alloccontext/ingest/kalshi.py +84 -0
  32. alloccontext/ingest/kalshi_api.py +199 -0
  33. alloccontext/ingest/kalshi_client.py +95 -0
  34. alloccontext/ingest/kalshi_files.py +44 -0
  35. alloccontext/ingest/kalshi_state.py +67 -0
  36. alloccontext/ingest/kraken_client.py +177 -0
  37. alloccontext/ingest/kraken_portfolio.py +161 -0
  38. alloccontext/ingest/macro_calendar.py +310 -0
  39. alloccontext/ingest/macro_normalize.py +98 -0
  40. alloccontext/ingest/market_snapshots.py +113 -0
  41. alloccontext/ingest/outcome.py +110 -0
  42. alloccontext/ingest/parse_helpers.py +23 -0
  43. alloccontext/ingest/runner.py +148 -0
  44. alloccontext/mcp/__init__.py +1 -0
  45. alloccontext/mcp/assets.py +153 -0
  46. alloccontext/mcp/bazaar.py +630 -0
  47. alloccontext/mcp/contracts.py +286 -0
  48. alloccontext/mcp/handlers.py +487 -0
  49. alloccontext/mcp/http.py +250 -0
  50. alloccontext/mcp/payment_middleware.py +211 -0
  51. alloccontext/mcp/server.py +319 -0
  52. alloccontext/mcp/staleness.py +30 -0
  53. alloccontext/mcp/validation.py +56 -0
  54. alloccontext/mcp/x402_bazaar_dynamic.py +104 -0
  55. alloccontext/mcp/x402_config.py +131 -0
  56. alloccontext/mcp/x402_pricing.py +55 -0
  57. alloccontext/mcp/x402_stables.py +179 -0
  58. alloccontext/rollup/__init__.py +1 -0
  59. alloccontext/rollup/band.py +50 -0
  60. alloccontext/rollup/breadth.py +45 -0
  61. alloccontext/rollup/cf_math.py +103 -0
  62. alloccontext/rollup/cluster.py +149 -0
  63. alloccontext/rollup/cluster_config.py +86 -0
  64. alloccontext/rollup/comparison.py +67 -0
  65. alloccontext/rollup/context.py +118 -0
  66. alloccontext/rollup/delta.py +109 -0
  67. alloccontext/rollup/etf.py +113 -0
  68. alloccontext/rollup/fear_greed.py +61 -0
  69. alloccontext/rollup/macro.py +185 -0
  70. alloccontext/rollup/portfolio.py +137 -0
  71. alloccontext/rollup/rebalance.py +125 -0
  72. alloccontext/rollup/regime.py +188 -0
  73. alloccontext/rollup/sentiment.py +118 -0
  74. alloccontext/rollup/snapshots.py +64 -0
  75. alloccontext/rollup/tape.py +176 -0
  76. alloccontext/status_report.py +321 -0
  77. alloccontext/store/__init__.py +0 -0
  78. alloccontext/store/db.py +216 -0
  79. alloccontext/store/jsonutil.py +10 -0
  80. alloccontext/store/meta.py +20 -0
  81. alloccontext/store/retention.py +63 -0
  82. alloccontext/store/status.py +89 -0
  83. alloccontext/timeutil.py +11 -0
  84. alloccontext/x402_production_check.py +193 -0
  85. alloccontext/x402_smoke_redact.py +41 -0
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: alloc-context
3
+ Version: 0.1.0
4
+ Summary: AllocContext — BTC/ETH allocation context, drift, and rebalance facts
5
+ License: MIT
6
+ Project-URL: Homepage, https://github.com/negillett/alloc-context
7
+ Project-URL: Documentation, https://github.com/negillett/alloc-context/blob/main/docs/agent-integration.md
8
+ Project-URL: Repository, https://github.com/negillett/alloc-context
9
+ Project-URL: Issues, https://github.com/negillett/alloc-context/issues
10
+ Project-URL: Changelog, https://github.com/negillett/alloc-context/releases
11
+ Project-URL: MCP Server, https://mcp.alloc-context.com/mcp
12
+ Keywords: mcp,x402,bitcoin,ethereum,portfolio,allocation,agents,crypto,rebalance
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Office/Business :: Financial
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: pyyaml>=6.0
25
+ Requires-Dist: requests>=2.31
26
+ Requires-Dist: PyJWT>=2.8
27
+ Requires-Dist: cryptography>=42.0
28
+ Provides-Extra: mcp
29
+ Requires-Dist: mcp>=1.6; extra == "mcp"
30
+ Provides-Extra: hosted
31
+ Requires-Dist: mcp>=1.6; extra == "hosted"
32
+ Requires-Dist: x402[evm,fastapi]>=2.0; extra == "hosted"
33
+ Requires-Dist: cdp-sdk>=1.46; extra == "hosted"
34
+ Requires-Dist: uvicorn[standard]>=0.30; extra == "hosted"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=8.0; extra == "dev"
37
+ Requires-Dist: mcp>=1.6; extra == "dev"
38
+ Requires-Dist: x402[evm,fastapi]>=2.0; extra == "dev"
39
+ Requires-Dist: cdp-sdk>=1.46; extra == "dev"
40
+ Requires-Dist: uvicorn[standard]>=0.30; extra == "dev"
41
+ Dynamic: license-file
42
+
43
+ # AllocContext
44
+
45
+ **Allocation context for BTC/ETH** — drift, band checks, USD rebalance moves,
46
+ and a fused market backdrop (Fear & Greed, Kalshi, ETF flows, macro) as
47
+ deterministic JSON over MCP.
48
+
49
+ The product is an **agent-native MCP API** with x402 pay-per-call on Base —
50
+ see [docs/mcp.md](docs/mcp.md).
51
+
52
+ ## Hosted MCP (production)
53
+
54
+ Try the public endpoint without self-hosting:
55
+
56
+ | | |
57
+ |--|--|
58
+ | **URL** | `https://mcp.alloc-context.com/mcp` |
59
+ | **Discovery** | [llms.txt](https://mcp.alloc-context.com/llms.txt), [x402 manifest](https://mcp.alloc-context.com/.well-known/x402.json) |
60
+ | **Pricing** | **$0.02** cached context/math · **$0.05** live ingest or portfolio |
61
+ | **Payment** | x402 on Base — USDC or EURC |
62
+
63
+ Agents find the service via [CDP Bazaar](docs/mcp-discovery.md). Integration
64
+ guide: [docs/agent-integration.md](docs/agent-integration.md). Example JSON:
65
+ [docs/examples.md](docs/examples.md).
66
+
67
+ **Try free locally** (no payment): `./scripts/dev-up.sh` — see
68
+ [docs/local-dev.md](docs/local-dev.md).
69
+
70
+ Optional live portfolio reads use read-only exchange credentials passed in
71
+ each request. Not financial advice.
72
+
73
+ ```text
74
+ ingest → store → rollup → MCP tools (+ optional x402 HTTP)
75
+ ```
76
+
77
+ This package is **facts and MCP only** — ingest, rollups, and agent tools.
78
+ Email, LLM synthesis, and alert delivery are out of scope for this repository.
79
+
80
+ ## Try it locally
81
+
82
+ ```bash
83
+ git clone git@github.com:negillett/alloc-context.git
84
+ cd alloc-context
85
+ python3.11 -m venv .venv && source .venv/bin/activate
86
+ pip install -e ".[dev]"
87
+ cp .env.example .env # fill locally; never commit
88
+ cp config/config.example.yaml config/config.yaml
89
+
90
+ python -m alloccontext ingest --dry-run
91
+ python -m alloccontext rollup --scope daily --stdout
92
+ pytest
93
+ ```
94
+
95
+ **MCP (stdio):** `pip install -e ".[mcp]"` then `alloc-context mcp`.
96
+ See [docs/cursor-mcp.md](docs/cursor-mcp.md).
97
+
98
+ **Hosted MCP + x402:** `pip install -e ".[hosted]"` then
99
+ `alloc-context mcp --transport http --x402`. See [docs/mcp-http.md](docs/mcp-http.md).
100
+
101
+ **Local dev stack (internal MCP on :8001):** `./scripts/dev-up.sh`.
102
+ See [docs/local-dev.md](docs/local-dev.md).
103
+
104
+ CLI entry point: `alloc-context` (same as `python -m alloccontext`).
105
+
106
+ ## Commands
107
+
108
+ | Command | Purpose |
109
+ |---------|---------|
110
+ | `python -m alloccontext ingest` | Pull configured sources → SQLite |
111
+ | `python -m alloccontext rollup --scope daily --stdout` | ContextBundle JSON (facts) |
112
+ | `python -m alloccontext status` | Per-source ingest ages, snapshots, MCP `/health` |
113
+ | `alloc-context mcp` | MCP server (stdio or HTTP) |
114
+
115
+ ## MCP tools
116
+
117
+ | Tool | Purpose |
118
+ |------|---------|
119
+ | `get_context_bundle` | Full ContextBundle — portfolio, market, sentiment, macro, delta, regime |
120
+ | `get_market_context` | Sentiment, macro, ETF, breadth, and market fields (no portfolio) |
121
+ | `get_context_at` | Saved snapshot from ingest history at a given `as_of` |
122
+ | `get_context_delta` | Notable shifts between two saved snapshots |
123
+ | `get_rebalance_plan` | USD rebalance moves from allocation, target, and NAV |
124
+ | `check_allocation_band` | Drift vs target and whether allocation is outside the band |
125
+ | `check_allocation_bands` | Batch band checks for multiple target scenarios |
126
+ | `get_portfolio_state` | Live NAV and allocation from Kraken or Coinbase (credentials in request) |
127
+
128
+ See [docs/mcp.md](docs/mcp.md) for arguments, pricing, and resources.
129
+
130
+ ## Documentation
131
+
132
+ | Document | Purpose |
133
+ |----------|---------|
134
+ | [docs/mcp.md](docs/mcp.md) | MCP tools and x402 |
135
+ | [docs/mcp-http.md](docs/mcp-http.md) | HTTP MCP + x402 setup |
136
+ | [docs/mcp-discovery.md](docs/mcp-discovery.md) | Bazaar and agent discovery |
137
+ | [docs/distribution.md](docs/distribution.md) | GitHub, PyPI, MCP Registry, directories |
138
+ | [docs/agent-integration.md](docs/agent-integration.md) | Paid HTTP MCP + Bazaar for agents |
139
+ | [docs/cursor-mcp.md](docs/cursor-mcp.md) | Cursor stdio MCP |
140
+ | [docs/examples.md](docs/examples.md) | Sample tool JSON (redacted) |
141
+ | [docs/context-bundle.md](docs/context-bundle.md) | ContextBundle schema |
142
+ | [docs/architecture.md](docs/architecture.md) | Pipeline and trust boundaries |
143
+ | [docs/data-sources.md](docs/data-sources.md) | Ingest sources |
144
+ | [docs/self-hosting.md](docs/self-hosting.md) | Optional Linux/systemd ingest + MCP |
145
+ | [docs/local-dev.md](docs/local-dev.md) | Local internal MCP + dev ingest |
146
+
147
+ ## Contributing
148
+
149
+ GitHub Issues are welcome for bugs, schema feedback, and MCP API suggestions.
150
+ Unsolicited pull requests are not expected — see [CONTRIBUTING.md](CONTRIBUTING.md).
151
+
152
+ ## License
153
+
154
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,85 @@
1
+ alloc_context-0.1.0.dist-info/licenses/LICENSE,sha256=GDUcA0IRGCCnLewosUCp6kgW19zdGlnTDlYR4qEps5g,1082
2
+ alloccontext/__init__.py,sha256=GNhoe9BVDD4fVryVcC9AUIlv2vDh7VVkT04RkrQahJk,94
3
+ alloccontext/__main__.py,sha256=pncyOmgB2ICxkLRSTyxh1H8GHEn6bE2pBpJpKlu5U3E,4405
4
+ alloccontext/config.py,sha256=yURf3zzurvqsJ-eIHo0pFOomi0agko3aWhHo_bTp3A0,12918
5
+ alloccontext/horizon.py,sha256=18Y7UlOgF2Lb-lo9O2B9f5Do--TSbLBrFM9oTOrjOyQ,843
6
+ alloccontext/status_report.py,sha256=GOgGboLkVHYb5pmUo8J9EwTArBFP46yJX9KrTNg467w,11145
7
+ alloccontext/timeutil.py,sha256=cgmsWpXGqtxH3r9uM5GLqdzBjYwTkZFmSQz5-1eylVo,227
8
+ alloccontext/x402_production_check.py,sha256=WJXr5hK2gVlbGbjUBrAy0mqol1RX7zBYSRwV36EU2CU,7464
9
+ alloccontext/x402_smoke_redact.py,sha256=a-pAt0VwA1Lz-kq7iapX4ncWK8YQ4nCK4ifajxZnjdY,1138
10
+ alloccontext/ingest/__init__.py,sha256=e6MrP8LbTbU_QkiLBiKfrXr5bgJm_x5tP_bjsoQzvWE,55
11
+ alloccontext/ingest/cf_benchmarks.py,sha256=jtoYVCZvszCc_lA0txPf7bG5oFCr0kr2ulEa9vTYal0,1300
12
+ alloccontext/ingest/cf_history.py,sha256=4lGRVU6uxACH5Xe8P4VfanVTfu5zCKtaU4eOtEhATSg,1994
13
+ alloccontext/ingest/coinbase_client.py,sha256=5Xv0wc8NpAp6fVC8XVbnYGeFq4MJ7g20nyp7Aiigvbs,7466
14
+ alloccontext/ingest/coinbase_portfolio.py,sha256=LZbnGB4qdbS6D4QlmB8dREdh5uZ5veq3nsCTFPyJn2E,1701
15
+ alloccontext/ingest/coingecko.py,sha256=5oEoALSUqFwdkR6ga91avnLJV4BHvrG-FIibvYCrI4s,5665
16
+ alloccontext/ingest/coinmarketcap.py,sha256=TLy7fVIoqajGenzKepjIesvrvEJnTDCaSoeN4gEAf0s,4800
17
+ alloccontext/ingest/env_keys.py,sha256=nTFNt1P6pxXFns9B05OxcgA4WoVS1H3QgO_o-AqQ6RI,287
18
+ alloccontext/ingest/etf_flows.py,sha256=lGSNeURbTysqpwECHr6qtJvWVQR2IYYNPjmRHPNhs2U,9302
19
+ alloccontext/ingest/exchange_http.py,sha256=JMNSv3o9P-Dyn2rjCoO-2oGfnadse4HPYtGTB_XK2fU,898
20
+ alloccontext/ingest/fear_greed.py,sha256=Awp4aKv4IZmnskJ31JFmPeuwtMtBM7axtt5NmTPBl84,2818
21
+ alloccontext/ingest/fred.py,sha256=5zSQtbikW2CmGUmNvQjbiIPKxDTBo_zDFFBKES63yBg,4253
22
+ alloccontext/ingest/http_errors.py,sha256=7dyLHAdJqNr71-bFpu2XGEMv61IJpw81dRy97zrCwTs,826
23
+ alloccontext/ingest/kalshi.py,sha256=ZhMD41h8YyRFdjWV3KYWaQTBpQoDkruHwNbFX2xSZR0,2747
24
+ alloccontext/ingest/kalshi_api.py,sha256=HiacWhuZYI2jv72XNHBjsv19kWOQKkBXxCI-uhxH-nE,6825
25
+ alloccontext/ingest/kalshi_client.py,sha256=A8D7XbN9tkVPadfRn9stnErDIHE9iR9jx6uVh7TSpLs,3277
26
+ alloccontext/ingest/kalshi_files.py,sha256=ZUB9YINJlqjbRNdLC1RJ2l7bGlNML91cACMmghzEdMM,1408
27
+ alloccontext/ingest/kalshi_state.py,sha256=9hAhAS0PN_DXBNcpRVkkdoo8S_VBQszdzYJ_FDAgpEA,2289
28
+ alloccontext/ingest/kraken_client.py,sha256=BBDOj_tXDN0O3b-6gwa_9GlRqD0EbaI6tCn7QbGU8kk,5797
29
+ alloccontext/ingest/kraken_portfolio.py,sha256=d6QYa38Coo_wcIyN697_Jb2shV45T266lz1mKz51IVc,4714
30
+ alloccontext/ingest/macro_calendar.py,sha256=kacNt3YoHCl7anJNSHl_XJb5QetJALLiXf8qNVWt4rk,10640
31
+ alloccontext/ingest/macro_normalize.py,sha256=BOi0eUaVKkhecycg9kDrJlCLGlX-umB7xpDIETwjCWs,2729
32
+ alloccontext/ingest/market_snapshots.py,sha256=N1sv2XYixxHGTjU3da7RozCJFgYZPbdT5Pmcz0HtKo8,3863
33
+ alloccontext/ingest/outcome.py,sha256=o-lDVOSU03jNqeuvyaRedZxIrMBaygVugKD3gwRCbO0,3272
34
+ alloccontext/ingest/parse_helpers.py,sha256=6wxFIp4hU8Ng8SqfeKgHefsLKipjGlAqkfbQPbSEHpc,473
35
+ alloccontext/ingest/runner.py,sha256=cqo0c7aRKi0xdbuTsvQlswEXwKLTZ22WFBSEvLbMEtM,4774
36
+ alloccontext/ingest/exchange/__init__.py,sha256=f3_n44hkOIq_T00c7yBOV334bL1CRBOXC4OCzcO5u2c,171
37
+ alloccontext/ingest/exchange/coinbase_adapter.py,sha256=9hsU3KSAbf9ZW5FWK7Rj1IFRJCyzbRd8TIo5KaKGq9g,2113
38
+ alloccontext/ingest/exchange/kraken_adapter.py,sha256=1f5EdW8A7CJe5X12PLB1LjIy9O94QsxuHBI_Rm9kg-M,2097
39
+ alloccontext/ingest/exchange/live.py,sha256=VMJ7msLxl8i2s3miFTQKT0TubhrDlA41pjno8tPsnjk,3025
40
+ alloccontext/ingest/exchange/portfolio.py,sha256=isYUGnwzk_az0J_LWK0LF1IZ0LNYRS_ky4LTluXXa7w,298
41
+ alloccontext/ingest/exchange/registry.py,sha256=giFgD5WdLeMPAhJUMLVlB64yeBI-oVCPM3219YfQV08,841
42
+ alloccontext/ingest/exchange/types.py,sha256=-TriA4kRdMfoILBHQHrwkzQ-WcQAJFsEiLYFXUn54mk,107
43
+ alloccontext/mcp/__init__.py,sha256=wv7woItWFRtf59FRFnqIEbN7k1K3vDwyywbMXSAK_9Q,39
44
+ alloccontext/mcp/assets.py,sha256=5A6PI-0KlADBoZxApSQmpwTfeF5MYCU2ETdpmtFS6l4,4880
45
+ alloccontext/mcp/bazaar.py,sha256=jS1OXfp5-zVP7bCvsnQznvAFqdmDfextj2LbBPeXf2I,22157
46
+ alloccontext/mcp/contracts.py,sha256=jMLENAkeXp30-giy82Zgca8Q1-FNKSHemTPnIO6fcI0,7426
47
+ alloccontext/mcp/handlers.py,sha256=A0NJ-m6N_8woDSYuWds-yvzTtZiE-Tc7maJatbfM3oQ,15187
48
+ alloccontext/mcp/http.py,sha256=z00tGJh6bUmlEgWtmkYksFlaFnFuqhYCju69wQc3qy0,7625
49
+ alloccontext/mcp/payment_middleware.py,sha256=z5T_tAFSqFddeV1xyizf6q-0KaOdacUWBIaKIEyCKVs,7650
50
+ alloccontext/mcp/server.py,sha256=AJypRnnDjt0cJr2el82M0b3evWCp2fnDyrmZzYv7KuA,10413
51
+ alloccontext/mcp/staleness.py,sha256=bw92FLStzIdWGE03ymIPzrjGCbWG39XKcr9qpI6qLUY,873
52
+ alloccontext/mcp/validation.py,sha256=oyjr6ePHyjYPhGi7HNlJahS2gogEFKKhQ7Ins7L5FRk,1759
53
+ alloccontext/mcp/x402_bazaar_dynamic.py,sha256=_hmYgE7zv9xtbtjzmcjk66eXBnfAESDDey8rPsjoEas,3669
54
+ alloccontext/mcp/x402_config.py,sha256=2n87QnDpo5AJTbE1yZVEOO840M38tY3GDudd0JdeYGI,4675
55
+ alloccontext/mcp/x402_pricing.py,sha256=lkesZBU87rW9Xy80qQBfehTue6Cutzw_92jlpJvbdes,1609
56
+ alloccontext/mcp/x402_stables.py,sha256=PCA5UiZYwI5wUvYGR2sfoyBT8OyjTS6ViK5WOXUNwGY,5196
57
+ alloccontext/rollup/__init__.py,sha256=myPg_8-snQKvaowD1GmhJlqBOJNXwOy6_dnQEBdv00o,44
58
+ alloccontext/rollup/band.py,sha256=51sCxv0YNU40EsXLBSntxc7-mZw5_lxZk1BZXNORt_w,1534
59
+ alloccontext/rollup/breadth.py,sha256=15YWVxb3GQ5SpGfvDS00HuIFeLyMaJCSZ_qxO6XQkqI,1669
60
+ alloccontext/rollup/cf_math.py,sha256=4SlfqvMFiqPoRuN5buDE30uoExnI7Nc4Ntc4AaPlVww,2743
61
+ alloccontext/rollup/cluster.py,sha256=3v6UlJ5wjbhVXoZtUQGWlxbsaHH59KJtKJU4zD1uPgg,4785
62
+ alloccontext/rollup/cluster_config.py,sha256=Y5x4ulY7IoX1TWUo9QCH_dXtgsV4wY3Hxjo6zS4kQ4c,2943
63
+ alloccontext/rollup/comparison.py,sha256=2RGwBjVipO0itYT-j8-H7DgAsoEY9CFHccbKAHw2yt8,2569
64
+ alloccontext/rollup/context.py,sha256=TZNV2TXZmio0pX9vAlmxiM5u4LKtPpWV5NDbrVEV7Os,3395
65
+ alloccontext/rollup/delta.py,sha256=3phVngnbv-hCvF8gXEIBA-8sBXjf4wuH3IjiRRpqW9I,4033
66
+ alloccontext/rollup/etf.py,sha256=xt1qLBlveGSkh5TRTOtN4pEu_2kLeBwZA0iB-IkwQ_s,3508
67
+ alloccontext/rollup/fear_greed.py,sha256=T3-nEOFwqPKCu_RSQ2RHy3xrGgXrB8FRMSpBUPX9SCc,1652
68
+ alloccontext/rollup/macro.py,sha256=jurjxvOhLANHErSytKkwWn4SVLqVSde5sUDtCgMfRxM,5663
69
+ alloccontext/rollup/portfolio.py,sha256=r5ObchOBoXKEp5tKnjvjJe2qF9NGkoS2Sz6onqESlUo,4597
70
+ alloccontext/rollup/rebalance.py,sha256=cTHS07xmEPojdiIo6cQldPmXpJBrxetJ4E9mlWqeXCw,4552
71
+ alloccontext/rollup/regime.py,sha256=yz0ZIJHTVEzHKNe8TvBg8ZAgfDScwV56WJ7j5-0SjF8,6498
72
+ alloccontext/rollup/sentiment.py,sha256=q2FR9GNYzTutRLfUgJGT2qXCN5grt3l3Vt2C0j6YHAs,3424
73
+ alloccontext/rollup/snapshots.py,sha256=-l-3uTcTOae3zc9MjeTtMI-syPv7ZWThhX1Z_iIA-1o,1642
74
+ alloccontext/rollup/tape.py,sha256=5CNtNxcjVUdzJJWFXKjYQEKLx6p60EMQvPzTskdYwrY,5429
75
+ alloccontext/store/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
+ alloccontext/store/db.py,sha256=yFbBjjHPV_89-9M-xxFr8DC6qg18AR7ApLz5W3JGUIU,5493
77
+ alloccontext/store/jsonutil.py,sha256=mxKKUQw30FVJYaWJUVqIm_Q8IhOHyHjIsjsLaqDLW_8,237
78
+ alloccontext/store/meta.py,sha256=SB_CPQzwklXhTEwpK4QPaCEhwja0YXwXTlnmf6MBOrs,529
79
+ alloccontext/store/retention.py,sha256=SkE1CI9jcRJJ-QmTDr5EHSu7xnz5YGEznwgp9aTwwGk,2132
80
+ alloccontext/store/status.py,sha256=-_8DlA_yImP46kbpPiywqxwyix9MSwfuFq4oAAlA80I,2648
81
+ alloc_context-0.1.0.dist-info/METADATA,sha256=NB9ckjLNJ_I80OZWi6F-kCxF5d0mV5Z85KcD0r_E5iE,6433
82
+ alloc_context-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
83
+ alloc_context-0.1.0.dist-info/entry_points.txt,sha256=dqR7Juqext6cuAv-7hOS44a3GRVTDqy7On0MoogD3t0,162
84
+ alloc_context-0.1.0.dist-info/top_level.txt,sha256=2XxC-sPSACrglRtVaUGfT7EHZsw1E1dmBMw3uc5yWTE,13
85
+ alloc_context-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ alloc-context = alloccontext.__main__:main
3
+ alloc-context-mcp = alloccontext.mcp.server:main
4
+ alloc-context-mcp-http = alloccontext.mcp.http:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AllocContext contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ alloccontext
@@ -0,0 +1,3 @@
1
+ """AllocContext — BTC/ETH allocation context and rebalance facts."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,149 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import json
5
+ import sys
6
+
7
+ from alloccontext.config import load_config
8
+ from alloccontext.ingest.runner import run_ingest
9
+ from alloccontext.rollup.context import build_context_bundle
10
+ from alloccontext.status_report import (
11
+ build_status_report,
12
+ default_mcp_health_url,
13
+ format_status_report,
14
+ )
15
+ from alloccontext.store.db import connect
16
+
17
+
18
+ def cmd_ingest(args: argparse.Namespace) -> int:
19
+ config = load_config(args.config)
20
+ conn = connect(config.paths.db)
21
+ result = run_ingest(conn, config, dry_run=args.dry_run)
22
+ conn.close()
23
+ print(json.dumps(result, indent=2))
24
+ return 0 if result["ok"] else 1
25
+
26
+
27
+ def cmd_rollup(args: argparse.Namespace) -> int:
28
+ config = load_config(args.config)
29
+ conn = connect(config.paths.db)
30
+ bundle = build_context_bundle(
31
+ conn,
32
+ config,
33
+ scope=args.scope,
34
+ rollup=config.rollup,
35
+ save_snapshot=args.save,
36
+ )
37
+ conn.close()
38
+ if args.stdout:
39
+ print(json.dumps(bundle, indent=2))
40
+ else:
41
+ print(json.dumps({"ok": True, "bundle_id": bundle["bundle_id"]}, indent=2))
42
+ return 0
43
+
44
+
45
+ def cmd_status(args: argparse.Namespace) -> int:
46
+ config = load_config(args.config)
47
+ conn = connect(config.paths.db)
48
+ try:
49
+ report = build_status_report(
50
+ config,
51
+ conn,
52
+ probe_mcp=not args.no_mcp,
53
+ mcp_health_url=args.mcp_url,
54
+ mcp_timeout_seconds=args.mcp_timeout,
55
+ )
56
+ finally:
57
+ conn.close()
58
+ if args.json:
59
+ print(json.dumps(report, indent=2))
60
+ else:
61
+ print(format_status_report(report))
62
+ return 0 if report.get("ok") else 1
63
+
64
+
65
+ def cmd_mcp(args: argparse.Namespace) -> int:
66
+ if args.transport == "http":
67
+ from alloccontext.mcp.http import run_http
68
+
69
+ run_http(
70
+ config_path=args.config,
71
+ host=args.host,
72
+ port=args.port,
73
+ x402=args.x402,
74
+ )
75
+ else:
76
+ from alloccontext.mcp.server import run_stdio
77
+
78
+ run_stdio(config_path=args.config)
79
+ return 0
80
+
81
+
82
+ def main(argv: list[str] | None = None) -> int:
83
+ parser = argparse.ArgumentParser(prog="alloc-context")
84
+ parser.add_argument("--config", default=None, help="Path to config YAML")
85
+ sub = parser.add_subparsers(dest="command", required=True)
86
+
87
+ ingest_p = sub.add_parser("ingest", help="Pull configured data sources")
88
+ ingest_p.add_argument("--dry-run", action="store_true")
89
+ ingest_p.set_defaults(func=cmd_ingest)
90
+
91
+ rollup_p = sub.add_parser("rollup", help="Build ContextBundle JSON")
92
+ rollup_p.add_argument("--scope", choices=["daily", "weekly"], default="daily")
93
+ rollup_p.add_argument("--stdout", action="store_true")
94
+ rollup_p.add_argument(
95
+ "--save",
96
+ action="store_true",
97
+ help="Persist snapshot for delta chain (normally done by ingest)",
98
+ )
99
+ rollup_p.set_defaults(func=cmd_rollup)
100
+
101
+ status_p = sub.add_parser(
102
+ "status",
103
+ help="Ingest ages, snapshot freshness, optional MCP /health probe",
104
+ )
105
+ status_p.add_argument(
106
+ "--json",
107
+ action="store_true",
108
+ help="Machine-readable JSON (default: human text for SSH)",
109
+ )
110
+ status_p.add_argument(
111
+ "--no-mcp",
112
+ action="store_true",
113
+ help="Skip HTTP GET to MCP /health",
114
+ )
115
+ status_p.add_argument(
116
+ "--mcp-url",
117
+ default=None,
118
+ help=f"MCP health URL (default: {default_mcp_health_url()})",
119
+ )
120
+ status_p.add_argument(
121
+ "--mcp-timeout",
122
+ type=float,
123
+ default=5.0,
124
+ help="Seconds to wait for MCP /health",
125
+ )
126
+ status_p.set_defaults(func=cmd_status)
127
+
128
+ mcp_p = sub.add_parser("mcp", help="Run MCP server (stdio or HTTP)")
129
+ mcp_p.add_argument(
130
+ "--transport",
131
+ choices=["stdio", "http"],
132
+ default="stdio",
133
+ help="stdio for Cursor; http for streamable MCP + optional x402",
134
+ )
135
+ mcp_p.add_argument("--host", default="127.0.0.1", help="HTTP bind host")
136
+ mcp_p.add_argument("--port", type=int, default=8000, help="HTTP bind port")
137
+ mcp_p.add_argument(
138
+ "--x402",
139
+ action="store_true",
140
+ help="Require x402 USDC payment on HTTP (needs X402_PAY_TO)",
141
+ )
142
+ mcp_p.set_defaults(func=cmd_mcp)
143
+
144
+ args = parser.parse_args(argv)
145
+ return int(args.func(args))
146
+
147
+
148
+ if __name__ == "__main__":
149
+ raise SystemExit(main())