@haven_ai/mcp 0.1.22-alpha.0 → 0.1.23-alpha.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/README.md +2 -5
- package/dist/cli.cjs +8 -118
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +9 -119
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +8 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -119
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -91,9 +91,6 @@ Environment variable form:
|
|
|
91
91
|
- `haven_quote_x402`
|
|
92
92
|
- `haven_pay_x402_quote`
|
|
93
93
|
- `haven_resume_x402_payment`
|
|
94
|
-
- `haven_quote_mpp`
|
|
95
|
-
- `haven_pay_mpp_challenge`
|
|
96
|
-
- `haven_resume_mpp_payment`
|
|
97
94
|
- `haven_get_payment_status`
|
|
98
95
|
- `haven_get_resume_state`
|
|
99
96
|
- `haven_get_agent`
|
|
@@ -174,8 +171,8 @@ every MCP tool that would settle, regardless of audit state.
|
|
|
174
171
|
then call `haven_resume_x402_payment` with the returned `resume_state` or
|
|
175
172
|
`payment_id`.
|
|
176
173
|
|
|
177
|
-
The MPP flow is
|
|
178
|
-
|
|
174
|
+
The legacy MPP demo flow is retired (#1328) — pay through the x402 merchant
|
|
175
|
+
flow above instead.
|
|
179
176
|
|
|
180
177
|
## Non-custodial invariant
|
|
181
178
|
|
package/dist/cli.cjs
CHANGED
|
@@ -252,22 +252,6 @@ var toolSchemas = {
|
|
|
252
252
|
payment_id: v3.z.string().optional(),
|
|
253
253
|
resume_state: v3.z.unknown().optional()
|
|
254
254
|
},
|
|
255
|
-
haven_quote_mpp: {
|
|
256
|
-
url: v3.z.string().url().optional(),
|
|
257
|
-
challenge: v3.z.unknown().optional(),
|
|
258
|
-
method: v3.z.string().optional(),
|
|
259
|
-
headers: headersSchema,
|
|
260
|
-
body: v3.z.string().optional(),
|
|
261
|
-
idempotencyKey: v3.z.string().optional()
|
|
262
|
-
},
|
|
263
|
-
haven_pay_mpp_challenge: {
|
|
264
|
-
quote: v3.z.unknown(),
|
|
265
|
-
idempotencyKey: v3.z.string().optional()
|
|
266
|
-
},
|
|
267
|
-
haven_resume_mpp_payment: {
|
|
268
|
-
payment_id: v3.z.string().optional(),
|
|
269
|
-
resume_state: v3.z.unknown().optional()
|
|
270
|
-
},
|
|
271
255
|
haven_get_payment_status: {
|
|
272
256
|
payment_id: v3.z.string()
|
|
273
257
|
},
|
|
@@ -279,6 +263,7 @@ var toolSchemas = {
|
|
|
279
263
|
haven_sweep_delegate: {},
|
|
280
264
|
haven_discover_tools: {
|
|
281
265
|
category: v3.z.string().optional(),
|
|
266
|
+
search: v3.z.string().optional(),
|
|
282
267
|
rail: v3.z.enum(["x402", "mpp"]).optional()
|
|
283
268
|
},
|
|
284
269
|
haven_list_receipts: {
|
|
@@ -295,9 +280,6 @@ var toolDescriptions = {
|
|
|
295
280
|
haven_pay_x402_quote: sdk.composeDescription(sdk.toolDescriptions.payX402),
|
|
296
281
|
haven_pay_x402: sdk.composeDescription(sdk.toolDescriptions.payX402OneShot),
|
|
297
282
|
haven_resume_x402_payment: sdk.composeDescription(sdk.toolDescriptions.resumeX402),
|
|
298
|
-
haven_quote_mpp: sdk.composeDescription(sdk.toolDescriptions.quoteMpp),
|
|
299
|
-
haven_pay_mpp_challenge: sdk.composeDescription(sdk.toolDescriptions.payMpp),
|
|
300
|
-
haven_resume_mpp_payment: sdk.composeDescription(sdk.toolDescriptions.resumeMpp),
|
|
301
283
|
haven_get_payment_status: sdk.composeDescription(sdk.toolDescriptions.getPaymentStatus),
|
|
302
284
|
haven_get_resume_state: sdk.composeDescription(sdk.toolDescriptions.getResumeState),
|
|
303
285
|
haven_get_agent: sdk.composeDescription(sdk.toolDescriptions.getAgent),
|
|
@@ -383,13 +365,6 @@ function createToolHandlers(haven) {
|
|
|
383
365
|
try {
|
|
384
366
|
return { success: true, data: await haven.quoteX402(args.url, requestInit(args), { idempotencyKey: args.idempotencyKey }) };
|
|
385
367
|
} catch (err) {
|
|
386
|
-
if (err instanceof sdk.HavenApiError && err.message.includes("quoteX402 only supports standard x402")) {
|
|
387
|
-
return wrongTool(
|
|
388
|
-
"WRONG_RAIL",
|
|
389
|
-
"The URL responds with an MPP machine-payment challenge, not an x402 payment. Use haven_quote_mpp to inspect this merchant.",
|
|
390
|
-
"haven_quote_mpp"
|
|
391
|
-
);
|
|
392
|
-
}
|
|
393
368
|
return normalizeError(err);
|
|
394
369
|
}
|
|
395
370
|
},
|
|
@@ -403,13 +378,6 @@ function createToolHandlers(haven) {
|
|
|
403
378
|
"haven_quote_x402"
|
|
404
379
|
);
|
|
405
380
|
}
|
|
406
|
-
if (!quote.paymentRequired && quote.rail === "mpp") {
|
|
407
|
-
return wrongTool(
|
|
408
|
-
"WRONG_TOOL",
|
|
409
|
-
"The quote is for the MPP rail. Use haven_pay_mpp_challenge to pay an MPP quote.",
|
|
410
|
-
"haven_pay_mpp_challenge"
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
381
|
if (!quote.paymentRequired) {
|
|
414
382
|
return wrongTool(
|
|
415
383
|
"WRONG_TOOL",
|
|
@@ -431,95 +399,12 @@ function createToolHandlers(haven) {
|
|
|
431
399
|
},
|
|
432
400
|
haven_resume_x402_payment: async (input) => {
|
|
433
401
|
const args = objectInput("haven_resume_x402_payment", input);
|
|
434
|
-
if (args.resume_state && typeof args.resume_state === "object") {
|
|
435
|
-
const stateRail = args.resume_state.rail;
|
|
436
|
-
if (stateRail && stateRail !== "x402") {
|
|
437
|
-
return wrongTool(
|
|
438
|
-
"WRONG_TOOL",
|
|
439
|
-
`The resume state is for the '${stateRail}' rail, not x402. Use haven_resume_mpp_payment instead.`,
|
|
440
|
-
"haven_resume_mpp_payment"
|
|
441
|
-
);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
402
|
return runTool(async () => {
|
|
445
403
|
const state = await resumeState(args, "x402");
|
|
446
404
|
const response = await haven.resumeX402Payment(state);
|
|
447
405
|
return responsePayload(response);
|
|
448
406
|
});
|
|
449
407
|
},
|
|
450
|
-
haven_quote_mpp: async (input) => {
|
|
451
|
-
const args = objectInput("haven_quote_mpp", input);
|
|
452
|
-
try {
|
|
453
|
-
if (args.challenge) {
|
|
454
|
-
return {
|
|
455
|
-
success: true,
|
|
456
|
-
data: await haven.quoteMpp(args.challenge, requestInit(args), {
|
|
457
|
-
idempotencyKey: args.idempotencyKey
|
|
458
|
-
})
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
if (!args.url) {
|
|
462
|
-
return normalizeError(new sdk.HavenApiError("haven_quote_mpp requires either url or challenge.", 400));
|
|
463
|
-
}
|
|
464
|
-
return { success: true, data: await haven.quoteMpp(args.url, requestInit(args), { idempotencyKey: args.idempotencyKey }) };
|
|
465
|
-
} catch (err) {
|
|
466
|
-
if (err instanceof Error && err.message.includes("No MACHINE-PAYMENT-CHALLENGE header found")) {
|
|
467
|
-
return wrongTool(
|
|
468
|
-
"WRONG_RAIL",
|
|
469
|
-
"The URL responds with an x402 payment requirement, not an MPP machine-payment challenge. Use haven_quote_x402 to inspect this merchant.",
|
|
470
|
-
"haven_quote_x402"
|
|
471
|
-
);
|
|
472
|
-
}
|
|
473
|
-
return normalizeError(err);
|
|
474
|
-
}
|
|
475
|
-
},
|
|
476
|
-
haven_pay_mpp_challenge: async (input) => {
|
|
477
|
-
const args = objectInput("haven_pay_mpp_challenge", input);
|
|
478
|
-
const quote = args.quote;
|
|
479
|
-
if (!quote || typeof quote !== "object") {
|
|
480
|
-
return wrongTool(
|
|
481
|
-
"WRONG_TOOL",
|
|
482
|
-
"The quote argument is missing or is not a valid MPP quote object. Call haven_quote_mpp first to obtain a quote.",
|
|
483
|
-
"haven_quote_mpp"
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
if (quote.paymentRequired || quote.rail === "x402") {
|
|
487
|
-
return wrongTool(
|
|
488
|
-
"WRONG_TOOL",
|
|
489
|
-
"The quote is for the x402 rail. Use haven_pay_x402_quote to pay an x402 quote.",
|
|
490
|
-
"haven_pay_x402_quote"
|
|
491
|
-
);
|
|
492
|
-
}
|
|
493
|
-
if (!quote.challenge) {
|
|
494
|
-
return wrongTool(
|
|
495
|
-
"WRONG_TOOL",
|
|
496
|
-
"The quote is missing the required challenge field. Call haven_quote_mpp first to obtain a valid MPP quote.",
|
|
497
|
-
"haven_quote_mpp"
|
|
498
|
-
);
|
|
499
|
-
}
|
|
500
|
-
return runTool(async () => {
|
|
501
|
-
const response = await haven.payMppChallenge(args.quote, { idempotencyKey: args.idempotencyKey });
|
|
502
|
-
return responsePayload(response);
|
|
503
|
-
});
|
|
504
|
-
},
|
|
505
|
-
haven_resume_mpp_payment: async (input) => {
|
|
506
|
-
const args = objectInput("haven_resume_mpp_payment", input);
|
|
507
|
-
if (args.resume_state && typeof args.resume_state === "object") {
|
|
508
|
-
const stateRail = args.resume_state.rail;
|
|
509
|
-
if (stateRail && stateRail !== "mpp") {
|
|
510
|
-
return wrongTool(
|
|
511
|
-
"WRONG_TOOL",
|
|
512
|
-
`The resume state is for the '${stateRail}' rail, not mpp. Use haven_resume_x402_payment instead.`,
|
|
513
|
-
"haven_resume_x402_payment"
|
|
514
|
-
);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
return runTool(async () => {
|
|
518
|
-
const state = await resumeState(args, "mpp");
|
|
519
|
-
const response = await haven.resumeMppPayment(state);
|
|
520
|
-
return responsePayload(response);
|
|
521
|
-
});
|
|
522
|
-
},
|
|
523
408
|
haven_get_payment_status: async (input) => {
|
|
524
409
|
const args = objectInput("haven_get_payment_status", input);
|
|
525
410
|
return runTool(async () => haven.getPaymentStatusWithPostPurchaseAllowance(args.payment_id));
|
|
@@ -536,6 +421,7 @@ function createToolHandlers(haven) {
|
|
|
536
421
|
return runTool(async () => {
|
|
537
422
|
const entries = await haven.discoverTools({
|
|
538
423
|
category: typeof args.category === "string" ? args.category : void 0,
|
|
424
|
+
search: typeof args.search === "string" ? args.search : void 0,
|
|
539
425
|
rail: args.rail === "x402" || args.rail === "mpp" ? args.rail : void 0
|
|
540
426
|
});
|
|
541
427
|
return entries.map((entry) => ({
|
|
@@ -555,7 +441,11 @@ function createToolHandlers(haven) {
|
|
|
555
441
|
status: entry.status,
|
|
556
442
|
verified_at: entry.verifiedAt,
|
|
557
443
|
// Which Haven pay tool reaches this entry from the local MCP surface.
|
|
558
|
-
|
|
444
|
+
// #1328: the 'mpp' rail's only-ever catalog row (the Haven MPP demo
|
|
445
|
+
// resource) is delisted with the mpp_demo retirement, so this
|
|
446
|
+
// fallback is unreachable today; it stays x402 rather than naming a
|
|
447
|
+
// deleted tool in case a future non-demo 'mpp' rail entry appears.
|
|
448
|
+
suggested_tool: entry.protocol === "mcp" ? "haven_pay_mcp_tool" : "haven_pay_x402"
|
|
559
449
|
}));
|
|
560
450
|
});
|
|
561
451
|
},
|
|
@@ -877,7 +767,7 @@ async function resolveHavenClient(options = {}) {
|
|
|
877
767
|
return { client, credentials };
|
|
878
768
|
}
|
|
879
769
|
var MCP_NAME = "@haven_ai/mcp";
|
|
880
|
-
var MCP_VERSION = "0.1.
|
|
770
|
+
var MCP_VERSION = "0.1.23-alpha.1";
|
|
881
771
|
var MCP_INSTRUCTIONS = [
|
|
882
772
|
"Haven local MCP server: signs in-process with the delegate key it holds on",
|
|
883
773
|
"this machine \u2014 the key never leaves this process. Call haven_get_agent",
|