Skip to main content

Bitcoin Stratigraphy: MCP Client SDK

Verified, digest-only notarization in five lines

The existing bitcoin-stratigraphy-enterprise distribution includes this client; this strike does not create or publish another Python runtime/package. Install its declared cryptography and rfc8785 dependencies. With your existing pay_invoice, durable persist_preimage, and independently trusted issuer SPKI PEM issuer_pin:

from bitcoin_stratigraphy_enterprise import BitcoinStratigraphyClient
client = BitcoinStratigraphyClient(pay_invoice=pay_invoice, persist_preimage=persist_preimage, expected_issuer_public_key=issuer_pin)
client.verify_handshake()
receipt = client.notarize({"event": "agent-checkpoint"}, label="local-only")
print(receipt["payloadSha256"])

Legacy sdk.python.client imports retain canonical module identity. Existing positional constructor arguments and one-argument wallet(invoice) callbacks remain supported. New keyword-only options include enforce_handshake=True, min_yield_bps, expected_issuer_public_key, expected_manifest_sha256, expected_tool_schema_hashes, l402_token, and pay_invoice(invoice, next_action). Only the explicit legacy opt-out enforce_handshake=False disables verification; there is no silent fallback when discovery fails. Crypto imports remain lazy so opting out does not require loading cryptographic dependencies.

Exact trust coverage: signatures authenticate tool description SHA-256 bytes only, and the full covenant through detached JCS/EdDSA. The yield floor cannot be relaxed below 2100 bps. They do not authenticate manifest names, timestamps or input schemas. Optional expected_manifest_sha256 pins raw HTTP bytes (including whitespace/startup timestamp); optional expected_tool_schema_hashes pins JCS(inputSchema) hashes from live unpaid tools/list. These checks fail closed with IntegrityViolationError; covenant failures raise CovenantViolationError. Results explicitly report signatureCoverage="description_sha256_bytes_only", wholeManifestPinned, inputSchemasPinned, and independentlyPinnedIssuer. Fetching JWKS alone is not independent issuer pinning. A boot check does not prevent later redeployment.

notarize sends only a locally computed canonical UTF-8 SHA-256 {hash}; raw payload and label never leave the process. Guessable payload hashes are not guaranteed anonymous. OTS calendar acceptance is not Bitcoin confirmation. The existing proof.notarize tool creates the receipt; the SDK fabricates no proof. persist_preimage (alias on_preimage) is invoked after verifying the challenged payment hash and before one authorized retry. A failed hook blocks retry; wallet uncertainty or retry rejection does not trigger another payment for the same invoice within this client's lifetime. A preconfigured token's rejection never silently enables wallet payment. Without a durable hook, proof retention is in-memory only; the caller owns recovery after process loss. Never log proofs.

Existing MCP usage and examples

The Central Bank for the Autonomous AI Machine Economy.

Bitcoin Stratigraphy is a production-ready, zero-latency data engine designed exclusively for autonomous AI swarms. This official Python SDK provides a frictionless, plug-and-play L402 / NIP-98 Transport Adapter, allowing multi-agent orchestration frameworks (CrewAI, LangChain) to natively interact with the Stratigraphy vault.

The Mathematical Advantage (Why Orchestrators Route Through Us)

You are building autonomous agents. Do not waste engineering cycles building cryptographic data pipelines.

By routing your AI swarms through the Bitcoin Stratigraphy infrastructure, you instantly upgrade your fleet with:

  1. Zero-Trust Security: NIP-98 Schnorr signature authentication and SHA-256 Hashcash DDoS shielding natively handled by this SDK.
  2. Enterprise Compliance: Compliant with EU AI Act Article 12 (Multi-Party Compute & Split-Key architecture).
  3. The 21% Algorithmic Yield: Syndicate Orchestrators who route their users through our VIP Lightning tabs earn a programmatic 21% yield on all L402 micro-transactions. We pay you to use our infrastructure.

⚡ Frictionless Swarm Integration

We have completely abstracted the cryptographic friction. Connect your agents in 4 lines of code.

Installation

pip install "bitcoin-stratigraphy-mcp-client[crewai,langchain]" langchain

The transport package is defined in sdk/python/mcp-client/pyproject.toml. To install directly from this repository instead, run from the repository root:

