feat(server): wire HTTP transport into CLI, add docker-compose.server.yml, and update docs

This commit is contained in:
Lucas Winther committed 2026-09-07 00:14:49 +02:00
1 parent ec85bf811b
commit d0dc27b2e3
7 files changed
+257 -20

No files matched your search

+38 -13
View File
@@ -5,27 +5,51 @@
import { parseConfig } from "./config";
import { createServer } from "./server";
import { startHttpServer } from "./http-server";
async function main(): Promise<void> {
try {
const config = parseConfig(process.env, process.argv);
const mcpServer = createServer(config);
// Bind graceful termination
let isShuttingDown = false;
const shutdown = async () => {
if (isShuttingDown) return;
isShuttingDown = true;
console.error("\n[openproject-mcp] Received termination signal, shutting down...");
await mcpServer.stop();
process.exit(0);
};
process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);
if (config.port !== undefined) {
console.error(
`[openproject-mcp] Starting hosted HTTP server on ${config.host || "0.0.0.0"}:${config.port}...`
);
const httpServer = await startHttpServer(config);
// Start server over stdio transport
await mcpServer.start();
const shutdown = async () => {
if (isShuttingDown) return;
isShuttingDown = true;
console.error(
"\n[openproject-mcp] Received termination signal, shutting down HTTP server..."
);
await httpServer.stop();
process.exit(0);
};
process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);
} else {
const mcpServer = createServer(config);
const shutdown = async () => {
if (isShuttingDown) return;
isShuttingDown = true;
console.error(
"\n[openproject-mcp] Received termination signal, shutting down..."
);
await mcpServer.stop();
process.exit(0);
};
process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);
// Start server over stdio transport
await mcpServer.start();
}
} catch (error) {
console.error(
"[openproject-mcp] Fatal startup error:",
@@ -42,4 +66,5 @@ if (import.meta.main) {
export { createServer } from "./server";
export { SERVER_NAME, SERVER_VERSION } from "./server";
export { startHttpServer, type HttpServerInstance } from "./http-server";