mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-02-19 11:54:58 -05:00
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
This commit is contained in:
@@ -42,7 +42,7 @@ const allowedDirectories = args.map(dir =>
|
||||
// Validate that all directories exist and are accessible
|
||||
await Promise.all(args.map(async (dir) => {
|
||||
try {
|
||||
const stats = await fs.stat(dir);
|
||||
const stats = await fs.stat(expandHome(dir));
|
||||
if (!stats.isDirectory()) {
|
||||
console.error(`Error: ${dir} is not a directory`);
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user