startMCPScriptsHTTPServer starts the mcp-scripts HTTP MCP server
(dir string, port int, verbose bool)
| 91 | |
| 92 | // startMCPScriptsHTTPServer starts the mcp-scripts HTTP MCP server |
| 93 | func 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 |
| 124 | func startMCPScriptsServer(ctx context.Context, mcpScriptsConfig *workflow.MCPScriptsConfig, verbose bool) (*parser.RegistryMCPServerConfig, *exec.Cmd, string, error) { |
no test coverage detected