(timeout = 10000)
| 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...'); |
no test coverage detected