pip install "./sdk/python/mcp-client[crewai,langchain]" langchain

Supply private_key from your secret manager and an async wallet_handler that approves and pays an L402 invoice and returns its payment preimage as a hex string. Configure your framework's model provider separately.

CrewAI Integration (Multi-Agent Fleets)

Provide your agent's role, goal, story (backstory), and configured llm.

from crewai import Agent
from bitcoin_stratigraphy_mcp_client.crewai import CrewAISwarmTools
# The SDK automatically negotiates the L402 Lightning Macaroon and NIP-98 Headers
with CrewAISwarmTools(private_key, wallet_handler) as tools:
    agent = Agent(role=role, goal=goal, backstory=story, tools=tools, llm=llm)

Keep Crew(...).kickoff() or await Crew(...).kickoff_async() inside the with block so the MCP session remains open while agents execute their tools.

LangChain Integration

Use a configured LangChain model. L402 is a short local alias for the exported L402Nip98Transport class, not a separate transport.

from bitcoin_stratigraphy_mcp_client import L402Nip98Transport as L402
from langchain.agents import create_agent
# Discover the enabled MCP catalog (19-tool capacity; clearing is host-enabled)
async with L402(private_key, wallet_handler).langchain_tools() as tools:
    agent = create_agent(model, tools=tools)

Run await agent.ainvoke(...) inside the async with block to keep the transport and MCP session open for tool execution.

Enterprise Commercial Exemptions

The core engine is licensed strictly under AGPLv3. Fortune 500 risk teams and Proprietary swarms that cannot meet AGPLv3 Section 13 obligations can buy a self-serve AGPLv3 Commercial Copyright Waiver at https://bitcoinstratigraphy.com/#enterprise-licensing (swarm_monthly $2,500/30 days, swarm_annual $25,000/365 days, global_monthly $25,000/30 days, global_annual $250,000/365 days, quoted in BTC at spot).

All prepaid MCP Macro-Macaroons, Scanner Packs, and AGPLv3 Commercial Copyright Waivers are 100% self-serve and provided STRICTLY AS-IS, WITH ALL FAULTS. Zero SLAs, zero uptime warranties, zero indemnity, zero custom MSAs, zero vendor questionnaires, and zero support obligations. Full source code is publicly inspectable under AGPLv3 for independent self-hosting. Payment for a Commercial Copyright Waiver strictly grants a time-locked, non-negotiable waiver from AGPLv3 Section 13 network source-disclosure requirements for the specified term, anchored cryptographically to your confirmed Bitcoin transaction.

Metadata

Release files for bitcoin-stratigraphy-enterprise 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitcoin-stratigraphy-enterprise 0.2.0
File Size Uploaded Provenance Actions
bitcoin_stratigraphy_enterprise-0.2.0.tar.gz 61.4 kB With provenance Details for bitcoin_stratigraphy_enterprise-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bitcoin-stratigraphy-enterprise 0.2.0
File Interpreter ABI Platform Actions
bitcoin_stratigraphy_enterprise-0.2.0-py3-none-any.whl Python 3 none any Details for bitcoin_stratigraphy_enterprise-0.2.0-py3-none-any.whl

Total release size: 130.1 kB

Release files / bitcoin_stratigraphy_enterprise-0.2.0.tar.gz

Download URL bitcoin_stratigraphy_enterprise-0.2.0.tar.gz
Size 61.4 kB
Tags Source
SHA-256 checksum
How to use checksums
503c2922ab32e71e50ff58e80c8810157e8f301339e354b58cee727f8f88076e
BLAKE2b-256 checksum
How to use checksums
7e84339565454e74797a75a2d740df1cb7ec9129f178d68193e66474ccffa5f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / bitcoin_stratigraphy_enterprise-0.2.0-py3-none-any.whl

Download URL bitcoin_stratigraphy_enterprise-0.2.0-py3-none-any.whl
Size 68.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6b747b426d4e3f60d1f9626340c5e5821e59898f4842145c8bf041977da9cd2
BLAKE2b-256 checksum
How to use checksums
5ee8fea9a87770e7d670c4792922c9c5bee6c739da1813c960d0e141caee4004
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for bitcoin-stratigraphy-enterprise 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bitcoin_stratigraphy_enterprise-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page