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

Function createServerCommand

mcp/cmd_test.go:236–247  ·  view source on GitHub ↗

createServerCommand creates a command to fork and exec the test binary as an MCP server. serverName must refer to an entry in the [serverFuncs] map.

(t *testing.T, serverName string)

Source from the content-addressed store, hash-verified

234//
235// serverName must refer to an entry in the [serverFuncs] map.
236func createServerCommand(t *testing.T, serverName string) *exec.Cmd {
237 t.Helper()
238
239 exe, err := os.Executable()
240 if err != nil {
241 t.Fatal(err)
242 }
243 cmd := exec.Command(exe)
244 cmd.Env = append(os.Environ(), runAsServer+"="+serverName)
245
246 return cmd
247}
248
249func TestCommandTransportTerminateDuration(t *testing.T) {
250 if runtime.GOOS == "windows" {

Callers 3

TestServerInterruptFunction · 0.85
TestCmdTransportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…