Skip to content

fix(memory): read serverInfo.version from package.json#4407

Open
syf2211 wants to merge 1 commit into
modelcontextprotocol:mainfrom
syf2211:fix/4406-memory-server-version-from-package-json
Open

fix(memory): read serverInfo.version from package.json#4407
syf2211 wants to merge 1 commit into
modelcontextprotocol:mainfrom
syf2211:fix/4406-memory-server-version-from-package-json

Conversation

@syf2211

@syf2211 syf2211 commented Jun 25, 2026

Copy link
Copy Markdown

Description

Read serverInfo.version from package.json at runtime instead of hardcoding "0.6.3" in the memory server.

Fixes #4406

Server Details

  • Server: memory
  • Changes to: server initialization / serverInfo version reporting

Motivation and Context

The published @modelcontextprotocol/server-memory calendar versions (e.g. 2026.1.26) still reported serverInfo.version as "0.6.3" because the value was hardcoded in source. This made diagnosing MCP startup issues confusing since the reported version did not match the installed package version.

Changes

  • Add version.ts with resolvePackageVersion() that locates package.json from both source (./package.json) and dist/Docker/npm layouts (../package.json)
  • Use the resolved version when constructing McpServer
  • Add tests covering source and dist version resolution

How Has This Been Tested?

cd src/memory
npm run build
npm test
node -e "import('./dist/version.js').then(m => console.log(m.SERVER_VERSION))"

Results:

  • 52 tests passed (including new server-version tests)
  • Build succeeds
  • Dist module resolves version correctly from parent package.json

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

The fix is scoped to the memory server only. Other TypeScript servers in this repo still hardcode versions and could be addressed separately.

Fixes modelcontextprotocol#4406. The memory server previously hardcoded serverInfo.version as
"0.6.3", which no longer matched published calendar versions. Resolve
package.json from both source and dist layouts so Docker and npm installs
report the installed package version.
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.

serverInfo.version hardcoded as "0.6.3" in @modelcontextprotocol/server-memory@2026.1.26

1 participant