MCPcopy
hub / github.com/garrytan/gstack / isServerHealthy

Function isServerHealthy

browse/src/cli.ts:124–135  ·  view source on GitHub ↗
(port: number)

Source from the content-addressed store, hash-verified

122 * Used in all polling loops instead of isProcessAlive() (which is slow on Windows).
123 */
124export async function isServerHealthy(port: number): Promise<boolean> {
125 try {
126 const resp = await fetch(`http://127.0.0.1:${port}/health`, {
127 signal: AbortSignal.timeout(2000),
128 });
129 if (!resp.ok) return false;
130 const health = await resp.json() as any;
131 return health.status === 'healthy';
132 } catch {
133 return false;
134 }
135}
136
137// ─── Process Management ─────────────────────────────────────────
138async function killServer(pid: number): Promise<void> {

Callers 5

config.test.tsFile · 0.85
probeHealthWithBackoffFunction · 0.85
startServerFunction · 0.85
ensureServerFunction · 0.85
mainFunction · 0.85

Calls 1

fetchFunction · 0.70

Tested by

no test coverage detected