Commit e1a0ccf
fix(probe): read initializeParams from DO storage, not transport
The transport-level initializeParams is only populated on the
cold-start handlePostRequest path (agents/mcp index.js:1001). When the
Durable Object evicts and revives between calls, McpAgent.onStart
creates a fresh transport and reinitializeServer replays the
initialize via onmessage — which routes through the SDK Server but
never re-sets transport.initializeParams. Subsequent tool calls then
see undefined, and the code silently falls back to Zod-filtered
getClientCapabilities() (which strips non-standard keys).
Confirmed empirically: \`mcpjam tools call get-mcp-init\` returned
\`protocolVersion: null\` even though the wire-level initialize clearly
sent protocolVersion: "2025-11-25" — because by the time the tool ran,
the transport had already been recycled.
Switch to McpAgent.getInitializeRequest() which reads the full raw
JSON-RPC envelope from ctx.storage; that survives DO revivals.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 61171d5 commit e1a0ccf
1 file changed
Lines changed: 38 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
18 | 40 | | |
19 | 41 | | |
20 | 42 | | |
| |||
127 | 149 | | |
128 | 150 | | |
129 | 151 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
143 | 160 | | |
144 | 161 | | |
145 | 162 | | |
| |||
189 | 206 | | |
190 | 207 | | |
191 | 208 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
206 | 217 | | |
207 | 218 | | |
208 | 219 | | |
| |||
0 commit comments