Skip to content

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

Description

@dishankgupta

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.

Activity

  1. added
    server-filesystemReference implementation for the Filesystem MCP server - src/filesystem
    on Jul 28, 2025
  2. dishankgupta commented on Jul 30, 2025

    @dishankgupta
    Author

    No assignees till now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingserver-filesystemReference implementation for the Filesystem MCP server - src/filesystem

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions