Bitcoin Stratigraphy MCP

官方

一个企业级、基于L402网关的AI公证中心及MCP数据服务器,提供热力学比特币遥测数据和OpenTimestamps状态锚定服务。

你可以用 Bitcoin Stratigraphy MCP 做什么?

  • 发现索引地层数据 — 让您的 AI 调用 stratigraphy.list 以查看可用的日期、高度、边界和指标。
  • 列出证明操作 — 在进行付费调用之前,使用 proof.list 检查支持的公证和验证模式。
  • 请求公证批次 — 请求一个包含 100 次调用的 L402 批次的 proof.notarize 挑战,然后通过 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 的 requirements 文件有意不安装任何内容。请勿绕过安全检查,也不要将徽章视为支持执行的声明。只有在审计了安全、完整的依赖树之后,才能恢复安装。

连接到实时 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 次调用的 Macro-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 支付回调不是自动的 Macro-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 获取完整的智能体执行脚本。