We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 32c5766 commit 71d8452Copy full SHA for 71d8452
1 file changed
client/internal/mcp/client.go
@@ -4,6 +4,7 @@ package mcp
4
import (
5
"context"
6
"fmt"
7
+ "io"
8
"os"
9
"os/exec"
10
"path/filepath"
@@ -101,6 +102,15 @@ func (c *Client) connectStdio(ctx context.Context) error {
101
102
if err != nil {
103
return fmt.Errorf("failed to create stdio MCP client: %w", err)
104
}
105
+
106
+ // Drain the server's stderr in a background goroutine to prevent the
107
+ // subprocess from blocking on a full pipe buffer. On Windows the default
108
+ // pipe buffer is ~4 KB; once it fills, any write to stderr blocks the
109
+ // entire Node.js event loop, causing all subsequent tool calls to hang.
110
+ if stderr, ok := mcpclient.GetStderr(client); ok {
111
+ go func() { _, _ = io.Copy(io.Discard, stderr) }()
112
+ }
113
114
c.inner = client
115
c.serverCmd = spawnedCmd
116
0 commit comments