fix(memory, filesystem): dynamic package version + Windows case-insensitive paths#4408
Open
vystartasv wants to merge 2 commits into
Open
fix(memory, filesystem): dynamic package version + Windows case-insensitive paths#4408vystartasv wants to merge 2 commits into
vystartasv wants to merge 2 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix 1: Dynamic version from package.json (Closes #4406)
serverInfo.versionwas hardcoded as"0.6.3"in server-memory since the package transitioned to calendar versioning. The compileddist/index.jsalways reported0.6.3regardless of the actual package version.Fix: Read version from
package.jsonat startup vialoadPackageJson()that works in both source (dev/test) and compiled contexts.Fix 2: Windows case-insensitive path comparison (Closes #470)
On Windows,
C:\sourceandc:\Sourcerefer to the same directory, but path validation used a case-sensitivestartsWithcomparison. When allowed directories had different casing than the filesystem path, access was incorrectly denied.Fix: On Windows (
process.platform === 'win32'), compare lowercased paths beforestartsWith. Non-Windows unchanged.Testing
tscclean (both packages)