Bitcoin Stratigraphy MCP

官方

企業級、L402閘控的AI公證中心與MCP資料伺服器,提供熱力學比特幣遙測資料與OpenTimestamps狀態錨定。

你可以用 Bitcoin Stratigraphy MCP 做什麼?

  • 探索索引化的地層資料 — 請您的 AI 呼叫 stratigraphy.list 以查看可用的日期、高度、邊界和指標。
  • 列出證明操作 — 在進行付費呼叫前,使用 proof.list 檢查支援的公證與驗證架構。
  • 請求公證批次 — 要求 proof.notarize 挑戰,包含 100 次呼叫的 L402 批次,然後透過 Lightning 支付,將雜湊錨定在 Bitcoin 上。
  • 執行免費沙盒用戶端 — 執行無需錢包的 Node 或 Python 範例,以測試 MCP 連線,無需簽章或付費。
  • 建置 LangChain ReAct 代理 — 設定一個僅使用免費工具的代理,使用文件化的 MCP 轉接器查詢地層與證明中繼資料。

託管 MCP 伺服器

npx add-mcp 'https://bitcoin-stratigraphy-dashboard.replit.app/mcp'

可安裝到 Claude Code、Codex、Cursor 等客戶端

文件

Bitcoin Stratigraphy MCP — 開發者發布版

MCP L402 OpenTimestamps LangChain LlamaIndex

版本: 1.1.0 · MCP 註冊表名稱: crstrogish/bitcoin-stratigraphy

這是一個獨立、以遠端優先的整合儲存庫,用於 Bitcoin Stratigraphy MCP 引擎:註冊表元資料、OpenAPI 契約、無依賴的用戶端,以及 原生框架代理範例。免費沙盒不需要 Replit 工作區、錢包、API 金鑰或模型 供應商帳戶。

範圍與安全狀態

此套件連線至託管引擎;它不包含或聲稱 可離線執行完整的結算伺服器。用戶端原始碼可在本機執行, 連線至即時服務或獨立運作的相容 MCP 端點。 沒有工作區別名、販售的憑證、私密簽章金鑰、 營運者狀態,或對父儲存庫的依賴。

支援 LangChain 執行。LlamaIndex 原始碼已保留,但依賴 安裝與執行暫時不可用:其 NLTK 依賴受到 GHSA-8mgp-746c-j5xp 的影響。 LlamaIndex 需求檔案刻意不安裝任何內容。請勿繞過安全 檢查,或將徽章視為支援執行的聲明。僅在稽核安全、完整的 依賴樹後恢復安裝。

連線至即時 MCP 引擎

介面URL
Streamable HTTP MCPhttps://bitcoin-stratigraphy-dashboard.replit.app/mcp
開發者入口網站https://bitcoin-stratigraphy-dashboard.replit.app/docs
即時 OpenAPIhttps://bitcoin-stratigraphy-dashboard.replit.app/openapi.json

在任何 Streamable HTTP 用戶端中使用 MCP URL。在您的用戶端支援 URL 型 MCP 設定時匯入 mcp.json;某些主機需要 在其自身設定格式中明確指定傳輸類型。smithery.yaml 是標準的遠端註冊元資料,而非本機伺服器啟動配方。

伺服器宣告 15 個標準能力。initialize 和 tools/list 是免費的協定探索操作。恰好有兩個工具執行是免費的:

工具參數用途
stratigraphy.list{}探索索引的日期/高度、邊界與可用指標
proof.list{}列出支援的證明操作與架構元資料

目錄探索並非付款授權。其他標準工具需要 付費存取;在授權購買前請查詢即時架構與付款條款。

免費沙盒快速入門 — 無需錢包

Node.js 22 或更新版本

從此儲存庫根目錄,無需安裝任何套件:

node examples/free-sandbox.mjs

這會協商 MCP、傳送初始化通知,然後僅呼叫 stratigraphy.list 和 proof.list。它不會簽章、付款、附加憑證或 發出 LLM 請求。如果免費呼叫回傳 HTTP 402,它會失敗而非付款。

若要使用您自己的相容端點:

node examples/free-sandbox.mjs --url http://127.0.0.1:5000/mcp

這是用戶端連線,不是啟動生產引擎的命令。

Python 3.11 或更新版本

隨附的用戶端使用標準程式庫即可運作;無需 安裝任何框架:

