{"slug": "l402-edge-cache-for-ai-agents-paying-over-lightning", "title": "L402 edge cache for AI agents paying over Lightning", "summary": "Charles Strogish released version 1.1.0 of the bitcoin-stratigraphy-mcp repository, a remote-first integration bundle for the Bitcoin Stratigraphy MCP engine that connects to a hosted endpoint at bitcoin-stratigraphy-dashboard.replit.app/mcp and advertises 15 canonical capabilities. The release ships dependency-free Node and Python clients with a free sandbox that executes only the stratigraphy.list and proof.list tools, while paid capabilities require tool-scoped credentials and an X-L402-Batch-Size header for batch requests. LlamaIndex source is preserved but installation and execution are unavailable because its NLTK dependency is affected by advisory GHSA-8mgp-746c-j5xp.", "body_md": "**Release:** 1.1.0 · **MCP registry name:** `crstrogish/bitcoin-stratigraphy`\n\nA standalone, remote-first integration repository for the Bitcoin Stratigraphy MCP engine: registry metadata, OpenAPI contracts, dependency-free clients, and native framework agent examples. No Replit workspace, wallet, API key, or model provider account is needed for the free sandbox.\n\nThis bundle **connects to the hosted engine**; it does not contain or claim to\nrun the complete settlement server offline. Client sources can be run locally\nagainst the live service or an independently operated compatible MCP endpoint.\nThere are no workspace aliases, vendored credentials, private signing keys,\noperator state, or dependency on a parent repository.\n\nLangChain execution is supported. **LlamaIndex source is preserved, but dependency\ninstallation and execution are temporarily unavailable**: its NLTK dependency is\naffected by [GHSA-8mgp-746c-j5xp](https://github.com/nltk/nltk/security/advisories/GHSA-8mgp-746c-j5xp).\nThe LlamaIndex requirements file intentionally installs nothing. Do not bypass\nsecurity checks or treat the badge as a claim of supported execution. Restore\ninstallation only after auditing a safe, complete dependency tree.\n\n| Surface | URL | \n|---|---|\n| Streamable HTTP MCP | `https://bitcoin-stratigraphy-dashboard.replit.app/mcp` | \n| Developer portal | `https://bitcoin-stratigraphy-dashboard.replit.app/docs` | \n| Live OpenAPI | `https://bitcoin-stratigraphy-dashboard.replit.app/openapi.json` | \n\nUse the MCP URL in any Streamable HTTP client. Import [mcp.json](https://github.com/CharlesStrogish/bitcoin-stratigraphy-mcp/blob/main/mcp.json) where\nyour client supports URL-based MCP configuration; some hosts require an explicit\ntransport type in their own configuration format. [smithery.yaml](https://github.com/CharlesStrogish/bitcoin-stratigraphy-mcp/blob/main/smithery.yaml)\nis canonical **remote registration metadata**, not a local-server launch recipe.\n\nThe server advertises 15 canonical capabilities. `initialize` and `tools/list`\nare free protocol discovery operations. Exactly two tool executions are free:\n\n| Tool | Arguments | Purpose | \n|---|---|---|\n| `stratigraphy.list` | `{}` | Discover indexed dates/heights, bounds, and available metrics | \n| `proof.list` | `{}` | List supported proof operations and schema metadata | \n\nCatalog discovery is not payment authorization. Other canonical tools require paid access; query live schemas and payment terms before authorizing purchases.\n\nFrom this repository's root, with **no package installation**:\n\n```\nnode examples/free-sandbox.mjs\n```\n\nThis negotiates MCP, sends the initialized notification, then calls only\n`stratigraphy.list` and `proof.list`. It does not sign, pay, attach credentials, or\nmake LLM requests. It fails rather than paying if a free call returns HTTP 402.\n\nTo use your own compatible endpoint:\n\n```\nnode examples/free-sandbox.mjs --url http://127.0.0.1:5000/mcp\n```\n\nThis is a client connection, not a command to start the production engine.\n\nThe bundled client works with the standard library; no framework installation is required:\n\n```\npython -m examples.free_sandbox\n```\n\nEquivalent copy-paste Python:\n\n``` python\nfrom sdk.python.client import BitcoinStratigraphyClient\n\nclient = BitcoinStratigraphyClient()\nprint(client.call_tool(\"stratigraphy.list\", {}))\nprint(client.call_tool(\"proof.list\", {}))\n```\n\nRun code from the repository root so the `sdk` namespace is importable. TLS\nverification remains enabled. If your organization uses a private CA, configure\nits trusted certificate store; do not disable verification.\n\nPaid capabilities use tool-scoped credentials. To request a batch, include:\n\n```\nX-L402-Batch-Size: 100\n```\n\nFor example, this request asks for a notarization batch **challenge**; it does\nnot pay an invoice:\n\n```\ncurl --include --request POST \\\n  'https://bitcoin-stratigraphy-dashboard.replit.app/mcp' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Accept: application/json, text/event-stream' \\\n  --header 'X-L402-Batch-Size: 100' \\\n  --data '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"proof.notarize\",\"arguments\":{\"hash\":\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}}}'\n```\n\n1. Inspect HTTP 402, the L402 `WWW-Authenticate` challenge, invoice amount,\nexpiry, and exact tool scope.\n2. Pay only through a trusted Lightning wallet/client with explicit spending limits. Verify the settlement proof matches the challenged payment hash.\n3. Retry the same tool call with the batch header and:\n\n```\nAuthorization: L402 <macaroon>:<preimage>\nX-L402-Batch-Size: 100\n```\n\nThe registered notarization quote is 250 sats/call × 100 = **25,000 sats**.\nThe live invoice is authoritative; registry target-price examples are not a\nprice guarantee. A `proof.notarize` pass does **not** unlock other paid tools.\nBudgets, expiration, revocation, and inherited caveats still apply on every use.\nAttenuation delegates or narrows scope; it does not reset the parent budget.\n\nNative framework adapters are **not wallets**. Provide a prepaid credential via\n`L402_AUTHORIZATION`, or a trusted loopback Streamable HTTP wallet proxy via\n`L402_PROXY_URL` with explicit spending limits. Do not commit either credentials\nor model-provider secrets. The older one-shot SDK payment callbacks are not\nautomatic Macro-Macaroon batching implementations.\n\nUse a separate consumer Python environment, not an older MCP 1.x environment:\n\n```\npython -m pip install -r cookbooks/requirements-langchain.txt\npython cookbooks/langchain_agent.py\n```\n\nDefault mode discovers tools only. To opt into an LLM and paid notarization,\nconfigure your provider key and a prepaid `proof.notarize` batch credential\nthrough your secret manager, then run:\n\n```\npython cookbooks/langchain_agent.py --run\n```\n\nCopy-paste **free-tool-only ReAct loop** (MCP calls are free; model usage is billed\nby your model provider):\n\n``` python\nimport asyncio\nfrom fastmcp.client import Client\nfrom fastmcp.client.transports import StreamableHttpTransport\nfrom langchain.mcp import MCPAdapter\nfrom langchain.agents import create_agent\nfrom langchain_openai import ChatOpenAI\n\nasync def main():\n    transport = StreamableHttpTransport(\n        url=\"https://bitcoin-stratigraphy-dashboard.replit.app/mcp\"\n    )\n    client = Client(transport, mode=\"legacy\", timeout=30)\n    async with MCPAdapter(client) as adapter:\n        tools = await adapter.list_tools()\n        free = [\n            t.model_copy(update={\"name\": t.name.replace(\".\", \"_\")})\n            for t in tools if t.name in {\"stratigraphy.list\", \"proof.list\"}\n        ]\n        if len(free) != 2:\n            raise RuntimeError(\"Expected both free sandbox capabilities\")\n        agent = create_agent(\n            model=ChatOpenAI(model=\"gpt-4.1-mini\", temperature=0),\n            tools=free,\n            system_prompt=\"Use only these discovery tools. Report actual results.\",\n        )\n        result = await agent.ainvoke(\n            {\"messages\": [{\"role\": \"user\", \"content\":\n                \"List indexed stratigraphy bounds and supported proof operations.\"}]}\n        )\n        print(result[\"messages\"][-1].content)\n\nasyncio.run(main())\n```\n\n`create_agent` implements the current ReAct model → tool → observation loop.\nUnderscore aliases satisfy model-provider naming rules; the wrappers retain the\noriginal dotted remote tool names.\n\n**Source-only until the dependency security hold is lifted.** The following\ncopy-paste example documents the supported API shape for a future audited\nenvironment; it is not an instruction to install vulnerable dependencies now.\nThe full paid-notarization example is [cookbooks/llamaindex_agent.py](https://github.com/CharlesStrogish/bitcoin-stratigraphy-mcp/blob/main/cookbooks/llamaindex_agent.py).\n\n``` python\nimport asyncio\nfrom llama_index.tools.mcp import BasicMCPClient, McpToolSpec\nfrom llama_index.core.agent.workflow import ReActAgent\nfrom llama_index.llms.openai import OpenAI\n\nasync def main():\n    client = BasicMCPClient(\n        \"https://bitcoin-stratigraphy-dashboard.replit.app/mcp\", timeout=30\n    )\n    try:\n        tools = await McpToolSpec(client=client).to_tool_list_async()\n        free = [t for t in tools if t.metadata.name in\n                {\"stratigraphy.list\", \"proof.list\"}]\n        if len(free) != 2:\n            raise RuntimeError(\"Expected both free sandbox capabilities\")\n        for tool in free:\n            tool.metadata.name = tool.metadata.name.replace(\".\", \"_\")\n        agent = ReActAgent(\n            tools=free,\n            llm=OpenAI(model=\"gpt-4.1-mini\", temperature=0),\n            system_prompt=\"Use only the discovery tools. Report actual results.\",\n            timeout=90,\n        )\n        response = await agent.run(\n            user_msg=\"List indexed stratigraphy bounds and supported proof operations.\"\n        )\n        print(str(response))\n    finally:\n        await client.http_client.aclose()\n\nasyncio.run(main())\n```\n\nModel credentials and charges are separate from MCP payments.\n\n[sdk/typescript](https://github.com/CharlesStrogish/bitcoin-stratigraphy-mcp/blob/main/sdk/typescript) contains both the REST client and MCP client\nsources, independent compiler configurations, local tests, and its own package\nmanifest. SDK version 0.1.0 is independent of registry release 1.1.0.\n\n```\ncd sdk/typescript\nnpm install\nnpm test\nnpm run build\n```\n\nThe root package manifest retains the canonical MCP registry identity and release version but replaces monorepo scripts/dependencies with portable distribution commands. It is not the private workspace orchestration manifest.\n\n```\nREADME.md                 Distribution and operational guide\npackage.json              Portable MCP metadata and sandbox/test commands\nsmithery.yaml             Canonical remote registration manifest\nmcp.json                  Remote MCP client configuration\nopenapi.yaml              Canonical self-contained REST/OpenAPI contract\nopenapi.json              JSON rendering of the same canonical contract\nLICENSE                   MIT license\ncookbooks/                Native framework sources, requirements, and offline tests\nsdk/typescript/           TypeScript REST/MCP clients and standalone package\nsdk/python/               Python REST/MCP clients and offline tests\nexamples/                 Wallet-free Node/Python sandbox entrypoints\ntest/                     Node sandbox transport and safety tests\nscripts/verify-export.mjs  Portable structure, import, and reference checks\nnpm run verify\nnpm test\npython -m unittest discover -s cookbooks -p 'test_*.py'\npython -m unittest discover -s sdk/python -p 'test_*.py'\n```\n\n`verify` checks relative source imports and Markdown file references, script and\nSDK package paths, JSON syntax, and absence of workspace dependency aliases.\nCompile Python and build the SDK as additional syntax checks. Tests are offline\nunless you explicitly run a sandbox or agent entrypoint.\n\n- Indexed stratigraphy heights are a documented daily-data index, not the live Bitcoin tip or native per-block provenance.\n- OTS calendar acceptance is not Bitcoin confirmation. Preserve the detached receipt and verify its matching digest and Bitcoin attestation separately.\n- Grounding signatures, ZK proofs, and OTS receipts establish different facts; do not describe one as another.\n- SDKs stop on payment errors. Do not retry paid calls blindly or log payment proofs. Store credentials in a secret manager and review spending and tool scope before enabling an agent.\n- The OpenAPI contract covers REST; live MCP `tools/list` describes executable\nMCP schemas. OpenAPI schema version and SDK version need not match the registry\nrelease.\n- Audit optional framework dependencies before installing or updating them. No local wallet, signing, or settlement credentials are shipped.\n\nMIT. See [LICENSE](https://github.com/CharlesStrogish/bitcoin-stratigraphy-mcp/blob/main/LICENSE). Frameworks and optional dependencies retain their own\nlicenses and terms.", "url": "https://wpnews.pro/news/l402-edge-cache-for-ai-agents-paying-over-lightning", "canonical_source": "https://github.com/CharlesStrogish/bitcoin-stratigraphy-mcp", "published_at": "2026-10-05 01:29:00+00:00", "updated_at": "2026-10-05 01:42:48.519507+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "developer-tools", "ai-tools"], "entities": ["Charles Strogish", "Bitcoin Stratigraphy MCP", "bitcoin-stratigraphy-mcp", "LlamaIndex", "LangChain", "NLTK", "Replit", "GHSA-8mgp-746c-j5xp"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/l402-edge-cache-for-ai-agents-paying-over-lightning", "markdown": "https://wpnews.pro/news/l402-edge-cache-for-ai-agents-paying-over-lightning.md", "text": "https://wpnews.pro/news/l402-edge-cache-for-ai-agents-paying-over-lightning.txt", "jsonld": "https://wpnews.pro/news/l402-edge-cache-for-ai-agents-paying-over-lightning.jsonld"}}