feat(v2.0.8): implement ipld dag-json/CIDv1, quant financial collector, MCP server (hs-mcp), /learn/ sub-page, /gallery/ sub-page, and global Lemurs footer
This commit is contained in:
1 parent
b767f8a4e9
commit
c17f74097b
55 files changed
+3974
-10
No files matched your search
@@ -0,0 +1,134 @@
|
||||
"""
|
||||
hyperstitionstud_io.mcp.resources — Static & Template URN Resources for MCP Clients.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
from typing import Any
|
||||
|
||||
from hyperstitionstud_io.config import load_workspace_config
|
||||
|
||||
STATIC_RESOURCES: list[dict[str, str]] = [
|
||||
{
|
||||
"uri": "urn:io:hyperstitionstud:resource:glossary-registry",
|
||||
"name": "Comprehensive Glossary & Bilingual Ledger (v1.6.0, 282 Entries)",
|
||||
"mimeType": "application/json",
|
||||
"description": "Canonical 282-entry Glossary & 190-specimen Bilingual Vocabulary Ledger.",
|
||||
},
|
||||
{
|
||||
"uri": "urn:io:hyperstitionstud:resource:encyclopedia-manifest",
|
||||
"name": "22-Volume PDF Encyclopedia Manifest (v1.7.0, 122 Pages)",
|
||||
"mimeType": "application/json",
|
||||
"description": "Manifest of the 9 Ontological Divisions (00-08) and 22 Alphabetized PDF Volumes.",
|
||||
},
|
||||
{
|
||||
"uri": "urn:io:hyperstitionstud:resource:eti-tier-list",
|
||||
"name": "Assemblage Builds Ecological Trophic Index (ETI v2.0.0) Tier List",
|
||||
"mimeType": "application/json",
|
||||
"description": "9 Taxon Assemblage Builds ranked S+ to D/F across 6 zoological base stats.",
|
||||
},
|
||||
{
|
||||
"uri": "urn:io:hyperstitionstud:resource:singularity-matrix",
|
||||
"name": "Technocapital Singularity Zoology Matrix (S1-S6)",
|
||||
"mimeType": "application/json",
|
||||
"description": "Six-Class Landian-Deleuzean Singularity Taxonomy and signature coordinate rings.",
|
||||
},
|
||||
{
|
||||
"uri": "urn:io:hyperstitionstud:resource:memetic-registry",
|
||||
"name": "State-Gated Memetic Superclass Registry (M1-M6 & Emergent M7+)",
|
||||
"mimeType": "application/json",
|
||||
"description": "Two-Gate state-matched memetic subclasses and M7_candidate_2026_11_28 nucleation telemetry.",
|
||||
},
|
||||
{
|
||||
"uri": "urn:io:hyperstitionstud:resource:quantitative-anchors",
|
||||
"name": "Quantitative Economic Anchors Registry",
|
||||
"mimeType": "application/json",
|
||||
"description": "Registered quantitative anchors ($6B Lazarus heist, $83 Anthropic IPO, 481 halted factories).",
|
||||
},
|
||||
{
|
||||
"uri": "urn:io:hyperstitionstud:resource:knowledge-graph-summary",
|
||||
"name": "Encyclopedia Knowledge Graph Summary (388 Nodes, 1,282 Edges)",
|
||||
"mimeType": "application/json",
|
||||
"description": "Node/edge ontology counts, top 15 AQ coordinate hubs by degree, and SHA-256 isolation receipt.",
|
||||
},
|
||||
]
|
||||
|
||||
RESOURCE_TEMPLATES: list[dict[str, str]] = [
|
||||
{
|
||||
"uriTemplate": "urn:io:hyperstitionstud:dossier:{dossier_number}",
|
||||
"name": "Canonical Archive or Zoology Dossier by Number (01..71)",
|
||||
"mimeType": "text/markdown",
|
||||
"description": "Read the full Markdown text and verified 333/666/777 equations of Dossier {dossier_number} (e.g. 65..71).",
|
||||
},
|
||||
{
|
||||
"uriTemplate": "urn:io:hyperstitionstud:schema:v1:{schema_slug}",
|
||||
"name": "Workspace Offline URN JSON Schema (v1)",
|
||||
"mimeType": "application/schema+json",
|
||||
"description": "Read a v1 JSON Schema contract (e.g. glossary-registry, encyclopedia-graph, learn-progress-state).",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def read_mcp_resource(uri: str) -> dict[str, Any]:
|
||||
cfg = load_workspace_config()
|
||||
static_map = {
|
||||
"urn:io:hyperstitionstud:resource:glossary-registry": cfg.zoology_dir / "taxonomy" / "glossary-registry.json",
|
||||
"urn:io:hyperstitionstud:resource:encyclopedia-manifest": cfg.zoology_dir / "encyclopedia" / "encyclopedia-manifest.json",
|
||||
"urn:io:hyperstitionstud:resource:eti-tier-list": cfg.zoology_dir / "taxonomy" / "assemblage-builds-tier-list.json",
|
||||
"urn:io:hyperstitionstud:resource:singularity-matrix": cfg.zoology_dir / "taxonomy" / "singularity-zoology-matrix.json",
|
||||
"urn:io:hyperstitionstud:resource:memetic-registry": cfg.zoology_dir / "taxonomy" / "memetic-superclass-registry.json",
|
||||
"urn:io:hyperstitionstud:resource:quantitative-anchors": cfg.zoology_dir / "taxonomy" / "quantitative-economic-anchors.json",
|
||||
}
|
||||
if uri in static_map:
|
||||
p = static_map[uri]
|
||||
return {
|
||||
"contents": [
|
||||
{"uri": uri, "mimeType": "application/json", "text": p.read_text(encoding="utf-8")}
|
||||
]
|
||||
}
|
||||
|
||||
if uri == "urn:io:hyperstitionstud:resource:knowledge-graph-summary":
|
||||
kg = json.loads((cfg.knowledge_graph_dir / "encyclopedia-graph.json").read_text(encoding="utf-8"))
|
||||
summary = {
|
||||
"version": kg.get("version"),
|
||||
"namespace_urn": kg.get("namespace_urn"),
|
||||
"counts": kg.get("counts"),
|
||||
"isolation_verified": kg.get("isolation_verified"),
|
||||
"top_coordinate_hubs_by_degree": kg.get("top_coordinate_hubs_by_degree"),
|
||||
}
|
||||
return {
|
||||
"contents": [
|
||||
{"uri": uri, "mimeType": "application/json", "text": json.dumps(summary, indent=2)}
|
||||
]
|
||||
}
|
||||
|
||||
m_dos = re.match(r"^urn:io:hyperstitionstud:dossier:(\d+)$", uri)
|
||||
if m_dos:
|
||||
num = int(m_dos.group(1))
|
||||
prefix = f"{num:02d}-"
|
||||
for d_dir in (cfg.zoology_dir / "dossiers", cfg.archive_dir / "ingglish-aq-archive"):
|
||||
if d_dir.is_dir():
|
||||
matches = sorted(d_dir.glob(f"{prefix}*.md"))
|
||||
if matches:
|
||||
return {
|
||||
"contents": [
|
||||
{"uri": uri, "mimeType": "text/markdown", "text": matches[0].read_text(encoding="utf-8")}
|
||||
]
|
||||
}
|
||||
raise ValueError(f"No dossier found matching number {num:02d}")
|
||||
|
||||
m_sch = re.match(r"^urn:io:hyperstitionstud:schema:v1:([a-z0-9-]+)$", uri)
|
||||
if m_sch:
|
||||
slug = m_sch.group(1)
|
||||
sp = cfg.core_dir / "schemas" / "v1" / f"{slug}.schema.json"
|
||||
if sp.is_file():
|
||||
return {
|
||||
"contents": [
|
||||
{"uri": uri, "mimeType": "application/schema+json", "text": sp.read_text(encoding="utf-8")}
|
||||
]
|
||||
}
|
||||
raise ValueError(f"Unknown schema slug: {slug}")
|
||||
|
||||
raise ValueError(f"Unknown MCP resource URI: {uri}")
|
||||
Reference in new issue
Block a user