python -m examples.free_sandbox

等效的複製貼上 Python:

from sdk.python.client import BitcoinStratigraphyClient

client = BitcoinStratigraphyClient()
print(client.call_tool("stratigraphy.list", {}))
print(client.call_tool("proof.list", {}))

從儲存庫根目錄執行程式碼,以便 sdk 命名空間可匯入。TLS 驗證保持啟用。如果您的組織使用私人 CA,請設定 其受信任的憑證儲存庫;請勿停用驗證。

L402:100 次呼叫的巨集 Macaroon 批次

付費能力使用工具範圍的憑證。若要請求批次,請包含:

X-L402-Batch-Size: 100

例如,此請求要求公證批次的挑戰;它不會 支付發票:

curl --include --request POST \
  'https://bitcoin-stratigraphy-dashboard.replit.app/mcp' \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json, text/event-stream' \
  --header 'X-L402-Batch-Size: 100' \
  --data '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"proof.notarize","arguments":{"hash":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}}}'
  1. 檢查 HTTP 402、L402 WWW-Authenticate 挑戰、 發票金額、到期時間與確切工具範圍。
  2. 僅透過受信任的 Lightning 錢包/用戶端付款,並設定明確的 支出限制。驗證結算證明與挑戰的付款雜湊相符。
  3. 使用批次標頭重試相同的工具呼叫,並加上:
Authorization: L402 <macaroon>:<preimage>
X-L402-Batch-Size: 100

註冊的公證報價為 250 sats/次 × 100 = 25,000 sats。 即時發票具有權威性;註冊表目標價格範例並非 價格保證。proof.notarize 通行證不會解鎖其他付費工具。 預算、到期、撤銷與繼承的制約在每次使用時仍然適用。 衰減會委派或縮小範圍;它不會重設父預算。

原生框架介面卡不是錢包。透過 L402_AUTHORIZATION 提供預付憑證,或透過 L402_PROXY_URL 提供受信任的回環 Streamable HTTP 錢包代理, 並設定明確的支出限制。請勿提交憑證 或模型供應商密鑰。舊版的一次性 SDK 付款回呼並非 自動巨集 Macaroon 批次實作。

LangChain:原生 MCP 與 ReAct 迴圈

使用獨立的使用者 Python 環境,而非舊版 MCP 1.x 環境:

python -m pip install -r cookbooks/requirements-langchain.txt
python cookbooks/langchain_agent.py

預設模式僅探索工具。若要選擇 LLM 與付費公證, 請透過您的密鑰管理員設定供應商金鑰與預付的 proof.notarize 批次憑證,然後執行:

python cookbooks/langchain_agent.py --run

複製貼上僅免費工具的 ReAct 迴圈(MCP 呼叫免費;模型使用由您的 模型供應商計費):

import asyncio
from fastmcp.client import Client
from fastmcp.client.transports import StreamableHttpTransport
from langchain.mcp import MCPAdapter
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI

async def main():
    transport = StreamableHttpTransport(
        url="https://bitcoin-stratigraphy-dashboard.replit.app/mcp"
    )
    client = Client(transport, mode="legacy", timeout=30)
    async with MCPAdapter(client) as adapter:
        tools = await adapter.list_tools()
        free = [
            t.model_copy(update={"name": t.name.replace(".", "_")})
            for t in tools if t.name in {"stratigraphy.list", "proof.list"}
        ]
        if len(free) != 2:
            raise RuntimeError("Expected both free sandbox capabilities")
        agent = create_agent(
            model=ChatOpenAI(model="gpt-4.1-mini", temperature=0),
            tools=free,
            system_prompt="Use only these discovery tools. Report actual results.",
        )
        result = await agent.ainvoke(
            {"messages": [{"role": "user", "content":
                "List indexed stratigraphy bounds and supported proof operations."}]}
        )
        print(result["messages"][-1].content)

asyncio.run(main())

create_agent 實作目前的 ReAct 模型 → 工具 → 觀察迴圈。 底線別名滿足模型供應商命名規則;包裝器保留 原始的點分隔遠端工具名稱。

LlamaIndex:保留的原生代理範例

在依賴安全暫停解除前僅提供原始碼。 以下 複製貼上範例記錄了未來稽核環境的支援 API 形狀; 它不是現在安裝易受攻擊依賴的指示。 完整的付費公證範例位於 cookbooks/llamaindex_agent.py。

