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
-
Configure filesystem MCP with allowed directories (see config below)
-
Try to create a directory using a relative path:
mcp_filesystem_create_directory({ path: "./Dishank" })
-
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
-
Try with absolute path:
mcp_filesystem_create_directory({ path: "C:\\Learn\\import_tracker\\Dishank" })
-
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.
Bug: create_directory fails with relative paths but works with absolute paths
Description
The
create_directoryfunction 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
Configure filesystem MCP with allowed directories (see config below)
Try to create a directory using a relative path:
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_trackerTry with absolute path:
This works successfully:
Successfully created directory C:\Learn\import_tracker\DishankExpected 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
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
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 thoughC:\Learn\import_trackeris 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.jsonconfiguration file, and the issue manifested when attempting to create directories through Kiro's AI assistant using themcp_filesystem_create_directorytool.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.