ZZanoraDocs

Packages

The public surface of @zanora/sdk, @zanora/middleware-mcp and @zanora/middleware-express, in one place.

@zanora/sdk

new ZanoraAgent(options)

OptionTypeNotes
agentIdstringrequired
walletIdstringrequired
privateKeyPemstringrequired: the ed25519 private key
apiKeystringworkspace key. Required on any real deployment
maxPriceMinorbigintclient-side ceiling
mcpCallerMcpToolCallerrequired for invokeMcp. See @zanora/mcp
gatewayUrlstringdefaults to DEFAULT_GATEWAY_URL (https://api.zanora.dev)
MethodReturns
discover({ query?, category?, protocol?, maxPriceMinor?, maxLatencyMs?, limit? }){ results: [{ capability, version, provider, score }] }
invoke<T>(url, { body?, method?, headers?, signal? })InvokeResult<T>
invokeMcp<T>(address, { tool, arguments?, signal? })InvokeResult<T>, plus mcpResult
verifyReceipt(receipt)Promise<boolean>
balance(){ balanceMinor, availableMinor, currency }
rateProvider(providerId, transactionId, rating)
TypeScript
interface InvokeResult<T> {
  status: number;
  data: T;
  receipt?: Receipt;
  receiptVerified: boolean;       // Zanora signed it
  responseHashVerified: boolean;  // it covers this response
  transactionId?: string;
  mcpResult?: McpToolCallResult;  // invokeMcp only: the seller's result, unmodified
}
Error classcode valuesMoney moved?
ZanoraPolicyRejectionPOLICY_DENIED, APPROVAL_REQUIRED (+ approvalId), INSUFFICIENT_FUNDS, …no
ZanoraPaymentErrorPRICE_ABOVE_CLIENT_LIMIT, CANCELLED, INVALID_CHALLENGE, MCP_TRANSPORT_UNAVAILABLEno

Also exported: ZanoraClient (typed API client, same gatewayUrl default), generateEd25519KeyPair(), DEFAULT_GATEWAY_URL.

@zanora/middleware-mcp

ExportUse
zanoraSeller({ gatewayUrl?, apiKey? })gateway: the option, then ZANORA_GATEWAY_URL, then https://api.zanora.dev. Key: the option, then ZANORA_API_KEY, and it must be a provider key
seller.sell(input)publishes or reconciles one tool, and returns the paid wrapper
seller.sellWithDetails(input)returns { paid, describe, capability: { capabilityId, published, changed, priceMinor, currency, endpoint } }
seller.sellAll({ tools?, from?, prices, skip?, category, url? | runsLocally?, … })returns { paid(tool), describe(tool, def), tools, capabilities }
zanoraTool({ backend, capabilityId })the low-level wrapper: paid(params, handler)

paid has two forms: paid(handler) for McpServer.tool(), and paid(params, handler) for setRequestHandler. The handler's second argument is { transactionId, walletId, agentId }.

@zanora/middleware-express

ExportUse
new HttpBackend({ gatewayUrl?, apiKey })the gateway connection, using your provider key. The gateway defaults to https://api.zanora.dev. The positional form new HttpBackend(gatewayUrl, apiKey) still works
zanora({ backend, capabilityId })Express middleware. Sets req.zanora = { transactionId, walletId, agentId }

@zanora/core

ExportUse
DEFAULT_GATEWAY_URL"https://api.zanora.dev", the default every client package uses
resolveCapabilityAddress(version)the url or package address to call or run
canonicalJson, signPayload, verifyPayloadthe signing scheme for challenges, proofs and receipts
generateEd25519KeyPair(){ publicKeyPem, privateKeyPem }
HttpBackend, ZanoraBackendthe seller-side gateway interface both middlewares use