Skip to content

Fix MCP bridge dropping tool results when servers send notifications#789

Open
pbranchu wants to merge 1 commit intoRightNow-AI:mainfrom
pbranchu:fix/mcp-response-matching
Open

Fix MCP bridge dropping tool results when servers send notifications#789
pbranchu wants to merge 1 commit intoRightNow-AI:mainfrom
pbranchu:fix/mcp-response-matching

Conversation

@pbranchu
Copy link

Summary

Read MCP response lines until finding a JSON-RPC response matching the request ID, instead of assuming the first line is the response.

Problem

When an MCP server sends notifications or log lines on stdout before the tool result, the bridge reads the first line, fails to find a result field, and returns "No result from MCP tools/call". This affects MCP servers like google-workspace-mcp that emit status messages during tool execution.

Fix

Loop reading lines, parsing each as JSON-RPC, and matching by request id. Non-matching responses, notifications, and non-JSON lines are skipped. Respects the existing timeout.

Test plan

  • cargo check passes
  • Tested with google-workspace-mcp (listComments, listGmailMessages)

🤖 Generated with Claude Code

…ions

Read response lines until finding a JSON-RPC response matching the
request ID. Previously, the bridge read one line and assumed it was
the response, causing "No result from MCP tools/call" when MCP
servers send notifications or log lines before the actual result.

Co-Authored-By: Claude Opus 4.6 (1M context) <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.

1 participant