Skip to content

test(filesystem): add regression tests for Docker Linux path handling#3805

Draft
majiayu000 wants to merge 1 commit intomodelcontextprotocol:mainfrom
majiayu000:fix/issue-3628-docker-linux-path-tests
Draft

test(filesystem): add regression tests for Docker Linux path handling#3805
majiayu000 wants to merge 1 commit intomodelcontextprotocol:mainfrom
majiayu000:fix/issue-3628-docker-linux-path-tests

Conversation

@majiayu000
Copy link
Copy Markdown

Fixes #3628

Description

Adds regression tests for the Docker/Linux path normalization bug where paths like /h/username/MCP_Development/data got wrongly converted to H:\username\MCP_Development\data. The code fix already landed on main (commit c9b0135 added platform detection to normalizePath and convertToWindowsPath), but there were no tests covering the exact scenario from the issue.

New tests mock process.platform to 'linux' (simulating Docker Alpine) and verify that single-letter root directories (/h/, /u/, /d/) aren't mistaken for Windows drive letters. Uses the same mocking pattern already in the WSL test block.

Note: Docker image 1.0.2 still has the bug. It needs rebuilding from current main to pick up the fix.

Server Details

  • Server: filesystem
  • Changes to: tests only (path-utils.test.ts)

Motivation and Context

Issue #3628 reports that the filesystem server running in Docker Alpine Linux converts valid Linux paths to Windows-style paths. The fix exists but had no dedicated test coverage for the Docker scenario.

How Has This Been Tested?

cd src/filesystem && npm test — all 149 tests pass (7 test files), including the new regression tests.

Breaking Changes

None. Test-only change.

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

Add tests for issue modelcontextprotocol#3628 where single-letter root directories
(/h/, /u/, /d/) on Linux Docker containers were incorrectly
converted to Windows drive letter paths (H:\, U:\, D:\).

The code fix exists on main via platform detection in normalizePath
and convertToWindowsPath. These tests mock process.platform to
'linux' and verify paths are preserved as-is.

Signed-off-by: majiayu000 <1835304752@qq.com>
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.

Docker Image 1.0.2 Breaks Linux Users with Letter at Start of Path

1 participant