servers icon indicating copy to clipboard operation
servers copied to clipboard

Filesystem MCP: create_directory fails with relative paths but works with absolute paths - Kiro AI IDE

Open dishankgupta opened this issue 1 year ago • 2 comments

Bug: create_directory fails with relative paths but works with absolute paths

Description

The create_directory function in the filesystem MCP server only works when provided with absolute paths. When using relative paths, it incorrectly throws an "Access denied" error even though the path is within allowed directories.

Steps to Reproduce

  1. Configure filesystem MCP with allowed directories (see config below)

  2. Try to create a directory using a relative path:

    mcp_filesystem_create_directory({ path: "./Dishank" })
    
  3. Observe error: Error: Access denied - path outside allowed directories: c:\Learn\import_tracker\Dishank not in C:\Learn\import_tracker, C:\Users\ADMIN\.kiro, C:\Learn\import_tracker

  4. Try with absolute path:

    mcp_filesystem_create_directory({ path: "C:\\Learn\\import_tracker\\Dishank" })
    
  5. This works successfully: Successfully created directory C:\Learn\import_tracker\Dishank

Expected Behavior

Both relative and absolute paths should work as long as they resolve to a location within the allowed directories.

Current Configuration

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "C:\\Learn\\import_tracker",
        "C:\\Users\\ADMIN\\.kiro",
        "."
      ],
      "disabled": false,
      "autoApprove": [
        "read_file"
      ]
    }
  }
}

Environment

  • OS: Windows
  • Platform: win32
  • Shell: cmd
  • Kiro IDE: Version: 0.1.25 (user setup) VSCode Version: 1.94.0 Commit: 6124c448360adbeb0adbc771a86db283d2d3f4db Date: 2025-07-23T19:45:58.809Z Electron: 30.5.1 ElectronBuildId: undefined Chromium: 124.0.6367.243 Node.js: 20.16.0 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.26100
  • MCP Server Version: @modelcontextprotocol/server-filesystem (latest via npx)
  • Node.js: 18+ (required for Kiro)

Additional Context

The error message shows that the server is correctly resolving the relative path to its absolute form (c:\Learn\import_tracker\Dishank), but then fails to recognize that this path is within the allowed directories list, even though C:\Learn\import_tracker is explicitly listed as an allowed directory.

This appears to be a path normalization issue where the comparison between the resolved path and allowed directories is failing due to case sensitivity or path format differences.

Reproduction via Kiro IDE

This issue was discovered while using Kiro IDE's MCP integration. The filesystem MCP server was configured through Kiro's .kiro/settings/mcp.json configuration file, and the issue manifested when attempting to create directories through Kiro's AI assistant using the mcp_filesystem_create_directory tool.

Impact

This bug affects the usability of the filesystem MCP server when integrated with IDEs like Kiro, as users naturally expect relative paths to work within their project workspace.

dishankgupta avatar Jul 24 '25 06:07 dishankgupta

No assignees till now...

dishankgupta avatar Jul 30 '25 12:07 dishankgupta

Closing: superseded by the v2 release.

Thank you for reporting this, and apologies for the long wait for a response.

Since this was filed, the reference servers have been rebuilt for the 2026-07-28 MCP specification (#4857) and released as v2 (2.0.0 on npm for the TypeScript servers, 2026.10.19 on PyPI for the Python servers). Each server now runs on v2 of its SDK, and the behavior described here has either been fixed or no longer exists in the same form. Relative paths are now resolved against the allowed directories instead of the process working directory, and drive letters are normalized, which removes the mismatch in this report.

This is not a judgment on whether the problem was real; it's a consequence of the code it describes having been replaced. This is happening as part of the backlog triage in #4875.

If this still happens on the v2 release, we'd genuinely like to know. Please open a fresh issue with the version you're running and steps to reproduce, and we'll look at it. Note that this repository accepts contributions as issues rather than pull requests; see CONTRIBUTING.md.

Thanks for taking the time to report it.

cliffhall avatar Oct 19 '26 17:10 cliffhall