From 94e50c2c628d99eb38c093fcd58425e1b36ac80e Mon Sep 17 00:00:00 2001 From: Guram Sigua Date: Sat, 4 Oct 2025 12:00:16 +0300 Subject: [PATCH 1/2] feat: add configurable HOST binding for Kubernetes deployments - Add HOST environment variable to config.ts with default '127.0.0.1' - Update sse_server.ts to use configurable HOST for HTTP and HTTPS servers - Add HOST to README.md configuration table - Maintains secure localhost default for local development - Allows 0.0.0.0 binding for production/Kubernetes via environment variable --- README.md | 1 + src/config.ts | 3 +++ src/sse_server.ts | 36 ++++++++++++++++++++---------------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index afe8283..98627df 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,7 @@ Available configuration options: | `DISABLED_TOOLS` | Comma-separated list of tools to disable | None | | `ENABLE_SSE` | Enable the HTTP/SSE transport | `false` | | `PORT` | Port for the HTTP server | `3231` | +| `HOST` | Host address for the HTTP server (use `0.0.0.0` for external access) | `127.0.0.1` | | `ENABLE_STDIO` | Enable the STDIO transport | `true` | | `ENABLE_SECURITY_FEATURES` | Enable security headers and logging | `false` | | `ENABLE_HTTPS` | Enable HTTPS/TLS encryption | `false` | diff --git a/src/config.ts b/src/config.ts index a3cb54d..9c8a3f9 100644 --- a/src/config.ts +++ b/src/config.ts @@ -38,6 +38,7 @@ for (let i = 0; i < args.length; i++) { if (key === 'SSE_PORT') envArgs.ssePort = value; if (key === 'ENABLE_STDIO') envArgs.enableStdio = value; if (key === 'PORT') envArgs.port = value; + if (key === 'HOST') envArgs.host = value; i++; } } @@ -80,6 +81,7 @@ interface Config { ssePort: number; enableStdio: boolean; port?: string; + host: string; // Security configuration (opt-in for backwards compatibility) enableSecurityFeatures: boolean; enableOriginValidation: boolean; @@ -133,6 +135,7 @@ const configuration: Config = { ssePort: parseInteger(envArgs.ssePort || process.env.SSE_PORT, 3000), enableStdio: parseBoolean(envArgs.enableStdio || process.env.ENABLE_STDIO, true), port: envArgs.port || process.env.PORT || '3231', + host: envArgs.host || process.env.HOST || '127.0.0.1', // Security configuration (opt-in for backwards compatibility) enableSecurityFeatures: parseBoolean(process.env.ENABLE_SECURITY_FEATURES, false), enableOriginValidation: parseBoolean(process.env.ENABLE_ORIGIN_VALIDATION, false), diff --git a/src/sse_server.ts b/src/sse_server.ts index e3db43d..d740b87 100644 --- a/src/sse_server.ts +++ b/src/sse_server.ts @@ -191,14 +191,16 @@ export function startSSEServer() { // Function to create and start HTTP server function startHttpServer() { const httpServer = http.createServer(app); - httpServer.listen(PORT, '127.0.0.1', () => { + const HOST = configuration.host; + httpServer.listen(PORT, HOST, () => { logger.info('ClickUp MCP Server (HTTP) started', { + host: HOST, port: PORT, protocol: 'http', endpoints: { - streamableHttp: `http://127.0.0.1:${PORT}/mcp`, - legacySSE: `http://127.0.0.1:${PORT}/sse`, - health: `http://127.0.0.1:${PORT}/health` + streamableHttp: `http://${HOST}:${PORT}/mcp`, + legacySSE: `http://${HOST}:${PORT}/sse`, + health: `http://${HOST}:${PORT}/health` }, security: { featuresEnabled: configuration.enableSecurityFeatures, @@ -209,10 +211,10 @@ export function startSSEServer() { } }); - console.log(`✅ ClickUp MCP Server started on http://127.0.0.1:${PORT}`); - console.log(`📡 Streamable HTTP endpoint: http://127.0.0.1:${PORT}/mcp`); - console.log(`🔄 Legacy SSE endpoint: http://127.0.0.1:${PORT}/sse`); - console.log(`❤️ Health check: http://127.0.0.1:${PORT}/health`); + console.log(`✅ ClickUp MCP Server started on http://${HOST}:${PORT}`); + console.log(`📡 Streamable HTTP endpoint: http://${HOST}:${PORT}/mcp`); + console.log(`🔄 Legacy SSE endpoint: http://${HOST}:${PORT}/sse`); + console.log(`❤️ Health check: http://${HOST}:${PORT}/health`); if (configuration.enableHttps) { console.log(`⚠️ HTTP server running alongside HTTPS - consider disabling HTTP in production`); @@ -253,14 +255,16 @@ export function startSSEServer() { } const httpsServer = https.createServer(httpsOptions, app); - httpsServer.listen(HTTPS_PORT, '127.0.0.1', () => { + const HOST = configuration.host; + httpsServer.listen(HTTPS_PORT, HOST, () => { logger.info('ClickUp MCP Server (HTTPS) started', { + host: HOST, port: HTTPS_PORT, protocol: 'https', endpoints: { - streamableHttp: `https://127.0.0.1:${HTTPS_PORT}/mcp`, - legacySSE: `https://127.0.0.1:${HTTPS_PORT}/sse`, - health: `https://127.0.0.1:${HTTPS_PORT}/health` + streamableHttp: `https://${HOST}:${HTTPS_PORT}/mcp`, + legacySSE: `https://${HOST}:${HTTPS_PORT}/sse`, + health: `https://${HOST}:${HTTPS_PORT}/health` }, security: { featuresEnabled: configuration.enableSecurityFeatures, @@ -271,10 +275,10 @@ export function startSSEServer() { } }); - console.log(`🔒 ClickUp MCP Server (HTTPS) started on https://127.0.0.1:${HTTPS_PORT}`); - console.log(`📡 Streamable HTTPS endpoint: https://127.0.0.1:${HTTPS_PORT}/mcp`); - console.log(`🔄 Legacy SSE HTTPS endpoint: https://127.0.0.1:${HTTPS_PORT}/sse`); - console.log(`❤️ Health check HTTPS: https://127.0.0.1:${HTTPS_PORT}/health`); + console.log(`🔒 ClickUp MCP Server (HTTPS) started on https://${HOST}:${HTTPS_PORT}`); + console.log(`📡 Streamable HTTPS endpoint: https://${HOST}:${HTTPS_PORT}/mcp`); + console.log(`🔄 Legacy SSE HTTPS endpoint: https://${HOST}:${HTTPS_PORT}/sse`); + console.log(`❤️ Health check HTTPS: https://${HOST}:${HTTPS_PORT}/health`); }); return httpsServer; } catch (error) { From 6e8f3357eb44dce8ed91c4ef75c2db7dfe9b8cd9 Mon Sep 17 00:00:00 2001 From: Guram Sigua Date: Sat, 4 Oct 2025 12:03:11 +0300 Subject: [PATCH 2/2] docs: add HOST configuration to SSE transport documentation - Add HOST to configuration options table in sse-transport.md - Include example of using HOST=0.0.0.0 for external access - Provides guidance for Docker/Kubernetes deployments --- docs/sse-transport.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/sse-transport.md b/docs/sse-transport.md index 2f611da..aff9794 100644 --- a/docs/sse-transport.md +++ b/docs/sse-transport.md @@ -10,6 +10,7 @@ The Server-Sent Events (SSE) transport for the ClickUp MCP Server enables integr | ------ | ----------- | ------- | | `ENABLE_SSE` | Enable the SSE transport | `false` | | `SSE_PORT` | Port for the SSE server | `3000` | +| `HOST` | Host address for the HTTP server (use `0.0.0.0` for external access) | `127.0.0.1` | | `ENABLE_STDIO` | Enable the STDIO transport | `true` | ## Enabling SSE Transport @@ -20,6 +21,9 @@ You can enable the SSE transport using environment variables: ```bash ENABLE_SSE=true SSE_PORT=3000 npx @taazkareem/clickup-mcp-server + +# For external access (e.g., in Docker/Kubernetes): +ENABLE_SSE=true SSE_PORT=3000 HOST=0.0.0.0 npx @taazkareem/clickup-mcp-server ``` ### Command Line Arguments