@bound/mcp 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bound-mcp.js CHANGED
@@ -318,8 +318,11 @@ var boundTools = {
318
318
  }
319
319
  };
320
320
 
321
+ // package.json
322
+ var version = "0.1.1";
323
+
321
324
  // src/server.ts
322
- var VERSION = "0.1.0";
325
+ var VERSION = version;
323
326
  function createBoundMcpServer(tools = boundTools) {
324
327
  const server = new mcp_js.McpServer({ name: "bound-protocol", version: VERSION });
325
328
  for (const [name, t] of Object.entries(tools)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.26_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js","../src/accounts.ts","../src/tools.ts","../src/server.ts","../src/bin.ts"],"names":["join","existsSync","dirname","createRequire","Keypair","z","bound","formatUsdc","usdc","agentFetch","getCertificate","premium","McpServer","StdioServerTransport"],"mappings":";;;;;;;;;;;;;AAKA,IAAM,gBAAA,GAAmB,MACvB,OAAO,QAAA,KAAa,WAAA,GAChB,IAAI,GAAA,CAAI,CAAA,KAAA,EAAQ,UAAU,CAAA,CAAE,CAAA,CAAE,IAAA,GAC7B,QAAA,CAAS,aAAA,IAAiB,QAAA,CAAS,aAAA,CAAc,OAAA,CAAQ,WAAA,EAAY,KAAM,QAAA,GAC1E,QAAA,CAAS,aAAA,CAAc,GAAA,GACvB,IAAI,GAAA,CAAI,SAAA,EAAW,QAAA,CAAS,OAAO,CAAA,CAAE,IAAA;AAEtC,IAAM,gCAAgC,gBAAA,EAAiB;ACO9D,SAAS,eAAe,QAAA,EAAsC;AAC5D,EAAA,IAAI,GAAA,GAAM,QAAA;AACV,EAAA,WAAS;AACP,IAAA,MAAM,SAAA,GAAYA,SAAA,CAAK,GAAA,EAAK,cAAc,CAAA;AAC1C,IAAA,IAAIC,aAAA,CAAW,SAAS,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M,CAAA,iBAAA,EAAoB,OAAO,CAAA,iBAAA,CAAmB,CAAA;AAC9D;AAEA,IAAA,EAAK,CAAE,KAAA,CAAM,CAAC,GAAA,KAAQ;AACpB,EAAA,OAAA,CAAQ,MAAM,GAAG,CAAA;AACjB,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAChB,CAAC,CAAA","file":"bound-mcp.js","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","// Demo keypairs, loaded from the environment. SERVER ONLY — these hold secret\n// keys, and every write tool in this package signs with one of them.\n//\n// This is a deliberate near-copy of apps/dashboard/app/lib/accounts.ts. The two\n// read the SAME five environment variables, so a repo checkout keeps working\n// either way, but a published package cannot reach into a Next.js app for its\n// credentials — that import is exactly what stopped `mcp/server.ts` from being\n// installable. Duplicating thirty lines is the cost of the package standing on\n// its own; the env var names are the contract that keeps them in step.\n//\n// Bound is testnet-only (see the SDK's committed deployment record), so naming\n// five fixed roles here is honest rather than limiting: there is no mainnet key\n// anyone could lose. An MCP client supplies them through the `env` block of its\n// server config; `.env.testnet` is only the in-repo convenience.\nimport { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { Keypair } from \"@stellar/stellar-sdk\";\n\nfunction findEnvTestnet(startDir: string): string | undefined {\n let dir = startDir;\n for (;;) {\n const candidate = join(dir, \".env.testnet\");\n if (existsSync(candidate)) return candidate;\n const parent = dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n}\n\n// An MCP client launches this server with cwd set to wherever it pleases, so we\n// walk upward rather than assuming a fixed relative path. Skipped entirely once\n// the environment already carries the keys, which is the normal case for an\n// installed server: the client's config block is the supply route.\n//\n// dotenv is loaded through createRequire and swallowed on failure because it is\n// NOT a dependency of this package — it is a dev-time convenience that happens\n// to be present inside the Bound repo. An installed copy has no .env.testnet to\n// find and never reaches this line.\nif (!process.env.OPERATOR_SECRET) {\n const envPath = findEnvTestnet(process.cwd());\n if (envPath) {\n try {\n const load = createRequire(import.meta.url)(\"dotenv\") as {\n config: (options: { path: string }) => void;\n };\n load.config({ path: envPath });\n } catch {\n // No dotenv on the resolution path: fall through and let kp() report the\n // missing variable by name, which is the more useful error anyway.\n }\n }\n}\n\nfunction kp(secretKey: string): Keypair {\n const secret = process.env[secretKey];\n if (!secret) {\n throw new Error(\n `missing ${secretKey} — set it in the MCP server's env block (see @bound/mcp README)`,\n );\n }\n return Keypair.fromSecret(secret);\n}\n\n// Lazily constructed so importing this module doesn't throw when only some\n// roles are needed. A read-only session never touches a secret at all.\nexport const accounts = {\n get operator() {\n return kp(\"OPERATOR_SECRET\");\n },\n get agent() {\n return kp(\"AGENT_SECRET\");\n },\n get auditor() {\n return kp(\"AUDITOR_SECRET\");\n },\n get challenger() {\n return kp(\"CHALLENGER_SECRET\");\n },\n get counterparty() {\n return kp(\"COUNTERPARTY_SECRET\");\n },\n};\n","// Framework-agnostic Bound tool definitions. Each tool is a description + a Zod\n// raw shape (the param map) + an execute() that calls BoundClient. The MCP\n// server here and the AI SDK loop in apps/dashboard both adapt these — one\n// core, two mouths. This file is the single definition of each tool; the app\n// imports it back from `@bound/mcp/tools` rather than owning a second copy.\n//\n// SERVER ONLY: execute() signs with secret keys held in the environment.\n//\n// Model A (pure bonding): there is NO spending cap. The agent pays whatever it\n// is asked. Safety is economic — the certificate bounds the counterparty's loss,\n// and a false vouch is slashed via challenge_certificate.\n//\n// v2 hangs two rails off that. The PaymentRouter meters what an enrolled agent\n// spends, and its counter is the on-chain state a BoundExceeded proof is read\n// from — routing is what turns a payment into evidence. The PremiumVault prices\n// the auditor's risk and pays them yield for carrying it, so vouching is a\n// business rather than a favour.\nimport { z } from \"zod\";\nimport { bound, type ProofType, agentFetch, getCertificate, usdc, formatUsdc } from \"@bound/sdk\";\nimport { accounts } from \"./accounts\";\n\nexport interface BoundTool {\n description: string;\n parameters: z.ZodRawShape;\n /**\n * Simulates against the chain, signs nothing, spends nothing. Surfaced to MCP\n * clients as `readOnlyHint` so a human is asked to approve only the calls\n * that actually move money.\n */\n readOnly?: boolean;\n execute: (args: any) => Promise<unknown>;\n}\n\nconst SECONDS_PER_DAY = 86_400;\n\nexport const boundTools: Record<string, BoundTool> = {\n verify_agent_certificate: {\n description:\n \"Check an AI agent's Bound Certificate before transacting with it. Returns whether it is valid, the bounded worst-case loss, the locked reserve, and the auditor's slashable stake.\",\n readOnly: true,\n parameters: { agent: z.string().describe(\"The G... address of the agent to verify\") },\n execute: async ({ agent }: { agent: string }) => {\n const v = await bound.verifyCertificate(agent);\n return {\n valid: v.valid,\n status: v.status.tag,\n bound: formatUsdc(v.bound),\n reserve: formatUsdc(v.reserve),\n auditorStake: formatUsdc(v.auditor_stake),\n auditor: v.auditor ?? null,\n };\n },\n },\n\n get_balance: {\n description: \"Get the USDC balance of an address. Defaults to this agent's own balance.\",\n readOnly: true,\n parameters: {\n address: z.string().optional().describe(\"G... address; omit for the agent itself\"),\n },\n execute: async ({ address }: { address?: string }) => {\n const addr = address ?? accounts.agent.publicKey();\n return { address: addr, balance: formatUsdc(await bound.usdcBalance(addr)) };\n },\n },\n\n execute_payment: {\n description:\n \"Send USDC directly to a recipient. The agent has no spending cap — it pays what it is asked. The counterparty's exposure is bounded by the agent's certificate, not by this call.\",\n parameters: {\n recipient: z.string().describe(\"G... address to pay\"),\n amountUsd: z.number().describe(\"Amount in USDC dollars\"),\n },\n execute: async ({ recipient, amountUsd }: { recipient: string; amountUsd: number }) => {\n const receipt = await bound.executePayment(accounts.agent, recipient, usdc(amountUsd));\n return {\n success: true,\n amountUsd,\n recipient,\n txHash: receipt.hash,\n // Whether this payment is on the record a challenger can read.\n routed: receipt.routed,\n certId: receipt.certId,\n };\n },\n },\n\n fetch_paid_service: {\n description:\n \"Fetch an HTTP resource that may require payment (x402). If the server answers 402, the agent autonomously pays the demanded price in USDC and retries. No human approves the amount — the service sets it, the agent decides.\",\n parameters: { url: z.string().describe(\"URL of the paid service\") },\n execute: async ({ url }: { url: string }) => {\n const { response, paid } = await agentFetch(url, accounts.agent, bound);\n const body = await response.text();\n return {\n status: response.status,\n paid: paid\n ? { amountUsd: paid.amount, recipient: paid.recipient, txHash: paid.txHash }\n : null,\n body,\n };\n },\n },\n\n challenge_certificate: {\n description:\n \"Prove a certificate's attestation is false and trigger on-chain enforcement. For InsufficientReserve the contract verifies the fraud itself (claimed reserve > actual), then slashes the auditor's stake and compensates the victim. Returns the resulting certificate status.\",\n parameters: {\n certId: z.number().describe(\"Certificate id to challenge\"),\n victim: z.string().describe(\"G... address of the harmed counterparty to compensate\"),\n proofType: z\n .enum([\"InsufficientReserve\", \"BoundExceeded\", \"FakeSignature\", \"ExpiredCertificate\"])\n .default(\"InsufficientReserve\")\n .describe(\"Kind of fraud; only InsufficientReserve is verified trustlessly on-chain\"),\n },\n execute: async ({\n certId,\n victim,\n proofType,\n }: {\n certId: number;\n victim: string;\n proofType?: ProofType[\"tag\"];\n }) => {\n const before = await bound.verifyCertificate(accounts.agent.publicKey());\n const challengeId = await bound.challengeCertificate(accounts.challenger, {\n certId: BigInt(certId),\n proofType: (proofType ?? \"InsufficientReserve\") as ProofType[\"tag\"],\n victim,\n bond: usdc(100),\n });\n const after = await bound.verifyCertificate(accounts.agent.publicKey());\n return {\n challengeId: Number(challengeId),\n certStatusBefore: before.status.tag,\n certStatusAfter: after.status.tag,\n outcome:\n after.status.tag === \"Invalid\"\n ? \"FRAUD_PROVEN — auditor slashed, victim compensated\"\n : \"challenge did not invalidate\",\n };\n },\n },\n\n // ---- PaymentRouter: the metered rail ---------------------------------------\n\n get_routing_status: {\n description:\n \"Check whether an address's payments are metered. An address bound to a certificate in the PaymentRouter pays from a float the router holds in custody, and every payment lands on that certificate's spend counter. An unenrolled address pays over the raw USDC rail instead, which leaves no trace any challenger can read.\",\n readOnly: true,\n parameters: {\n address: z.string().optional().describe(\"G... address; omit for the agent itself\"),\n },\n execute: async ({ address }: { address?: string }) => {\n const addr = address ?? accounts.agent.publicKey();\n const certId = await bound.routedCertId(addr);\n return {\n address: addr,\n routed: certId !== null,\n certId,\n floatHeld: formatUsdc(await bound.routedBalance(addr)),\n };\n },\n },\n\n get_cert_meter: {\n description:\n \"Read a certificate's meter: cumulative routed spend, the float the router holds for it, that float's ceiling, and whether the operator has halted it. Spend is GROSS FLOW, not loss — a certificate that has routed more than its bound has broken a covenant about its own conduct, it has not thereby cost anyone that much money. The bound is returned alongside so the two can be compared.\",\n readOnly: true,\n parameters: { certId: z.number().describe(\"Certificate id to read\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n const [spent, float, floatCap, halted, cert] = await Promise.all([\n bound.spendForCert(id),\n bound.floatForCert(id),\n bound.floatCapForCert(id),\n bound.certHalted(id),\n getCertificate(certId),\n ]);\n return {\n certId,\n agent: cert?.agent ?? null,\n status: cert?.status ?? null,\n bound: cert?.boundUsd ?? null,\n spent: formatUsdc(spent),\n float: formatUsdc(float),\n floatCap: formatUsdc(floatCap),\n halted,\n };\n },\n },\n\n enroll_agent: {\n description:\n \"Bind the agent to a certificate in the PaymentRouter and set that certificate's float cap. Both the operator and the agent authorize: enrolment attaches spend to the operator's certificate and subjects the agent to metering and to the operator's kill switch, so neither may conscript the other. A binding is permanent — an operator cannot walk an agent off a certificate whose counter is climbing.\",\n parameters: {\n certId: z.number().describe(\"Certificate id to meter the agent against\"),\n floatCapUsd: z\n .number()\n .describe(\"Ceiling on the float the router will hold — what a stolen agent key can reach\"),\n },\n execute: async ({ certId, floatCapUsd }: { certId: number; floatCapUsd: number }) => {\n await bound.enrollAgent(accounts.operator, accounts.agent, BigInt(certId), usdc(floatCapUsd));\n return {\n success: true,\n agent: accounts.agent.publicKey(),\n certId,\n floatCapUsd,\n note: \"the agent's payments are now metered on this certificate's spend counter\",\n };\n },\n },\n\n fund_float: {\n description:\n \"Move USDC into the PaymentRouter's custody, crediting the agent an equal routed balance to pay from. execute_payment tops this up on demand, so funding ahead of time is optional: float that is never idle is float that cannot be stolen.\",\n parameters: {\n amountUsd: z.number().describe(\"Amount in USDC dollars to move into the router\"),\n },\n execute: async ({ amountUsd }: { amountUsd: number }) => {\n const { hash } = await bound.fundFloat(accounts.agent, usdc(amountUsd));\n const addr = accounts.agent.publicKey();\n return {\n success: true,\n amountUsd,\n txHash: hash,\n floatHeld: formatUsdc(await bound.routedBalance(addr)),\n };\n },\n },\n\n halt_certificate: {\n description:\n \"The operator's kill switch: stop every transfer, withdrawal and burn on a certificate. Signed by the operator, not the agent — this is the lever that exists precisely for the case where the agent's key is the problem.\",\n parameters: { certId: z.number().describe(\"Certificate id to halt\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash } = await bound.haltCert(accounts.operator, BigInt(certId));\n return { success: true, certId, halted: true, txHash: hash };\n },\n },\n\n resume_certificate: {\n description: \"Lift an operator halt and let a certificate's payments flow again.\",\n parameters: { certId: z.number().describe(\"Certificate id to resume\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash } = await bound.resumeCert(accounts.operator, BigInt(certId));\n return { success: true, certId, halted: false, txHash: hash };\n },\n },\n\n // ---- PremiumVault: the economy ---------------------------------------------\n\n quote_premium: {\n description:\n \"Price coverage: bound x duration x rate. Pass a certId to quote a published certificate from its own recorded terms, or boundUsd + durationDays to price a hypothetical one before publishing it.\",\n readOnly: true,\n parameters: {\n certId: z.number().optional().describe(\"Published certificate id to price from its terms\"),\n boundUsd: z.number().optional().describe(\"Hypothetical bound in USDC dollars\"),\n durationDays: z.number().optional().describe(\"Hypothetical coverage length in days\"),\n },\n execute: async ({\n certId,\n boundUsd,\n durationDays,\n }: {\n certId?: number;\n boundUsd?: number;\n durationDays?: number;\n }) => {\n if (certId !== undefined) {\n const premium = await bound.quotePremiumForCert(BigInt(certId));\n return { certId, premium: formatUsdc(premium) };\n }\n if (boundUsd === undefined || durationDays === undefined) {\n throw new Error(\"pass either certId, or both boundUsd and durationDays\");\n }\n const premium = await bound.quotePremium(\n usdc(boundUsd),\n BigInt(Math.round(durationDays * SECONDS_PER_DAY)),\n );\n return { boundUsd, durationDays, premium: formatUsdc(premium) };\n },\n },\n\n get_coverage: {\n description:\n \"Read a certificate's coverage: what the operator paid, the protocol's cut, and how much of the rest the auditor has earned so far. The auditor's yield accrues in a straight line across the term, and a slash forfeits only what is still unclaimed — the premium is yield on the stake, never a second bond. Returns the quote instead when no premium has been paid yet.\",\n readOnly: true,\n parameters: { certId: z.number().describe(\"Certificate id to read coverage for\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n if (!(await bound.premiumPaid(id))) {\n return { certId, paid: false, quote: formatUsdc(await bound.quotePremiumForCert(id)) };\n }\n const [c, accrued, claimable] = await Promise.all([\n bound.coverage(id),\n bound.premiumAccrued(id),\n bound.premiumClaimable(id),\n ]);\n return {\n certId,\n paid: true,\n payer: c.payer,\n auditor: c.auditor,\n premium: formatUsdc(c.premium),\n protocolFee: formatUsdc(c.protocol_fee),\n yieldPot: formatUsdc(c.yield_pot),\n claimed: formatUsdc(c.claimed),\n accrued: formatUsdc(accrued),\n claimable: formatUsdc(claimable),\n startUnix: Number(c.start),\n durationSeconds: Number(c.duration),\n closed: c.closed,\n closedAtUnix: Number(c.closed_at),\n };\n },\n },\n\n pay_premium: {\n description:\n \"Operator buys coverage for a certificate. Payable once, and only on a VERIFIED certificate — the premium is yield on the auditor's staked capital, and there is no auditor to pay until one has attested. The protocol's share leaves in the same transaction; the rest accrues to the auditor across the term.\",\n parameters: { certId: z.number().describe(\"Certificate id to buy coverage for\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n const quote = await bound.quotePremiumForCert(id);\n const { hash } = await bound.payPremium(accounts.operator, id);\n return { success: true, certId, premium: formatUsdc(quote), txHash: hash };\n },\n },\n\n claim_premium: {\n description:\n \"Auditor withdraws accrued-and-unclaimed yield. Allowed at any time, including mid-coverage: at every instant the accrued figure is payment for coverage already delivered. Claiming continuously converts forfeitable yield into settled income, which is deliberate — see get_coverage.\",\n parameters: { certId: z.number().describe(\"Certificate id to claim yield from\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash, result } = await bound.claimPremium(accounts.auditor, BigInt(certId));\n return { success: true, certId, claimed: formatUsdc(result), txHash: hash };\n },\n },\n};\n","// Adapts the Bound tool table onto an MCP server. Transport-free on purpose:\n// the stdio wiring lives in bin.ts, so an embedder that wants Bound's tools\n// inside its own server (HTTP, SSE, in-process) can take this and supply its\n// own transport.\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { boundTools, type BoundTool } from \"./tools\";\n\n/** Kept in step with package.json by hand; it is reported over the wire. */\nexport const VERSION = \"0.1.0\";\n\n/**\n * Build a server exposing every Bound tool.\n *\n * Results go back as pretty-printed JSON text rather than a structured output\n * schema: the tools return small, self-describing objects with money already\n * formatted as dollar strings, and a model reads those fine. A thrown error is\n * returned as an `isError` result instead of being allowed to escape — an MCP\n * client should see \"that call failed and here is why\" and be able to try\n * something else, not lose the session because a chain read timed out.\n */\nexport function createBoundMcpServer(tools: Record<string, BoundTool> = boundTools): McpServer {\n const server = new McpServer({ name: \"bound-protocol\", version: VERSION });\n\n for (const [name, t] of Object.entries(tools)) {\n server.registerTool(\n name,\n {\n description: t.description,\n inputSchema: t.parameters,\n // Only the read-only hint is claimed. `destructiveHint` and\n // `idempotentHint` would both be lies here: a payment is neither\n // reversible nor safe to replay.\n annotations: { readOnlyHint: t.readOnly === true },\n },\n async (args: unknown) => {\n try {\n const result = await t.execute(args);\n return { content: [{ type: \"text\" as const, text: JSON.stringify(result, null, 2) }] };\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n return {\n isError: true,\n content: [{ type: \"text\" as const, text: `Error: ${message}` }],\n };\n }\n },\n );\n }\n\n return server;\n}\n","#!/usr/bin/env node\n// Bound MCP server over stdio — the executable an MCP client launches.\n//\n// Run: npx @bound/mcp\n//\n// stdout is the JSON-RPC channel and nothing else may touch it. Every diagnostic\n// this process emits goes to stderr; a stray console.log here corrupts the\n// stream and the client's only symptom is a server that \"won't connect\".\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { createBoundMcpServer, VERSION } from \"./server\";\n\nasync function main() {\n const server = createBoundMcpServer();\n await server.connect(new StdioServerTransport());\n console.error(`Bound MCP server ${VERSION} running on stdio`);\n}\n\nmain().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.26_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js","../src/accounts.ts","../src/tools.ts","../package.json","../src/server.ts","../src/bin.ts"],"names":["join","existsSync","dirname","createRequire","Keypair","z","bound","formatUsdc","usdc","agentFetch","getCertificate","premium","McpServer","StdioServerTransport"],"mappings":";;;;;;;;;;;;;AAKA,IAAM,gBAAA,GAAmB,MACvB,OAAO,QAAA,KAAa,WAAA,GAChB,IAAI,GAAA,CAAI,CAAA,KAAA,EAAQ,UAAU,CAAA,CAAE,CAAA,CAAE,IAAA,GAC7B,QAAA,CAAS,aAAA,IAAiB,QAAA,CAAS,aAAA,CAAc,OAAA,CAAQ,WAAA,EAAY,KAAM,QAAA,GAC1E,QAAA,CAAS,aAAA,CAAc,GAAA,GACvB,IAAI,GAAA,CAAI,SAAA,EAAW,QAAA,CAAS,OAAO,CAAA,CAAE,IAAA;AAEtC,IAAM,gCAAgC,gBAAA,EAAiB;ACO9D,SAAS,eAAe,QAAA,EAAsC;AAC5D,EAAA,IAAI,GAAA,GAAM,QAAA;AACV,EAAA,WAAS;AACP,IAAA,MAAM,SAAA,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AAqB;AACpC,EAAA,MAAM,MAAA,CAAO,OAAA,CAAQ,IAAIC,6BAAA,EAAsB,CAAA;AAC/C,EAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,iBAAA,EAAoB,OAAO,CAAA,iBAAA,CAAmB,CAAA;AAC9D;AAEA,IAAA,EAAK,CAAE,KAAA,CAAM,CAAC,GAAA,KAAQ;AACpB,EAAA,OAAA,CAAQ,MAAM,GAAG,CAAA;AACjB,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAChB,CAAC,CAAA","file":"bound-mcp.js","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","// Demo keypairs, loaded from the environment. SERVER ONLY — these hold secret\n// keys, and every write tool in this package signs with one of them.\n//\n// This is a deliberate near-copy of apps/dashboard/app/lib/accounts.ts. The two\n// read the SAME five environment variables, so a repo checkout keeps working\n// either way, but a published package cannot reach into a Next.js app for its\n// credentials — that import is exactly what stopped `mcp/server.ts` from being\n// installable. Duplicating thirty lines is the cost of the package standing on\n// its own; the env var names are the contract that keeps them in step.\n//\n// Bound is testnet-only (see the SDK's committed deployment record), so naming\n// five fixed roles here is honest rather than limiting: there is no mainnet key\n// anyone could lose. An MCP client supplies them through the `env` block of its\n// server config; `.env.testnet` is only the in-repo convenience.\nimport { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { Keypair } from \"@stellar/stellar-sdk\";\n\nfunction findEnvTestnet(startDir: string): string | undefined {\n let dir = startDir;\n for (;;) {\n const candidate = join(dir, \".env.testnet\");\n if (existsSync(candidate)) return candidate;\n const parent = dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n}\n\n// An MCP client launches this server with cwd set to wherever it pleases, so we\n// walk upward rather than assuming a fixed relative path. Skipped entirely once\n// the environment already carries the keys, which is the normal case for an\n// installed server: the client's config block is the supply route.\n//\n// dotenv is loaded through createRequire and swallowed on failure because it is\n// NOT a dependency of this package — it is a dev-time convenience that happens\n// to be present inside the Bound repo. An installed copy has no .env.testnet to\n// find and never reaches this line.\nif (!process.env.OPERATOR_SECRET) {\n const envPath = findEnvTestnet(process.cwd());\n if (envPath) {\n try {\n const load = createRequire(import.meta.url)(\"dotenv\") as {\n config: (options: { path: string }) => void;\n };\n load.config({ path: envPath });\n } catch {\n // No dotenv on the resolution path: fall through and let kp() report the\n // missing variable by name, which is the more useful error anyway.\n }\n }\n}\n\nfunction kp(secretKey: string): Keypair {\n const secret = process.env[secretKey];\n if (!secret) {\n throw new Error(\n `missing ${secretKey} — set it in the MCP server's env block (see @bound/mcp README)`,\n );\n }\n return Keypair.fromSecret(secret);\n}\n\n// Lazily constructed so importing this module doesn't throw when only some\n// roles are needed. A read-only session never touches a secret at all.\nexport const accounts = {\n get operator() {\n return kp(\"OPERATOR_SECRET\");\n },\n get agent() {\n return kp(\"AGENT_SECRET\");\n },\n get auditor() {\n return kp(\"AUDITOR_SECRET\");\n },\n get challenger() {\n return kp(\"CHALLENGER_SECRET\");\n },\n get counterparty() {\n return kp(\"COUNTERPARTY_SECRET\");\n },\n};\n","// Framework-agnostic Bound tool definitions. Each tool is a description + a Zod\n// raw shape (the param map) + an execute() that calls BoundClient. The MCP\n// server here and the AI SDK loop in apps/dashboard both adapt these — one\n// core, two mouths. This file is the single definition of each tool; the app\n// imports it back from `@bound/mcp/tools` rather than owning a second copy.\n//\n// SERVER ONLY: execute() signs with secret keys held in the environment.\n//\n// Model A (pure bonding): there is NO spending cap. The agent pays whatever it\n// is asked. Safety is economic — the certificate bounds the counterparty's loss,\n// and a false vouch is slashed via challenge_certificate.\n//\n// v2 hangs two rails off that. The PaymentRouter meters what an enrolled agent\n// spends, and its counter is the on-chain state a BoundExceeded proof is read\n// from — routing is what turns a payment into evidence. The PremiumVault prices\n// the auditor's risk and pays them yield for carrying it, so vouching is a\n// business rather than a favour.\nimport { z } from \"zod\";\nimport { bound, type ProofType, agentFetch, getCertificate, usdc, formatUsdc } from \"@bound/sdk\";\nimport { accounts } from \"./accounts\";\n\nexport interface BoundTool {\n description: string;\n parameters: z.ZodRawShape;\n /**\n * Simulates against the chain, signs nothing, spends nothing. Surfaced to MCP\n * clients as `readOnlyHint` so a human is asked to approve only the calls\n * that actually move money.\n */\n readOnly?: boolean;\n execute: (args: any) => Promise<unknown>;\n}\n\nconst SECONDS_PER_DAY = 86_400;\n\nexport const boundTools: Record<string, BoundTool> = {\n verify_agent_certificate: {\n description:\n \"Check an AI agent's Bound Certificate before transacting with it. Returns whether it is valid, the bounded worst-case loss, the locked reserve, and the auditor's slashable stake.\",\n readOnly: true,\n parameters: { agent: z.string().describe(\"The G... address of the agent to verify\") },\n execute: async ({ agent }: { agent: string }) => {\n const v = await bound.verifyCertificate(agent);\n return {\n valid: v.valid,\n status: v.status.tag,\n bound: formatUsdc(v.bound),\n reserve: formatUsdc(v.reserve),\n auditorStake: formatUsdc(v.auditor_stake),\n auditor: v.auditor ?? null,\n };\n },\n },\n\n get_balance: {\n description: \"Get the USDC balance of an address. Defaults to this agent's own balance.\",\n readOnly: true,\n parameters: {\n address: z.string().optional().describe(\"G... address; omit for the agent itself\"),\n },\n execute: async ({ address }: { address?: string }) => {\n const addr = address ?? accounts.agent.publicKey();\n return { address: addr, balance: formatUsdc(await bound.usdcBalance(addr)) };\n },\n },\n\n execute_payment: {\n description:\n \"Send USDC directly to a recipient. The agent has no spending cap — it pays what it is asked. The counterparty's exposure is bounded by the agent's certificate, not by this call.\",\n parameters: {\n recipient: z.string().describe(\"G... address to pay\"),\n amountUsd: z.number().describe(\"Amount in USDC dollars\"),\n },\n execute: async ({ recipient, amountUsd }: { recipient: string; amountUsd: number }) => {\n const receipt = await bound.executePayment(accounts.agent, recipient, usdc(amountUsd));\n return {\n success: true,\n amountUsd,\n recipient,\n txHash: receipt.hash,\n // Whether this payment is on the record a challenger can read.\n routed: receipt.routed,\n certId: receipt.certId,\n };\n },\n },\n\n fetch_paid_service: {\n description:\n \"Fetch an HTTP resource that may require payment (x402). If the server answers 402, the agent autonomously pays the demanded price in USDC and retries. No human approves the amount — the service sets it, the agent decides.\",\n parameters: { url: z.string().describe(\"URL of the paid service\") },\n execute: async ({ url }: { url: string }) => {\n const { response, paid } = await agentFetch(url, accounts.agent, bound);\n const body = await response.text();\n return {\n status: response.status,\n paid: paid\n ? { amountUsd: paid.amount, recipient: paid.recipient, txHash: paid.txHash }\n : null,\n body,\n };\n },\n },\n\n challenge_certificate: {\n description:\n \"Prove a certificate's attestation is false and trigger on-chain enforcement. For InsufficientReserve the contract verifies the fraud itself (claimed reserve > actual), then slashes the auditor's stake and compensates the victim. Returns the resulting certificate status.\",\n parameters: {\n certId: z.number().describe(\"Certificate id to challenge\"),\n victim: z.string().describe(\"G... address of the harmed counterparty to compensate\"),\n proofType: z\n .enum([\"InsufficientReserve\", \"BoundExceeded\", \"FakeSignature\", \"ExpiredCertificate\"])\n .default(\"InsufficientReserve\")\n .describe(\"Kind of fraud; only InsufficientReserve is verified trustlessly on-chain\"),\n },\n execute: async ({\n certId,\n victim,\n proofType,\n }: {\n certId: number;\n victim: string;\n proofType?: ProofType[\"tag\"];\n }) => {\n const before = await bound.verifyCertificate(accounts.agent.publicKey());\n const challengeId = await bound.challengeCertificate(accounts.challenger, {\n certId: BigInt(certId),\n proofType: (proofType ?? \"InsufficientReserve\") as ProofType[\"tag\"],\n victim,\n bond: usdc(100),\n });\n const after = await bound.verifyCertificate(accounts.agent.publicKey());\n return {\n challengeId: Number(challengeId),\n certStatusBefore: before.status.tag,\n certStatusAfter: after.status.tag,\n outcome:\n after.status.tag === \"Invalid\"\n ? \"FRAUD_PROVEN — auditor slashed, victim compensated\"\n : \"challenge did not invalidate\",\n };\n },\n },\n\n // ---- PaymentRouter: the metered rail ---------------------------------------\n\n get_routing_status: {\n description:\n \"Check whether an address's payments are metered. An address bound to a certificate in the PaymentRouter pays from a float the router holds in custody, and every payment lands on that certificate's spend counter. An unenrolled address pays over the raw USDC rail instead, which leaves no trace any challenger can read.\",\n readOnly: true,\n parameters: {\n address: z.string().optional().describe(\"G... address; omit for the agent itself\"),\n },\n execute: async ({ address }: { address?: string }) => {\n const addr = address ?? accounts.agent.publicKey();\n const certId = await bound.routedCertId(addr);\n return {\n address: addr,\n routed: certId !== null,\n certId,\n floatHeld: formatUsdc(await bound.routedBalance(addr)),\n };\n },\n },\n\n get_cert_meter: {\n description:\n \"Read a certificate's meter: cumulative routed spend, the float the router holds for it, that float's ceiling, and whether the operator has halted it. Spend is GROSS FLOW, not loss — a certificate that has routed more than its bound has broken a covenant about its own conduct, it has not thereby cost anyone that much money. The bound is returned alongside so the two can be compared.\",\n readOnly: true,\n parameters: { certId: z.number().describe(\"Certificate id to read\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n const [spent, float, floatCap, halted, cert] = await Promise.all([\n bound.spendForCert(id),\n bound.floatForCert(id),\n bound.floatCapForCert(id),\n bound.certHalted(id),\n getCertificate(certId),\n ]);\n return {\n certId,\n agent: cert?.agent ?? null,\n status: cert?.status ?? null,\n bound: cert?.boundUsd ?? null,\n spent: formatUsdc(spent),\n float: formatUsdc(float),\n floatCap: formatUsdc(floatCap),\n halted,\n };\n },\n },\n\n enroll_agent: {\n description:\n \"Bind the agent to a certificate in the PaymentRouter and set that certificate's float cap. Both the operator and the agent authorize: enrolment attaches spend to the operator's certificate and subjects the agent to metering and to the operator's kill switch, so neither may conscript the other. A binding is permanent — an operator cannot walk an agent off a certificate whose counter is climbing.\",\n parameters: {\n certId: z.number().describe(\"Certificate id to meter the agent against\"),\n floatCapUsd: z\n .number()\n .describe(\"Ceiling on the float the router will hold — what a stolen agent key can reach\"),\n },\n execute: async ({ certId, floatCapUsd }: { certId: number; floatCapUsd: number }) => {\n await bound.enrollAgent(accounts.operator, accounts.agent, BigInt(certId), usdc(floatCapUsd));\n return {\n success: true,\n agent: accounts.agent.publicKey(),\n certId,\n floatCapUsd,\n note: \"the agent's payments are now metered on this certificate's spend counter\",\n };\n },\n },\n\n fund_float: {\n description:\n \"Move USDC into the PaymentRouter's custody, crediting the agent an equal routed balance to pay from. execute_payment tops this up on demand, so funding ahead of time is optional: float that is never idle is float that cannot be stolen.\",\n parameters: {\n amountUsd: z.number().describe(\"Amount in USDC dollars to move into the router\"),\n },\n execute: async ({ amountUsd }: { amountUsd: number }) => {\n const { hash } = await bound.fundFloat(accounts.agent, usdc(amountUsd));\n const addr = accounts.agent.publicKey();\n return {\n success: true,\n amountUsd,\n txHash: hash,\n floatHeld: formatUsdc(await bound.routedBalance(addr)),\n };\n },\n },\n\n halt_certificate: {\n description:\n \"The operator's kill switch: stop every transfer, withdrawal and burn on a certificate. Signed by the operator, not the agent — this is the lever that exists precisely for the case where the agent's key is the problem.\",\n parameters: { certId: z.number().describe(\"Certificate id to halt\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash } = await bound.haltCert(accounts.operator, BigInt(certId));\n return { success: true, certId, halted: true, txHash: hash };\n },\n },\n\n resume_certificate: {\n description: \"Lift an operator halt and let a certificate's payments flow again.\",\n parameters: { certId: z.number().describe(\"Certificate id to resume\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash } = await bound.resumeCert(accounts.operator, BigInt(certId));\n return { success: true, certId, halted: false, txHash: hash };\n },\n },\n\n // ---- PremiumVault: the economy ---------------------------------------------\n\n quote_premium: {\n description:\n \"Price coverage: bound x duration x rate. Pass a certId to quote a published certificate from its own recorded terms, or boundUsd + durationDays to price a hypothetical one before publishing it.\",\n readOnly: true,\n parameters: {\n certId: z.number().optional().describe(\"Published certificate id to price from its terms\"),\n boundUsd: z.number().optional().describe(\"Hypothetical bound in USDC dollars\"),\n durationDays: z.number().optional().describe(\"Hypothetical coverage length in days\"),\n },\n execute: async ({\n certId,\n boundUsd,\n durationDays,\n }: {\n certId?: number;\n boundUsd?: number;\n durationDays?: number;\n }) => {\n if (certId !== undefined) {\n const premium = await bound.quotePremiumForCert(BigInt(certId));\n return { certId, premium: formatUsdc(premium) };\n }\n if (boundUsd === undefined || durationDays === undefined) {\n throw new Error(\"pass either certId, or both boundUsd and durationDays\");\n }\n const premium = await bound.quotePremium(\n usdc(boundUsd),\n BigInt(Math.round(durationDays * SECONDS_PER_DAY)),\n );\n return { boundUsd, durationDays, premium: formatUsdc(premium) };\n },\n },\n\n get_coverage: {\n description:\n \"Read a certificate's coverage: what the operator paid, the protocol's cut, and how much of the rest the auditor has earned so far. The auditor's yield accrues in a straight line across the term, and a slash forfeits only what is still unclaimed — the premium is yield on the stake, never a second bond. Returns the quote instead when no premium has been paid yet.\",\n readOnly: true,\n parameters: { certId: z.number().describe(\"Certificate id to read coverage for\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n if (!(await bound.premiumPaid(id))) {\n return { certId, paid: false, quote: formatUsdc(await bound.quotePremiumForCert(id)) };\n }\n const [c, accrued, claimable] = await Promise.all([\n bound.coverage(id),\n bound.premiumAccrued(id),\n bound.premiumClaimable(id),\n ]);\n return {\n certId,\n paid: true,\n payer: c.payer,\n auditor: c.auditor,\n premium: formatUsdc(c.premium),\n protocolFee: formatUsdc(c.protocol_fee),\n yieldPot: formatUsdc(c.yield_pot),\n claimed: formatUsdc(c.claimed),\n accrued: formatUsdc(accrued),\n claimable: formatUsdc(claimable),\n startUnix: Number(c.start),\n durationSeconds: Number(c.duration),\n closed: c.closed,\n closedAtUnix: Number(c.closed_at),\n };\n },\n },\n\n pay_premium: {\n description:\n \"Operator buys coverage for a certificate. Payable once, and only on a VERIFIED certificate — the premium is yield on the auditor's staked capital, and there is no auditor to pay until one has attested. The protocol's share leaves in the same transaction; the rest accrues to the auditor across the term.\",\n parameters: { certId: z.number().describe(\"Certificate id to buy coverage for\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n const quote = await bound.quotePremiumForCert(id);\n const { hash } = await bound.payPremium(accounts.operator, id);\n return { success: true, certId, premium: formatUsdc(quote), txHash: hash };\n },\n },\n\n claim_premium: {\n description:\n \"Auditor withdraws accrued-and-unclaimed yield. Allowed at any time, including mid-coverage: at every instant the accrued figure is payment for coverage already delivered. Claiming continuously converts forfeitable yield into settled income, which is deliberate — see get_coverage.\",\n parameters: { certId: z.number().describe(\"Certificate id to claim yield from\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash, result } = await bound.claimPremium(accounts.auditor, BigInt(certId));\n return { success: true, certId, claimed: formatUsdc(result), txHash: hash };\n },\n },\n};\n","{\n \"name\": \"@bound/mcp\",\n \"version\": \"0.1.1\",\n \"private\": false,\n \"description\": \"MCP server exposing Bound Protocol's agent tools to any MCP-capable client.\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/iamnotdou/bound.git\",\n \"directory\": \"packages/mcp\"\n },\n \"homepage\": \"https://github.com/iamnotdou/bound/tree/main/packages/mcp#readme\",\n \"keywords\": [\n \"bound-protocol\",\n \"mcp\",\n \"model-context-protocol\",\n \"stellar\",\n \"soroban\",\n \"agent\",\n \"x402\"\n ],\n \"sideEffects\": false,\n \"bin\": {\n \"bound-mcp\": \"./dist/bound-mcp.js\"\n },\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.mts\",\n \"default\": \"./dist/index.mjs\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n }\n },\n \"./tools\": {\n \"import\": {\n \"types\": \"./dist/tools.d.mts\",\n \"default\": \"./dist/tools.mjs\"\n },\n \"require\": {\n \"types\": \"./dist/tools.d.ts\",\n \"default\": \"./dist/tools.js\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"engines\": {\n \"node\": \">=20\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"prepack\": \"pnpm run build\",\n \"typecheck\": \"tsc --noEmit -p tsconfig.json\"\n },\n \"dependencies\": {\n \"@bound/sdk\": \"workspace:*\",\n \"@modelcontextprotocol/sdk\": \"^1.29.0\",\n \"@stellar/stellar-sdk\": \"^16.0.1\",\n \"zod\": \"^3.25.56\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^22\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"^5\",\n \"vitest\": \"^4.1.10\"\n }\n}\n","// Adapts the Bound tool table onto an MCP server. Transport-free on purpose:\n// the stdio wiring lives in bin.ts, so an embedder that wants Bound's tools\n// inside its own server (HTTP, SSE, in-process) can take this and supply its\n// own transport.\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { boundTools, type BoundTool } from \"./tools\";\nimport { version } from \"../package.json\";\n\n/**\n * Reported over the wire, so a client can tell which connector it is talking\n * to. Read from package.json and inlined at build time rather than typed out\n * here: the literal it replaced carried a comment promising it was \"kept in\n * step with package.json by hand\", and it fell out of step on the very first\n * version bump. A constant that has to be remembered will eventually be\n * forgotten, and a connector reporting the wrong version of itself is worse\n * than one reporting none.\n */\nexport const VERSION: string = version;\n\n/**\n * Build a server exposing every Bound tool.\n *\n * Results go back as pretty-printed JSON text rather than a structured output\n * schema: the tools return small, self-describing objects with money already\n * formatted as dollar strings, and a model reads those fine. A thrown error is\n * returned as an `isError` result instead of being allowed to escape — an MCP\n * client should see \"that call failed and here is why\" and be able to try\n * something else, not lose the session because a chain read timed out.\n */\nexport function createBoundMcpServer(tools: Record<string, BoundTool> = boundTools): McpServer {\n const server = new McpServer({ name: \"bound-protocol\", version: VERSION });\n\n for (const [name, t] of Object.entries(tools)) {\n server.registerTool(\n name,\n {\n description: t.description,\n inputSchema: t.parameters,\n // Only the read-only hint is claimed. `destructiveHint` and\n // `idempotentHint` would both be lies here: a payment is neither\n // reversible nor safe to replay.\n annotations: { readOnlyHint: t.readOnly === true },\n },\n async (args: unknown) => {\n try {\n const result = await t.execute(args);\n return { content: [{ type: \"text\" as const, text: JSON.stringify(result, null, 2) }] };\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n return {\n isError: true,\n content: [{ type: \"text\" as const, text: `Error: ${message}` }],\n };\n }\n },\n );\n }\n\n return server;\n}\n","#!/usr/bin/env node\n// Bound MCP server over stdio — the executable an MCP client launches.\n//\n// Run: npx @bound/mcp\n//\n// stdout is the JSON-RPC channel and nothing else may touch it. Every diagnostic\n// this process emits goes to stderr; a stray console.log here corrupts the\n// stream and the client's only symptom is a server that \"won't connect\".\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { createBoundMcpServer, VERSION } from \"./server\";\n\nasync function main() {\n const server = createBoundMcpServer();\n await server.connect(new StdioServerTransport());\n console.error(`Bound MCP server ${VERSION} running on stdio`);\n}\n\nmain().catch((err) => {\n console.error(err);\n process.exit(1);\n});\n"]}
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { createBoundMcpServer, VERSION } from './chunk-EOWCXK3R.mjs';
2
+ import { createBoundMcpServer, VERSION } from './chunk-XY3F4CUI.mjs';
3
3
  import './chunk-X6XXF6NT.mjs';
4
4
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
5
 
@@ -1,7 +1,11 @@
1
1
  import { boundTools } from './chunk-X6XXF6NT.mjs';
2
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
 
4
- var VERSION = "0.1.0";
4
+ // package.json
5
+ var version = "0.1.1";
6
+
7
+ // src/server.ts
8
+ var VERSION = version;
5
9
  function createBoundMcpServer(tools = boundTools) {
6
10
  const server = new McpServer({ name: "bound-protocol", version: VERSION });
7
11
  for (const [name, t] of Object.entries(tools)) {
@@ -33,5 +37,5 @@ function createBoundMcpServer(tools = boundTools) {
33
37
  }
34
38
 
35
39
  export { VERSION, createBoundMcpServer };
36
- //# sourceMappingURL=chunk-EOWCXK3R.mjs.map
37
- //# sourceMappingURL=chunk-EOWCXK3R.mjs.map
40
+ //# sourceMappingURL=chunk-XY3F4CUI.mjs.map
41
+ //# sourceMappingURL=chunk-XY3F4CUI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../package.json","../src/server.ts"],"names":[],"mappings":";;;;AAEE,IAAA,OAAA,GAAW,OAAA;;;ACeN,IAAM,OAAA,GAAkB;AAYxB,SAAS,oBAAA,CAAqB,QAAmC,UAAA,EAAuB;AAC7F,EAAA,MAAM,MAAA,GAAS,IAAI,SAAA,CAAU,EAAE,MAAM,gBAAA,EAAkB,OAAA,EAAS,SAAS,CAAA;AAEzE,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,CAAC,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC7C,IAAA,MAAA,CAAO,YAAA;AAAA,MACL,IAAA;AAAA,MACA;AAAA,QACE,aAAa,CAAA,CAAE,WAAA;AAAA,QACf,aAAa,CAAA,CAAE,UAAA;AAAA;AAAA;AAAA;AAAA,QAIf,WAAA,EAAa,EAAE,YAAA,EAAc,CAAA,CAAE,aAAa,IAAA;AAAK,OACnD;AAAA,MACA,OAAO,IAAA,KAAkB;AACvB,QAAA,IAAI;AACF,UAAA,MAAM,MAAA,GAAS,MAAM,CAAA,CAAE,OAAA,CAAQ,IAAI,CAAA;AACnC,UAAA,OAAO,EAAE,OAAA,EAAS,CAAC,EAAE,MAAM,MAAA,EAAiB,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,MAAA,EAAQ,IAAA,EAAM,CAAC,CAAA,EAAG,CAAA,EAAE;AAAA,QACvF,SAAS,GAAA,EAAc;AACrB,UAAA,MAAM,UAAU,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG,CAAA;AAC/D,UAAA,OAAO;AAAA,YACL,OAAA,EAAS,IAAA;AAAA,YACT,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,QAAiB,IAAA,EAAM,CAAA,OAAA,EAAU,OAAO,CAAA,CAAA,EAAI;AAAA,WAChE;AAAA,QACF;AAAA,MACF;AAAA,KACF;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT","file":"chunk-XY3F4CUI.mjs","sourcesContent":["{\n \"name\": \"@bound/mcp\",\n \"version\": \"0.1.1\",\n \"private\": false,\n \"description\": \"MCP server exposing Bound Protocol's agent tools to any MCP-capable client.\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/iamnotdou/bound.git\",\n \"directory\": \"packages/mcp\"\n },\n \"homepage\": \"https://github.com/iamnotdou/bound/tree/main/packages/mcp#readme\",\n \"keywords\": [\n \"bound-protocol\",\n \"mcp\",\n \"model-context-protocol\",\n \"stellar\",\n \"soroban\",\n \"agent\",\n \"x402\"\n ],\n \"sideEffects\": false,\n \"bin\": {\n \"bound-mcp\": \"./dist/bound-mcp.js\"\n },\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.mts\",\n \"default\": \"./dist/index.mjs\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n }\n },\n \"./tools\": {\n \"import\": {\n \"types\": \"./dist/tools.d.mts\",\n \"default\": \"./dist/tools.mjs\"\n },\n \"require\": {\n \"types\": \"./dist/tools.d.ts\",\n \"default\": \"./dist/tools.js\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"engines\": {\n \"node\": \">=20\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"prepack\": \"pnpm run build\",\n \"typecheck\": \"tsc --noEmit -p tsconfig.json\"\n },\n \"dependencies\": {\n \"@bound/sdk\": \"workspace:*\",\n \"@modelcontextprotocol/sdk\": \"^1.29.0\",\n \"@stellar/stellar-sdk\": \"^16.0.1\",\n \"zod\": \"^3.25.56\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^22\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"^5\",\n \"vitest\": \"^4.1.10\"\n }\n}\n","// Adapts the Bound tool table onto an MCP server. Transport-free on purpose:\n// the stdio wiring lives in bin.ts, so an embedder that wants Bound's tools\n// inside its own server (HTTP, SSE, in-process) can take this and supply its\n// own transport.\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { boundTools, type BoundTool } from \"./tools\";\nimport { version } from \"../package.json\";\n\n/**\n * Reported over the wire, so a client can tell which connector it is talking\n * to. Read from package.json and inlined at build time rather than typed out\n * here: the literal it replaced carried a comment promising it was \"kept in\n * step with package.json by hand\", and it fell out of step on the very first\n * version bump. A constant that has to be remembered will eventually be\n * forgotten, and a connector reporting the wrong version of itself is worse\n * than one reporting none.\n */\nexport const VERSION: string = version;\n\n/**\n * Build a server exposing every Bound tool.\n *\n * Results go back as pretty-printed JSON text rather than a structured output\n * schema: the tools return small, self-describing objects with money already\n * formatted as dollar strings, and a model reads those fine. A thrown error is\n * returned as an `isError` result instead of being allowed to escape — an MCP\n * client should see \"that call failed and here is why\" and be able to try\n * something else, not lose the session because a chain read timed out.\n */\nexport function createBoundMcpServer(tools: Record<string, BoundTool> = boundTools): McpServer {\n const server = new McpServer({ name: \"bound-protocol\", version: VERSION });\n\n for (const [name, t] of Object.entries(tools)) {\n server.registerTool(\n name,\n {\n description: t.description,\n inputSchema: t.parameters,\n // Only the read-only hint is claimed. `destructiveHint` and\n // `idempotentHint` would both be lies here: a payment is neither\n // reversible nor safe to replay.\n annotations: { readOnlyHint: t.readOnly === true },\n },\n async (args: unknown) => {\n try {\n const result = await t.execute(args);\n return { content: [{ type: \"text\" as const, text: JSON.stringify(result, null, 2) }] };\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n return {\n isError: true,\n content: [{ type: \"text\" as const, text: `Error: ${message}` }],\n };\n }\n },\n );\n }\n\n return server;\n}\n"]}
package/dist/index.d.mts CHANGED
@@ -12,8 +12,16 @@ declare const accounts: {
12
12
  readonly counterparty: Keypair;
13
13
  };
14
14
 
15
- /** Kept in step with package.json by hand; it is reported over the wire. */
16
- declare const VERSION = "0.1.0";
15
+ /**
16
+ * Reported over the wire, so a client can tell which connector it is talking
17
+ * to. Read from package.json and inlined at build time rather than typed out
18
+ * here: the literal it replaced carried a comment promising it was "kept in
19
+ * step with package.json by hand", and it fell out of step on the very first
20
+ * version bump. A constant that has to be remembered will eventually be
21
+ * forgotten, and a connector reporting the wrong version of itself is worse
22
+ * than one reporting none.
23
+ */
24
+ declare const VERSION: string;
17
25
  /**
18
26
  * Build a server exposing every Bound tool.
19
27
  *
package/dist/index.d.ts CHANGED
@@ -12,8 +12,16 @@ declare const accounts: {
12
12
  readonly counterparty: Keypair;
13
13
  };
14
14
 
15
- /** Kept in step with package.json by hand; it is reported over the wire. */
16
- declare const VERSION = "0.1.0";
15
+ /**
16
+ * Reported over the wire, so a client can tell which connector it is talking
17
+ * to. Read from package.json and inlined at build time rather than typed out
18
+ * here: the literal it replaced carried a comment promising it was "kept in
19
+ * step with package.json by hand", and it fell out of step on the very first
20
+ * version bump. A constant that has to be remembered will eventually be
21
+ * forgotten, and a connector reporting the wrong version of itself is worse
22
+ * than one reporting none.
23
+ */
24
+ declare const VERSION: string;
17
25
  /**
18
26
  * Build a server exposing every Bound tool.
19
27
  *
package/dist/index.js CHANGED
@@ -319,7 +319,12 @@ var boundTools = {
319
319
  }
320
320
  }
321
321
  };
322
- var VERSION = "0.1.0";
322
+
323
+ // package.json
324
+ var version = "0.1.1";
325
+
326
+ // src/server.ts
327
+ var VERSION = version;
323
328
  function createBoundMcpServer(tools = boundTools) {
324
329
  const server = new mcp_js.McpServer({ name: "bound-protocol", version: VERSION });
325
330
  for (const [name, t] of Object.entries(tools)) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.26_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js","../src/accounts.ts","../src/tools.ts","../src/server.ts"],"names":["join","existsSync","dirname","createRequire","Keypair","z","bound","formatUsdc","usdc","agentFetch","getCertificate","premium","McpServer"],"mappings":";;;;;;;;;;;AAKA,IAAM,gBAAA,GAAmB,MACvB,OAAO,QAAA,KAAa,WAAA,GAChB,IAAI,GAAA,CAAI,CAAA,KAAA,EAAQ,UAAU,CAAA,CAAE,CAAA,CAAE,IAAA,GAC7B,QAAA,CAAS,aAAA,IAAiB,QAAA,CAAS,aAAA,CAAc,OAAA,CAAQ,WAAA,EAAY,KAAM,QAAA,GAC1E,QAAA,CAAS,aAAA,CAAc,GAAA,GACvB,IAAI,GAAA,CAAI,SAAA,EAAW,QAAA,CAAS,OAAO,CAAA,CAAE,IAAA;AAEtC,IAAM,gCAAgC,gBAAA,EAAiB;ACO9D,SAAS,eAAe,QAAA,EAAsC;AAC5D,EAAA,IAAI,GAAA,GAAM,QAAA;AACV,EAAA,WAAS;AACP,IAAA,MAAM,SAAA,GAAYA,SAAA,CAAK,GAAA,EAAK,cAAc,CAAA;AAC1C,IAAA,IAAIC,aAAA,CAAW,SAAS,CAAA,EAAG,OAAO,SAAA;AAClC,IAAA,MAAM,MAAA,GAASC,aAAQ,GAAG,CAAA;AAC1B,IAAA,IAAI,MAAA,KAAW,KAAK,OAAO,MAAA;AAC3B,IAAA,GAAA,GAAM,MAAA;AAAA,EACR;AACF;AAWA,IAAI,CAAC,OAAA,CAAQ,GAAA,CAAI,eAAA,EAAiB;AAChC,EAAA,MAAM,OAAA,GAAU,cAAA,CAAe,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,MAAA,CAAO,YAAA;AAAA,MACL,IAAA;AAAA,MACA;AAAA,QACE,aAAa,CAAA,CAAE,WAAA;AAAA,QACf,aAAa,CAAA,CAAE,UAAA;AAAA;AAAA;AAAA;AAAA,QAIf,WAAA,EAAa,EAAE,YAAA,EAAc,CAAA,CAAE,aAAa,IAAA;AAAK,OACnD;AAAA,MACA,OAAO,IAAA,KAAkB;AACvB,QAAA,IAAI;AACF,UAAA,MAAM,MAAA,GAAS,MAAM,CAAA,CAAE,OAAA,CAAQ,IAAI,CAAA;AACnC,UAAA,OAAO,EAAE,OAAA,EAAS,CAAC,EAAE,MAAM,MAAA,EAAiB,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,MAAA,EAAQ,IAAA,EAAM,CAAC,CAAA,EAAG,CAAA,EAAE;AAAA,QACvF,SAAS,GAAA,EAAc;AACrB,UAAA,MAAM,UAAU,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG,CAAA;AAC/D,UAAA,OAAO;AAAA,YACL,OAAA,EAAS,IAAA;AAAA,YACT,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,QAAiB,IAAA,EAAM,CAAA,OAAA,EAAU,OAAO,CAAA,CAAA,EAAI;AAAA,WAChE;AAAA,QACF;AAAA,MACF;AAAA,KACF;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","// Demo keypairs, loaded from the environment. SERVER ONLY — these hold secret\n// keys, and every write tool in this package signs with one of them.\n//\n// This is a deliberate near-copy of apps/dashboard/app/lib/accounts.ts. The two\n// read the SAME five environment variables, so a repo checkout keeps working\n// either way, but a published package cannot reach into a Next.js app for its\n// credentials — that import is exactly what stopped `mcp/server.ts` from being\n// installable. Duplicating thirty lines is the cost of the package standing on\n// its own; the env var names are the contract that keeps them in step.\n//\n// Bound is testnet-only (see the SDK's committed deployment record), so naming\n// five fixed roles here is honest rather than limiting: there is no mainnet key\n// anyone could lose. An MCP client supplies them through the `env` block of its\n// server config; `.env.testnet` is only the in-repo convenience.\nimport { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { Keypair } from \"@stellar/stellar-sdk\";\n\nfunction findEnvTestnet(startDir: string): string | undefined {\n let dir = startDir;\n for (;;) {\n const candidate = join(dir, \".env.testnet\");\n if (existsSync(candidate)) return candidate;\n const parent = dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n}\n\n// An MCP client launches this server with cwd set to wherever it pleases, so we\n// walk upward rather than assuming a fixed relative path. Skipped entirely once\n// the environment already carries the keys, which is the normal case for an\n// installed server: the client's config block is the supply route.\n//\n// dotenv is loaded through createRequire and swallowed on failure because it is\n// NOT a dependency of this package — it is a dev-time convenience that happens\n// to be present inside the Bound repo. An installed copy has no .env.testnet to\n// find and never reaches this line.\nif (!process.env.OPERATOR_SECRET) {\n const envPath = findEnvTestnet(process.cwd());\n if (envPath) {\n try {\n const load = createRequire(import.meta.url)(\"dotenv\") as {\n config: (options: { path: string }) => void;\n };\n load.config({ path: envPath });\n } catch {\n // No dotenv on the resolution path: fall through and let kp() report the\n // missing variable by name, which is the more useful error anyway.\n }\n }\n}\n\nfunction kp(secretKey: string): Keypair {\n const secret = process.env[secretKey];\n if (!secret) {\n throw new Error(\n `missing ${secretKey} — set it in the MCP server's env block (see @bound/mcp README)`,\n );\n }\n return Keypair.fromSecret(secret);\n}\n\n// Lazily constructed so importing this module doesn't throw when only some\n// roles are needed. A read-only session never touches a secret at all.\nexport const accounts = {\n get operator() {\n return kp(\"OPERATOR_SECRET\");\n },\n get agent() {\n return kp(\"AGENT_SECRET\");\n },\n get auditor() {\n return kp(\"AUDITOR_SECRET\");\n },\n get challenger() {\n return kp(\"CHALLENGER_SECRET\");\n },\n get counterparty() {\n return kp(\"COUNTERPARTY_SECRET\");\n },\n};\n","// Framework-agnostic Bound tool definitions. Each tool is a description + a Zod\n// raw shape (the param map) + an execute() that calls BoundClient. The MCP\n// server here and the AI SDK loop in apps/dashboard both adapt these — one\n// core, two mouths. This file is the single definition of each tool; the app\n// imports it back from `@bound/mcp/tools` rather than owning a second copy.\n//\n// SERVER ONLY: execute() signs with secret keys held in the environment.\n//\n// Model A (pure bonding): there is NO spending cap. The agent pays whatever it\n// is asked. Safety is economic — the certificate bounds the counterparty's loss,\n// and a false vouch is slashed via challenge_certificate.\n//\n// v2 hangs two rails off that. The PaymentRouter meters what an enrolled agent\n// spends, and its counter is the on-chain state a BoundExceeded proof is read\n// from — routing is what turns a payment into evidence. The PremiumVault prices\n// the auditor's risk and pays them yield for carrying it, so vouching is a\n// business rather than a favour.\nimport { z } from \"zod\";\nimport { bound, type ProofType, agentFetch, getCertificate, usdc, formatUsdc } from \"@bound/sdk\";\nimport { accounts } from \"./accounts\";\n\nexport interface BoundTool {\n description: string;\n parameters: z.ZodRawShape;\n /**\n * Simulates against the chain, signs nothing, spends nothing. Surfaced to MCP\n * clients as `readOnlyHint` so a human is asked to approve only the calls\n * that actually move money.\n */\n readOnly?: boolean;\n execute: (args: any) => Promise<unknown>;\n}\n\nconst SECONDS_PER_DAY = 86_400;\n\nexport const boundTools: Record<string, BoundTool> = {\n verify_agent_certificate: {\n description:\n \"Check an AI agent's Bound Certificate before transacting with it. Returns whether it is valid, the bounded worst-case loss, the locked reserve, and the auditor's slashable stake.\",\n readOnly: true,\n parameters: { agent: z.string().describe(\"The G... address of the agent to verify\") },\n execute: async ({ agent }: { agent: string }) => {\n const v = await bound.verifyCertificate(agent);\n return {\n valid: v.valid,\n status: v.status.tag,\n bound: formatUsdc(v.bound),\n reserve: formatUsdc(v.reserve),\n auditorStake: formatUsdc(v.auditor_stake),\n auditor: v.auditor ?? null,\n };\n },\n },\n\n get_balance: {\n description: \"Get the USDC balance of an address. Defaults to this agent's own balance.\",\n readOnly: true,\n parameters: {\n address: z.string().optional().describe(\"G... address; omit for the agent itself\"),\n },\n execute: async ({ address }: { address?: string }) => {\n const addr = address ?? accounts.agent.publicKey();\n return { address: addr, balance: formatUsdc(await bound.usdcBalance(addr)) };\n },\n },\n\n execute_payment: {\n description:\n \"Send USDC directly to a recipient. The agent has no spending cap — it pays what it is asked. The counterparty's exposure is bounded by the agent's certificate, not by this call.\",\n parameters: {\n recipient: z.string().describe(\"G... address to pay\"),\n amountUsd: z.number().describe(\"Amount in USDC dollars\"),\n },\n execute: async ({ recipient, amountUsd }: { recipient: string; amountUsd: number }) => {\n const receipt = await bound.executePayment(accounts.agent, recipient, usdc(amountUsd));\n return {\n success: true,\n amountUsd,\n recipient,\n txHash: receipt.hash,\n // Whether this payment is on the record a challenger can read.\n routed: receipt.routed,\n certId: receipt.certId,\n };\n },\n },\n\n fetch_paid_service: {\n description:\n \"Fetch an HTTP resource that may require payment (x402). If the server answers 402, the agent autonomously pays the demanded price in USDC and retries. No human approves the amount — the service sets it, the agent decides.\",\n parameters: { url: z.string().describe(\"URL of the paid service\") },\n execute: async ({ url }: { url: string }) => {\n const { response, paid } = await agentFetch(url, accounts.agent, bound);\n const body = await response.text();\n return {\n status: response.status,\n paid: paid\n ? { amountUsd: paid.amount, recipient: paid.recipient, txHash: paid.txHash }\n : null,\n body,\n };\n },\n },\n\n challenge_certificate: {\n description:\n \"Prove a certificate's attestation is false and trigger on-chain enforcement. For InsufficientReserve the contract verifies the fraud itself (claimed reserve > actual), then slashes the auditor's stake and compensates the victim. Returns the resulting certificate status.\",\n parameters: {\n certId: z.number().describe(\"Certificate id to challenge\"),\n victim: z.string().describe(\"G... address of the harmed counterparty to compensate\"),\n proofType: z\n .enum([\"InsufficientReserve\", \"BoundExceeded\", \"FakeSignature\", \"ExpiredCertificate\"])\n .default(\"InsufficientReserve\")\n .describe(\"Kind of fraud; only InsufficientReserve is verified trustlessly on-chain\"),\n },\n execute: async ({\n certId,\n victim,\n proofType,\n }: {\n certId: number;\n victim: string;\n proofType?: ProofType[\"tag\"];\n }) => {\n const before = await bound.verifyCertificate(accounts.agent.publicKey());\n const challengeId = await bound.challengeCertificate(accounts.challenger, {\n certId: BigInt(certId),\n proofType: (proofType ?? \"InsufficientReserve\") as ProofType[\"tag\"],\n victim,\n bond: usdc(100),\n });\n const after = await bound.verifyCertificate(accounts.agent.publicKey());\n return {\n challengeId: Number(challengeId),\n certStatusBefore: before.status.tag,\n certStatusAfter: after.status.tag,\n outcome:\n after.status.tag === \"Invalid\"\n ? \"FRAUD_PROVEN — auditor slashed, victim compensated\"\n : \"challenge did not invalidate\",\n };\n },\n },\n\n // ---- PaymentRouter: the metered rail ---------------------------------------\n\n get_routing_status: {\n description:\n \"Check whether an address's payments are metered. An address bound to a certificate in the PaymentRouter pays from a float the router holds in custody, and every payment lands on that certificate's spend counter. An unenrolled address pays over the raw USDC rail instead, which leaves no trace any challenger can read.\",\n readOnly: true,\n parameters: {\n address: z.string().optional().describe(\"G... address; omit for the agent itself\"),\n },\n execute: async ({ address }: { address?: string }) => {\n const addr = address ?? accounts.agent.publicKey();\n const certId = await bound.routedCertId(addr);\n return {\n address: addr,\n routed: certId !== null,\n certId,\n floatHeld: formatUsdc(await bound.routedBalance(addr)),\n };\n },\n },\n\n get_cert_meter: {\n description:\n \"Read a certificate's meter: cumulative routed spend, the float the router holds for it, that float's ceiling, and whether the operator has halted it. Spend is GROSS FLOW, not loss — a certificate that has routed more than its bound has broken a covenant about its own conduct, it has not thereby cost anyone that much money. The bound is returned alongside so the two can be compared.\",\n readOnly: true,\n parameters: { certId: z.number().describe(\"Certificate id to read\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n const [spent, float, floatCap, halted, cert] = await Promise.all([\n bound.spendForCert(id),\n bound.floatForCert(id),\n bound.floatCapForCert(id),\n bound.certHalted(id),\n getCertificate(certId),\n ]);\n return {\n certId,\n agent: cert?.agent ?? null,\n status: cert?.status ?? null,\n bound: cert?.boundUsd ?? null,\n spent: formatUsdc(spent),\n float: formatUsdc(float),\n floatCap: formatUsdc(floatCap),\n halted,\n };\n },\n },\n\n enroll_agent: {\n description:\n \"Bind the agent to a certificate in the PaymentRouter and set that certificate's float cap. Both the operator and the agent authorize: enrolment attaches spend to the operator's certificate and subjects the agent to metering and to the operator's kill switch, so neither may conscript the other. A binding is permanent — an operator cannot walk an agent off a certificate whose counter is climbing.\",\n parameters: {\n certId: z.number().describe(\"Certificate id to meter the agent against\"),\n floatCapUsd: z\n .number()\n .describe(\"Ceiling on the float the router will hold — what a stolen agent key can reach\"),\n },\n execute: async ({ certId, floatCapUsd }: { certId: number; floatCapUsd: number }) => {\n await bound.enrollAgent(accounts.operator, accounts.agent, BigInt(certId), usdc(floatCapUsd));\n return {\n success: true,\n agent: accounts.agent.publicKey(),\n certId,\n floatCapUsd,\n note: \"the agent's payments are now metered on this certificate's spend counter\",\n };\n },\n },\n\n fund_float: {\n description:\n \"Move USDC into the PaymentRouter's custody, crediting the agent an equal routed balance to pay from. execute_payment tops this up on demand, so funding ahead of time is optional: float that is never idle is float that cannot be stolen.\",\n parameters: {\n amountUsd: z.number().describe(\"Amount in USDC dollars to move into the router\"),\n },\n execute: async ({ amountUsd }: { amountUsd: number }) => {\n const { hash } = await bound.fundFloat(accounts.agent, usdc(amountUsd));\n const addr = accounts.agent.publicKey();\n return {\n success: true,\n amountUsd,\n txHash: hash,\n floatHeld: formatUsdc(await bound.routedBalance(addr)),\n };\n },\n },\n\n halt_certificate: {\n description:\n \"The operator's kill switch: stop every transfer, withdrawal and burn on a certificate. Signed by the operator, not the agent — this is the lever that exists precisely for the case where the agent's key is the problem.\",\n parameters: { certId: z.number().describe(\"Certificate id to halt\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash } = await bound.haltCert(accounts.operator, BigInt(certId));\n return { success: true, certId, halted: true, txHash: hash };\n },\n },\n\n resume_certificate: {\n description: \"Lift an operator halt and let a certificate's payments flow again.\",\n parameters: { certId: z.number().describe(\"Certificate id to resume\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash } = await bound.resumeCert(accounts.operator, BigInt(certId));\n return { success: true, certId, halted: false, txHash: hash };\n },\n },\n\n // ---- PremiumVault: the economy ---------------------------------------------\n\n quote_premium: {\n description:\n \"Price coverage: bound x duration x rate. Pass a certId to quote a published certificate from its own recorded terms, or boundUsd + durationDays to price a hypothetical one before publishing it.\",\n readOnly: true,\n parameters: {\n certId: z.number().optional().describe(\"Published certificate id to price from its terms\"),\n boundUsd: z.number().optional().describe(\"Hypothetical bound in USDC dollars\"),\n durationDays: z.number().optional().describe(\"Hypothetical coverage length in days\"),\n },\n execute: async ({\n certId,\n boundUsd,\n durationDays,\n }: {\n certId?: number;\n boundUsd?: number;\n durationDays?: number;\n }) => {\n if (certId !== undefined) {\n const premium = await bound.quotePremiumForCert(BigInt(certId));\n return { certId, premium: formatUsdc(premium) };\n }\n if (boundUsd === undefined || durationDays === undefined) {\n throw new Error(\"pass either certId, or both boundUsd and durationDays\");\n }\n const premium = await bound.quotePremium(\n usdc(boundUsd),\n BigInt(Math.round(durationDays * SECONDS_PER_DAY)),\n );\n return { boundUsd, durationDays, premium: formatUsdc(premium) };\n },\n },\n\n get_coverage: {\n description:\n \"Read a certificate's coverage: what the operator paid, the protocol's cut, and how much of the rest the auditor has earned so far. The auditor's yield accrues in a straight line across the term, and a slash forfeits only what is still unclaimed — the premium is yield on the stake, never a second bond. Returns the quote instead when no premium has been paid yet.\",\n readOnly: true,\n parameters: { certId: z.number().describe(\"Certificate id to read coverage for\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n if (!(await bound.premiumPaid(id))) {\n return { certId, paid: false, quote: formatUsdc(await bound.quotePremiumForCert(id)) };\n }\n const [c, accrued, claimable] = await Promise.all([\n bound.coverage(id),\n bound.premiumAccrued(id),\n bound.premiumClaimable(id),\n ]);\n return {\n certId,\n paid: true,\n payer: c.payer,\n auditor: c.auditor,\n premium: formatUsdc(c.premium),\n protocolFee: formatUsdc(c.protocol_fee),\n yieldPot: formatUsdc(c.yield_pot),\n claimed: formatUsdc(c.claimed),\n accrued: formatUsdc(accrued),\n claimable: formatUsdc(claimable),\n startUnix: Number(c.start),\n durationSeconds: Number(c.duration),\n closed: c.closed,\n closedAtUnix: Number(c.closed_at),\n };\n },\n },\n\n pay_premium: {\n description:\n \"Operator buys coverage for a certificate. Payable once, and only on a VERIFIED certificate — the premium is yield on the auditor's staked capital, and there is no auditor to pay until one has attested. The protocol's share leaves in the same transaction; the rest accrues to the auditor across the term.\",\n parameters: { certId: z.number().describe(\"Certificate id to buy coverage for\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n const quote = await bound.quotePremiumForCert(id);\n const { hash } = await bound.payPremium(accounts.operator, id);\n return { success: true, certId, premium: formatUsdc(quote), txHash: hash };\n },\n },\n\n claim_premium: {\n description:\n \"Auditor withdraws accrued-and-unclaimed yield. Allowed at any time, including mid-coverage: at every instant the accrued figure is payment for coverage already delivered. Claiming continuously converts forfeitable yield into settled income, which is deliberate — see get_coverage.\",\n parameters: { certId: z.number().describe(\"Certificate id to claim yield from\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash, result } = await bound.claimPremium(accounts.auditor, BigInt(certId));\n return { success: true, certId, claimed: formatUsdc(result), txHash: hash };\n },\n },\n};\n","// Adapts the Bound tool table onto an MCP server. Transport-free on purpose:\n// the stdio wiring lives in bin.ts, so an embedder that wants Bound's tools\n// inside its own server (HTTP, SSE, in-process) can take this and supply its\n// own transport.\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { boundTools, type BoundTool } from \"./tools\";\n\n/** Kept in step with package.json by hand; it is reported over the wire. */\nexport const VERSION = \"0.1.0\";\n\n/**\n * Build a server exposing every Bound tool.\n *\n * Results go back as pretty-printed JSON text rather than a structured output\n * schema: the tools return small, self-describing objects with money already\n * formatted as dollar strings, and a model reads those fine. A thrown error is\n * returned as an `isError` result instead of being allowed to escape — an MCP\n * client should see \"that call failed and here is why\" and be able to try\n * something else, not lose the session because a chain read timed out.\n */\nexport function createBoundMcpServer(tools: Record<string, BoundTool> = boundTools): McpServer {\n const server = new McpServer({ name: \"bound-protocol\", version: VERSION });\n\n for (const [name, t] of Object.entries(tools)) {\n server.registerTool(\n name,\n {\n description: t.description,\n inputSchema: t.parameters,\n // Only the read-only hint is claimed. `destructiveHint` and\n // `idempotentHint` would both be lies here: a payment is neither\n // reversible nor safe to replay.\n annotations: { readOnlyHint: t.readOnly === true },\n },\n async (args: unknown) => {\n try {\n const result = await t.execute(args);\n return { content: [{ type: \"text\" as const, text: JSON.stringify(result, null, 2) }] };\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n return {\n isError: true,\n content: [{ type: \"text\" as const, text: `Error: ${message}` }],\n };\n }\n },\n );\n }\n\n return server;\n}\n"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.26_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/cjs_shims.js","../src/accounts.ts","../src/tools.ts","../package.json","../src/server.ts"],"names":["join","existsSync","dirname","createRequire","Keypair","z","bound","formatUsdc","usdc","agentFetch","getCertificate","premium","McpServer"],"mappings":";;;;;;;;;;;AAKA,IAAM,gBAAA,GAAmB,MACvB,OAAO,QAAA,KAAa,WAAA,GAChB,IAAI,GAAA,CAAI,CAAA,KAAA,EAAQ,UAAU,CAAA,CAAE,CAAA,CAAE,IAAA,GAC7B,QAAA,CAAS,aAAA,IAAiB,QAAA,CAAS,aAAA,CAAc,OAAA,CAAQ,WAAA,EAAY,KAAM,QAAA,GAC1E,QAAA,CAAS,aAAA,CAAc,GAAA,GACv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AAAA,YACL,OAAA,EAAS,IAAA;AAAA,YACT,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,QAAiB,IAAA,EAAM,CAAA,OAAA,EAAU,OAAO,CAAA,CAAA,EAAI;AAAA,WAChE;AAAA,QACF;AAAA,MACF;AAAA,KACF;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","// Demo keypairs, loaded from the environment. SERVER ONLY — these hold secret\n// keys, and every write tool in this package signs with one of them.\n//\n// This is a deliberate near-copy of apps/dashboard/app/lib/accounts.ts. The two\n// read the SAME five environment variables, so a repo checkout keeps working\n// either way, but a published package cannot reach into a Next.js app for its\n// credentials — that import is exactly what stopped `mcp/server.ts` from being\n// installable. Duplicating thirty lines is the cost of the package standing on\n// its own; the env var names are the contract that keeps them in step.\n//\n// Bound is testnet-only (see the SDK's committed deployment record), so naming\n// five fixed roles here is honest rather than limiting: there is no mainnet key\n// anyone could lose. An MCP client supplies them through the `env` block of its\n// server config; `.env.testnet` is only the in-repo convenience.\nimport { existsSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\nimport { Keypair } from \"@stellar/stellar-sdk\";\n\nfunction findEnvTestnet(startDir: string): string | undefined {\n let dir = startDir;\n for (;;) {\n const candidate = join(dir, \".env.testnet\");\n if (existsSync(candidate)) return candidate;\n const parent = dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n}\n\n// An MCP client launches this server with cwd set to wherever it pleases, so we\n// walk upward rather than assuming a fixed relative path. Skipped entirely once\n// the environment already carries the keys, which is the normal case for an\n// installed server: the client's config block is the supply route.\n//\n// dotenv is loaded through createRequire and swallowed on failure because it is\n// NOT a dependency of this package — it is a dev-time convenience that happens\n// to be present inside the Bound repo. An installed copy has no .env.testnet to\n// find and never reaches this line.\nif (!process.env.OPERATOR_SECRET) {\n const envPath = findEnvTestnet(process.cwd());\n if (envPath) {\n try {\n const load = createRequire(import.meta.url)(\"dotenv\") as {\n config: (options: { path: string }) => void;\n };\n load.config({ path: envPath });\n } catch {\n // No dotenv on the resolution path: fall through and let kp() report the\n // missing variable by name, which is the more useful error anyway.\n }\n }\n}\n\nfunction kp(secretKey: string): Keypair {\n const secret = process.env[secretKey];\n if (!secret) {\n throw new Error(\n `missing ${secretKey} — set it in the MCP server's env block (see @bound/mcp README)`,\n );\n }\n return Keypair.fromSecret(secret);\n}\n\n// Lazily constructed so importing this module doesn't throw when only some\n// roles are needed. A read-only session never touches a secret at all.\nexport const accounts = {\n get operator() {\n return kp(\"OPERATOR_SECRET\");\n },\n get agent() {\n return kp(\"AGENT_SECRET\");\n },\n get auditor() {\n return kp(\"AUDITOR_SECRET\");\n },\n get challenger() {\n return kp(\"CHALLENGER_SECRET\");\n },\n get counterparty() {\n return kp(\"COUNTERPARTY_SECRET\");\n },\n};\n","// Framework-agnostic Bound tool definitions. Each tool is a description + a Zod\n// raw shape (the param map) + an execute() that calls BoundClient. The MCP\n// server here and the AI SDK loop in apps/dashboard both adapt these — one\n// core, two mouths. This file is the single definition of each tool; the app\n// imports it back from `@bound/mcp/tools` rather than owning a second copy.\n//\n// SERVER ONLY: execute() signs with secret keys held in the environment.\n//\n// Model A (pure bonding): there is NO spending cap. The agent pays whatever it\n// is asked. Safety is economic — the certificate bounds the counterparty's loss,\n// and a false vouch is slashed via challenge_certificate.\n//\n// v2 hangs two rails off that. The PaymentRouter meters what an enrolled agent\n// spends, and its counter is the on-chain state a BoundExceeded proof is read\n// from — routing is what turns a payment into evidence. The PremiumVault prices\n// the auditor's risk and pays them yield for carrying it, so vouching is a\n// business rather than a favour.\nimport { z } from \"zod\";\nimport { bound, type ProofType, agentFetch, getCertificate, usdc, formatUsdc } from \"@bound/sdk\";\nimport { accounts } from \"./accounts\";\n\nexport interface BoundTool {\n description: string;\n parameters: z.ZodRawShape;\n /**\n * Simulates against the chain, signs nothing, spends nothing. Surfaced to MCP\n * clients as `readOnlyHint` so a human is asked to approve only the calls\n * that actually move money.\n */\n readOnly?: boolean;\n execute: (args: any) => Promise<unknown>;\n}\n\nconst SECONDS_PER_DAY = 86_400;\n\nexport const boundTools: Record<string, BoundTool> = {\n verify_agent_certificate: {\n description:\n \"Check an AI agent's Bound Certificate before transacting with it. Returns whether it is valid, the bounded worst-case loss, the locked reserve, and the auditor's slashable stake.\",\n readOnly: true,\n parameters: { agent: z.string().describe(\"The G... address of the agent to verify\") },\n execute: async ({ agent }: { agent: string }) => {\n const v = await bound.verifyCertificate(agent);\n return {\n valid: v.valid,\n status: v.status.tag,\n bound: formatUsdc(v.bound),\n reserve: formatUsdc(v.reserve),\n auditorStake: formatUsdc(v.auditor_stake),\n auditor: v.auditor ?? null,\n };\n },\n },\n\n get_balance: {\n description: \"Get the USDC balance of an address. Defaults to this agent's own balance.\",\n readOnly: true,\n parameters: {\n address: z.string().optional().describe(\"G... address; omit for the agent itself\"),\n },\n execute: async ({ address }: { address?: string }) => {\n const addr = address ?? accounts.agent.publicKey();\n return { address: addr, balance: formatUsdc(await bound.usdcBalance(addr)) };\n },\n },\n\n execute_payment: {\n description:\n \"Send USDC directly to a recipient. The agent has no spending cap — it pays what it is asked. The counterparty's exposure is bounded by the agent's certificate, not by this call.\",\n parameters: {\n recipient: z.string().describe(\"G... address to pay\"),\n amountUsd: z.number().describe(\"Amount in USDC dollars\"),\n },\n execute: async ({ recipient, amountUsd }: { recipient: string; amountUsd: number }) => {\n const receipt = await bound.executePayment(accounts.agent, recipient, usdc(amountUsd));\n return {\n success: true,\n amountUsd,\n recipient,\n txHash: receipt.hash,\n // Whether this payment is on the record a challenger can read.\n routed: receipt.routed,\n certId: receipt.certId,\n };\n },\n },\n\n fetch_paid_service: {\n description:\n \"Fetch an HTTP resource that may require payment (x402). If the server answers 402, the agent autonomously pays the demanded price in USDC and retries. No human approves the amount — the service sets it, the agent decides.\",\n parameters: { url: z.string().describe(\"URL of the paid service\") },\n execute: async ({ url }: { url: string }) => {\n const { response, paid } = await agentFetch(url, accounts.agent, bound);\n const body = await response.text();\n return {\n status: response.status,\n paid: paid\n ? { amountUsd: paid.amount, recipient: paid.recipient, txHash: paid.txHash }\n : null,\n body,\n };\n },\n },\n\n challenge_certificate: {\n description:\n \"Prove a certificate's attestation is false and trigger on-chain enforcement. For InsufficientReserve the contract verifies the fraud itself (claimed reserve > actual), then slashes the auditor's stake and compensates the victim. Returns the resulting certificate status.\",\n parameters: {\n certId: z.number().describe(\"Certificate id to challenge\"),\n victim: z.string().describe(\"G... address of the harmed counterparty to compensate\"),\n proofType: z\n .enum([\"InsufficientReserve\", \"BoundExceeded\", \"FakeSignature\", \"ExpiredCertificate\"])\n .default(\"InsufficientReserve\")\n .describe(\"Kind of fraud; only InsufficientReserve is verified trustlessly on-chain\"),\n },\n execute: async ({\n certId,\n victim,\n proofType,\n }: {\n certId: number;\n victim: string;\n proofType?: ProofType[\"tag\"];\n }) => {\n const before = await bound.verifyCertificate(accounts.agent.publicKey());\n const challengeId = await bound.challengeCertificate(accounts.challenger, {\n certId: BigInt(certId),\n proofType: (proofType ?? \"InsufficientReserve\") as ProofType[\"tag\"],\n victim,\n bond: usdc(100),\n });\n const after = await bound.verifyCertificate(accounts.agent.publicKey());\n return {\n challengeId: Number(challengeId),\n certStatusBefore: before.status.tag,\n certStatusAfter: after.status.tag,\n outcome:\n after.status.tag === \"Invalid\"\n ? \"FRAUD_PROVEN — auditor slashed, victim compensated\"\n : \"challenge did not invalidate\",\n };\n },\n },\n\n // ---- PaymentRouter: the metered rail ---------------------------------------\n\n get_routing_status: {\n description:\n \"Check whether an address's payments are metered. An address bound to a certificate in the PaymentRouter pays from a float the router holds in custody, and every payment lands on that certificate's spend counter. An unenrolled address pays over the raw USDC rail instead, which leaves no trace any challenger can read.\",\n readOnly: true,\n parameters: {\n address: z.string().optional().describe(\"G... address; omit for the agent itself\"),\n },\n execute: async ({ address }: { address?: string }) => {\n const addr = address ?? accounts.agent.publicKey();\n const certId = await bound.routedCertId(addr);\n return {\n address: addr,\n routed: certId !== null,\n certId,\n floatHeld: formatUsdc(await bound.routedBalance(addr)),\n };\n },\n },\n\n get_cert_meter: {\n description:\n \"Read a certificate's meter: cumulative routed spend, the float the router holds for it, that float's ceiling, and whether the operator has halted it. Spend is GROSS FLOW, not loss — a certificate that has routed more than its bound has broken a covenant about its own conduct, it has not thereby cost anyone that much money. The bound is returned alongside so the two can be compared.\",\n readOnly: true,\n parameters: { certId: z.number().describe(\"Certificate id to read\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n const [spent, float, floatCap, halted, cert] = await Promise.all([\n bound.spendForCert(id),\n bound.floatForCert(id),\n bound.floatCapForCert(id),\n bound.certHalted(id),\n getCertificate(certId),\n ]);\n return {\n certId,\n agent: cert?.agent ?? null,\n status: cert?.status ?? null,\n bound: cert?.boundUsd ?? null,\n spent: formatUsdc(spent),\n float: formatUsdc(float),\n floatCap: formatUsdc(floatCap),\n halted,\n };\n },\n },\n\n enroll_agent: {\n description:\n \"Bind the agent to a certificate in the PaymentRouter and set that certificate's float cap. Both the operator and the agent authorize: enrolment attaches spend to the operator's certificate and subjects the agent to metering and to the operator's kill switch, so neither may conscript the other. A binding is permanent — an operator cannot walk an agent off a certificate whose counter is climbing.\",\n parameters: {\n certId: z.number().describe(\"Certificate id to meter the agent against\"),\n floatCapUsd: z\n .number()\n .describe(\"Ceiling on the float the router will hold — what a stolen agent key can reach\"),\n },\n execute: async ({ certId, floatCapUsd }: { certId: number; floatCapUsd: number }) => {\n await bound.enrollAgent(accounts.operator, accounts.agent, BigInt(certId), usdc(floatCapUsd));\n return {\n success: true,\n agent: accounts.agent.publicKey(),\n certId,\n floatCapUsd,\n note: \"the agent's payments are now metered on this certificate's spend counter\",\n };\n },\n },\n\n fund_float: {\n description:\n \"Move USDC into the PaymentRouter's custody, crediting the agent an equal routed balance to pay from. execute_payment tops this up on demand, so funding ahead of time is optional: float that is never idle is float that cannot be stolen.\",\n parameters: {\n amountUsd: z.number().describe(\"Amount in USDC dollars to move into the router\"),\n },\n execute: async ({ amountUsd }: { amountUsd: number }) => {\n const { hash } = await bound.fundFloat(accounts.agent, usdc(amountUsd));\n const addr = accounts.agent.publicKey();\n return {\n success: true,\n amountUsd,\n txHash: hash,\n floatHeld: formatUsdc(await bound.routedBalance(addr)),\n };\n },\n },\n\n halt_certificate: {\n description:\n \"The operator's kill switch: stop every transfer, withdrawal and burn on a certificate. Signed by the operator, not the agent — this is the lever that exists precisely for the case where the agent's key is the problem.\",\n parameters: { certId: z.number().describe(\"Certificate id to halt\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash } = await bound.haltCert(accounts.operator, BigInt(certId));\n return { success: true, certId, halted: true, txHash: hash };\n },\n },\n\n resume_certificate: {\n description: \"Lift an operator halt and let a certificate's payments flow again.\",\n parameters: { certId: z.number().describe(\"Certificate id to resume\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash } = await bound.resumeCert(accounts.operator, BigInt(certId));\n return { success: true, certId, halted: false, txHash: hash };\n },\n },\n\n // ---- PremiumVault: the economy ---------------------------------------------\n\n quote_premium: {\n description:\n \"Price coverage: bound x duration x rate. Pass a certId to quote a published certificate from its own recorded terms, or boundUsd + durationDays to price a hypothetical one before publishing it.\",\n readOnly: true,\n parameters: {\n certId: z.number().optional().describe(\"Published certificate id to price from its terms\"),\n boundUsd: z.number().optional().describe(\"Hypothetical bound in USDC dollars\"),\n durationDays: z.number().optional().describe(\"Hypothetical coverage length in days\"),\n },\n execute: async ({\n certId,\n boundUsd,\n durationDays,\n }: {\n certId?: number;\n boundUsd?: number;\n durationDays?: number;\n }) => {\n if (certId !== undefined) {\n const premium = await bound.quotePremiumForCert(BigInt(certId));\n return { certId, premium: formatUsdc(premium) };\n }\n if (boundUsd === undefined || durationDays === undefined) {\n throw new Error(\"pass either certId, or both boundUsd and durationDays\");\n }\n const premium = await bound.quotePremium(\n usdc(boundUsd),\n BigInt(Math.round(durationDays * SECONDS_PER_DAY)),\n );\n return { boundUsd, durationDays, premium: formatUsdc(premium) };\n },\n },\n\n get_coverage: {\n description:\n \"Read a certificate's coverage: what the operator paid, the protocol's cut, and how much of the rest the auditor has earned so far. The auditor's yield accrues in a straight line across the term, and a slash forfeits only what is still unclaimed — the premium is yield on the stake, never a second bond. Returns the quote instead when no premium has been paid yet.\",\n readOnly: true,\n parameters: { certId: z.number().describe(\"Certificate id to read coverage for\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n if (!(await bound.premiumPaid(id))) {\n return { certId, paid: false, quote: formatUsdc(await bound.quotePremiumForCert(id)) };\n }\n const [c, accrued, claimable] = await Promise.all([\n bound.coverage(id),\n bound.premiumAccrued(id),\n bound.premiumClaimable(id),\n ]);\n return {\n certId,\n paid: true,\n payer: c.payer,\n auditor: c.auditor,\n premium: formatUsdc(c.premium),\n protocolFee: formatUsdc(c.protocol_fee),\n yieldPot: formatUsdc(c.yield_pot),\n claimed: formatUsdc(c.claimed),\n accrued: formatUsdc(accrued),\n claimable: formatUsdc(claimable),\n startUnix: Number(c.start),\n durationSeconds: Number(c.duration),\n closed: c.closed,\n closedAtUnix: Number(c.closed_at),\n };\n },\n },\n\n pay_premium: {\n description:\n \"Operator buys coverage for a certificate. Payable once, and only on a VERIFIED certificate — the premium is yield on the auditor's staked capital, and there is no auditor to pay until one has attested. The protocol's share leaves in the same transaction; the rest accrues to the auditor across the term.\",\n parameters: { certId: z.number().describe(\"Certificate id to buy coverage for\") },\n execute: async ({ certId }: { certId: number }) => {\n const id = BigInt(certId);\n const quote = await bound.quotePremiumForCert(id);\n const { hash } = await bound.payPremium(accounts.operator, id);\n return { success: true, certId, premium: formatUsdc(quote), txHash: hash };\n },\n },\n\n claim_premium: {\n description:\n \"Auditor withdraws accrued-and-unclaimed yield. Allowed at any time, including mid-coverage: at every instant the accrued figure is payment for coverage already delivered. Claiming continuously converts forfeitable yield into settled income, which is deliberate — see get_coverage.\",\n parameters: { certId: z.number().describe(\"Certificate id to claim yield from\") },\n execute: async ({ certId }: { certId: number }) => {\n const { hash, result } = await bound.claimPremium(accounts.auditor, BigInt(certId));\n return { success: true, certId, claimed: formatUsdc(result), txHash: hash };\n },\n },\n};\n","{\n \"name\": \"@bound/mcp\",\n \"version\": \"0.1.1\",\n \"private\": false,\n \"description\": \"MCP server exposing Bound Protocol's agent tools to any MCP-capable client.\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/iamnotdou/bound.git\",\n \"directory\": \"packages/mcp\"\n },\n \"homepage\": \"https://github.com/iamnotdou/bound/tree/main/packages/mcp#readme\",\n \"keywords\": [\n \"bound-protocol\",\n \"mcp\",\n \"model-context-protocol\",\n \"stellar\",\n \"soroban\",\n \"agent\",\n \"x402\"\n ],\n \"sideEffects\": false,\n \"bin\": {\n \"bound-mcp\": \"./dist/bound-mcp.js\"\n },\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.mts\",\n \"default\": \"./dist/index.mjs\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n }\n },\n \"./tools\": {\n \"import\": {\n \"types\": \"./dist/tools.d.mts\",\n \"default\": \"./dist/tools.mjs\"\n },\n \"require\": {\n \"types\": \"./dist/tools.d.ts\",\n \"default\": \"./dist/tools.js\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"engines\": {\n \"node\": \">=20\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"prepack\": \"pnpm run build\",\n \"typecheck\": \"tsc --noEmit -p tsconfig.json\"\n },\n \"dependencies\": {\n \"@bound/sdk\": \"workspace:*\",\n \"@modelcontextprotocol/sdk\": \"^1.29.0\",\n \"@stellar/stellar-sdk\": \"^16.0.1\",\n \"zod\": \"^3.25.56\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^22\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"^5\",\n \"vitest\": \"^4.1.10\"\n }\n}\n","// Adapts the Bound tool table onto an MCP server. Transport-free on purpose:\n// the stdio wiring lives in bin.ts, so an embedder that wants Bound's tools\n// inside its own server (HTTP, SSE, in-process) can take this and supply its\n// own transport.\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { boundTools, type BoundTool } from \"./tools\";\nimport { version } from \"../package.json\";\n\n/**\n * Reported over the wire, so a client can tell which connector it is talking\n * to. Read from package.json and inlined at build time rather than typed out\n * here: the literal it replaced carried a comment promising it was \"kept in\n * step with package.json by hand\", and it fell out of step on the very first\n * version bump. A constant that has to be remembered will eventually be\n * forgotten, and a connector reporting the wrong version of itself is worse\n * than one reporting none.\n */\nexport const VERSION: string = version;\n\n/**\n * Build a server exposing every Bound tool.\n *\n * Results go back as pretty-printed JSON text rather than a structured output\n * schema: the tools return small, self-describing objects with money already\n * formatted as dollar strings, and a model reads those fine. A thrown error is\n * returned as an `isError` result instead of being allowed to escape — an MCP\n * client should see \"that call failed and here is why\" and be able to try\n * something else, not lose the session because a chain read timed out.\n */\nexport function createBoundMcpServer(tools: Record<string, BoundTool> = boundTools): McpServer {\n const server = new McpServer({ name: \"bound-protocol\", version: VERSION });\n\n for (const [name, t] of Object.entries(tools)) {\n server.registerTool(\n name,\n {\n description: t.description,\n inputSchema: t.parameters,\n // Only the read-only hint is claimed. `destructiveHint` and\n // `idempotentHint` would both be lies here: a payment is neither\n // reversible nor safe to replay.\n annotations: { readOnlyHint: t.readOnly === true },\n },\n async (args: unknown) => {\n try {\n const result = await t.execute(args);\n return { content: [{ type: \"text\" as const, text: JSON.stringify(result, null, 2) }] };\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n return {\n isError: true,\n content: [{ type: \"text\" as const, text: `Error: ${message}` }],\n };\n }\n },\n );\n }\n\n return server;\n}\n"]}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { VERSION, createBoundMcpServer } from './chunk-EOWCXK3R.mjs';
1
+ export { VERSION, createBoundMcpServer } from './chunk-XY3F4CUI.mjs';
2
2
  export { accounts, boundTools } from './chunk-X6XXF6NT.mjs';
3
3
  //# sourceMappingURL=index.mjs.map
4
4
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bound/mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
5
  "description": "MCP server exposing Bound Protocol's agent tools to any MCP-capable client.",
6
6
  "license": "MIT",
@@ -58,21 +58,20 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "scripts": {
62
- "build": "tsup",
63
- "prepack": "pnpm run build",
64
- "typecheck": "tsc --noEmit -p tsconfig.json"
65
- },
66
61
  "dependencies": {
67
- "@bound/sdk": "workspace:*",
68
62
  "@modelcontextprotocol/sdk": "^1.29.0",
69
63
  "@stellar/stellar-sdk": "^16.0.1",
70
- "zod": "^3.25.56"
64
+ "zod": "^3.25.56",
65
+ "@bound/sdk": "0.5.0"
71
66
  },
72
67
  "devDependencies": {
73
68
  "@types/node": "^22",
74
69
  "tsup": "^8.5.1",
75
70
  "typescript": "^5",
76
71
  "vitest": "^4.1.10"
72
+ },
73
+ "scripts": {
74
+ "build": "tsup",
75
+ "typecheck": "tsc --noEmit -p tsconfig.json"
77
76
  }
78
- }
77
+ }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/server.ts"],"names":[],"mappings":";;;AAQO,IAAM,OAAA,GAAU;AAYhB,SAAS,oBAAA,CAAqB,QAAmC,UAAA,EAAuB;AAC7F,EAAA,MAAM,MAAA,GAAS,IAAI,SAAA,CAAU,EAAE,MAAM,gBAAA,EAAkB,OAAA,EAAS,SAAS,CAAA;AAEzE,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,CAAC,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC7C,IAAA,MAAA,CAAO,YAAA;AAAA,MACL,IAAA;AAAA,MACA;AAAA,QACE,aAAa,CAAA,CAAE,WAAA;AAAA,QACf,aAAa,CAAA,CAAE,UAAA;AAAA;AAAA;AAAA;AAAA,QAIf,WAAA,EAAa,EAAE,YAAA,EAAc,CAAA,CAAE,aAAa,IAAA;AAAK,OACnD;AAAA,MACA,OAAO,IAAA,KAAkB;AACvB,QAAA,IAAI;AACF,UAAA,MAAM,MAAA,GAAS,MAAM,CAAA,CAAE,OAAA,CAAQ,IAAI,CAAA;AACnC,UAAA,OAAO,EAAE,OAAA,EAAS,CAAC,EAAE,MAAM,MAAA,EAAiB,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,MAAA,EAAQ,IAAA,EAAM,CAAC,CAAA,EAAG,CAAA,EAAE;AAAA,QACvF,SAAS,GAAA,EAAc;AACrB,UAAA,MAAM,UAAU,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG,CAAA;AAC/D,UAAA,OAAO;AAAA,YACL,OAAA,EAAS,IAAA;AAAA,YACT,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,QAAiB,IAAA,EAAM,CAAA,OAAA,EAAU,OAAO,CAAA,CAAA,EAAI;AAAA,WAChE;AAAA,QACF;AAAA,MACF;AAAA,KACF;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT","file":"chunk-EOWCXK3R.mjs","sourcesContent":["// Adapts the Bound tool table onto an MCP server. Transport-free on purpose:\n// the stdio wiring lives in bin.ts, so an embedder that wants Bound's tools\n// inside its own server (HTTP, SSE, in-process) can take this and supply its\n// own transport.\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { boundTools, type BoundTool } from \"./tools\";\n\n/** Kept in step with package.json by hand; it is reported over the wire. */\nexport const VERSION = \"0.1.0\";\n\n/**\n * Build a server exposing every Bound tool.\n *\n * Results go back as pretty-printed JSON text rather than a structured output\n * schema: the tools return small, self-describing objects with money already\n * formatted as dollar strings, and a model reads those fine. A thrown error is\n * returned as an `isError` result instead of being allowed to escape — an MCP\n * client should see \"that call failed and here is why\" and be able to try\n * something else, not lose the session because a chain read timed out.\n */\nexport function createBoundMcpServer(tools: Record<string, BoundTool> = boundTools): McpServer {\n const server = new McpServer({ name: \"bound-protocol\", version: VERSION });\n\n for (const [name, t] of Object.entries(tools)) {\n server.registerTool(\n name,\n {\n description: t.description,\n inputSchema: t.parameters,\n // Only the read-only hint is claimed. `destructiveHint` and\n // `idempotentHint` would both be lies here: a payment is neither\n // reversible nor safe to replay.\n annotations: { readOnlyHint: t.readOnly === true },\n },\n async (args: unknown) => {\n try {\n const result = await t.execute(args);\n return { content: [{ type: \"text\" as const, text: JSON.stringify(result, null, 2) }] };\n } catch (err: unknown) {\n const message = err instanceof Error ? err.message : String(err);\n return {\n isError: true,\n content: [{ type: \"text\" as const, text: `Error: ${message}` }],\n };\n }\n },\n );\n }\n\n return server;\n}\n"]}