@j0hanz/filesystem-mcp 1.13.2 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +162 -145
  2. package/dist/cli.js +2 -2
  3. package/dist/completions.js +54 -51
  4. package/dist/config.d.ts +13 -14
  5. package/dist/config.js +12 -12
  6. package/dist/index.js +1 -1
  7. package/dist/lib/abort.d.ts +7 -0
  8. package/dist/lib/abort.js +81 -0
  9. package/dist/lib/constants.d.ts +3 -1
  10. package/dist/lib/constants.js +8 -2
  11. package/dist/lib/errors.d.ts +7 -3
  12. package/dist/lib/errors.js +64 -41
  13. package/dist/lib/file-operations/core.d.ts +3 -3
  14. package/dist/lib/file-operations/core.js +23 -20
  15. package/dist/lib/file-operations/metadata.d.ts +2 -2
  16. package/dist/lib/file-operations/metadata.js +69 -22
  17. package/dist/lib/file-operations/search.d.ts +0 -1
  18. package/dist/lib/file-operations/search.js +87 -95
  19. package/dist/lib/file-operations/traversal.js +13 -15
  20. package/dist/lib/fs-helpers.d.ts +3 -10
  21. package/dist/lib/fs-helpers.js +29 -108
  22. package/dist/lib/globs.d.ts +2 -0
  23. package/dist/lib/globs.js +19 -0
  24. package/dist/lib/logger.d.ts +28 -0
  25. package/dist/lib/logger.js +91 -0
  26. package/dist/lib/observability.d.ts +7 -0
  27. package/dist/lib/observability.js +19 -9
  28. package/dist/lib/paths.js +55 -55
  29. package/dist/lib/resource-store.js +4 -4
  30. package/dist/lib/utils.d.ts +0 -12
  31. package/dist/lib/utils.js +0 -13
  32. package/dist/lib/zod-codecs.d.ts +2 -0
  33. package/dist/lib/zod-codecs.js +18 -0
  34. package/dist/pkg-info.d.ts +1 -0
  35. package/dist/pkg-info.js +2 -2
  36. package/dist/prompts.js +3 -3
  37. package/dist/resources/generated-instructions.js +41 -41
  38. package/dist/resources/tool-catalog.js +33 -58
  39. package/dist/resources/tool-info.d.ts +0 -1
  40. package/dist/resources/tool-info.js +44 -67
  41. package/dist/resources/workflows.js +47 -19
  42. package/dist/resources.d.ts +1 -1
  43. package/dist/resources.js +4 -4
  44. package/dist/schemas.d.ts +185 -465
  45. package/dist/schemas.js +174 -206
  46. package/dist/server/bootstrap.d.ts +12 -11
  47. package/dist/server/bootstrap.js +95 -86
  48. package/dist/server/roots-manager.d.ts +5 -2
  49. package/dist/server/roots-manager.js +9 -7
  50. package/dist/server/task-store.d.ts +10 -0
  51. package/dist/server/task-store.js +73 -0
  52. package/dist/tools/apply-patch.js +39 -20
  53. package/dist/tools/calculate-hash.js +14 -27
  54. package/dist/tools/create-directory.js +11 -9
  55. package/dist/tools/delete-file.js +19 -19
  56. package/dist/tools/diff-files.js +16 -18
  57. package/dist/tools/edit-file.js +11 -5
  58. package/dist/tools/list-directory.js +16 -21
  59. package/dist/tools/move-file.js +105 -100
  60. package/dist/tools/read-multiple.js +15 -10
  61. package/dist/tools/read.js +6 -7
  62. package/dist/tools/replace-in-files.js +76 -115
  63. package/dist/tools/roots.js +3 -7
  64. package/dist/tools/search-content.js +158 -203
  65. package/dist/tools/search-files.js +59 -50
  66. package/dist/tools/shared.d.ts +10 -0
  67. package/dist/tools/shared.js +105 -36
  68. package/dist/tools/stat-many.js +15 -9
  69. package/dist/tools/stat.js +6 -6
  70. package/dist/tools/task-support.d.ts +10 -9
  71. package/dist/tools/task-support.js +94 -23
  72. package/dist/tools/tree.js +4 -4
  73. package/dist/tools/write-file.js +11 -12
  74. package/package.json +10 -9
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/%40j0hanz%2Ffilesystem-mcp?style=flat-square&logo=npm)](https://www.npmjs.com/package/%40j0hanz%2Ffilesystem-mcp) [![License: MIT](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](#contributing-and-license)
4
4
 
5
- [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=filesystem-mcp&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ffilesystem-mcp%40latest%22%5D%7D) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=filesystem-mcp&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ffilesystem-mcp%40latest%22%5D%7D&quality=insiders) [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install_Server-C16FDE?logo=visualstudio&logoColor=white)](https://vs-open.link/mcp-install?%7B%22filesystem-mcp%22%3A%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ffilesystem-mcp%40latest%22%5D%7D%7D)
5
+ [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=filesystem&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ffilesystem-mcp%40latest%22%5D%7D) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=filesystem&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ffilesystem-mcp%40latest%22%5D%7D&quality=insiders) [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install_Server-C16FDE?logo=visualstudio&logoColor=white)](https://vs-open.link/mcp-install?%7B%22filesystem-mcp%22%3A%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ffilesystem-mcp%40latest%22%5D%7D%7D)
6
6
 
7
- [![Add to LM Studio](https://files.lmstudio.ai/deeplink/mcp-install-light.svg)](https://lmstudio.ai/install-mcp?name=filesystem-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovZmlsZXN5c3RlbS1tY3BAbGF0ZXN0Il19) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=filesystem-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovZmlsZXN5c3RlbS1tY3BAbGF0ZXN0Il19) [![Install in Goose](https://block.github.io/goose/img/extension-install-dark.svg)](https://block.github.io/goose/extension?cmd=npx&arg=-y&arg=%40j0hanz%2Ffilesystem-mcp%40latest&id=%40j0hanz%2Ffilesystem-mcp&name=filesystem-mcp&description=MCP%20Server%20that%20enables%20LLMs%20to%20interact%20with%20the%20local%20filesystem.)
7
+ [![Add to LM Studio](https://files.lmstudio.ai/deeplink/mcp-install-light.svg)](https://lmstudio.ai/install-mcp?name=filesystem&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovZmlsZXN5c3RlbS1tY3BAbGF0ZXN0Il19) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=filesystem&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovZmlsZXN5c3RlbS1tY3BAbGF0ZXN0Il19) [![Install in Goose](https://block.github.io/goose/img/extension-install-dark.svg)](https://block.github.io/goose/extension?cmd=npx&arg=-y&arg=%40j0hanz%2Ffilesystem-mcp%40latest&id=%40j0hanz%2Ffilesystem-mcp&name=filesystem&description=MCP%20Server%20that%20enables%20LLMs%20to%20interact%20with%20the%20local%20filesystem.)
8
8
 
9
9
  A local filesystem MCP server that lets LLMs and AI agents read, write, search, diff, patch, and manage files safely and efficiently. Built for reliable, structured, and controlled filesystem interaction.
10
10
 
@@ -12,7 +12,7 @@ A local filesystem MCP server that lets LLMs and AI agents read, write, search,
12
12
 
13
13
  A secure, production-ready [Model Context Protocol](https://modelcontextprotocol.io) server that gives AI assistants controlled access to the local filesystem. All operations are sandboxed to explicitly allowed directories with path traversal prevention, sensitive file blocking, and optional Bearer token authentication.
14
14
 
15
- Supports **stdio** (default) and **Streamable HTTP + SSE** transports with per-session isolation.
15
+ Supports stdio (default) and Streamable HTTP transport with SSE support. HTTP sessions are implemented with isolated per-session server state.
16
16
 
17
17
  ## Key Features
18
18
 
@@ -20,7 +20,7 @@ Supports **stdio** (default) and **Streamable HTTP + SSE** transports with per-s
20
20
  - **Security-first** — path validation, symlink escape prevention, sensitive file denylist, localhost-only CORS, optional API key auth
21
21
  - **Dual transport** — stdio for local use, Streamable HTTP with SSE for networked/multi-session deployments
22
22
  - **Structured output** — all tools return typed `outputSchema` / `structuredContent` for reliable LLM parsing
23
- - **Self-documenting** — 6 built-in resources (`internal://instructions`, `internal://tool-catalog`, etc.) and a `get-help` prompt
23
+ - **Self-documenting** — 6 built-in resources (`internal://instructions`, `internal://tool-catalog`, etc.) and 4 built-in prompts (`get-help`, `compare-files`, `analyze-path`, `get-tool-help`)
24
24
 
25
25
  ## Requirements
26
26
 
@@ -31,7 +31,7 @@ Supports **stdio** (default) and **Streamable HTTP + SSE** transports with per-s
31
31
  ```json
32
32
  {
33
33
  "mcpServers": {
34
- "filesystem-mcp": {
34
+ "filesystem": {
35
35
  "command": "npx",
36
36
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
37
37
  }
@@ -82,14 +82,14 @@ Examples:
82
82
  <details>
83
83
  <summary><b>Install in VS Code</b></summary>
84
84
 
85
- [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=filesystem-mcp&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ffilesystem-mcp%40latest%22%5D%7D)
85
+ [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=filesystem&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ffilesystem-mcp%40latest%22%5D%7D)
86
86
 
87
87
  Add to `.vscode/mcp.json`:
88
88
 
89
89
  ```json
90
90
  {
91
91
  "servers": {
92
- "filesystem-mcp": {
92
+ "filesystem": {
93
93
  "command": "npx",
94
94
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
95
95
  }
@@ -100,7 +100,7 @@ Add to `.vscode/mcp.json`:
100
100
  Or install via CLI:
101
101
 
102
102
  ```sh
103
- code --add-mcp '{"name":"filesystem-mcp","command":"npx","args":["-y","@j0hanz/filesystem-mcp@latest"]}'
103
+ code --add-mcp '{"name":"filesystem","command":"npx","args":["-y","@j0hanz/filesystem-mcp@latest"]}'
104
104
  ```
105
105
 
106
106
  </details>
@@ -108,14 +108,14 @@ code --add-mcp '{"name":"filesystem-mcp","command":"npx","args":["-y","@j0hanz/f
108
108
  <details>
109
109
  <summary><b>Install in VS Code Insiders</b></summary>
110
110
 
111
- [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=filesystem-mcp&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ffilesystem-mcp%40latest%22%5D%7D&quality=insiders)
111
+ [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=filesystem&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ffilesystem-mcp%40latest%22%5D%7D&quality=insiders)
112
112
 
113
113
  Add to `.vscode/mcp.json`:
114
114
 
115
115
  ```json
116
116
  {
117
117
  "servers": {
118
- "filesystem-mcp": {
118
+ "filesystem": {
119
119
  "command": "npx",
120
120
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
121
121
  }
@@ -126,7 +126,7 @@ Add to `.vscode/mcp.json`:
126
126
  Or install via CLI:
127
127
 
128
128
  ```sh
129
- code-insiders --add-mcp '{"name":"filesystem-mcp","command":"npx","args":["-y","@j0hanz/filesystem-mcp@latest"]}'
129
+ code-insiders --add-mcp '{"name":"filesystem","command":"npx","args":["-y","@j0hanz/filesystem-mcp@latest"]}'
130
130
  ```
131
131
 
132
132
  </details>
@@ -134,14 +134,14 @@ code-insiders --add-mcp '{"name":"filesystem-mcp","command":"npx","args":["-y","
134
134
  <details>
135
135
  <summary><b>Install in Cursor</b></summary>
136
136
 
137
- [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=filesystem-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovZmlsZXN5c3RlbS1tY3BAbGF0ZXN0Il19)
137
+ [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=filesystem&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovZmlsZXN5c3RlbS1tY3BAbGF0ZXN0Il19)
138
138
 
139
139
  Add to `~/.cursor/mcp.json`:
140
140
 
141
141
  ```json
142
142
  {
143
143
  "mcpServers": {
144
- "filesystem-mcp": {
144
+ "filesystem": {
145
145
  "command": "npx",
146
146
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
147
147
  }
@@ -156,10 +156,12 @@ Add to `~/.cursor/mcp.json`:
156
156
 
157
157
  [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install_Server-C16FDE?logo=visualstudio&logoColor=white)](https://vs-open.link/mcp-install?%7B%22filesystem-mcp%22%3A%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ffilesystem-mcp%40latest%22%5D%7D%7D)
158
158
 
159
+ Add to `<SOLUTIONDIR>.mcp.json` or `%USERPROFILE%\.mcp.json`:
160
+
159
161
  ```json
160
162
  {
161
- "mcpServers": {
162
- "filesystem-mcp": {
163
+ "servers": {
164
+ "filesystem": {
163
165
  "command": "npx",
164
166
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
165
167
  }
@@ -172,17 +174,20 @@ Add to `~/.cursor/mcp.json`:
172
174
  <details>
173
175
  <summary><b>Install in Goose</b></summary>
174
176
 
175
- [![Install in Goose](https://block.github.io/goose/img/extension-install-dark.svg)](https://block.github.io/goose/extension?cmd=npx&arg=-y&arg=%40j0hanz%2Ffilesystem-mcp%40latest&id=%40j0hanz%2Ffilesystem-mcp&name=filesystem-mcp&description=MCP%20Server%20that%20enables%20LLMs%20to%20interact%20with%20the%20local%20filesystem.)
177
+ [![Install in Goose](https://block.github.io/goose/img/extension-install-dark.svg)](https://block.github.io/goose/extension?cmd=npx&arg=-y&arg=%40j0hanz%2Ffilesystem-mcp%40latest&id=%40j0hanz%2Ffilesystem-mcp&name=filesystem&description=MCP%20Server%20that%20enables%20LLMs%20to%20interact%20with%20the%20local%20filesystem.)
176
178
 
177
- ```json
178
- {
179
- "mcpServers": {
180
- "filesystem-mcp": {
181
- "command": "npx",
182
- "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
183
- }
184
- }
185
- }
179
+ Add to `~/.config/goose/config.yaml`:
180
+
181
+ ```yaml
182
+ extensions:
183
+ filesystem:
184
+ name: Filesystem MCP
185
+ cmd: npx
186
+ args:
187
+ - -y
188
+ - '@j0hanz/filesystem-mcp@latest'
189
+ enabled: true
190
+ type: stdio
186
191
  ```
187
192
 
188
193
  </details>
@@ -190,12 +195,12 @@ Add to `~/.cursor/mcp.json`:
190
195
  <details>
191
196
  <summary><b>Add to LM Studio</b></summary>
192
197
 
193
- [![Add to LM Studio](https://files.lmstudio.ai/deeplink/mcp-install-light.svg)](https://lmstudio.ai/install-mcp?name=filesystem-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovZmlsZXN5c3RlbS1tY3BAbGF0ZXN0Il19)
198
+ [![Add to LM Studio](https://files.lmstudio.ai/deeplink/mcp-install-light.svg)](https://lmstudio.ai/install-mcp?name=filesystem&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovZmlsZXN5c3RlbS1tY3BAbGF0ZXN0Il19)
194
199
 
195
200
  ```json
196
201
  {
197
202
  "mcpServers": {
198
- "filesystem-mcp": {
203
+ "filesystem": {
199
204
  "command": "npx",
200
205
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
201
206
  }
@@ -213,7 +218,7 @@ Add to `claude_desktop_config.json`:
213
218
  ```json
214
219
  {
215
220
  "mcpServers": {
216
- "filesystem-mcp": {
221
+ "filesystem": {
217
222
  "command": "npx",
218
223
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
219
224
  }
@@ -230,12 +235,12 @@ Add to `claude_desktop_config.json`:
230
235
  claude mcp add filesystem-mcp -- npx -y @j0hanz/filesystem-mcp@latest
231
236
  ```
232
237
 
233
- Or add to config:
238
+ Or add a project-scoped `.mcp.json`:
234
239
 
235
240
  ```json
236
241
  {
237
242
  "mcpServers": {
238
- "filesystem-mcp": {
243
+ "filesystem": {
239
244
  "command": "npx",
240
245
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
241
246
  }
@@ -253,7 +258,7 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
253
258
  ```json
254
259
  {
255
260
  "mcpServers": {
256
- "filesystem-mcp": {
261
+ "filesystem": {
257
262
  "command": "npx",
258
263
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
259
264
  }
@@ -270,12 +275,12 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
270
275
  amp mcp add filesystem-mcp -- npx -y @j0hanz/filesystem-mcp@latest
271
276
  ```
272
277
 
273
- Or add to config:
278
+ Or add to `settings.json`:
274
279
 
275
280
  ```json
276
281
  {
277
- "mcpServers": {
278
- "filesystem-mcp": {
282
+ "amp.mcpServers": {
283
+ "filesystem": {
279
284
  "command": "npx",
280
285
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
281
286
  }
@@ -293,7 +298,7 @@ Add to `cline_mcp_settings.json`:
293
298
  ```json
294
299
  {
295
300
  "mcpServers": {
296
- "filesystem-mcp": {
301
+ "filesystem": {
297
302
  "command": "npx",
298
303
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
299
304
  }
@@ -304,32 +309,35 @@ Add to `cline_mcp_settings.json`:
304
309
  </details>
305
310
 
306
311
  <details>
307
- <summary><b>Install in Codex CLI</b></summary>
312
+ <summary><b>Install in Codex</b></summary>
308
313
 
309
- ```json
310
- {
311
- "mcpServers": {
312
- "filesystem-mcp": {
313
- "command": "npx",
314
- "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
315
- }
316
- }
317
- }
314
+ ```sh
315
+ codex mcp add filesystem -- npx -y @j0hanz/filesystem-mcp@latest
316
+ ```
317
+
318
+ Or add to `~/.codex/config.toml` (or `.codex/config.toml` in a trusted project):
319
+
320
+ ```toml
321
+ [mcp_servers.filesystem]
322
+ command = "npx"
323
+ args = ["-y", "@j0hanz/filesystem-mcp@latest"]
318
324
  ```
319
325
 
320
326
  </details>
321
327
 
322
328
  <details>
323
- <summary><b>Install in GitHub Copilot</b></summary>
329
+ <summary><b>Install in GitHub Copilot Coding Agent</b></summary>
324
330
 
325
- Add to `.vscode/mcp.json`:
331
+ Add this JSON in your repository's GitHub Copilot coding agent MCP configuration:
326
332
 
327
333
  ```json
328
334
  {
329
- "servers": {
330
- "filesystem-mcp": {
335
+ "mcpServers": {
336
+ "filesystem": {
337
+ "type": "local",
331
338
  "command": "npx",
332
- "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
339
+ "args": ["-y", "@j0hanz/filesystem-mcp@latest"],
340
+ "tools": ["*"]
333
341
  }
334
342
  }
335
343
  }
@@ -343,7 +351,7 @@ Add to `.vscode/mcp.json`:
343
351
  ```json
344
352
  {
345
353
  "mcpServers": {
346
- "filesystem-mcp": {
354
+ "filesystem": {
347
355
  "command": "npx",
348
356
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
349
357
  }
@@ -361,7 +369,7 @@ Add to `.kiro/settings/mcp.json`:
361
369
  ```json
362
370
  {
363
371
  "mcpServers": {
364
- "filesystem-mcp": {
372
+ "filesystem": {
365
373
  "command": "npx",
366
374
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
367
375
  }
@@ -379,7 +387,7 @@ Add to `~/.gemini/settings.json`:
379
387
  ```json
380
388
  {
381
389
  "mcpServers": {
382
- "filesystem-mcp": {
390
+ "filesystem": {
383
391
  "command": "npx",
384
392
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
385
393
  }
@@ -397,11 +405,10 @@ Add to `~/.config/zed/settings.json`:
397
405
  ```json
398
406
  {
399
407
  "context_servers": {
400
- "filesystem-mcp": {
401
- "settings": {
402
- "command": "npx",
403
- "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
404
- }
408
+ "filesystem": {
409
+ "command": "npx",
410
+ "args": ["-y", "@j0hanz/filesystem-mcp@latest"],
411
+ "env": {}
405
412
  }
406
413
  }
407
414
  }
@@ -419,7 +426,7 @@ Add to VS Code `settings.json` under `augment.advanced`:
419
426
  "augment.advanced": {
420
427
  "mcpServers": [
421
428
  {
422
- "id": "filesystem-mcp",
429
+ "id": "filesystem",
423
430
  "command": "npx",
424
431
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
425
432
  }
@@ -436,7 +443,7 @@ Add to VS Code `settings.json` under `augment.advanced`:
436
443
  ```json
437
444
  {
438
445
  "mcpServers": {
439
- "filesystem-mcp": {
446
+ "filesystem": {
440
447
  "command": "npx",
441
448
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
442
449
  }
@@ -452,7 +459,7 @@ Add to VS Code `settings.json` under `augment.advanced`:
452
459
  ```json
453
460
  {
454
461
  "mcpServers": {
455
- "filesystem-mcp": {
462
+ "filesystem": {
456
463
  "command": "npx",
457
464
  "args": ["-y", "@j0hanz/filesystem-mcp@latest"]
458
465
  }
@@ -536,6 +543,9 @@ Create directories, move/rename files, delete files, and verify file integrity v
536
543
  |
537
544
  +-- prompts/get ─────────────────────────────────────────
538
545
  | +-- get-help (optional topic argument)
546
+ | +-- compare-files (original, modified)
547
+ | +-- analyze-path (path)
548
+ | +-- get-tool-help (name)
539
549
  |
540
550
  +-- Capabilities: logging, resources, tools, prompts, completions, tasks
541
551
  ```
@@ -567,17 +577,17 @@ _No parameters._
567
577
 
568
578
  List immediate directory contents: name, path, type, size, modified date.
569
579
 
570
- | Parameter | Type | Required | Description |
571
- | ----------------------- | ------- | -------- | ------------------------------------------------------------ |
572
- | `path` | string | no | Base directory (default: root) |
573
- | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
574
- | `includeIgnored` | boolean | no | Include ignored items (node_modules, .git). Default: `false` |
575
- | `maxDepth` | integer | no | Max recursion depth (1-100) when pattern is provided |
576
- | `maxEntries` | integer | no | Max entries before truncation. Default: 1000, Max: 10000 |
577
- | `sortBy` | enum | no | `name` \| `size` \| `modified` \| `type`. Default: `name` |
578
- | `pattern` | string | no | Glob filter (e.g. `**/*.ts`) |
579
- | `includeSymlinkTargets` | boolean | no | Resolve symlink targets. Default: `false` |
580
- | `cursor` | string | no | Pagination cursor from a previous response |
580
+ | Parameter | Type | Required | Description |
581
+ | ----------------------- | ------- | -------- | --------------------------------------------------------------------------- |
582
+ | `path` | string | no | Base directory (default: root) |
583
+ | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
584
+ | `includeIgnored` | boolean | no | Include ignored items (node_modules, .git). Default: `false` |
585
+ | `maxDepth` | integer | no | Max recursion depth (1-100) when pattern is provided |
586
+ | `maxEntries` | integer | no | Max entries before truncation. Default: 1000, Max: 10000 |
587
+ | `sortBy` | enum | no | `name` \| `size` \| `modified` \| `type`. Default: `name` |
588
+ | `pattern` | string | no | Relative glob filter (e.g. `**/*.ts`). Absolute paths and `..` are rejected |
589
+ | `includeSymlinkTargets` | boolean | no | Resolve symlink targets. Default: `false` |
590
+ | `cursor` | string | no | Pagination cursor from a previous response |
581
591
 
582
592
  ---
583
593
 
@@ -585,16 +595,16 @@ List immediate directory contents: name, path, type, size, modified date.
585
595
 
586
596
  Find files by glob pattern. Returns matching files with metadata.
587
597
 
588
- | Parameter | Type | Required | Description |
589
- | ---------------- | ------- | -------- | --------------------------------------------------------- |
590
- | `path` | string | no | Base directory (default: root) |
591
- | `pattern` | string | **yes** | Glob pattern (e.g. `**/*.ts`) |
592
- | `maxResults` | integer | no | Max results (1-100000). Default: 1000 |
593
- | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
594
- | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
595
- | `sortBy` | enum | no | `path` \| `name` \| `size` \| `modified`. Default: `path` |
596
- | `maxDepth` | integer | no | Max directory depth (0-1000) |
597
- | `cursor` | string | no | Pagination cursor |
598
+ | Parameter | Type | Required | Description |
599
+ | ---------------- | ------- | -------- | ---------------------------------------------------------------------------- |
600
+ | `path` | string | no | Base directory (default: root) |
601
+ | `pattern` | string | **yes** | Relative glob pattern (e.g. `**/*.ts`). Absolute paths and `..` are rejected |
602
+ | `maxResults` | integer | no | Max results (1-100000). Default: 1000 |
603
+ | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
604
+ | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
605
+ | `sortBy` | enum | no | `path` \| `name` \| `size` \| `modified`. Default: `path` |
606
+ | `maxDepth` | integer | no | Max directory depth (0-1000) |
607
+ | `cursor` | string | no | Pagination cursor |
598
608
 
599
609
  ---
600
610
 
@@ -602,26 +612,29 @@ Find files by glob pattern. Returns matching files with metadata.
602
612
 
603
613
  Render a directory tree with bounded recursion. Returns ASCII tree + structured JSON.
604
614
 
605
- | Parameter | Type | Required | Description |
606
- | ---------------- | ------- | -------- | ------------------------------------------------- |
607
- | `path` | string | no | Base directory (default: root) |
608
- | `maxDepth` | integer | no | Depth (0 = root node only). Default: 10, Max: 100 |
609
- | `maxEntries` | integer | no | Max entries. Default: 5000, Max: 100000 |
610
- | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
611
- | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
615
+ | Parameter | Type | Required | Description |
616
+ | ---------------- | ------- | -------- | ---------------------------------------------------- |
617
+ | `path` | string | no | Base directory (default: root) |
618
+ | `maxDepth` | integer | no | Depth (0 = root node only). Default: 10, Max: 100 |
619
+ | `maxEntries` | integer | no | Max entries. Default: 5000, Max: 100000 |
620
+ | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
621
+ | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
622
+ | `includeSizes` | boolean | no | Include file sizes in tree entries. Default: `false` |
612
623
 
613
624
  ---
614
625
 
615
626
  #### `read`
616
627
 
617
- Read text file contents. Use `head` to preview first N lines of large files.
628
+ Read text file contents. Use `head`/`tail` to preview first/last N lines of large files.
618
629
 
619
- | Parameter | Type | Required | Description |
620
- | ----------- | ------- | -------- | --------------------------------------------------- |
621
- | `path` | string | **yes** | Absolute path to file |
622
- | `head` | integer | no | Read first N lines (1-100000) |
623
- | `startLine` | integer | no | Start line (1-based, inclusive) |
624
- | `endLine` | integer | no | End line (1-based, inclusive). Requires `startLine` |
630
+ | Parameter | Type | Required | Description |
631
+ | ------------- | ------- | -------- | ----------------------------------------------------------- |
632
+ | `path` | string | **yes** | Absolute path to file |
633
+ | `head` | integer | no | Read first N lines (1-100000) |
634
+ | `tail` | integer | no | Read last N lines (1-100000) |
635
+ | `startLine` | integer | no | Start line (1-based, inclusive) |
636
+ | `endLine` | integer | no | End line (1-based, inclusive). Requires `startLine` |
637
+ | `includeHash` | boolean | no | Include SHA-256 hash of full file content. Default: `false` |
625
638
 
626
639
  ---
627
640
 
@@ -633,6 +646,7 @@ Read multiple text files in one request.
633
646
  | ----------- | -------- | -------- | ------------------------------- |
634
647
  | `paths` | string[] | **yes** | Files to read (1-100 paths) |
635
648
  | `head` | integer | no | Read first N lines of each file |
649
+ | `tail` | integer | no | Read last N lines of each file |
636
650
  | `startLine` | integer | no | Start line (1-based) per file |
637
651
  | `endLine` | integer | no | End line (1-based) per file |
638
652
 
@@ -662,18 +676,18 @@ Get metadata for multiple files/directories in one request.
662
676
 
663
677
  Search file contents (grep-like). Returns matching lines with optional context.
664
678
 
665
- | Parameter | Type | Required | Description |
666
- | ---------------- | ------- | -------- | ------------------------------------------------ |
667
- | `path` | string | no | Base directory (default: root) |
668
- | `pattern` | string | **yes** | Search text or RE2 regex when `isRegex=true` |
669
- | `isRegex` | boolean | no | Treat pattern as RE2 regex. Default: `false` |
670
- | `caseSensitive` | boolean | no | Case-sensitive matching. Default: `false` |
671
- | `wholeWord` | boolean | no | Match whole words only. Default: `false` |
672
- | `contextLines` | integer | no | Lines of context before/after (0-50). Default: 0 |
673
- | `maxResults` | integer | no | Max match rows (1-100000). Default: 100 |
674
- | `filePattern` | string | no | Glob for candidate files (e.g. `**/*.ts`) |
675
- | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
676
- | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
679
+ | Parameter | Type | Required | Description |
680
+ | ---------------- | ------- | -------- | ---------------------------------------------------------------------------------------- |
681
+ | `path` | string | no | Base directory (default: root) |
682
+ | `pattern` | string | **yes** | Search text or RE2 regex when `isRegex=true` |
683
+ | `isRegex` | boolean | no | Treat pattern as RE2 regex. Default: `false` |
684
+ | `caseSensitive` | boolean | no | Case-sensitive matching. Default: `false` |
685
+ | `wholeWord` | boolean | no | Match whole words only. Default: `false` |
686
+ | `contextLines` | integer | no | Lines of context before/after (0-50). Default: 0 |
687
+ | `maxResults` | integer | no | Max match rows (1-100000). Default: 100 |
688
+ | `filePattern` | string | no | Relative glob for candidate files (e.g. `**/*.ts`). Absolute paths and `..` are rejected |
689
+ | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
690
+ | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
677
691
 
678
692
  ---
679
693
 
@@ -706,7 +720,7 @@ Apply sequential literal string replacements (first occurrence per edit). Use `d
706
720
  | Parameter | Type | Required | Description |
707
721
  | ------------------ | ------- | -------- | ---------------------------------------------------------- |
708
722
  | `path` | string | **yes** | Absolute path to file |
709
- | `edits` | array | **yes** | List of `{oldText, newText}` replacements |
723
+ | `edits` | array | **yes** | List of non-empty `{oldText, newText}` replacements |
710
724
  | `dryRun` | boolean | no | Preview edits without writing. Default: `false` |
711
725
  | `ignoreWhitespace` | boolean | no | Treat whitespace sequences as equivalent. Default: `false` |
712
726
 
@@ -778,34 +792,39 @@ Apply a unified diff patch to one or more files. Single-file: throws on failure.
778
792
 
779
793
  Bulk search-and-replace across files matching a glob. Replaces **all** occurrences per file. Always `dryRun: true` first.
780
794
 
781
- | Parameter | Type | Required | Description |
782
- | ---------------- | ------- | -------- | --------------------------------------------------- |
783
- | `path` | string | no | Base directory (default: root) |
784
- | `filePattern` | string | **yes** | Glob pattern (e.g. `**/*.ts`) |
785
- | `searchPattern` | string | **yes** | Text to search. RE2 regex when `isRegex=true` |
786
- | `replacement` | string | **yes** | Replacement text. Supports `$1`, `$2` with regex |
787
- | `isRegex` | boolean | no | Treat as RE2 regex. Default: `false` |
788
- | `dryRun` | boolean | no | Preview matches with diff. Default: `false` |
789
- | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
790
- | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
791
- | `returnDiff` | boolean | no | Return diff even when not dry-run. Default: `false` |
795
+ | Parameter | Type | Required | Description |
796
+ | ---------------- | ------- | -------- | ---------------------------------------------------------------------------- |
797
+ | `path` | string | no | Base directory (default: root) |
798
+ | `filePattern` | string | **yes** | Relative glob pattern (e.g. `**/*.ts`). Absolute paths and `..` are rejected |
799
+ | `searchPattern` | string | **yes** | Text to search. RE2 regex when `isRegex=true` |
800
+ | `replacement` | string | **yes** | Replacement text. Supports `$1`, `$2` with regex |
801
+ | `isRegex` | boolean | no | Treat as RE2 regex. Default: `false` |
802
+ | `dryRun` | boolean | no | Preview matches with diff. Default: `false` |
803
+ | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
804
+ | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
805
+ | `returnDiff` | boolean | no | Return diff even when not dry-run. Default: `false` |
806
+ | `maxFiles` | integer | no | Max files to process before stopping (1-10000) |
807
+ | `caseSensitive` | boolean | no | Case-sensitive matching. Default: `true` |
792
808
 
793
809
  ### Resources
794
810
 
795
- | Resource | URI | MIME Type | Description |
796
- | ------------ | ------------------------------ | ------------- | ------------------------------------------------------------------ |
797
- | Instructions | `internal://instructions` | text/markdown | Comprehensive usage rules and guidelines |
798
- | Tool Catalog | `internal://tool-catalog` | text/markdown | Tool selection guide and data flow map |
799
- | Workflows | `internal://workflows` | text/markdown | Standard operating procedures for exploration, search, edit, patch |
800
- | Tool Info | `internal://tool-info/{name}` | text/markdown | Per-tool contract details, nuances, gotchas |
801
- | Result Cache | `filesystem-mcp://result/{id}` | text/markdown | Ephemeral cached tool output (large results externalized here) |
802
- | Metrics | `filesystem-mcp://metrics` | text/markdown | Live per-tool call/error/avgDurationMs snapshot |
811
+ | Resource | URI | MIME Type | Description |
812
+ | ------------ | ------------------------------ | ---------------- | ------------------------------------------------------------------ |
813
+ | Instructions | `internal://instructions` | text/markdown | Comprehensive usage rules and guidelines |
814
+ | Tool Catalog | `internal://tool-catalog` | text/markdown | Tool selection guide and data flow map |
815
+ | Workflows | `internal://workflows` | text/markdown | Standard operating procedures for exploration, search, edit, patch |
816
+ | Tool Info | `internal://tool-info/{name}` | text/markdown | Per-tool contract details, nuances, gotchas |
817
+ | Result Cache | `filesystem-mcp://result/{id}` | text/plain | Ephemeral cached tool output (large results externalized here) |
818
+ | Metrics | `filesystem-mcp://metrics` | application/json | Live per-tool call/error/avgDurationMs snapshot |
803
819
 
804
820
  ### Prompts
805
821
 
806
- | Prompt | Arguments | Description |
807
- | ---------- | ------------------ | ---------------------------------------------------------------------- |
808
- | `get-help` | `topic` (optional) | Return usage instructions. Optionally filter by section heading prefix |
822
+ | Prompt | Arguments | Description |
823
+ | --------------- | ---------------------- | ---------------------------------------------------------------------- |
824
+ | `get-help` | `topic` (optional) | Return usage instructions. Optionally filter by section heading prefix |
825
+ | `compare-files` | `original`, `modified` | Generate a workflow for comparing two files using `diff_files` |
826
+ | `analyze-path` | `path` | Generate a workflow for analyzing a file or directory |
827
+ | `get-tool-help` | `name` | Return a prompt with the authoritative contract for a specific tool |
809
828
 
810
829
  ## MCP Capabilities
811
830
 
@@ -814,8 +833,8 @@ Bulk search-and-replace across files matching a glob. Replaces **all** occurrenc
814
833
  | `logging` | confirmed | `src/server/bootstrap.ts` — registered in capabilities |
815
834
  | `resources` | confirmed | `src/server/bootstrap.ts` — 6 resources registered |
816
835
  | `tools` | confirmed | `src/server/bootstrap.ts` — 18 tools registered |
817
- | `prompts` | confirmed | `src/server/bootstrap.ts` — `get-help` prompt registered |
818
- | `completions` | confirmed | `src/completions.ts` — path + topic auto-completion |
836
+ | `prompts` | confirmed | `src/server/bootstrap.ts` — 4 prompts registered |
837
+ | `completions` | confirmed | `src/completions.ts` — path, topic, and tool-name auto-completion |
819
838
  | `tasks` | confirmed | `src/server/bootstrap.ts` — optional task support (list, cancel, requests) |
820
839
 
821
840
  ### Tool Annotations
@@ -881,18 +900,16 @@ When started with `--port <number>`, the server exposes a single MCP endpoint:
881
900
 
882
901
  ## Development
883
902
 
884
- | Script | Command | Purpose |
885
- | ------------ | --------------------------------------------------------- | --------------------------------- |
886
- | `dev` | `tsc --watch` | Watch mode TypeScript compilation |
887
- | `dev:run` | `node --env-file=.env --watch dist/index.js` | Run server with auto-reload |
888
- | `start` | `node dist/index.js` | Run production server |
889
- | `build` | `node scripts/tasks.mjs build` | Clean build |
890
- | `test` | `node scripts/tasks.mjs test` | Build + run all tests |
891
- | `test:fast` | `node --test --import tsx/esm src/__tests__/**/*.test.ts` | Run tests without build |
892
- | `lint` | `eslint .` | Lint source |
893
- | `type-check` | `node scripts/tasks.mjs type-check` | Type-check src + tests |
894
- | `format` | `prettier --write .` | Format code |
895
- | `inspector` | `npm run build && npx @modelcontextprotocol/inspector` | Launch MCP Inspector |
903
+ - `dev` `tsc --watch --preserveWatchOutput` — Watch mode TypeScript compilation
904
+ - `dev:run` `node --env-file=.env --watch dist/index.js` — Run server with auto-reload
905
+ - `start` `node dist/index.js` Run production server
906
+ - `build` `node scripts/tasks.mjs build` Clean build
907
+ - `test` `node scripts/tasks.mjs test` Build + run all tests
908
+ - `test:fast` `node --test --import tsx/esm src/__tests__/**/*.test.ts node-tests/**/*.test.ts` Run tests without build
909
+ - `lint` `eslint .` Lint source
910
+ - `type-check` `node scripts/tasks.mjs type-check` Type-check src + tests
911
+ - `format` `prettier --write .` Format code
912
+ - `inspector` `npm run build && npx -y @modelcontextprotocol/inspector node dist/index.js ${workspaceFolder}` Launch MCP Inspector
896
913
 
897
914
  ## Build and Release
898
915
 
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as fs from 'node:fs/promises';
1
+ import { stat } from 'node:fs/promises';
2
2
  import { getSystemErrorMessage, getSystemErrorName } from 'node:util';
3
3
  import { Command, CommanderError, InvalidArgumentError } from 'commander';
4
4
  import { processInParallel } from './lib/fs-helpers.js';
@@ -83,7 +83,7 @@ function assertDirectory(stats, inputPath) {
83
83
  async function validateDirectoryPath(inputPath) {
84
84
  const normalized = normalizePath(inputPath);
85
85
  try {
86
- const stats = await fs.stat(normalized);
86
+ const stats = await stat(normalized);
87
87
  assertDirectory(stats, inputPath);
88
88
  return normalized;
89
89
  }