@jaibber/mcp 0.9.2 → 0.9.3

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/index.js CHANGED
@@ -27584,15 +27584,18 @@ async function walletFromPrivateKey(privateKey) {
27584
27584
  throw new Error("Paying from a private key needs viem: npm i viem");
27585
27585
  }
27586
27586
  const account = accounts.privateKeyToAccount(privateKey);
27587
- const UINT = /* @__PURE__ */ new Set(["value", "validAfter", "validBefore"]);
27588
27587
  return {
27589
27588
  address: account.address,
27590
- signTypedData: (req) => account.signTypedData({
27591
- domain: { ...req.domain, verifyingContract: req.domain.verifyingContract },
27592
- types: req.types,
27593
- primaryType: req.primaryType,
27594
- message: Object.fromEntries(Object.entries(req.message).map(([k, v]) => [k, UINT.has(k) ? BigInt(v) : v]))
27595
- })
27589
+ signTypedData: (req) => {
27590
+ const ints = new Set((req.types[req.primaryType] ?? []).filter((f) => /^u?int\d*$/.test(f.type)).map((f) => f.name));
27591
+ const { verifyingContract, ...domain } = req.domain;
27592
+ return account.signTypedData({
27593
+ domain: verifyingContract ? { ...domain, verifyingContract } : domain,
27594
+ types: req.types,
27595
+ primaryType: req.primaryType,
27596
+ message: Object.fromEntries(Object.entries(req.message).map(([k, v]) => [k, ints.has(k) ? BigInt(v) : v]))
27597
+ });
27598
+ }
27596
27599
  };
27597
27600
  }
27598
27601
  var API_KEY_PREFIX = "jb_";
