22 lines
827 B
TypeScript
22 lines
827 B
TypeScript
import { createServer } from "node:http";
|
|
|
|
import { loadMcpRuntimeConfig } from "./config.js";
|
|
import { hardenMcpHttpServer } from "./http-server.js";
|
|
import { mcpLogger } from "./logger.js";
|
|
import { createMcpRequestHandler } from "./request-handler.js";
|
|
import { assertRlsRuntimeReady } from "@hivegrid/db/rls-runtime-readiness.server";
|
|
|
|
const config = loadMcpRuntimeConfig();
|
|
const rlsReadiness = await assertRlsRuntimeReady();
|
|
if (!rlsReadiness.ready) {
|
|
mcpLogger.warn({ diagnostics: rlsReadiness.diagnostics }, "RLS runtime is running in audit mode with failed checks");
|
|
}
|
|
|
|
const server = hardenMcpHttpServer(
|
|
createServer(createMcpRequestHandler(config)),
|
|
);
|
|
|
|
server.listen(config.listen.port, config.listen.host, () => {
|
|
mcpLogger.info({ port: config.listen.port, host: config.listen.host }, "MCP listening");
|
|
});
|