()
| 167 | |
| 168 | // Mount dashboard routes only if enabled |
| 169 | if (enableDashboard) { |
| 170 | app.use('/dashboard', createDashboardRouter(client)); |
| 171 | } |
| 172 | |
| 173 | return app; |
| 174 | } |
| 175 | |
| 176 | async function startStdioServer() { |
| 177 | const env = getEnvironment(); |
| 178 | const dashboardEnabled = !!(env.DASHBOARD_USERNAME && env.DASHBOARD_PASSWORD); |
| 179 | |
| 180 | if (dashboardEnabled) { |
| 181 | // Start Express server for dashboard |
| 182 | const app = createExpressApp(true); |
| 183 | |
| 184 | // Start HTTP server for dashboard |
| 185 | app.listen(env.PORT, env.MCP_HOST, () => { |
| 186 | logger.info( |
| 187 | null, |
| 188 | `Dashboard server running on HTTP at ${env.MCP_HOST}:${env.PORT}/dashboard` |
| 189 | ); |
| 190 | }); |
| 191 | } |
| 192 | |
| 193 | // Start MCP server on stdio |
| 194 | const server = createMCPServer(); |
| 195 | const transport = new StdioServerTransport(); |
| 196 | |
| 197 | // Error handling |
| 198 | process.on('SIGINT', async () => { |
| 199 | await server.close(); |
| 200 | process.exit(0); |
| 201 | }); |
no test coverage detected