Skip to content

Conversation

@EthBerryAdmin
Copy link
Contributor

@EthBerryAdmin EthBerryAdmin commented Mar 16, 2025

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

Description

Server Details

  • Server:
  • Changes to:

Motivation and Context

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

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
@EthBerryAdmin
Copy link
Contributor Author

Hey guys! Any chance to get this merged?

@olaservo olaservo added server-filesystem Reference implementation for the Filesystem MCP server - src/filesystem bug Something isn't working labels Mar 27, 2025
Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, can you get the latest from main and then I can merge? Edit: nm looks like it can be merged but I'm checking out some failing checks in the CI.

@olaservo
Copy link
Member

Going to merge this one since the CI failure is unrelated and its a fairly urgent issue.

@olaservo olaservo merged commit 1d45459 into modelcontextprotocol:main Mar 27, 2025
20 of 25 checks passed
@EthBerryAdmin
Copy link
Contributor Author

thanks

PazerOP referenced this pull request in PazerOP/mcp-template Jul 15, 2025
Allow ~ to be used in config for server-filesystem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working server-filesystem Reference implementation for the Filesystem MCP server - src/filesystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants