@haven_ai/mcp 0.1.23-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 +6 -118
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +7 -119
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +6 -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 +7 -119
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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
|
},
|
|
@@ -296,9 +280,6 @@ var toolDescriptions = {
|
|
|
296
280
|
haven_pay_x402_quote: sdk.composeDescription(sdk.toolDescriptions.payX402),
|
|
297
281
|
haven_pay_x402: sdk.composeDescription(sdk.toolDescriptions.payX402OneShot),
|
|
298
282
|
haven_resume_x402_payment: sdk.composeDescription(sdk.toolDescriptions.resumeX402),
|
|
299
|
-
haven_quote_mpp: sdk.composeDescription(sdk.toolDescriptions.quoteMpp),
|
|
300
|
-
haven_pay_mpp_challenge: sdk.composeDescription(sdk.toolDescriptions.payMpp),
|
|
301
|
-
haven_resume_mpp_payment: sdk.composeDescription(sdk.toolDescriptions.resumeMpp),
|
|
302
283
|
haven_get_payment_status: sdk.composeDescription(sdk.toolDescriptions.getPaymentStatus),
|
|
303
284
|
haven_get_resume_state: sdk.composeDescription(sdk.toolDescriptions.getResumeState),
|
|
304
285
|
haven_get_agent: sdk.composeDescription(sdk.toolDescriptions.getAgent),
|
|
@@ -384,13 +365,6 @@ function createToolHandlers(haven) {
|
|
|
384
365
|
try {
|
|
385
366
|
return { success: true, data: await haven.quoteX402(args.url, requestInit(args), { idempotencyKey: args.idempotencyKey }) };
|
|
386
367
|
} catch (err) {
|
|
387
|
-
if (err instanceof sdk.HavenApiError && err.message.includes("quoteX402 only supports standard x402")) {
|
|
388
|
-
return wrongTool(
|
|
389
|
-
"WRONG_RAIL",
|
|
390
|
-
"The URL responds with an MPP machine-payment challenge, not an x402 payment. Use haven_quote_mpp to inspect this merchant.",
|
|
391
|
-
"haven_quote_mpp"
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
368
|
return normalizeError(err);
|
|
395
369
|
}
|
|
396
370
|
},
|
|
@@ -404,13 +378,6 @@ function createToolHandlers(haven) {
|
|
|
404
378
|
"haven_quote_x402"
|
|
405
379
|
);
|
|
406
380
|
}
|
|
407
|
-
if (!quote.paymentRequired && quote.rail === "mpp") {
|
|
408
|
-
return wrongTool(
|
|
409
|
-
"WRONG_TOOL",
|
|
410
|
-
"The quote is for the MPP rail. Use haven_pay_mpp_challenge to pay an MPP quote.",
|
|
411
|
-
"haven_pay_mpp_challenge"
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
381
|
if (!quote.paymentRequired) {
|
|
415
382
|
return wrongTool(
|
|
416
383
|
"WRONG_TOOL",
|
|
@@ -432,95 +399,12 @@ function createToolHandlers(haven) {
|
|
|
432
399
|
},
|
|
433
400
|
haven_resume_x402_payment: async (input) => {
|
|
434
401
|
const args = objectInput("haven_resume_x402_payment", input);
|
|
435
|
-
if (args.resume_state && typeof args.resume_state === "object") {
|
|
436
|
-
const stateRail = args.resume_state.rail;
|
|
437
|
-
if (stateRail && stateRail !== "x402") {
|
|
438
|
-
return wrongTool(
|
|
439
|
-
"WRONG_TOOL",
|
|
440
|
-
`The resume state is for the '${stateRail}' rail, not x402. Use haven_resume_mpp_payment instead.`,
|
|
441
|
-
"haven_resume_mpp_payment"
|
|
442
|
-
);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
402
|
return runTool(async () => {
|
|
446
403
|
const state = await resumeState(args, "x402");
|
|
447
404
|
const response = await haven.resumeX402Payment(state);
|
|
448
405
|
return responsePayload(response);
|
|
449
406
|
});
|
|
450
407
|
},
|
|
451
|
-
haven_quote_mpp: async (input) => {
|
|
452
|
-
const args = objectInput("haven_quote_mpp", input);
|
|
453
|
-
try {
|
|
454
|
-
if (args.challenge) {
|
|
455
|
-
return {
|
|
456
|
-
success: true,
|
|
457
|
-
data: await haven.quoteMpp(args.challenge, requestInit(args), {
|
|
458
|
-
idempotencyKey: args.idempotencyKey
|
|
459
|
-
})
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
if (!args.url) {
|
|
463
|
-
return normalizeError(new sdk.HavenApiError("haven_quote_mpp requires either url or challenge.", 400));
|
|
464
|
-
}
|
|
465
|
-
return { success: true, data: await haven.quoteMpp(args.url, requestInit(args), { idempotencyKey: args.idempotencyKey }) };
|
|
466
|
-
} catch (err) {
|
|
467
|
-
if (err instanceof Error && err.message.includes("No MACHINE-PAYMENT-CHALLENGE header found")) {
|
|
468
|
-
return wrongTool(
|
|
469
|
-
"WRONG_RAIL",
|
|
470
|
-
"The URL responds with an x402 payment requirement, not an MPP machine-payment challenge. Use haven_quote_x402 to inspect this merchant.",
|
|
471
|
-
"haven_quote_x402"
|
|
472
|
-
);
|
|
473
|
-
}
|
|
474
|
-
return normalizeError(err);
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
haven_pay_mpp_challenge: async (input) => {
|
|
478
|
-
const args = objectInput("haven_pay_mpp_challenge", input);
|
|
479
|
-
const quote = args.quote;
|
|
480
|
-
if (!quote || typeof quote !== "object") {
|
|
481
|
-
return wrongTool(
|
|
482
|
-
"WRONG_TOOL",
|
|
483
|
-
"The quote argument is missing or is not a valid MPP quote object. Call haven_quote_mpp first to obtain a quote.",
|
|
484
|
-
"haven_quote_mpp"
|
|
485
|
-
);
|
|
486
|
-
}
|
|
487
|
-
if (quote.paymentRequired || quote.rail === "x402") {
|
|
488
|
-
return wrongTool(
|
|
489
|
-
"WRONG_TOOL",
|
|
490
|
-
"The quote is for the x402 rail. Use haven_pay_x402_quote to pay an x402 quote.",
|
|
491
|
-
"haven_pay_x402_quote"
|
|
492
|
-
);
|
|
493
|
-
}
|
|
494
|
-
if (!quote.challenge) {
|
|
495
|
-
return wrongTool(
|
|
496
|
-
"WRONG_TOOL",
|
|
497
|
-
"The quote is missing the required challenge field. Call haven_quote_mpp first to obtain a valid MPP quote.",
|
|
498
|
-
"haven_quote_mpp"
|
|
499
|
-
);
|
|
500
|
-
}
|
|
501
|
-
return runTool(async () => {
|
|
502
|
-
const response = await haven.payMppChallenge(args.quote, { idempotencyKey: args.idempotencyKey });
|
|
503
|
-
return responsePayload(response);
|
|
504
|
-
});
|
|
505
|
-
},
|
|
506
|
-
haven_resume_mpp_payment: async (input) => {
|
|
507
|
-
const args = objectInput("haven_resume_mpp_payment", input);
|
|
508
|
-
if (args.resume_state && typeof args.resume_state === "object") {
|
|
509
|
-
const stateRail = args.resume_state.rail;
|
|
510
|
-
if (stateRail && stateRail !== "mpp") {
|
|
511
|
-
return wrongTool(
|
|
512
|
-
"WRONG_TOOL",
|
|
513
|
-
`The resume state is for the '${stateRail}' rail, not mpp. Use haven_resume_x402_payment instead.`,
|
|
514
|
-
"haven_resume_x402_payment"
|
|
515
|
-
);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
return runTool(async () => {
|
|
519
|
-
const state = await resumeState(args, "mpp");
|
|
520
|
-
const response = await haven.resumeMppPayment(state);
|
|
521
|
-
return responsePayload(response);
|
|
522
|
-
});
|
|
523
|
-
},
|
|
524
408
|
haven_get_payment_status: async (input) => {
|
|
525
409
|
const args = objectInput("haven_get_payment_status", input);
|
|
526
410
|
return runTool(async () => haven.getPaymentStatusWithPostPurchaseAllowance(args.payment_id));
|
|
@@ -557,7 +441,11 @@ function createToolHandlers(haven) {
|
|
|
557
441
|
status: entry.status,
|
|
558
442
|
verified_at: entry.verifiedAt,
|
|
559
443
|
// Which Haven pay tool reaches this entry from the local MCP surface.
|
|
560
|
-
|
|
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"
|
|
561
449
|
}));
|
|
562
450
|
});
|
|
563
451
|
},
|
|
@@ -879,7 +767,7 @@ async function resolveHavenClient(options = {}) {
|
|
|
879
767
|
return { client, credentials };
|
|
880
768
|
}
|
|
881
769
|
var MCP_NAME = "@haven_ai/mcp";
|
|
882
|
-
var MCP_VERSION = "0.1.23-alpha.
|
|
770
|
+
var MCP_VERSION = "0.1.23-alpha.1";
|
|
883
771
|
var MCP_INSTRUCTIONS = [
|
|
884
772
|
"Haven local MCP server: signs in-process with the delegate key it holds on",
|
|
885
773
|
"this machine \u2014 the key never leaves this process. Call haven_get_agent",
|