Skip to content

Commit d7ea463

Browse files
allow ~ to be used in config
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
1 parent b832073 commit d7ea463

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/filesystem/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const allowedDirectories = args.map(dir =>
4242
// Validate that all directories exist and are accessible
4343
await Promise.all(args.map(async (dir) => {
4444
try {
45-
const stats = await fs.stat(dir);
45+
const stats = await fs.stat(expandHome(dir));
4646
if (!stats.isDirectory()) {
4747
console.error(`Error: ${dir} is not a directory`);
4848
process.exit(1);

0 commit comments

Comments
 (0)