Feat/cep 8 update#44
Conversation
Add support for session-level payment interaction negotiation through the new `payment_interaction` tag, enabling clients to choose between `transparent` (default) and `explicit_gating` semantics for payment-gated invocations.
…gating Restructures the payment flow documentation to clearly distinguish between the default transparent notification-based lifecycle and the explicit gating lifecycle. Adds JSON-RPC error codes (-32042 Payment Required, -32043 Payment Pending) for explicit gating mode, defines authorization identity using RFC 8785 canonicalization, and clarifies that payment processing is a transport concern that MCP handlers may remain unaware of. Removes redundant sections and updates notification field references for consistency.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@ContextVM-org Really like where this is headed, the transparent vs explicit_gating split is clean and it's exactly what's needed for agent-driven payment flows. Just a small point; Step 10 says the server "consumes one authorization atomically" before forwarding to the handler. But what happens if the server successfully consumes the auth, calls the MCP handler, and then the response never makes it back to the client (maybe something like a relay drop)? From the client's perspective, they paid, retried, and got nothing. The authorization is gone. Their only option is to pay again for the same invocation. |
|
@1amKhush, thanks for your feedback. Yes, it effectively works that way. I think network conditions and other possible quirks are out of scope for this PR. I can’t think of an easy way to handle those cases without introducing some out‑of‑band interaction between the client and server, something like a channel for feedback or other communications. Do you have anything else in mind? |
|
@ContextVM-org the transparent vs. explicit_gating split is clean and it's the right shape for agent-driven payments. Two things:
Nit: after the reorg, "Discovery methods" / "Stateless operation" ended up nested under Payment Interaction Negotiation instead of PMI Discovery, looks like they got stranded when "PMI Discovery" was trimmed. Otherwise LGTM. |
@ContextVM-org Yeah fair point, I don't think it needs a full out-of-band channel either. What I had in mind is simpler than that, imo the components are actually already in the spec. The server already computes a canonical invocation identity (client pubkey + JCS hash of method/params) for authorization matching. After it consumes the authorization and gets the result back from the handler, it could just cache If the client retries with the same canonical identity and the server sees no unused authorization but does have a cached result for that identity, it returns the cached result instead of sending back a fresh |
Summary
This PR updates CEP-8 to introduce a new
explicit_gatingpayment lifecycle convention and clarify how it should be used alongside the existing transparent payment flow.Before this change, CEP-8 was centered on the notification-based payment flow. This PR adds a second, opt-in lifecycle for cases where payment requirements need to be surfaced directly to the client as part of the invocation result, instead of being handled transparently by transport or middleware.
What this PR adds
explicit_gatingas a new CEP-8 payment interaction modetransparentas the default and backward-compatible lifecyclepayment_interactiontag-32042Payment Required-32043Payment PendingWhy
The existing CEP-8 text did not clearly separate two different payment interaction models:
This PR makes that distinction explicit and documents the intended behavior of the new lifecycle so implementers can support agent-visible payment gates without ambiguity.
Compatibility
This change is additive:
explicit_gatingis opt-in and only applies when negotiated