Skip to content

Commit 69fb223

Browse files
Claudeclaude
authored andcommitted
fix: read version from package.json instead of hardcoding 1.0.3
Version was hardcoded in 3 places in server.ts, showing stale v1.0.3 when actual version is 1.1.2. Now reads from package.json at startup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1ce37f9 commit 69fb223

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/server.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
* Tool definitions are in ./tools/definitions.ts
66
*/
77

8+
import { createRequire } from "module";
9+
const require = createRequire(import.meta.url);
10+
const pkg = require("../package.json") as { version: string };
11+
812
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
913
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
1014
import {
@@ -89,7 +93,7 @@ export function createServer(): Server {
8993
const server = new Server(
9094
{
9195
name: "gitmem-mcp",
92-
version: "1.0.3",
96+
version: pkg.version,
9397
},
9498
{
9599
capabilities: {
@@ -309,7 +313,7 @@ export function createServer(): Server {
309313
const cmdLines = visibleCommands.map(c => ` ${c.alias.padEnd(22)} ${c.description}`).join("\n");
310314

311315
const display = [
312-
`gitmem v1.0.3 · ${tier} · ${registeredTools.length} tools · ${hasSupabase() ? "supabase" : "local (.gitmem/)"}`,
316+
`gitmem v${pkg.version} · ${tier} · ${registeredTools.length} tools · ${hasSupabase() ? "supabase" : "local (.gitmem/)"}`,
313317
"Memory that compounds.",
314318
"",
315319
cmdLines,
@@ -322,7 +326,7 @@ export function createServer(): Server {
322326
].join("\n");
323327

324328
result = {
325-
version: "1.0.3",
329+
version: pkg.version,
326330
tier,
327331
tools_registered: registeredTools.length,
328332
storage: hasSupabase() ? "supabase" : "local (.gitmem/)",

0 commit comments

Comments
 (0)