@debugmcp/mcp-debugger
Version:
Run-time step-through debugging for LLM agents.
39 lines (31 loc) • 1.96 kB
Markdown
# Container Path Translation Fix Summary
## Problem
The container path translation was failing with Windows paths being appended to `/workspace/` resulting in paths like:
- `/workspace/C:/Users/user/AppData/Local/Temp/mcp-container-test-123/test.py`
## Root Cause
1. In the Linux container environment, `path.isAbsolute()` does not recognize Windows paths as absolute
2. The path was falling through to the relative path handling which uses `path.posix.join()`
3. `path.posix.join('/workspace', 'C:/Users/...')` produces `/workspace/C:/Users/...`
## Solution Implemented
1. Added explicit checks for Windows paths using regex: `/^[a-zA-Z]:/.test(path)`
2. Enhanced absolute path detection to handle both Windows and Unix paths in container mode
3. Improved path normalization and comparison logic
4. Added comprehensive logging for debugging
## Key Changes in `src/utils/path-translator.ts`
- Added `isWindowsPath` check using regex pattern
- Enhanced `isAbsolutePath` detection to include Windows paths explicitly
- Improved case-insensitive comparison for Windows paths
- Added fallback to `path.win32.relative()` when manual extraction fails
- Added safety check to ensure no Windows drive letters remain in translated paths
## Test Coverage
Added new test cases for:
- Paths outside workspace (temp directories)
- Mixed case drive letters
- Trailing slashes in host paths
- Verification that translated paths never contain Windows drive letters
## Status
The fix has been implemented but the container smoke test is still failing. The issue appears to be that the path translation logic is correct, but the path might not be going through the translation in the container environment properly.
## Next Steps
1. Verify that the path translator is being used in the container environment
2. Check if there's a configuration issue with MCP_HOST_WORKSPACE in the test
3. Consider if the path needs to be translated at a different point in the flow