Add IOTransport for separate reader/writer#376
Add IOTransport for separate reader/writer#376findleyr merged 5 commits intomodelcontextprotocol:mainfrom
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.
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 |
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.