import asyncio
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
from llama_index.core.agent.workflow import ReActAgent
from llama_index.llms.openai import OpenAI

async def main():
    client = BasicMCPClient(
        "https://bitcoin-stratigraphy-dashboard.replit.app/mcp", timeout=30
    )
    try:
        tools = await McpToolSpec(client=client).to_tool_list_async()
        free = [t for t in tools if t.metadata.name in
                {"stratigraphy.list", "proof.list"}]
        if len(free) != 2:
            raise RuntimeError("Expected both free sandbox capabilities")
        for tool in free:
            tool.metadata.name = tool.metadata.name.replace(".", "_")
        agent = ReActAgent(
            tools=free,
            llm=OpenAI(model="gpt-4.1-mini", temperature=0),
            system_prompt="Use only the discovery tools. Report actual results.",
            timeout=90,
        )
        response = await agent.run(
            user_msg="List indexed stratigraphy bounds and supported proof operations."
        )
        print(str(response))
    finally:
        await client.http_client.aclose()

asyncio.run(main())

模型憑證與費用與 MCP 付款分開。

TypeScript SDK

sdk/typescript 包含 REST 用戶端與 MCP 用戶端 原始碼、獨立的編譯器設定、本機測試,以及自身的套件 清單。SDK 版本 0.1.0 獨立於註冊表版本 1.1.0。

cd sdk/typescript
npm install
npm test
npm run build

根套件清單保留標準的 MCP 註冊表身分與 發布版本,但將 monorepo 腳本/依賴替換為可攜的 發布命令。它不是私人工作區編排清單。

儲存庫內容與匯出檢查

README.md                 Distribution and operational guide
package.json              Portable MCP metadata and sandbox/test commands
smithery.yaml             Canonical remote registration manifest
mcp.json                  Remote MCP client configuration
openapi.yaml              Canonical self-contained REST/OpenAPI contract
openapi.json              JSON rendering of the same canonical contract
LICENSE                   MIT license
cookbooks/                Native framework sources, requirements, and offline tests
sdk/typescript/           TypeScript REST/MCP clients and standalone package
sdk/python/               Python REST/MCP clients and offline tests
examples/                 Wallet-free Node/Python sandbox entrypoints
test/                     Node sandbox transport and safety tests
scripts/verify-export.mjs  Portable structure, import, and reference checks
npm run verify
npm test
python -m unittest discover -s cookbooks -p 'test_*.py'
python -m unittest discover -s sdk/python -p 'test_*.py'

verify 檢查相對原始碼匯入與 Markdown 檔案引用、腳本與 SDK 套件路徑、JSON 語法,以及工作區依賴別名的缺失。 編譯 Python 並建置 SDK 作為額外的語法檢查。測試為離線 狀態,除非您明確執行沙盒或代理入口點。

營運邊界

  • 索引的地層高度是記錄的每日資料索引,而非即時 Bitcoin 頂點或原生逐區塊來源。
  • OTS 日曆接受並非 Bitcoin 確認。保留分離的 收據,並分別驗證其相符的摘要與 Bitcoin 證明。
  • 接地簽章、ZK 證明與 OTS 收據建立不同的事實; 請勿將其一描述為另一者。
  • SDK 在付款錯誤時停止。請勿盲目重試付費呼叫或記錄付款 證明。將憑證儲存在密鑰管理員中,並在啟用代理前檢視支出與工具 範圍。
  • OpenAPI 契約涵蓋 REST;即時 MCP tools/list 描述可執行的 MCP 架構。OpenAPI 架構版本與 SDK 版本不必與註冊表 發布相符。
  • 在安裝或更新前稽核選用的框架依賴。 不隨附本機錢包、簽章或結算憑證。

授權

MIT。請參閱 LICENSE。框架與選用依賴保留其自身的授權與 條款。

🤖 CrewAI 整合

Bitcoin Stratigraphy 資料引擎原生支援 CrewAI 的 MCPServerAdapter。將此片段放入您的工作流程,即可立即為您的代理配備熱力學工具與 OpenTimestamps 狀態錨定:

pip install crewai-tools[mcp]

請參閱 crewai_cookbook.py 取得完整的代理執行腳本。