MCPcopy Create free account
hub / github.com/github/gh-aw / configureMCPStdioCommand

Function configureMCPStdioCommand

pkg/parser/mcp.go:541–567  ·  view source on GitHub ↗
(toolName string, mcpConfig map[string]any, config *RegistryMCPServerConfig)

Source from the content-addressed store, hash-verified

539}
540
541func configureMCPStdioCommand(toolName string, mcpConfig map[string]any, config *RegistryMCPServerConfig) error {
542 command, hasCommand := mcpConfig["command"]
543 if !hasCommand {
544 return fmt.Errorf(
545 "stdio MCP tool '%s' must specify either 'command' or 'container' field. Cannot specify both. "+
546 "Example with command:\n"+
547 "mcp-servers:\n"+
548 " %s:\n"+
549 " command: \"npx @my/tool\"\n"+
550 " args: [\"--port\", \"3000\"]\n\n"+
551 "Example with container:\n"+
552 "mcp-servers:\n"+
553 " %s:\n"+
554 " container: \"myorg/my-tool:latest\"\n"+
555 " env:\n"+
556 " API_KEY: \"${{ secrets.API_KEY }}\"",
557 toolName, toolName, toolName,
558 )
559 }
560 commandStr, ok := command.(string)
561 if !ok {
562 return fmt.Errorf("command field must be a string, got %T. Example:\nmcp-servers:\n %s:\n command: \"npx @my/tool\"\n args: [\"--port\", \"3000\"]", command, toolName)
563 }
564 config.Command = commandStr
565 appendBuiltinArgs(config, mcpConfig["args"])
566 return nil
567}
568
569func appendContainerEnv(config *RegistryMCPServerConfig, envValue any) {
570 envMap, ok := envValue.(map[string]any)

Callers 1

parseMCPStdioTypeConfigFunction · 0.85

Calls 2

appendBuiltinArgsFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected