-
Notifications
You must be signed in to change notification settings - Fork 205
Add IOTransport for separate reader/writer #376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IOTransport for separate reader/writer #376
Conversation
Enable MCP communication over arbitrary I/O streams beyond stdin/stdout, supporting custom transport implementations.
We have a CommandTransport for communicating with a server started via an In other words: why do you need to start the process separately from connecting the server? |
I have the following case: I run a command in a Docker container using the Docker Go package. Its The reason I launch MCP servers in a Docker container is that my environment already uses Docker, and I prefer using ready-made Docker images instead of installing additional tools like Node.js or Python. |
Understood, I support this change. Could you please file a proposal issue describing your use case (e.g. "Proposal: add IOTransport, a generalized transport over a Reader/Writer"). We need to keep the proposal open for a week for feedback, but can still merge this CL as long as it's not released. |
mcp/transport.go
Outdated
// An IOTransport is a [Transport] that communicates over separate | ||
// io.ReadCloser and io.WriteCloser using newline-delimited JSON. | ||
type IOTransport struct { | ||
reader io.ReadCloser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just make these exported fields, so that the transport is extensible, and remove NewIOTransport.
See also #286
ok, i have created #444, made fields public, and removed the constructor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will let Rob approve.
This commit adds ability to create a mcp.Transport with specific io.ReadCloser and io.WriteCloser.
Ii is needed when you need create an mcp.Client for mcp.Server launched in separate process and you need to communicate with it with it's own stdin/stdout.