Skip to content

Commit 231c38c

Browse files
findleyrgopherbot
authored andcommitted
internal/mcp: rename StdIO->Stdio
In CL 682976, Alan Donovan correctly points out that the term in the MCP spec is 'stdio', and therefore the correct capitalization is Stdio. Change-Id: Ib5bbe04f1a61de886298b4d0adc13aefd6aadd9c Reviewed-on: https://go-review.googlesource.com/c/tools/+/683075 Reviewed-by: Alan Donovan <[email protected]> Auto-Submit: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent fcfa492 commit 231c38c

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

gopls/internal/mcp/mcp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func Serve(ctx context.Context, address string, eventChan <-chan lsprpc.SessionE
5454

5555
// StartStdIO starts an MCP server over stdio.
5656
func StartStdIO(ctx context.Context, session *cache.Session) error {
57-
t := mcp.NewLoggingTransport(mcp.NewStdIOTransport(), os.Stderr)
57+
t := mcp.NewLoggingTransport(mcp.NewStdioTransport(), os.Stderr)
5858
s := newServer(session)
5959
return s.Run(ctx, t)
6060
}

internal/mcp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func main() {
110110
server := mcp.NewServer("greeter", "v1.0.0", nil)
111111
server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi))
112112
// Run the server over stdin/stdout, until the client disconnects
113-
if err := server.Run(context.Background(), mcp.NewStdIOTransport()); err != nil {
113+
if err := server.Run(context.Background(), mcp.NewStdioTransport()); err != nil {
114114
log.Fatal(err)
115115
}
116116
}

internal/mcp/cmd_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func runServer() {
3333
server := mcp.NewServer("greeter", "v0.0.1", nil)
3434
server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi))
3535

36-
if err := server.Run(ctx, mcp.NewStdIOTransport()); err != nil {
36+
if err := server.Run(ctx, mcp.NewStdioTransport()); err != nil {
3737
log.Fatal(err)
3838
}
3939
}

internal/mcp/design/design.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ func NewCommandTransport(cmd *exec.Command) *CommandTransport
110110
func (*CommandTransport) Connect(ctx context.Context) (Connection, error) {
111111
```
112112
113-
The `StdIOTransport` is the server side of the stdio transport, and connects by binding to `os.Stdin` and `os.Stdout`.
113+
The `StdioTransport` is the server side of the stdio transport, and connects by binding to `os.Stdin` and `os.Stdout`.
114114
115115
```go
116-
// A StdIOTransport is a [Transport] that communicates using newline-delimited
116+
// A StdioTransport is a [Transport] that communicates using newline-delimited
117117
// JSON over stdin/stdout.
118-
type StdIOTransport struct { /* unexported fields */ }
118+
type StdioTransport struct { /* unexported fields */ }
119119

120-
func NewStdIOTransport() *StdIOTransport
120+
func NewStdioTransport() *StdioTransport
121121

122-
func (t *StdIOTransport) Connect(context.Context) (Connection, error)
122+
func (t *StdioTransport) Connect(context.Context) (Connection, error)
123123
```
124124
125125
#### HTTP transports
@@ -378,7 +378,7 @@ A server that can handle that client call would look like this:
378378
server := mcp.NewServer("greeter", "v1.0.0", nil)
379379
server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi))
380380
// Run the server over stdin/stdout, until the client disconnects.
381-
transport := mcp.NewStdIOTransport()
381+
transport := mcp.NewStdioTransport()
382382
session, err := server.Connect(ctx, transport)
383383
...
384384
return session.Wait()

internal/mcp/examples/hello/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func main() {
6868
log.Printf("MCP handler listening at %s", *httpAddr)
6969
http.ListenAndServe(*httpAddr, handler)
7070
} else {
71-
t := mcp.NewLoggingTransport(mcp.NewStdIOTransport(), os.Stderr)
71+
t := mcp.NewLoggingTransport(mcp.NewStdioTransport(), os.Stderr)
7272
if err := server.Run(context.Background(), t); err != nil {
7373
log.Printf("Server failed: %v", err)
7474
}

internal/mcp/internal/readme/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func main() {
2727
server := mcp.NewServer("greeter", "v1.0.0", nil)
2828
server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi))
2929
// Run the server over stdin/stdout, until the client disconnects
30-
if err := server.Run(context.Background(), mcp.NewStdIOTransport()); err != nil {
30+
if err := server.Run(context.Background(), mcp.NewStdioTransport()); err != nil {
3131
log.Fatal(err)
3232
}
3333
}

internal/mcp/mcp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
//
2727
// A [Transport] connects a bidirectional [Connection] of jsonrpc2 messages. In
2828
// practice, transports in the MCP spec are are either client transports or
29-
// server transports. For example, the [StdIOTransport] is a server transport
29+
// server transports. For example, the [StdioTransport] is a server transport
3030
// that communicates over stdin/stdout, and its counterpart is a
3131
// [CommandTransport] that communicates with a subprocess over its
3232
// stdin/stdout.

internal/mcp/transport.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ type Connection interface {
5252
Close() error // may be called concurrently by both peers
5353
}
5454

55-
// A StdIOTransport is a [Transport] that communicates over stdin/stdout using
55+
// A StdioTransport is a [Transport] that communicates over stdin/stdout using
5656
// newline-delimited JSON.
57-
type StdIOTransport struct {
57+
type StdioTransport struct {
5858
ioTransport
5959
}
6060

@@ -68,10 +68,10 @@ func (t *ioTransport) Connect(context.Context) (Connection, error) {
6868
return newIOConn(t.rwc), nil
6969
}
7070

71-
// NewStdIOTransport constructs a transport that communicates over
71+
// NewStdioTransport constructs a transport that communicates over
7272
// stdin/stdout.
73-
func NewStdIOTransport() *StdIOTransport {
74-
return &StdIOTransport{ioTransport{rwc{os.Stdin, os.Stdout}}}
73+
func NewStdioTransport() *StdioTransport {
74+
return &StdioTransport{ioTransport{rwc{os.Stdin, os.Stdout}}}
7575
}
7676

7777
// An InMemoryTransport is a [Transport] that communicates over an in-memory

0 commit comments

Comments
 (0)