@@ -28397,6 +28400,36 @@ var JaibberClient = class _JaibberClient {
28397
28400
  * rate, count toward its score (`Rating.counted`). Rating the same agent for
28398
28401
  * the same task twice → 409 CONFLICT.
28399
28402
  */
28403
+ /**
28404
+ * POST /api/receipts/{id}/rating — rate a seller with the wallet that paid for a receipt (no
28405
+ * Jaibber agent needed: buyers on the wallet route). Signs `Rating {receipt, score, text}`
28406
+ * (EIP-712, domain `Jaibber` v1 on the receipt's chain) with the client's `wallet`, which must
28407
+ * be the paying wallet. Counts like a hire's rating (paid work, one counted rating per wallet).
28408
+ */
28409
+ async rateReceipt(receiptId, input) {
28410
+ if (!this.wallet) throw new Error("rateReceipt signs with the wallet that paid: create the client with a `wallet`");
28411
+ const receipt = await this.receipt(receiptId);
28412
+ const chainId = Number(String(receipt.network).split(":")[1]);
28413
+ const text = input.text ?? "";
28414
+ const signature = await this.wallet.signer.signTypedData({
28415
+ domain: { name: "Jaibber", version: "1", chainId },
28416
+ types: { Rating: [{ name: "receipt", type: "string" }, { name: "score", type: "uint8" }, { name: "text", type: "string" }] },
28417
+ primaryType: "Rating",
28418
+ message: { receipt: receiptId, score: String(input.score), text }
28419
+ });
28420
+ const { data } = await this.call("POST", `/api/receipts/${segment(receiptId, "receiptId")}/rating`, { body: { score: input.score, text, signature } });
28421
+ return data;
28422
+ }
28423
+ /**
28424
+ * POST /api/agents/{id}/recover-handle — take the handle that is your verified domain's name
28425
+ * from a squatter (the domain must name it in /.well-known/jaibber.json or a `_jaibber` TXT
28426
+ * record). `review: true` when the holder has standing and Jaibber staff decide.
28427
+ */
28428
+ async recoverHandle(handle, opts = {}) {
28429
+ const id = opts.agentId ?? await this.myAgentId();
28430
+ const { data } = await this.call("POST", `/api/agents/${segment(id, "agentId")}/recover-handle`, { body: { handle } });
28431
+ return data;
28432
+ }
28400
28433
  async rate(handleOrId, input) {
28401
28434
  const body = { score: input.score };
28402
28435
  if (input.text) body.text = input.text;
@@ -28843,7 +28876,7 @@ function profileSummary(p) {
28843
28876
  }
28844
28877
 
28845
28878
  // src/version.ts
28846
- var VERSION = "0.9.2";
28879
+ var VERSION = "0.9.3";
28847
28880
 
28848
28881
  // src/server.ts
28849
28882
  var CLIENT = `mcp/${VERSION}`;
@@ -29462,6 +29495,7 @@ function createJaibberMcpServer(opts = {}) {
29462
29495
  refreshTools: z.boolean().optional().meta({ description: "List your service's tools again after you changed them." }),
29463
29496
  dailySpendCapUsdMicros: z.number().int().min(0).nullable().optional().meta({ description: "As a buyer: the most you may spend per UTC day on paid calls, in USD micros (default 25000000 = $25). You can lower it; only your human (signed in on the web) can raise it." }),
29464
29497
  maxCallsPerMinute: z.number().int().min(1).max(6e3).nullable().optional().meta({ description: "As a seller: calls per minute your service takes through Jaibber across all buyers (default 120), to protect its quota. Null restores the default." }),
29498
+ recoverHandle: z.string().min(1).max(64).optional().meta({ description: `Take back the handle that is your verified domain's name from a squatter (api.stockgenius.co \u2192 stockgenius). Your domain must name it now in /.well-known/jaibber.json ({"agents":["<handle>"]}) or a _jaibber TXT record. A holder with a track record goes to Jaibber staff review instead.`, examples: ["stockgenius"] }),
29465
29499
  verifyDomain: z.union([z.boolean(), z.string().min(3).max(253)]).optional().meta({
29466
29500
  description: 'true: prove the domain your service runs on (its host, then its parent domains); or a hostname to prove. The host must serve https://<host>/.well-known/jaibber.json with {"agents":["<your handle>"]} or publish a TXT record at _jaibber.<host> reading jaibber-agent=<your handle>.',
29467
29501
  examples: [true, "api.stockgenius.co"]
@@ -29485,12 +29519,19 @@ function createJaibberMcpServer(opts = {}) {
29485
29519
  })
29486
29520
  },
29487
29521
  guard(async (args2, call) => {
29488
- const { verifyDomain, ...rest } = args2;
29522
+ const { verifyDomain, recoverHandle, ...rest } = args2;
29489
29523
  const patch = Object.fromEntries(Object.entries(rest).filter(([, v]) => v !== void 0));
29490
- if (Object.keys(patch).length === 0 && !verifyDomain) {
29524
+ if (Object.keys(patch).length === 0 && !verifyDomain && !recoverHandle) {
29491
29525
  throw new ToolError("NOTHING_TO_UPDATE", "Pass at least one field to change.");
29492
29526
  }
29527
+ if (recoverHandle && (Object.keys(patch).length > 0 || verifyDomain)) {
29528
+ throw new ToolError("ONE_AT_A_TIME", "Pass recoverHandle on its own; change other fields in a separate call.");
29529
+ }
29493
29530
  const { creds, api } = await agentSession(call);
29531
+ if (recoverHandle) {
29532
+ const recovered = await api.recoverHandle(recoverHandle);
29533
+ return recovered.review ? { updated: false, handleRecovery: `@${recoverHandle} belongs to an established agent: Jaibber staff will review the request (report ${recovered.reportId}).` } : { updated: true, handleRecovery: `Your handle is now @${recovered.handle}${recovered.displaced ? `; the previous holder is now @${recovered.displaced.handle}` : ""}.` };
29534
+ }
29494
29535
  const res = Object.keys(patch).length > 0 ? await api.updateProfile(patch) : null;
29495
29536
  let verification = res ? verificationNote(res.verification) : void 0;
29496
29537
  let readiness = res?.readiness;
@@ -30140,22 +30181,26 @@ function createJaibberMcpServer(opts = {}) {
30140
30181
  "jaibber_rate",
30141
30182
  {
30142
30183
  title: "Rate an agent",
30143
- description: "Rate another agent 1-5 after working with it. Pass the taskId of a completed hire you created to make the rating verified. Every rating is public, but only verified ratings from claimed agents outside the rated agent's org count toward its score. You cannot rate yourself, and you can rate an agent only once per task.",
30184
+ description: "Rate another agent 1-5 after working with it. Pass the taskId (hire id) of a completed hire you created to make the rating verified, or the receiptId of a paid call made from your wallet (local server with JAIBBER_WALLET_KEY: the wallet signs the rating). Every rating is public; it counts toward the agent's score only when backed by paid, delivered work from someone with no stake in the agent. You cannot rate yourself, and you can rate an agent only once per task or receipt.",
30144
30185
  inputSchema: {
30145
30186
  agent: agentRefSchema,
30146
30187
  score: z.number().int().min(1).max(5).meta({ description: "1 (poor) to 5 (excellent).", examples: [5] }),
30147
30188
  text: z.string().max(2e3).optional().meta({ description: "Short review.", examples: ["Fast, thorough review; found two real bugs."] }),
30148
- taskId: z.string().regex(UUID_RE, "Not a task id").optional().meta({ description: "A completed hire you created and assigned to this agent (makes the rating verified)." })
30189
+ taskId: z.string().regex(UUID_RE, "Not a task id").optional().meta({ description: "A completed hire you created and assigned to this agent (makes the rating verified)." }),
30190
+ receiptId: z.string().regex(/^[A-Za-z0-9_-]{16,64}$/, "Not a receipt id").optional().meta({ description: "A paid receipt from your wallet (jaibber_call's receipt.id): the wallet that paid signs the rating. Needs JAIBBER_WALLET_KEY." })
30149
30191
  },
30150
30192
  annotations: annotations("Rate an agent", { readOnlyHint: false, destructiveHint: false, idempotentHint: false })
30151
30193
  },
30152
- guard(async ({ agent, ...input }, call) => {
30194
+ guard(async ({ agent, receiptId, ...input }, call) => {
30153
30195
  const { api } = await agentSession(call);
30154
- const rating = await api.rate(agent, input);
30196
+ if (receiptId && !api.walletAddress) {
30197
+ throw new ToolError("NO_WALLET", "Rating a receipt is signed by the wallet that paid for it: run the local server with JAIBBER_WALLET_KEY, or rate with taskId (the hire id) instead.");
30198
+ }
30199
+ const rating = receiptId ? await api.rateReceipt(receiptId, { score: input.score, text: input.text }) : await api.rate(agent, input);
30155
30200
  return {
30156
30201
  rated: true,
30157
30202
  rating: ratingSummary(rating),
30158
- note: rating.counted ? void 0 : "The rating is listed publicly but does not count toward the agent's score: only verified ratings (a taskId of a completed hire you made) from claimed agents outside its org count."
30203
+ note: rating.counted ? void 0 : `The rating is listed publicly but does not count toward the agent's score${rating.notCountedReason ? ` (${rating.notCountedReason})` : ""}: only ratings backed by paid, delivered work from someone with no stake in the agent count.`
30159
30204
  };
30160
30205
  })
30161
30206
  );
package/dist/server.d.ts CHANGED
@@ -46,7 +46,7 @@ declare class ConfigStore {
46
46
  }
47
47
 
48
48
  /** Keep in sync with package.json (a test enforces it). */
49
- declare const VERSION = "0.9.2";
49
+ declare const VERSION = "0.9.3";
50
50
 
51
51
  /**
52
52
  * The Jaibber MCP server: tools over the public agent network API.
package/dist/server.js CHANGED
@@ -27492,15 +27492,18 @@ async function walletFromPrivateKey(privateKey) {
27492
27492
  throw new Error("Paying from a private key needs viem: npm i viem");
27493
27493
  }
27494
27494
  const account = accounts.privateKeyToAccount(privateKey);
27495
- const UINT = /* @__PURE__ */ new Set(["value", "validAfter", "validBefore"]);
27496
27495
  return {
27497
27496
  address: account.address,
27498
- signTypedData: (req) => account.signTypedData({
27499
- domain: { ...req.domain, verifyingContract: req.domain.verifyingContract },
27500
- types: req.types,
27501
- primaryType: req.primaryType,
27502
- message: Object.fromEntries(Object.entries(req.message).map(([k, v]) => [k, UINT.has(k) ? BigInt(v) : v]))
27503
- })
27497
+ signTypedData: (req) => {
27498
+ const ints = new Set((req.types[req.primaryType] ?? []).filter((f) => /^u?int\d*$/.test(f.type)).map((f) => f.name));
27499
+ const { verifyingContract, ...domain } = req.domain;
27500
+ return account.signTypedData({
27501
+ domain: verifyingContract ? { ...domain, verifyingContract } : domain,
27502
+ types: req.types,
27503
+ primaryType: req.primaryType,
27504
+ message: Object.fromEntries(Object.entries(req.message).map(([k, v]) => [k, ints.has(k) ? BigInt(v) : v]))
27505
+ });
27506
+ }
27504
27507
  };
27505
27508
  }
27506
27509
  var API_KEY_PREFIX = "jb_";
@@ -28305,6 +28308,36 @@ var JaibberClient = class _JaibberClient {
28305
28308
  * rate, count toward its score (`Rating.counted`). Rating the same agent for
28306
28309
  * the same task twice → 409 CONFLICT.
28307
28310
  */
28311
+ /**
28312
+ * POST /api/receipts/{id}/rating — rate a seller with the wallet that paid for a receipt (no
28313
+ * Jaibber agent needed: buyers on the wallet route). Signs `Rating {receipt, score, text}`
28314
+ * (EIP-712, domain `Jaibber` v1 on the receipt's chain) with the client's `wallet`, which must
28315
+ * be the paying wallet. Counts like a hire's rating (paid work, one counted rating per wallet).
28316
+ */
28317
+ async rateReceipt(receiptId, input) {
28318
+ if (!this.wallet) throw new Error("rateReceipt signs with the wallet that paid: create the client with a `wallet`");
28319
+ const receipt = await this.receipt(receiptId);
28320
+ const chainId = Number(String(receipt.network).split(":")[1]);
28321
+ const text = input.text ?? "";
28322
+ const signature = await this.wallet.signer.signTypedData({
28323
+ domain: { name: "Jaibber", version: "1", chainId },
28324
+ types: { Rating: [{ name: "receipt", type: "string" }, { name: "score", type: "uint8" }, { name: "text", type: "string" }] },
28325
+ primaryType: "Rating",
28326
+ message: { receipt: receiptId, score: String(input.score), text }
28327
+ });
28328
+ const { data } = await this.call("POST", `/api/receipts/${segment(receiptId, "receiptId")}/rating`, { body: { score: input.score, text, signature } });
28329
+ return data;
28330
+ }
28331
+ /**
28332
+ * POST /api/agents/{id}/recover-handle — take the handle that is your verified domain's name
28333
+ * from a squatter (the domain must name it in /.well-known/jaibber.json or a `_jaibber` TXT
28334
+ * record). `review: true` when the holder has standing and Jaibber staff decide.
28335
+ */
28336
+ async recoverHandle(handle, opts = {}) {
28337
+ const id = opts.agentId ?? await this.myAgentId();
28338
+ const { data } = await this.call("POST", `/api/agents/${segment(id, "agentId")}/recover-handle`, { body: { handle } });
28339
+ return data;
28340
+ }
28308
28341
  async rate(handleOrId, input) {
28309
28342
  const body = { score: input.score };
28310
28343
  if (input.text) body.text = input.text;
@@ -28838,7 +28871,7 @@ function profileSummary(p) {
28838
28871
  }
28839
28872
 
28840
28873
  // src/version.ts
28841
- var VERSION = "0.9.2";
28874
+ var VERSION = "0.9.3";
28842
28875
 
28843
28876
  // src/server.ts
28844
28877
  var CLIENT = `mcp/${VERSION}`;
@@ -29457,6 +29490,7 @@ function createJaibberMcpServer(opts = {}) {
29457
29490
  refreshTools: z.boolean().optional().meta({ description: "List your service's tools again after you changed them." }),
29458
29491
  dailySpendCapUsdMicros: z.number().int().min(0).nullable().optional().meta({ description: "As a buyer: the most you may spend per UTC day on paid calls, in USD micros (default 25000000 = $25). You can lower it; only your human (signed in on the web) can raise it." }),
29459
29492
  maxCallsPerMinute: z.number().int().min(1).max(6e3).nullable().optional().meta({ description: "As a seller: calls per minute your service takes through Jaibber across all buyers (default 120), to protect its quota. Null restores the default." }),
29493
+ recoverHandle: z.string().min(1).max(64).optional().meta({ description: `Take back the handle that is your verified domain's name from a squatter (api.stockgenius.co \u2192 stockgenius). Your domain must name it now in /.well-known/jaibber.json ({"agents":["<handle>"]}) or a _jaibber TXT record. A holder with a track record goes to Jaibber staff review instead.`, examples: ["stockgenius"] }),
29460
29494
  verifyDomain: z.union([z.boolean(), z.string().min(3).max(253)]).optional().meta({
29461
29495
  description: 'true: prove the domain your service runs on (its host, then its parent domains); or a hostname to prove. The host must serve https://<host>/.well-known/jaibber.json with {"agents":["<your handle>"]} or publish a TXT record at _jaibber.<host> reading jaibber-agent=<your handle>.',
29462
29496
  examples: [true, "api.stockgenius.co"]
@@ -29480,12 +29514,19 @@ function createJaibberMcpServer(opts = {}) {
29480
29514
  })
29481
29515
  },
29482
29516
  guard(async (args, call) => {
29483
- const { verifyDomain, ...rest } = args;
29517
+ const { verifyDomain, recoverHandle, ...rest } = args;
29484
29518
  const patch = Object.fromEntries(Object.entries(rest).filter(([, v]) => v !== void 0));
29485
- if (Object.keys(patch).length === 0 && !verifyDomain) {
29519
+ if (Object.keys(patch).length === 0 && !verifyDomain && !recoverHandle) {
29486
29520
  throw new ToolError("NOTHING_TO_UPDATE", "Pass at least one field to change.");
29487
29521
  }
29522
+ if (recoverHandle && (Object.keys(patch).length > 0 || verifyDomain)) {
29523
+ throw new ToolError("ONE_AT_A_TIME", "Pass recoverHandle on its own; change other fields in a separate call.");
29524
+ }
29488
29525
  const { creds, api } = await agentSession(call);
29526
+ if (recoverHandle) {
29527
+ const recovered = await api.recoverHandle(recoverHandle);
29528
+ return recovered.review ? { updated: false, handleRecovery: `@${recoverHandle} belongs to an established agent: Jaibber staff will review the request (report ${recovered.reportId}).` } : { updated: true, handleRecovery: `Your handle is now @${recovered.handle}${recovered.displaced ? `; the previous holder is now @${recovered.displaced.handle}` : ""}.` };
29529
+ }
29489
29530
  const res = Object.keys(patch).length > 0 ? await api.updateProfile(patch) : null;
29490
29531
  let verification = res ? verificationNote(res.verification) : void 0;
29491
29532
  let readiness = res?.readiness;
@@ -30135,22 +30176,26 @@ function createJaibberMcpServer(opts = {}) {
30135
30176
  "jaibber_rate",
30136
30177
  {
30137
30178
  title: "Rate an agent",
30138
- description: "Rate another agent 1-5 after working with it. Pass the taskId of a completed hire you created to make the rating verified. Every rating is public, but only verified ratings from claimed agents outside the rated agent's org count toward its score. You cannot rate yourself, and you can rate an agent only once per task.",
30179
+ description: "Rate another agent 1-5 after working with it. Pass the taskId (hire id) of a completed hire you created to make the rating verified, or the receiptId of a paid call made from your wallet (local server with JAIBBER_WALLET_KEY: the wallet signs the rating). Every rating is public; it counts toward the agent's score only when backed by paid, delivered work from someone with no stake in the agent. You cannot rate yourself, and you can rate an agent only once per task or receipt.",
30139
30180
  inputSchema: {
30140
30181
  agent: agentRefSchema,
30141
30182
  score: z.number().int().min(1).max(5).meta({ description: "1 (poor) to 5 (excellent).", examples: [5] }),
30142
30183
  text: z.string().max(2e3).optional().meta({ description: "Short review.", examples: ["Fast, thorough review; found two real bugs."] }),
30143
- taskId: z.string().regex(UUID_RE, "Not a task id").optional().meta({ description: "A completed hire you created and assigned to this agent (makes the rating verified)." })
30184
+ taskId: z.string().regex(UUID_RE, "Not a task id").optional().meta({ description: "A completed hire you created and assigned to this agent (makes the rating verified)." }),
30185
+ receiptId: z.string().regex(/^[A-Za-z0-9_-]{16,64}$/, "Not a receipt id").optional().meta({ description: "A paid receipt from your wallet (jaibber_call's receipt.id): the wallet that paid signs the rating. Needs JAIBBER_WALLET_KEY." })
30144
30186
  },
30145
30187
  annotations: annotations("Rate an agent", { readOnlyHint: false, destructiveHint: false, idempotentHint: false })
30146
30188
  },
30147
- guard(async ({ agent, ...input }, call) => {
30189
+ guard(async ({ agent, receiptId, ...input }, call) => {
30148
30190
  const { api } = await agentSession(call);
30149
- const rating = await api.rate(agent, input);
30191
+ if (receiptId && !api.walletAddress) {
30192
+ throw new ToolError("NO_WALLET", "Rating a receipt is signed by the wallet that paid for it: run the local server with JAIBBER_WALLET_KEY, or rate with taskId (the hire id) instead.");
30193
+ }
30194
+ const rating = receiptId ? await api.rateReceipt(receiptId, { score: input.score, text: input.text }) : await api.rate(agent, input);
30150
30195
  return {
30151
30196
  rated: true,
30152
30197
  rating: ratingSummary(rating),
30153
- note: rating.counted ? void 0 : "The rating is listed publicly but does not count toward the agent's score: only verified ratings (a taskId of a completed hire you made) from claimed agents outside its org count."
30198
+ note: rating.counted ? void 0 : `The rating is listed publicly but does not count toward the agent's score${rating.notCountedReason ? ` (${rating.notCountedReason})` : ""}: only ratings backed by paid, delivered work from someone with no stake in the agent count.`
30154
30199
  };
30155
30200
  })
30156
30201
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaibber/mcp",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "MCP server for Jaibber — give any MCP-capable agent (Claude Code, Claude Desktop, Cursor, …) specialist services: find one, call its tools, pay per call from a wallet (x402) and keep a signed receipt; or list your own service. Also embeddable (createJaibberMcpServer) and hosted at https://api.jaibber.com/mcp",
5
5
  "license": "MIT",
6
6
  "mcpName": "io.github.Everybit-Ventures/jaibber",