Repository navigation
fix(mcp): read server version from package.json, rename to lens-mcp-server - #540
Conversation
|
Merged. Real bug worth fixing: the server advertised Two fixes while merging. 1. It didn't compile. The version read used I ran The interesting part: your own new test in this PR already used const pkg = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'))So the source file was the odd one out. I switched it to Worth running 2. The read is now non-fatal. It executes at module load, so an unreadable or unparseable Merge note: Also: this PR names no issue, which is correct — it's a chore, and I'd rather have it as one than see it bundled into something else. Verified on the merge result: |
Summary
Closes #420
The MCP server was advertising
version: '1.0.0'(hard-coded) andname: 'bazaar-mcp-server'regardless of the actual package version or project name.Changes
package.jsonat module load time usingreadFileSync+fileURLToPath(works for bothts-node/tsxand compileddist/).SERVER_VERSION(sourced frompackage.json) andSERVER_NAME('lens-mcp-server').Serverconstructor with those constants.Client-affecting rename:
bazaar-mcp-server→lens-mcp-server. Any MCP client that identified the server by name must be updated.Tests
BazaarMcpServer — server identitydescribe block intests/mcp.test.ts.advertises the version from package.json— assertsSERVER_VERSION === pkg.versionread fresh from the file system, proving it can never drift.uses the canonical server name lens-mcp-server— guards the rename against accidental revert.npx vitest run tests/mcp.test.ts).