@@ -323,7 +323,7 @@ Sessions are created from either `Client` or `Server` using the `Connect` method
323323
324324` ` ` go
325325type Client struct { /* ... */ }
326- func NewClient (name, version string , opts *ClientOptions) *Client
326+ func NewClient (impl *Implementation , opts *ClientOptions) *Client
327327func (*Client) Connect (context.Context , Transport) (*ClientSession, error )
328328func (*Client) Sessions () iter.Seq [*ClientSession]
329329// Methods for adding/removing client features are described below.
@@ -338,7 +338,7 @@ func (*ClientSession) Wait() error
338338// For example: ClientSession.ListTools.
339339
340340type Server struct { /* ... */ }
341- func NewServer (name, version string , opts *ServerOptions) *Server
341+ func NewServer (impl *Implementation , opts *ServerOptions) *Server
342342func (*Server) Connect (context.Context , Transport) (*ServerSession, error )
343343func (*Server) Sessions () iter.Seq [*ServerSession]
344344// Methods for adding/removing server features are described below.
@@ -356,7 +356,7 @@ func (*ServerSession) Wait() error
356356Here's an example of these APIs from the client side:
357357
358358` ` ` go
359- client := mcp.NewClient (" mcp-client" , " v1.0.0" , nil )
359+ client := mcp.NewClient (&mcp. Implementation {Name: " mcp-client" , Version: " v1.0.0" } , nil )
360360// Connect to a server over stdin/stdout
361361transport := mcp.NewCommandTransport (exec.Command (" myserver" ))
362362session , err := client.Connect (ctx, transport)
@@ -371,7 +371,7 @@ A server that can handle that client call would look like this:
371371
372372` ` ` go
373373// Create a server with a single tool.
374- server := mcp.NewServer (" greeter" , " v1.0.0" , nil )
374+ server := mcp.NewServer (&mcp. Implementation {Name: " greeter" , Version: " v1.0.0" } , nil )
375375mcp.AddTool (server, &mcp.Tool {Name: " greet" , Description: " say hi" }, SayHi)
376376// Run the server over stdin/stdout, until the client disconnects.
377377if err := server.Run (context.Background (), mcp.NewStdioTransport ()); err != nil {
0 commit comments