fix(mcp): add titleFixWriter for Windsurf stdio compatibility#104
fix(mcp): add titleFixWriter for Windsurf stdio compatibility#104yoanbernabeu merged 1 commit intoyoanbernabeu:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #104 +/- ##
==========================================
+ Coverage 27.16% 32.36% +5.20%
==========================================
Files 32 40 +8
Lines 3711 6303 +2592
==========================================
+ Hits 1008 2040 +1032
- Misses 2620 4094 +1474
- Partials 83 169 +86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @cmdaltctr, thanks for this contribution! The PR currently has merge conflicts with Everything else looks good — CI is green (only |
Replace server.ServeStdio with a custom titleFixWriter that wraps stdout to fix three issues with Windsurf MCP integration: 1. Missing newline after JSON-RPC responses (causes client to hang) 2. Move tool title from annotations to root level (Windsurf expects it there) 3. Add $schema to inputSchema (required by Windsurf for tool discovery)
f94acf6 to
2073bc7
Compare
|
Hi @yoanbernabeu, thanks for the review! I've rebased onto the latest The global-mode fallback logic I originally included in What remains is a single focused change: replacing |
This PR adds a
titleFixWriterthat wraps stdout in the MCP server to fix three issues with Windsurf (and potentially other IDE) integration:server.ServeStdiowrites JSON without a trailing newline. Clients relying on line-delimited JSON-RPC (like Windsurf) hang waiting for the message to complete.titleat the tool root level, butmcp-goplaces it insideannotations. The writer moves it to the correct location.$schemaininputSchema— Windsurf requires$schemafor tool discovery. The writer injects it if absent.Changes from previous version
This PR was previously scoped to also include a global-mode fallback for
mcp-serve. That has been dropped since the upstream--workspaceflag (#100) andresolveMCPTargetprovide a better solution. This PR now focuses solely on thetitleFixWriterfix inmcp/server.go.