MCPcopy Create free account
hub / github.com/chokcoco/iCSS / waitForReady

Method waitForReady

MCP/server.js:132–156  ·  view source on GitHub ↗
(timeout = 10000)

Source from the content-addressed store, hash-verified

130 }
131
132 async waitForReady(timeout = 10000) {
133 debugLog(`⏳ Waiting for server to be ready (timeout: ${timeout}ms)`);
134 const startTime = Date.now();
135
136 while (!this.isReady && !this.dbInitFailed) {
137 if (Date.now() - startTime > timeout) {
138 debugLog('⚠️ Server initialization timeout');
139 throw new McpError(
140 ErrorCode.InternalError,
141 'Server initialization timeout'
142 );
143 }
144 await new Promise(resolve => setTimeout(resolve, 100));
145 }
146
147 if (this.dbInitFailed) {
148 debugLog('❌ Server initialization failed');
149 throw new McpError(
150 ErrorCode.InternalError,
151 'Server initialization failed'
152 );
153 }
154
155 debugLog('✅ Server is ready');
156 }
157
158 setupHandlers() {
159 debugLog('🔗 Setting up request handlers...');

Callers 1

setupHandlersMethod · 0.95

Calls 1

debugLogFunction · 0.70

Tested by

no test coverage detected