- Add symlink resolution using fs.realpath() for security consistency
- Support home directory expansion (~/) in root URI specifications
- Improve error handling with null checks, detailed error messages, and informative logging
- Change allowedDirectories from constant to variable to support roots protocol directory management
- Extract roots processing logic from index.ts into testable roots-utils.ts module and add Test suite
- Update README to recommend MCP roots protocol for dynamic directory management
- Add support for dynamic directory updates via MCP roots protocol
- Allow clients to override command-line directories at runtime
- Maintain backwards compatibility with existing command-line args
- Add comprehensive error handling for edge cases
- Update documentation to explain both configuration methods
Fixes#401
- Add head/tail functionality for memory-efficient file reading
- Implement new list_directory_with_sizes command with file size info
- Add formatSize utility for human-readable file sizes
following config throws error
```
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"~"
]
},
```
```
Error accessing directory ~: Error: ENOENT: no such file or directory, stat '~'
at async Object.stat (node:internal/fs/promises:1032:18)
at async file:///Users/USER_NAME/.npm/_npx/a3241bba59c344f5/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js:33:23━━━━━━━━━━━━━━━━━
at async Promise.all (index 0)
at async file:///Users/USER_NAME/.npm/_npx/a3241bba59c344f5/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js:31:1 {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: '~'
}
```
this commit fixes error and allows to set ~ as allowed directory
- Add excludePatterns property to SearchFilesArgsSchema
- Modify searchFiles function to handle path exclusions
- Add minimatch import for glob pattern matching
This change allows excluding specific directories (like node_modules)
from file searches to prevent context window overflow.
Issue: modelcontextprotocol/servers#251