Skip to content

fix(memory, filesystem): dynamic package version + Windows case-insensitive paths#4408

Open
vystartasv wants to merge 2 commits into
modelcontextprotocol:mainfrom
vystartasv:fix/memory-server-dynamic-version
Open

fix(memory, filesystem): dynamic package version + Windows case-insensitive paths#4408
vystartasv wants to merge 2 commits into
modelcontextprotocol:mainfrom
vystartasv:fix/memory-server-dynamic-version

Conversation

@vystartasv

@vystartasv vystartasv commented Jun 25, 2026

Copy link
Copy Markdown

Fix 1: Dynamic version from package.json (Closes #4406)

serverInfo.version was hardcoded as "0.6.3" in server-memory since the package transitioned to calendar versioning. The compiled dist/index.js always reported 0.6.3 regardless of the actual package version.

Fix: Read version from package.json at startup via loadPackageJson() that works in both source (dev/test) and compiled contexts.

Fix 2: Windows case-insensitive path comparison (Closes #470)

On Windows, C:\source and c:\Source refer to the same directory, but path validation used a case-sensitive startsWith comparison. When allowed directories had different casing than the filesystem path, access was incorrectly denied.

Fix: On Windows (process.platform === 'win32'), compare lowercased paths before startsWith. Non-Windows unchanged.

Testing

  • Build: tsc clean (both packages)
  • Memory tests: 50/50 pass
  • Filesystem tests: 147/147 pass

The serverInfo.version field was hardcoded as '0.6.3' in the McpServer
constructor, causing it to drift from the actual package version when
publishing. The compiled dist/index.js always reported '0.6.3' regardless
of the package version set in package.json.

Fix by reading the version from package.json at startup via a fallback
path lookup that works in both source (dev/test) and compiled (production)
contexts.

Fixes modelcontextprotocol#4406
On Windows, file paths are case-insensitive (C:\source and c:\Source
refer to the same location). The path validation was comparing paths
case-sensitively, causing 'Access denied' errors when the allowed
directories were configured with a different casing than the actual
filesystem paths.

Fix by lowercasing both paths before the startsWith comparison on
Windows. Non-Windows platforms remain case-sensitive.

Fixes modelcontextprotocol#470
@vystartasv vystartasv changed the title fix(memory): read server version from package.json at runtime fix(memory, filesystem): dynamic package version + Windows case-insensitive paths Jun 25, 2026
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 Filesystem server access denied for allowed paths on Windows

1 participant