From 2cfbe90c26c4370364fca272e6741abc1e90b4ce Mon Sep 17 00:00:00 2001 From: bendtherules Date: Thu, 16 Apr 2026 17:16:53 +0530 Subject: [PATCH] feat(server): add DEFAULT_PORT constant and use it for server port configuration --- src/constants.ts | 3 +++ src/mcp-server-http.ts | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 54b7f41..25d27a9 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -12,3 +12,6 @@ export const EMBEDDING_PROVIDER = process.env.ASK262_EMBEDDING_PROVIDER ?? "ollama"; export const FIREWORKS_EMBEDDING_MODEL = "fireworks/qwen3-embedding-8b"; export const FIREWORKS_BASE_URL = "https://api.fireworks.ai/inference/v1"; + +// Server configuration +export const DEFAULT_PORT = 8081; diff --git a/src/mcp-server-http.ts b/src/mcp-server-http.ts index 83becde..1f99083 100644 --- a/src/mcp-server-http.ts +++ b/src/mcp-server-http.ts @@ -32,7 +32,7 @@ import { sectionContentToolMetadata, sectionContentToolName, } from "./agent-tools/index.js"; -import { STORAGE_DIR as STORAGE_DIR_REL } from "./constants.js"; +import { DEFAULT_PORT, STORAGE_DIR as STORAGE_DIR_REL } from "./constants.js"; import { createEmbeddings } from "./lib/embeddings-factory.js"; // Resolve storage path relative to this script's directory @@ -43,8 +43,8 @@ const STORAGE_DIR = path.resolve(__dirname, "..", STORAGE_DIR_REL); // Initialize embeddings based on ASK262_EMBEDDING_PROVIDER env var const embeddings = createEmbeddings(); -// Server port (default: 8081) -const PORT = Number(process.env.ASK262_PORT) || 8081; +// Server port (uses env var or default from constants) +const PORT = Number(process.env.ASK262_PORT) || DEFAULT_PORT; /** * Factory function to create a fresh MCP server instance.