mppx 0.9.0 → 0.9.2
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 +18 -0
- package/README.md +7 -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.d.ts +1 -0
- package/dist/cli/cli.js +135 -135
- package/dist/cli/internal.js +2 -2
- package/dist/cli/plugins/evm.js +2 -0
- package/dist/cli/plugins/index.d.ts +1 -0
- package/dist/cli/plugins/index.js +12 -12
- package/dist/cli/plugins/x402.d.ts +3 -0
- package/dist/cli/plugins/x402.js +61 -0
- 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/middlewares/internal/mppx.js +17 -3
- 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 +24 -0
- package/dist/stripe/Methods.js +3 -1
- package/dist/stripe/client/Charge.d.ts +24 -0
- package/dist/stripe/client/Methods.d.ts +24 -0
- package/dist/stripe/internal/constants.d.ts +4 -0
- package/dist/stripe/internal/constants.js +2 -0
- package/dist/stripe/internal/payment-intent.d.ts +16 -0
- package/dist/stripe/internal/payment-intent.js +13 -0
- package/dist/stripe/internal/types.d.ts +4 -0
- package/dist/stripe/server/Charge.d.ts +24 -0
- package/dist/stripe/server/Charge.js +31 -10
- package/dist/stripe/server/Methods.d.ts +6 -0
- package/dist/stripe/server/Methods.js +80 -8
- package/dist/stripe/server/internal/hosted-fee-payer.d.ts +10 -0
- package/dist/stripe/server/internal/hosted-fee-payer.js +54 -0
- package/dist/stripe/server/internal/html.gen.d.ts +1 -1
- package/dist/stripe/server/internal/html.gen.js +1 -1
- package/dist/stripe/server/internal/record-payment.d.ts +3 -1
- package/dist/stripe/server/internal/record-payment.js +33 -5
- 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/account.d.ts +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/internal/remote-fee-payer.d.ts +2 -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/viem/Client.js +1 -0
- package/dist/x402/mcp.js +4 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# mppx
|
|
2
2
|
|
|
3
|
+
## 0.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 14e8b25: Added CLI support for selecting and paying x402 payment challenges.
|
|
8
|
+
- 5cbc5e4: Added request-scoped PaymentIntent customer, receipt email, and Tax calculation options, with fallback recording without rejected optional fields for completed crypto payments.
|
|
9
|
+
- b12e65b: Fixed framework adapters to preserve multi-method intent challenges.
|
|
10
|
+
- f13f800: Added a machine-payment metadata field to every Stripe PaymentIntent created by mppx.
|
|
11
|
+
- 9dd9969: Added opt-in Stripe-hosted Tempo fee sponsorship to `stripe.create()` using the configured Stripe client.
|
|
12
|
+
|
|
13
|
+
## 0.9.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- a33ff0a: Added MACH as a charge currency with stablecoin gas fallback and preserved session recovery.
|
|
18
|
+
- c74d2ce: Added request-scoped PaymentIntent metadata to Stripe machine payment charge handlers, and exposed pre-transform request input to payment-success callbacks.
|
|
19
|
+
- 2735c65: Fixed MCP payment errors to use the specification-defined JSON-RPC codes and retry verification challenges.
|
|
20
|
+
|
|
3
21
|
## 0.9.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -109,6 +109,9 @@ mppx account create
|
|
|
109
109
|
# make request - automatic payment handling, curl-like api
|
|
110
110
|
mppx example.com
|
|
111
111
|
|
|
112
|
+
# pay an x402 offer on a server that advertises both protocols
|
|
113
|
+
mppx example.com --protocol x402
|
|
114
|
+
|
|
112
115
|
# open another session instead of reusing the preferred channel
|
|
113
116
|
mppx example.com --session new
|
|
114
117
|
|
|
@@ -131,6 +134,10 @@ its configured custom escrow in the payment challenge, but the client rejects it
|
|
|
131
134
|
that do not support custom escrows should leave it unset. See the
|
|
132
135
|
[session escrow trust documentation](./src/tempo/session/README.md#escrow-configuration-and-trust).
|
|
133
136
|
|
|
137
|
+
`--protocol auto` is the default: MPP is preferred when available, and x402 is used otherwise.
|
|
138
|
+
Pass `mpp` or `x402` to require one protocol. x402 payments use the same EVM account as EVM
|
|
139
|
+
charges, so `MPPX_PRIVATE_KEY` or a stored account works for both.
|
|
140
|
+
|
|
134
141
|
You can also install globally to use the `mppx` CLI from anywhere:
|
|
135
142
|
|
|
136
143
|
```bash
|
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. */
|
package/dist/cli/cli.d.ts
CHANGED