-
Notifications
You must be signed in to change notification settings - Fork 469
Description
Describe the bug
The rmcp server fails to initialize when used with VS Code's MCP client because it strictly requires the initialized notification immediately after the initialize response, rejecting any other messages including logging/setLevel requests. This prevents the server from working with VS Code while it works correctly with Claude Desktop.
To Reproduce
Steps to reproduce the behavior:
- Create an MCP server using rmcp with stdio transport
- Configure the server in VS Code's mcp.json file
- Attempt to connect to the server from VS Code
- Observe the initialization failure with error: "expect initialized notification, but received: Some(Request(...SetLevelRequest...))"
Expected behavior
The server should accept logging/setLevel requests during the initialization phase (after initialize response but before initialized notification). According to the MCP specification, the server is allowed to send logging messages before receiving initialized, which implies it should also be able to receive logging-related requests during this phase.
The initialization sequence should work as follows:
- Client sends
initializerequest - Server sends
initializeresponse - Client MAY send
logging/setLevelrequest (should be accepted) - Client sends
initializednotification - Normal operations begin
Logs
2026-02-27 07:18:51.764 [warning] [server stderr] ERROR rudof_mcp\src\server\stdio_server.rs:31: Failed to initialize stdio transport: expect initialized notification, but received: Some(Request(JsonRpcRequest { jsonrpc: JsonRpcVersion2_0, id: Number(2), request: SetLevelRequest(Request { method: SetLevelRequestMethod, params: SetLevelRequestParams { meta: None, level: Info }, extensions: Extensions }) }))
2026-02-27 07:18:51.765 [warning] [server stderr] Error: expect initialized notification, but received: Some(Request(JsonRpcRequest { jsonrpc: JsonRpcVersion2_0, id: Number(2), request: SetLevelRequest(Request { method: SetLevelRequestMethod, params: SetLevelRequestParams { meta: None, level: Info }, extensions: Extensions }) }))
2026-02-27 07:18:51.771 [info] Connection state: Error Process exited with code 1
Additional context
- Works correctly: Claude Desktop (sends
initializedbefore other requests) - Fails: VS Code (sends
logging/setLevelbeforeinitialized) - Transport: stdio
The MCP specification states:
"The server SHOULD NOT send requests other than pings and logging before receiving the
initializednotification."
This suggests that logging is a special category that can be communicated during initialization. The current implementation is too strict and limits interoperability with MCP clients that configure logging early in the connection handshake.