-
Notifications
You must be signed in to change notification settings - Fork 704
Open
Description
Description
mcp-go would panic for stdio tools if the tool outputs a really long line
Code Sample
// Minimum code snippet to reproduce the issue
// Remove if not applicable
Logs or Error Messages
I got this panic stack
panic: runtime error: slice bounds out of range [:8192] with capacity 4096
goroutine 38 [running]:
bufio.(*Reader).ReadSlice(0x1400028c300, 0xa)
/opt/homebrew/Cellar/go/1.24.4/libexec/src/bufio/bufio.go:355 +0x34c
bufio.(*Reader).collectFragments(0x1400028c300, 0xa)
/opt/homebrew/Cellar/go/1.24.4/libexec/src/bufio/bufio.go:455 +0x6c
bufio.(*Reader).ReadString(0x1400028c300, 0xa)
/opt/homebrew/Cellar/go/1.24.4/libexec/src/bufio/bufio.go:502 +0x50
github.com/mark3labs/mcp-go/client/transport.(*Stdio).readResponses(0x1400040c0c0)
/Users/izzy/go/pkg/mod/github.com/mark3labs/[email protected]/client/transport/stdio.go:170 +0x7c
github.com/mark3labs/mcp-go/client/transport.(*Stdio).Start.func1()
/Users/izzy/go/pkg/mod/github.com/mark3labs/[email protected]/client/transport/stdio.go:79 +0x38
created by github.com/mark3labs/mcp-go/client/transport.(*Stdio).Start in goroutine 1
/Users/izzy/go/pkg/mod/github.com/mark3labs/[email protected]/client/transport/stdio.go:77 +0x104
panic: runtime error: slice bounds out of range [:8192] with capacity 4096```
## Environment
- Go version (see `go.mod`): go 1.24.3
- mcp-go version (see `go.mod`): 0.32.0
## Possible Solution
Perhaps don't use bufio.Reader as stdin
Metadata
Metadata
Assignees
Labels
No labels