You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: document progressToken usage in transport features
Adds documentation explaining how the MCP request progressToken enables request-scoped transport features (CEP-22 oversized transfer and CEP-41 open streams). Covers high-level SDK automatic token creation versus low-level manual request requirements, and recommends resetTimeoutOnProgress for long-running requests.
Copy file name to clipboardExpand all lines: src/content/docs/ts-sdk/transports/nostr-client-transport.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,6 +117,17 @@ This keeps the active relay set minimal and avoids automatically merging every p
117
117
- If the message is a **response** (correlated by the original event ID), it is passed to the MCP client to resolve the pending request.
118
118
- If the message is a **notification**, it is emitted through the `onmessage` handler.
119
119
120
+
## Progress Tokens and Request-Scoped Transport Features
121
+
122
+
Some transport features are activated per request, not just per transport instance.
123
+
124
+
-[Oversized Transfer](/ts-sdk/transports/oversized-transfer) uses the MCP request `progressToken` as the CEP-22 transfer identifier.
125
+
-[Open Stream](/ts-sdk/transports/open-stream) uses the MCP request `progressToken` as the CEP-41 stream identifier.
126
+
127
+
When you use the MCP TypeScript SDK through high-level request APIs and provide an `onprogress` callback, the SDK usually creates that token automatically. When you construct raw requests manually, you must provide the token yourself if you want request-scoped progress-based transport features to activate.
128
+
129
+
For requests that may receive progress notifications over a longer period, `resetTimeoutOnProgress: true` is the recommended client-side setting. On the MCP TypeScript SDK low-level `client.request()` path, that timeout-reset behavior is effective when `onprogress` is also provided.
130
+
120
131
## Server Discovery and Relay Selection
121
132
122
133
The client transport accepts a known [`serverPubkey`](contextvm-docs/src/content/docs/ts-sdk/transports/nostr-client-transport.md:28) in multiple forms and can now resolve operational relays automatically when needed.
Copy file name to clipboardExpand all lines: src/content/docs/ts-sdk/transports/open-stream.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,6 +116,8 @@ If your application already has its own request correlation or tracing scheme, y
116
116
117
117
This is why the helper is usually preferable to assembling the request metadata and session correlation manually.
118
118
119
+
For consistency with other progress-based transport features such as [Oversized Transfer](/ts-sdk/transports/oversized-transfer), remember that high-level MCP TypeScript SDK usage can usually create the request `progressToken` automatically when `onprogress` is used, while low-level manual requests must provide that token explicitly. On the MCP TypeScript SDK low-level `client.request()` path, `resetTimeoutOnProgress: true` also depends on `onprogress` being provided.
120
+
119
121
## Enabling Open Stream on Transports
120
122
121
123
To use CEP-41 across the Nostr transports, enable `openStream` on both the server and the client transport.
Copy file name to clipboardExpand all lines: src/content/docs/ts-sdk/transports/oversized-transfer.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,66 @@ With defaults:
22
22
23
23
This means most consumers do not need to configure anything unless they want stricter limits or different relay-size margins.
24
24
25
+
## Request Activation and `progressToken`
26
+
27
+
CEP-22 oversized transfer is request-scoped. It is only available for a logical exchange when the originating MCP request includes a `progressToken`, as described in [CEP-22: Oversized Payload Transfer](/spec/ceps/cep-22).
28
+
29
+
In practice, this matters most on the client side:
30
+
31
+
- if you use the MCP TypeScript SDK in the normal high-level way and provide an `onprogress` callback, the SDK assigns the `progressToken` automatically
32
+
- if you build raw JSON-RPC requests manually or bypass the usual MCP client helpers, you must ensure a `progressToken` is present yourself
33
+
- when no `progressToken` is present, oversized transfer cannot activate for that request, so the exchange falls back to ordinary non-fragmented behavior
34
+
35
+
For the MCP TypeScript SDK's low-level `client.request()` path specifically, `resetTimeoutOnProgress: true` only works when an `onprogress` callback is provided. In that code path the SDK registers the progress handler and manages the request `progressToken` automatically.
36
+
37
+
This is why oversized transfer usually works transparently for normal MCP client calls, but low-level transport integrations must still understand the request-level activation rule.
38
+
39
+
### Recommended MCP client usage
40
+
41
+
When you expect a request may run for a while or may trigger CEP-22 fragmentation, prefer enabling progress handling explicitly:
- the MCP TypeScript SDK creates the `progressToken` automatically
65
+
- the application receives ordinary MCP progress updates when they are emitted
66
+
- ContextVM transports can also use the same MCP progress channel for CEP-22 transfer frames
67
+
68
+
### Why `resetTimeoutOnProgress: true` is strongly recommended
69
+
70
+
CEP-22 frames are carried over MCP `notifications/progress`. That means a valid oversized transfer is itself ongoing request activity, not idle time.
71
+
72
+
Setting `resetTimeoutOnProgress: true` is therefore strongly recommended because it allows each valid progress notification to extend the request timeout window. Without that, a client may time out a healthy oversized transfer simply because the response is arriving as multiple progress-framed transfer messages before the final JSON-RPC result.
73
+
74
+
When using the MCP TypeScript SDK, remember that this timeout-reset behavior is tied to `onprogress`. In practice, use both together.
75
+
76
+
### Low-level transport usage
77
+
78
+
If you are working below the usual MCP client helpers, such as constructing raw requests for [`NostrClientTransport`](/ts-sdk/transports/nostr-client-transport), treat `progressToken` as part of the activation contract for CEP-22.
79
+
80
+
- High-level MCP SDK usage with `onprogress` usually handles this automatically.
81
+
- Manual raw requests must include the token explicitly in request metadata.
82
+
- If you omit it, the transport cannot correlate an oversized transfer session for that exchange.
83
+
- For low-level MCP TS SDK `client.request()` calls, `resetTimeoutOnProgress: true` should be paired with `onprogress`; providing your own raw token alone does not enable the SDK-managed timeout reset path.
84
+
25
85
## When You Would Change It
26
86
27
87
Most projects should keep the default behavior.
@@ -110,6 +170,8 @@ If an oversized transfer fails, the transport may surface one of these errors:
110
170
111
171
- Leave oversized transfer enabled unless you have a specific reason not to.
112
172
- Keep defaults unless you know your relay environment needs different thresholds.
173
+
- Prefer high-level MCP client calls with `onprogress` so the SDK can assign a `progressToken` automatically.
174
+
- Set `resetTimeoutOnProgress: true` for requests that may emit progress or trigger CEP-22 oversized transfer.
113
175
- Tighten `policy` values if you operate in a more adversarial or resource-constrained environment.
114
176
- Refer to [CEP-22: Oversized Payload Transfer](/spec/ceps/cep-22) for protocol-level behavior.
0 commit comments