diff --git a/README.md b/README.md index b2ef73d..0055376 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ func main() { server := mcp.NewServer("greeter", "v1.0.0", nil) server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi)) // Run the server over stdin/stdout, until the client disconnects - if err := server.Run(context.Background(), mcp.NewStdIOTransport()); err != nil { + if err := server.Run(context.Background(), mcp.NewStdioTransport()); err != nil { log.Fatal(err) } } diff --git a/design/design.md b/design/design.md index 4b39e10..66338b7 100644 --- a/design/design.md +++ b/design/design.md @@ -110,16 +110,16 @@ func NewCommandTransport(cmd *exec.Command) *CommandTransport func (*CommandTransport) Connect(ctx context.Context) (Connection, error) { ``` -The `StdIOTransport` is the server side of the stdio transport, and connects by binding to `os.Stdin` and `os.Stdout`. +The `StdioTransport` is the server side of the stdio transport, and connects by binding to `os.Stdin` and `os.Stdout`. ```go -// A StdIOTransport is a [Transport] that communicates using newline-delimited +// A StdioTransport is a [Transport] that communicates using newline-delimited // JSON over stdin/stdout. -type StdIOTransport struct { /* unexported fields */ } +type StdioTransport struct { /* unexported fields */ } -func NewStdIOTransport() *StdIOTransport +func NewStdioTransport() *StdioTransport -func (t *StdIOTransport) Connect(context.Context) (Connection, error) +func (t *StdioTransport) Connect(context.Context) (Connection, error) ``` #### HTTP transports @@ -378,7 +378,7 @@ A server that can handle that client call would look like this: server := mcp.NewServer("greeter", "v1.0.0", nil) server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi)) // Run the server over stdin/stdout, until the client disconnects. -transport := mcp.NewStdIOTransport() +transport := mcp.NewStdioTransport() session, err := server.Connect(ctx, transport) ... return session.Wait() diff --git a/examples/hello/main.go b/examples/hello/main.go index 86bb143..2e8c2d9 100644 --- a/examples/hello/main.go +++ b/examples/hello/main.go @@ -68,7 +68,7 @@ func main() { log.Printf("MCP handler listening at %s", *httpAddr) http.ListenAndServe(*httpAddr, handler) } else { - t := mcp.NewLoggingTransport(mcp.NewStdIOTransport(), os.Stderr) + t := mcp.NewLoggingTransport(mcp.NewStdioTransport(), os.Stderr) if err := server.Run(context.Background(), t); err != nil { log.Printf("Server failed: %v", err) } diff --git a/internal/readme/server/server.go b/internal/readme/server/server.go index 4c7cdd4..7d5b6ea 100644 --- a/internal/readme/server/server.go +++ b/internal/readme/server/server.go @@ -27,7 +27,7 @@ func main() { server := mcp.NewServer("greeter", "v1.0.0", nil) server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi)) // Run the server over stdin/stdout, until the client disconnects - if err := server.Run(context.Background(), mcp.NewStdIOTransport()); err != nil { + if err := server.Run(context.Background(), mcp.NewStdioTransport()); err != nil { log.Fatal(err) } } diff --git a/mcp/cmd_test.go b/mcp/cmd_test.go index 7ff1573..69f67a5 100644 --- a/mcp/cmd_test.go +++ b/mcp/cmd_test.go @@ -33,7 +33,7 @@ func runServer() { server := mcp.NewServer("greeter", "v0.0.1", nil) server.AddTools(mcp.NewServerTool("greet", "say hi", SayHi)) - if err := server.Run(ctx, mcp.NewStdIOTransport()); err != nil { + if err := server.Run(ctx, mcp.NewStdioTransport()); err != nil { log.Fatal(err) } } diff --git a/mcp/mcp.go b/mcp/mcp.go index 91f1487..1a0cf13 100644 --- a/mcp/mcp.go +++ b/mcp/mcp.go @@ -26,7 +26,7 @@ // // A [Transport] connects a bidirectional [Connection] of jsonrpc2 messages. In // practice, transports in the MCP spec are are either client transports or -// server transports. For example, the [StdIOTransport] is a server transport +// server transports. For example, the [StdioTransport] is a server transport // that communicates over stdin/stdout, and its counterpart is a // [CommandTransport] that communicates with a subprocess over its // stdin/stdout. diff --git a/mcp/transport.go b/mcp/transport.go index dafd1e7..8498eb3 100644 --- a/mcp/transport.go +++ b/mcp/transport.go @@ -52,9 +52,9 @@ type Connection interface { Close() error // may be called concurrently by both peers } -// A StdIOTransport is a [Transport] that communicates over stdin/stdout using +// A StdioTransport is a [Transport] that communicates over stdin/stdout using // newline-delimited JSON. -type StdIOTransport struct { +type StdioTransport struct { ioTransport } @@ -68,10 +68,10 @@ func (t *ioTransport) Connect(context.Context) (Connection, error) { return newIOConn(t.rwc), nil } -// NewStdIOTransport constructs a transport that communicates over +// NewStdioTransport constructs a transport that communicates over // stdin/stdout. -func NewStdIOTransport() *StdIOTransport { - return &StdIOTransport{ioTransport{rwc{os.Stdin, os.Stdout}}} +func NewStdioTransport() *StdioTransport { + return &StdioTransport{ioTransport{rwc{os.Stdin, os.Stdout}}} } // An InMemoryTransport is a [Transport] that communicates over an in-memory