Skip to content

Server initialization fails with VS Code: rejects logging/setLevel request before initialized notification #704

@samuel-bustamante

Description

@samuel-bustamante

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:

  1. Create an MCP server using rmcp with stdio transport
  2. Configure the server in VS Code's mcp.json file
  3. Attempt to connect to the server from VS Code
  4. 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:

  1. Client sends initialize request
  2. Server sends initialize response
  3. Client MAY send logging/setLevel request (should be accepted)
  4. Client sends initialized notification
  5. 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 initialized before other requests)
  • Fails: VS Code (sends logging/setLevel before initialized)
  • Transport: stdio

The MCP specification states:

"The server SHOULD NOT send requests other than pings and logging before receiving the initialized notification."

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions