Repository navigation
Description
Description
src/client/kosli-client.ts:93 sends a bare User-Agent: kosli-mcp-server with every API request. Adding the version — kosli-mcp-server/0.5.0 — would let the Kosli backend tell versions apart: which releases are actually in use, whether a regression correlates with a version, and how quickly users pick up new releases.
There is already a version string, and it is wrong
src/index.ts:17 registers the MCP server as:
const server = new McpServer({
name: "kosli",
version: "0.1.0",
});The package is at 0.5.0. Every MCP client has been told this server is 0.1.0 since shortly after the first release. So this isn't only about adding a version to one header — it's about having one place the version comes from, because the copy we already have has silently rotted.
Two constraints that rule out the obvious approaches
1. Reading package.json at runtime breaks the .mcpb bundle.
scripts/pack-mcpb.sh:31 copies package.json into the staging dir so npm install --omit=dev can run, then line 34 deletes it before zipping. So readFileSync(new URL("../package.json", import.meta.url)) works under npx and throws for every Claude Desktop bundle user.
2. Importing ../package.json breaks the compiler layout.
tsconfig.json sets rootDir: "src", so a JSON import from outside src/ moves the outDir layout and dist/index.js is no longer where bin expects it — even though resolveJsonModule is on.
Proposal
Add src/version.ts exporting a single VERSION constant, consumed by both kosli-client.ts and index.ts. Guard it with a test that reads package.json and asserts they match — tests run from the repo root, so the test can do what the shipped code can't. Drift then fails CI instead of shipping.
Alternative worth considering: generate src/version.ts during npm run build from package.json. No manual step, but it adds a generated file to the build and a stale copy in a fresh checkout before the first build.
Either way, CLAUDE.md's Releasing section should list the version bump as touching package.json and this constant together.
Tasks
- Add
src/version.tswith a singleVERSIONconstant - Use it in the
User-Agentheader inKosliClient - Use it in the
McpServerregistration, replacing the stale0.1.0 - Add a test asserting it matches
package.json - Update the two existing
User-Agentassertions intest/client/kosli-client.test.ts(lines 106, 217) - Note the coupling in
CLAUDE.md's Releasing section
Activity