mcp: don't mark the server sesion as initialized prematurely

Update ServerSession so that the session is not marked as initialized
until 'notifications/initialized' is actually received from the client.

Include a new test of this lifecycle strictness.

Fixes #225
This commit is contained in:
Rob Findley 2025-08-07 18:46:23 +00:00 • committed by Robert Findley
commit 5ab63feefa

View file

@ -20,6 +20,7 @@ greet
"clientInfo": { "name": "ExampleClient", "version": "1.0.0" }
}
}
{"jsonrpc":"2.0", "method": "notifications/initialized"}
{ "jsonrpc": "2.0", "id": 2, "method": "tools/list" }
{ "jsonrpc": "2.0", "id": 3, "method": "resources/list" }
{ "jsonrpc": "2.0", "id": 4, "method": "prompts/list" }