internal/mcp: rename LocalTransport->InMemoryTransport, and document
Update the design to mention our in-memory transport, since it is generally useful, and update the implementation to use distinct types for InMemoryTransport and StdIOTransport (the fact that they are both implemented as an io.ReadWriteCloser is an implementation detail). Change-Id: I8228ccf2092a56a730c113c4db105fb492cce112 Reviewed-on: https://go-review.googlesource.com/c/tools/+/672715 Reviewed-by: Sam Thanawalla <samthanawalla@google.com> Commit-Queue: Robert Findley <rfindley@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> TryBot-Bypass: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
ac828d5a82
commit
dbf57af24b
1 changed files with 33 additions and 13 deletions
|
|
@ -283,6 +283,14 @@ func NewStreamableClientTransport(url string) *StreamableClientTransport {
|
|||
func (*StreamableClientTransport) Connect(context.Context) (Stream, error)
|
||||
```
|
||||
|
||||
Finally, we also provide an in-memory transport, for scenarios such as testing,
|
||||
where the MCP client and server are in the same process.
|
||||
|
||||
```go
|
||||
type InMemoryTransport struct { /* ... */ }
|
||||
func NewInMemoryTransport() (*InMemoryTransport, *InMemoryTransport)
|
||||
```
|
||||
|
||||
**Differences from mcp-go**: The Go team has a battle-tested JSON-RPC
|
||||
implementation that we use for gopls, our Go LSP server. We are using the new
|
||||
version of this library as part of our MCP SDK. It handles all JSON-RPC 2.0
|
||||
|
|
|
|||
Loading…
Reference in a new issue