From 089b7f9abe0c582c2440865031b1c388eeb78eec Mon Sep 17 00:00:00 2001 From: Shotaro Sano Date: Mon, 3 Feb 2025 11:54:28 +0900 Subject: [PATCH 1/2] Fix misleading edit_file functionality docs in filesystem README --- src/filesystem/README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/filesystem/README.md b/src/filesystem/README.md index c52f1a4..3d3fb48 100644 --- a/src/filesystem/README.md +++ b/src/filesystem/README.md @@ -41,22 +41,16 @@ Node.js server implementing Model Context Protocol (MCP) for filesystem operatio - Features: - Line-based and multi-line content matching - Whitespace normalization with indentation preservation - - Fuzzy matching with confidence scoring - Multiple simultaneous edits with correct positioning - Indentation style detection and preservation - Git-style diff output with context - Preview changes with dry run mode - - Failed match debugging with confidence scores - Inputs: - `path` (string): File to edit - `edits` (array): List of edit operations - `oldText` (string): Text to search for (can be substring) - `newText` (string): Text to replace with - `dryRun` (boolean): Preview changes without applying (default: false) - - `options` (object): Optional formatting settings - - `preserveIndentation` (boolean): Keep existing indentation (default: true) - - `normalizeWhitespace` (boolean): Normalize spaces while preserving structure (default: true) - - `partialMatch` (boolean): Enable fuzzy matching (default: true) - Returns detailed diff and match information for dry runs, otherwise applies changes - Best Practice: Always use dryRun first to preview changes before applying them From d7ea463aa5dac91cf762271dad2084f7898c8a1e Mon Sep 17 00:00:00 2001 From: EthBerryAdmin Date: Sun, 16 Mar 2025 16:39:24 +0400 Subject: [PATCH 2/2] allow ~ to be used in config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/filesystem/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filesystem/index.ts b/src/filesystem/index.ts index b4d5c41..c544ff2 100644 --- a/src/filesystem/index.ts +++ b/src/filesystem/index.ts @@ -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);