From 88c0e8fee39c7fb733bdec4657d2eaf2c355292e Mon Sep 17 00:00:00 2001 From: Giancarlo Erra Date: Wed, 4 Mar 2026 18:06:36 +0000 Subject: [PATCH] fix: add mcpName and read version dynamically from package.json --- package.json | 1 + src/constants.ts | 8 ++++++++ src/index.ts | 3 ++- src/tools/manage-tools.ts | 4 ++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1169987..c34eb36 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "socraticode", + "mcpName": "io.github.giancarloerra/socraticode", "version": "1.0.0", "description": "SocratiCode — MCP server for local codebase indexing, semantic search, and code dependency graphs. All private, all local via Docker.", "type": "module", diff --git a/src/constants.ts b/src/constants.ts index 07630d2..43a44cc 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,5 +1,13 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Giancarlo Erra - Altaire Limited + +import { createRequire } from "node:module"; + +// ── Package metadata ───────────────────────────────────────────────────── +const esmRequire = createRequire(import.meta.url); +const pkg = esmRequire("../package.json") as { version: string }; +export const SOCRATICODE_VERSION: string = pkg.version; + // ── Embedding configuration ────────────────────────────────────────────── // Embedding model and dimensions are now configured via environment variables. // See src/services/embedding-config.ts for OLLAMA_MODE, OLLAMA_URL, diff --git a/src/index.ts b/src/index.ts index d74f009..d6b96ef 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { z } from "zod"; +import { SOCRATICODE_VERSION } from "./constants.js"; import { logger, setMcpLogSender } from "./services/logger.js"; import { autoResumeIndexedProjects, gracefulShutdown } from "./services/startup.js"; import { handleContextTool } from "./tools/context-tools.js"; @@ -16,7 +17,7 @@ import { handleQueryTool } from "./tools/query-tools.js"; const server = new McpServer( { name: "socraticode", - version: "1.0.0", + version: SOCRATICODE_VERSION, }, { capabilities: { diff --git a/src/tools/manage-tools.ts b/src/tools/manage-tools.ts index 5648424..1f78af7 100644 --- a/src/tools/manage-tools.ts +++ b/src/tools/manage-tools.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright (C) 2026 Giancarlo Erra - Altaire Limited -import { QDRANT_HOST, QDRANT_MODE, QDRANT_PORT, QDRANT_URL } from "../constants.js"; +import { QDRANT_HOST, QDRANT_MODE, QDRANT_PORT, QDRANT_URL, SOCRATICODE_VERSION } from "../constants.js"; import { getArtifactStatusSummary } from "../services/context-artifacts.js"; import { isDockerAvailable, isQdrantImagePresent, isQdrantRunning } from "../services/docker.js"; import { getEmbeddingConfig } from "../services/embedding-config.js"; @@ -235,7 +235,7 @@ export async function handleManageTool( "3. codebase_graph_query to explore dependencies.", "4. codebase_context_search for schemas, API specs, configs.", "", - "v1.0.0 · © 2026 Giancarlo Erra — Altaire Limited · AGPL-3.0", + `v${SOCRATICODE_VERSION} · © 2026 Giancarlo Erra — Altaire Limited · AGPL-3.0`, "https://github.com/giancarloerra/socraticode", ].join("\n"); }