mppx 0.9.0 → 0.9.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/CHANGELOG.md +8 -0
- package/dist/Errors.d.ts +10 -0
- package/dist/Errors.js +12 -0
- package/dist/Mcp.d.ts +9 -1
- package/dist/Mcp.js +18 -0
- package/dist/Method.d.ts +7 -0
- package/dist/cli/cli.js +134 -134
- package/dist/cli/plugins/index.js +12 -12
- package/dist/client/internal/protocols/Mcp.js +2 -1
- package/dist/mcp/client/McpClient.js +22 -10
- package/dist/mcp/server/Transport.d.ts +2 -2
- package/dist/mcp/server/Transport.js +11 -4
- package/dist/server/Mppx.d.ts +6 -0
- package/dist/server/Mppx.js +75 -6
- package/dist/server/Transport.js +8 -15
- package/dist/stripe/Methods.d.ts +6 -0
- package/dist/stripe/Methods.js +3 -1
- package/dist/stripe/client/Charge.d.ts +6 -0
- package/dist/stripe/client/Methods.d.ts +6 -0
- package/dist/stripe/internal/payment-intent.d.ts +7 -0
- package/dist/stripe/internal/payment-intent.js +6 -0
- package/dist/stripe/server/Charge.d.ts +6 -0
- package/dist/stripe/server/Charge.js +8 -3
- package/dist/stripe/server/Methods.js +62 -7
- package/dist/stripe/server/internal/html.gen.d.ts +1 -1
- package/dist/stripe/server/internal/html.gen.js +1 -1
- package/dist/tempo/Tokens.d.ts +13 -0
- package/dist/tempo/Tokens.js +13 -0
- package/dist/tempo/client/Charge.d.ts +1 -1
- package/dist/tempo/client/Charge.js +17 -0
- package/dist/tempo/index.d.ts +1 -0
- package/dist/tempo/index.js +1 -0
- package/dist/tempo/internal/fee-payer.d.ts +1 -1
- package/dist/tempo/internal/fee-payer.js +2 -12
- package/dist/tempo/internal/fee-token.d.ts +2 -0
- package/dist/tempo/internal/fee-token.js +7 -0
- package/dist/tempo/server/internal/html.gen.d.ts +1 -1
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/session/client/SessionManager.js +1 -2
- package/dist/tempo/session/server/Session.js +5 -2
- package/dist/x402/mcp.js +4 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# mppx
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a33ff0a: Added MACH as a charge currency with stablecoin gas fallback and preserved session recovery.
|
|
8
|
+
- c74d2ce: Added request-scoped PaymentIntent metadata to Stripe machine payment charge handlers, and exposed pre-transform request input to payment-success callbacks.
|
|
9
|
+
- 2735c65: Fixed MCP payment errors to use the specification-defined JSON-RPC codes and retry verification challenges.
|
|
10
|
+
|
|
3
11
|
## 0.9.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/Errors.d.ts
CHANGED
|
@@ -95,6 +95,16 @@ export declare namespace VerificationFailedError {
|
|
|
95
95
|
reason?: string;
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Payment processing failed because of an unexpected internal error.
|
|
100
|
+
*/
|
|
101
|
+
export declare class InternalPaymentError extends PaymentError {
|
|
102
|
+
readonly name = "InternalPaymentError";
|
|
103
|
+
readonly title = "Internal Payment Error";
|
|
104
|
+
readonly status = 500;
|
|
105
|
+
readonly type = "https://paymentauth.org/problems/internal-payment-error";
|
|
106
|
+
constructor();
|
|
107
|
+
}
|
|
98
108
|
/**
|
|
99
109
|
* Payment requires additional action (e.g., 3DS authentication).
|
|
100
110
|
*/
|
package/dist/Errors.js
CHANGED
|
@@ -74,6 +74,18 @@ export class VerificationFailedError extends PaymentError {
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Payment processing failed because of an unexpected internal error.
|
|
79
|
+
*/
|
|
80
|
+
export class InternalPaymentError extends PaymentError {
|
|
81
|
+
name = 'InternalPaymentError';
|
|
82
|
+
title = 'Internal Payment Error';
|
|
83
|
+
status = 500;
|
|
84
|
+
type = 'https://paymentauth.org/problems/internal-payment-error';
|
|
85
|
+
constructor() {
|
|
86
|
+
super('An internal payment error occurred.');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
77
89
|
/**
|
|
78
90
|
* Payment requires additional action (e.g., 3DS authentication).
|
|
79
91
|
*/
|
package/dist/Mcp.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type * as Challenge from './Challenge.js';
|
|
2
2
|
import type * as Credential from './Credential.js';
|
|
3
|
-
import
|
|
3
|
+
import * as Errors from './Errors.js';
|
|
4
4
|
import type { OneOf } from './internal/types.js';
|
|
5
5
|
import type * as core_Receipt from './Receipt.js';
|
|
6
6
|
/** MCP JSON-RPC error code for payment required. */
|
|
7
7
|
export declare const paymentRequiredCode = -32042;
|
|
8
8
|
/** MCP JSON-RPC error code for payment verification failed. */
|
|
9
9
|
export declare const paymentVerificationFailedCode = -32043;
|
|
10
|
+
/** JSON-RPC error code for invalid parameters. */
|
|
11
|
+
export declare const invalidParamsCode = -32602;
|
|
12
|
+
/** JSON-RPC error code for internal errors. */
|
|
13
|
+
export declare const internalErrorCode = -32603;
|
|
14
|
+
/**
|
|
15
|
+
* Maps a payment error to its MCP JSON-RPC error code.
|
|
16
|
+
*/
|
|
17
|
+
export declare function errorCode(error?: Errors.PaymentError): number;
|
|
10
18
|
/** MCP metadata key for credentials. */
|
|
11
19
|
export declare const credentialMetaKey = "org.paymentauth/credential";
|
|
12
20
|
/** MCP metadata key for payment-required tool results. */
|
package/dist/Mcp.js
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
+
import * as Errors from './Errors.js';
|
|
1
2
|
/** MCP JSON-RPC error code for payment required. */
|
|
2
3
|
export const paymentRequiredCode = -32042;
|
|
3
4
|
/** MCP JSON-RPC error code for payment verification failed. */
|
|
4
5
|
export const paymentVerificationFailedCode = -32043;
|
|
6
|
+
/** JSON-RPC error code for invalid parameters. */
|
|
7
|
+
export const invalidParamsCode = -32602;
|
|
8
|
+
/** JSON-RPC error code for internal errors. */
|
|
9
|
+
export const internalErrorCode = -32603;
|
|
10
|
+
/**
|
|
11
|
+
* Maps a payment error to its MCP JSON-RPC error code.
|
|
12
|
+
*/
|
|
13
|
+
export function errorCode(error) {
|
|
14
|
+
if (!error || error instanceof Errors.PaymentRequiredError)
|
|
15
|
+
return paymentRequiredCode;
|
|
16
|
+
if (error instanceof Errors.MalformedCredentialError ||
|
|
17
|
+
error instanceof Errors.InvalidPayloadError)
|
|
18
|
+
return invalidParamsCode;
|
|
19
|
+
if (error instanceof Errors.InternalPaymentError)
|
|
20
|
+
return internalErrorCode;
|
|
21
|
+
return paymentVerificationFailedCode;
|
|
22
|
+
}
|
|
5
23
|
/** MCP metadata key for credentials. */
|
|
6
24
|
export const credentialMetaKey = 'org.paymentauth/credential';
|
|
7
25
|
/** MCP metadata key for payment-required tool results. */
|
package/dist/Method.d.ts
CHANGED
|
@@ -187,7 +187,14 @@ export type CanOfferFn<method extends Method> = (parameters: {
|
|
|
187
187
|
export type OnPaymentSuccessFn<method extends Method> = (parameters: {
|
|
188
188
|
input?: globalThis.Request;
|
|
189
189
|
receipt: DeepReadonly<Receipt.Receipt>;
|
|
190
|
+
/** Canonical payment request included in the challenge. */
|
|
190
191
|
request: DeepReadonly<z.output<method['schema']['request']>>;
|
|
192
|
+
/**
|
|
193
|
+
* Server-side request after defaults and request hooks, before the method
|
|
194
|
+
* request schema's output transforms. Absent during standalone credential
|
|
195
|
+
* verification when no route options are supplied.
|
|
196
|
+
*/
|
|
197
|
+
requestInput?: DeepReadonly<z.input<method['schema']['request']>> | undefined;
|
|
191
198
|
}) => MaybePromise<void>;
|
|
192
199
|
export type ComposableHooks<method extends Method> = {
|
|
193
200
|
/** Decides whether this method's configured offer is available for an HTTP request. */
|