MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / connect

Function connect

mcp/tool_example_test.go:256–263  ·  view source on GitHub ↗
(ctx context.Context, server *mcp.Server)

Source from the content-addressed store, hash-verified

254}
255
256func connect(ctx context.Context, server *mcp.Server) (*mcp.ClientSession, error) {
257 t1, t2 := mcp.NewInMemoryTransports()
258 if _, err := server.Connect(ctx, t1, nil); err != nil {
259 return nil, err
260 }
261 client := mcp.NewClient(&mcp.Implementation{Name: "client", Version: "v0.0.1"}, nil)
262 return client.Connect(ctx, t2, nil)
263}
264
265func jsonPath(s any, path ...string) any {
266 if len(path) == 0 {

Calls 4

ConnectMethod · 0.95
NewInMemoryTransportsFunction · 0.92
NewClientFunction · 0.92
ConnectMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…