MCPcopy Create free account
hub / github.com/coder/coder / newTestMCPServer

Function newTestMCPServer

coderd/x/chatd/mcpclient/mcpclient_test.go:28–36  ·  view source on GitHub ↗

newTestMCPServer creates a streamable HTTP MCP server with the given tools. The caller must close the returned *httptest.Server.

(t *testing.T, tools ...mcpserver.ServerTool)

Source from the content-addressed store, hash-verified

26// newTestMCPServer creates a streamable HTTP MCP server with the
27// given tools. The caller must close the returned *httptest.Server.
28func newTestMCPServer(t *testing.T, tools ...mcpserver.ServerTool) *httptest.Server {
29 t.Helper()
30 srv := mcpserver.NewMCPServer("test-server", "1.0.0")
31 srv.AddTools(tools...)
32 httpSrv := mcpserver.NewStreamableHTTPServer(srv)
33 ts := httptest.NewServer(httpSrv)
34 t.Cleanup(ts.Close)
35 return ts
36}
37
38// echoTool returns a ServerTool that echoes its "input" argument
39// prefixed with "echo: ".

Calls 2

HelperMethod · 0.65
CleanupMethod · 0.65

Tested by

no test coverage detected