Commit de7c087
fix: mark client initialized after initialize handshake
Many real-world MCP clients (Claude Code, Gemini/Antigravity)
complete the initialize handshake and immediately call tools/list or
tools/call without sending the notifications/initialized notification.
Currently, initialized is only set to true in
handleNotificationInitialized(), so these clients get permanently
locked out with "Client session not initialized" errors.
This change marks the session as initialized right after a successful
initialize response. If a client still sends notifications/initialized,
handleNotificationInitialized() sets the flag again — a harmless no-op.
Discovered while running a production MCP server (Cohete blog) that
serves Claude Code and other MCP clients over SSE transport.1 parent d2c5833 commit de7c087
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
| |||
0 commit comments