Docs · SDKs
SDKs
Two packages on npm and one on PyPI. @unfragile/sdk (TypeScript) and unfragile (Python) call the API and check what it signs. @unfragile/tool-search ranks the tools you already have.
TypeScript: @unfragile/sdk
npm install @unfragile/sdkimport { Unfragile } from "@unfragile/sdk";
const u = new Unfragile(); // keyless: the free daily allowance; or new Unfragile({ apiKey })
const r = await u.find("refund a stripe payment", { answer: true });
const v = await u.verify("npm:@stripe/mcp"); // { verdict, reason, record, passport }Calls: find, search, verify, resolve, passport, stats. A refusal is an UnfragileError with the API's own message, plus the parameter, the seconds until the reset and whose allowance it was when the API names them. No dependencies; Node 20+, Deno, Bun or a current browser.
Python: unfragile
pip install "unfragile[verify]"from unfragile import Unfragile, verify_receipt
u = Unfragile() # keyless: the free daily allowance; or Unfragile(api_key=...)
r = u.find("refund a stripe payment", answer=True)
print(verify_receipt(r["receipt"]).valid) # needs the verify extraThe same calls, on Python's standard library. The signature check needs the verify extra, which adds cryptography, because Python has no Ed25519 of its own. Python 3.9 or later.
Check a receipt offline
import { verifyReceipt } from "@unfragile/sdk";
const check = await verifyReceipt(r.receipt); // Ed25519, on your machine
console.log(check.valid, check.signedAt);The same check works on a passport. It verifies the Ed25519 signature over the receipt's canonical JSON against the published key (see Receipts), with WebCrypto and nothing else.
Rank your own tools: @unfragile/tool-search
npm install @unfragile/tool-searchimport { toolSearch } from "ai";
import { unfragileSearch } from "@unfragile/tool-search/ai-sdk";
const search = toolSearch({ search: unfragileSearch() }); // ranks YOUR deferred tools by what they doIt reorders only the tools you registered, by keywords and a small local model, on your machine. For Gemini's client-side tool retrieval, import geminiToolSearch from @unfragile/tool-search/gemini.