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

Function startMCPScriptsHTTPServer

pkg/cli/mcp_inspect_mcp_scripts_server.go:93–121  ·  view source on GitHub ↗

startMCPScriptsHTTPServer starts the mcp-scripts HTTP MCP server

(dir string, port int, verbose bool)

Source from the content-addressed store, hash-verified

91
92// startMCPScriptsHTTPServer starts the mcp-scripts HTTP MCP server
93func startMCPScriptsHTTPServer(dir string, port int, verbose bool) (*exec.Cmd, error) {
94 mcpInspectLog.Printf("Starting mcp-scripts HTTP server on port %d", port)
95
96 mcpServerPath := filepath.Join(dir, "mcp-server.cjs")
97
98 cmd := exec.Command("node", mcpServerPath)
99 cmd.Dir = dir
100 cmd.Env = append(os.Environ(),
101 fmt.Sprintf("GH_AW_MCP_SCRIPTS_PORT=%d", port),
102 )
103
104 // Capture output for debugging
105 if verbose {
106 cmd.Stdout = os.Stdout
107 cmd.Stderr = os.Stderr
108 }
109
110 if err := cmd.Start(); err != nil {
111 errMsg := fmt.Sprintf("failed to start server: %v", err)
112 fmt.Fprintln(os.Stderr, console.FormatErrorMessage(errMsg))
113 return nil, fmt.Errorf("failed to start server: %w", err)
114 }
115
116 if verbose {
117 fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Started mcp-scripts server (PID: %d)", cmd.Process.Pid)))
118 }
119
120 return cmd, nil
121}
122
123// startMCPScriptsServer starts the mcp-scripts HTTP server and returns the MCP config
124func startMCPScriptsServer(ctx context.Context, mcpScriptsConfig *workflow.MCPScriptsConfig, verbose bool) (*parser.RegistryMCPServerConfig, *exec.Cmd, string, error) {

Callers 1

startMCPScriptsServerFunction · 0.85

Calls 5

FormatErrorMessageFunction · 0.92
FormatInfoMessageFunction · 0.92
PrintfMethod · 0.45
StartMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected