Skip to content

fix(mcp): read version from package.json instead of hardcoding#431

Open
fxstein wants to merge 1 commit intotobi:mainfrom
fxstein:fix/mcp-server-version
Open

fix(mcp): read version from package.json instead of hardcoding#431
fxstein wants to merge 1 commit intotobi:mainfrom
fxstein:fix/mcp-server-version

Conversation

@fxstein
Copy link
Copy Markdown

@fxstein fxstein commented Mar 18, 2026

Problem

The MCP server reports version: "0.9.9" in its initialize handshake regardless of the actual installed version. The value is hardcoded in src/mcp/server.ts and was never updated across the 1.x and 2.x release trains:

const server = new McpServer(
  { name: "qmd", version: "0.9.9" },  // hardcoded
);

Any tooling or agent that reads serverInfo.version from the MCP handshake gets a stale value.

Fix

Read version from package.json at startup via a getPackageVersion() helper. Falls back to "unknown" if the file can't be read. Path resolution accounts for the compiled output location (dist/mcp/server.js../../package.json).

Testing

Built and tested locally. MCP initialize response now returns the correct version from package.json:

Before After
serverInfo.version 0.9.9 2.0.1

Verified via a benchmark script that connects directly to the MCP HTTP transport and reads the initialize response.

Environment

  • QMD: v2.0.1
  • Platform: macOS (Apple Silicon)
  • Node: v24.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant