Skip to content

fix: remove premature server.initialized from MCP stdio mode (#898)#1581

Open
ousamabenyounes wants to merge 1 commit intoruvnet:mainfrom
ousamabenyounes:fix/issue-898
Open

fix: remove premature server.initialized from MCP stdio mode (#898)#1581
ousamabenyounes wants to merge 1 commit intoruvnet:mainfrom
ousamabenyounes:fix/issue-898

Conversation

@ousamabenyounes
Copy link
Copy Markdown

Summary

Fixes #898

  • Removed the premature server.initialized JSON-RPC notification that was sent to stdout immediately on MCP stdio server startup, before the client's initialize request
  • This violated the MCP protocol and caused Claude Desktop to reject the connection with a Zod validation error
  • The handleMCPMessage method already correctly handles initialize requests reactively — no replacement notification needed

Verification

  • Baseline tests: 1211 pass, 4 pre-existing failures
  • Post-fix tests: 1217 pass (6 new), no regressions
  • New tests: 6 added, all pass
  • Review agent: issue alignment verified

Files changed

File Change
v3/@claude-flow/cli/src/mcp-server.ts Removed premature console.log with server.initialized notification from startStdioServer()
v3/@claude-flow/cli/__tests__/mcp-stdio-protocol.test.ts New: 6 tests verifying MCP stdio protocol compliance

Generated by Claude Code
Vibe coded by ousamabenyounes

…mode (ruvnet#898)

The MCP server sent a server.initialized JSON-RPC notification to stdout
before receiving the client's initialize request, violating the MCP protocol
and breaking Claude Desktop's strict validation.

Generated by Claude Code
Vibe coded by ousamabenyounes

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP server sends server.initialized notification before receiving initialize request

1 participant