GitHub Issue Content
Title: Refactor filesystem MCP server path logic to fix Linux support and follow DRY
Body:
Problem
The filesystem MCP server initialization logic is duplicated across multiple files and contains incorrect platform detection for Linux systems. Currently, it defaults to /Users for all non-Windows platforms, but Linux uses /home for user directories, causing failures on Linux.
Current Issues
- DRY Violation: Same logic repeated in 3+ places (
src/core/config.ts, src/interfaces/cli/index.ts, src/interfaces/http/session-manager.ts)
- Linux Bug: Uses
/Users instead of /home on Linux, causing "ENOENT: no such file or directory, stat '/Users'" errors
- Maintainability: Platform changes require updates in multiple locations
Proposed Solution
- Create
src/utils/platform.ts with getDefaultFilesystemAllowedPath() utility function
- Update all usage locations to import and use this centralized function
- Fix platform detection: Windows →
C:\Users, macOS → /Users, Linux → /home
Files to Modify
src/utils/platform.ts (new file)
src/core/config.ts
src/interfaces/cli/index.ts
src/interfaces/http/session-manager.ts
- Update documentation in
docs/architecture/FILESYSTEM_ACCESS.md
Acceptance Criteria
- No more "ENOENT: no such file or directory, stat '/Users'" on Linux
- Single source of truth for platform-specific filesystem paths
- All interfaces (CLI, HTTP, programmatic) use consistent path logic
- Backward compatibility maintained
Additional Context
This fixes the error encountered on Linux where the filesystem MCP server tries to access /Users which doesn't exist, and consolidates the logic to prevent future inconsistencies.
GitHub Issue Content
Title: Refactor filesystem MCP server path logic to fix Linux support and follow DRY
Body:
Problem
The filesystem MCP server initialization logic is duplicated across multiple files and contains incorrect platform detection for Linux systems. Currently, it defaults to
/Usersfor all non-Windows platforms, but Linux uses/homefor user directories, causing failures on Linux.Current Issues
src/core/config.ts,src/interfaces/cli/index.ts,src/interfaces/http/session-manager.ts)/Usersinstead of/homeon Linux, causing "ENOENT: no such file or directory, stat '/Users'" errorsProposed Solution
src/utils/platform.tswithgetDefaultFilesystemAllowedPath()utility functionC:\Users, macOS →/Users, Linux →/homeFiles to Modify
src/utils/platform.ts(new file)src/core/config.tssrc/interfaces/cli/index.tssrc/interfaces/http/session-manager.tsdocs/architecture/FILESYSTEM_ACCESS.mdAcceptance Criteria
Additional Context
This fixes the error encountered on Linux where the filesystem MCP server tries to access
/Userswhich doesn't exist, and consolidates the logic to prevent future inconsistencies.