@j0hanz/filesystem-context-mcp 1.3.0 → 1.3.2
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.
- package/README.md +251 -504
- package/dist/__tests__/lib/file-operations/search-content-edge-cases.test.js +1 -1
- package/dist/__tests__/lib/file-operations/search-content-edge-cases.test.js.map +1 -1
- package/dist/__tests__/lib/file-operations/search-definitions-helpers.test.d.ts +2 -0
- package/dist/__tests__/lib/file-operations/search-definitions-helpers.test.d.ts.map +1 -0
- package/dist/__tests__/lib/file-operations/search-definitions-helpers.test.js +43 -0
- package/dist/__tests__/lib/file-operations/search-definitions-helpers.test.js.map +1 -0
- package/dist/__tests__/lib/file-operations/search-definitions.fixtures.d.ts +7 -0
- package/dist/__tests__/lib/file-operations/search-definitions.fixtures.d.ts.map +1 -0
- package/dist/__tests__/lib/file-operations/search-definitions.fixtures.js +113 -0
- package/dist/__tests__/lib/file-operations/search-definitions.fixtures.js.map +1 -0
- package/dist/__tests__/lib/file-operations/search-definitions.test.js +1 -112
- package/dist/__tests__/lib/file-operations/search-definitions.test.js.map +1 -1
- package/dist/__tests__/lib/file-operations/sorting.test.js +15 -40
- package/dist/__tests__/lib/file-operations/sorting.test.js.map +1 -1
- package/dist/__tests__/lib/path-validation-errors.test.js +1 -1
- package/dist/__tests__/lib/path-validation-errors.test.js.map +1 -1
- package/dist/__tests__/lib/path-validation.test.js +17 -0
- package/dist/__tests__/lib/path-validation.test.js.map +1 -1
- package/dist/config/formatting.d.ts +14 -0
- package/dist/config/formatting.d.ts.map +1 -0
- package/dist/config/formatting.js +34 -0
- package/dist/config/formatting.js.map +1 -0
- package/dist/config/types.d.ts +3 -97
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/dist/instructions.md +151 -170
- package/dist/lib/constants.d.ts +1 -5
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +19 -15
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/errors.d.ts +0 -2
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +2 -30
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/file-operations/analyze-directory.d.ts.map +1 -1
- package/dist/lib/file-operations/analyze-directory.js +8 -1
- package/dist/lib/file-operations/analyze-directory.js.map +1 -1
- package/dist/lib/file-operations/batch-results.d.ts +2 -1
- package/dist/lib/file-operations/batch-results.d.ts.map +1 -1
- package/dist/lib/file-operations/compute-checksums.d.ts +1 -0
- package/dist/lib/file-operations/compute-checksums.d.ts.map +1 -1
- package/dist/lib/file-operations/compute-checksums.js +58 -45
- package/dist/lib/file-operations/compute-checksums.js.map +1 -1
- package/dist/lib/file-operations/directory-tree-builders.d.ts +7 -0
- package/dist/lib/file-operations/directory-tree-builders.d.ts.map +1 -0
- package/dist/lib/file-operations/directory-tree-builders.js +58 -0
- package/dist/lib/file-operations/directory-tree-builders.js.map +1 -0
- package/dist/lib/file-operations/directory-tree-helpers.d.ts +0 -5
- package/dist/lib/file-operations/directory-tree-helpers.d.ts.map +1 -1
- package/dist/lib/file-operations/directory-tree-helpers.js +21 -71
- package/dist/lib/file-operations/directory-tree-helpers.js.map +1 -1
- package/dist/lib/file-operations/directory-tree.d.ts.map +1 -1
- package/dist/lib/file-operations/directory-tree.js +2 -1
- package/dist/lib/file-operations/directory-tree.js.map +1 -1
- package/dist/lib/file-operations/file-info.d.ts +3 -1
- package/dist/lib/file-operations/file-info.d.ts.map +1 -1
- package/dist/lib/file-operations/file-info.js +16 -5
- package/dist/lib/file-operations/file-info.js.map +1 -1
- package/dist/lib/file-operations/get-multiple-file-info.d.ts +1 -1
- package/dist/lib/file-operations/get-multiple-file-info.d.ts.map +1 -1
- package/dist/lib/file-operations/get-multiple-file-info.js +6 -8
- package/dist/lib/file-operations/get-multiple-file-info.js.map +1 -1
- package/dist/lib/file-operations/list-directory-entry.d.ts.map +1 -1
- package/dist/lib/file-operations/list-directory-entry.js +5 -2
- package/dist/lib/file-operations/list-directory-entry.js.map +1 -1
- package/dist/lib/file-operations/list-directory-helpers.d.ts +10 -1
- package/dist/lib/file-operations/list-directory-helpers.d.ts.map +1 -1
- package/dist/lib/file-operations/list-directory-helpers.js +51 -31
- package/dist/lib/file-operations/list-directory-helpers.js.map +1 -1
- package/dist/lib/file-operations/list-directory.d.ts +1 -0
- package/dist/lib/file-operations/list-directory.d.ts.map +1 -1
- package/dist/lib/file-operations/list-directory.js +13 -4
- package/dist/lib/file-operations/list-directory.js.map +1 -1
- package/dist/lib/file-operations/read-media-file.d.ts.map +1 -1
- package/dist/lib/file-operations/read-media-file.js +5 -1
- package/dist/lib/file-operations/read-media-file.js.map +1 -1
- package/dist/lib/file-operations/read-multiple-files.d.ts +8 -0
- package/dist/lib/file-operations/read-multiple-files.d.ts.map +1 -1
- package/dist/lib/file-operations/read-multiple-files.js +47 -18
- package/dist/lib/file-operations/read-multiple-files.js.map +1 -1
- package/dist/lib/file-operations/search/context-manager.d.ts +2 -0
- package/dist/lib/file-operations/search/context-manager.d.ts.map +1 -1
- package/dist/lib/file-operations/search/context-manager.js +22 -8
- package/dist/lib/file-operations/search/context-manager.js.map +1 -1
- package/dist/lib/file-operations/search/engine-stream.d.ts +1 -1
- package/dist/lib/file-operations/search/engine-stream.d.ts.map +1 -1
- package/dist/lib/file-operations/search/engine-stream.js +102 -9
- package/dist/lib/file-operations/search/engine-stream.js.map +1 -1
- package/dist/lib/file-operations/search/engine.d.ts.map +1 -1
- package/dist/lib/file-operations/search/engine.js +42 -5
- package/dist/lib/file-operations/search/engine.js.map +1 -1
- package/dist/lib/file-operations/search/file-processor.d.ts.map +1 -1
- package/dist/lib/file-operations/search/file-processor.js +102 -55
- package/dist/lib/file-operations/search/file-processor.js.map +1 -1
- package/dist/lib/file-operations/search/match-strategy.d.ts.map +1 -1
- package/dist/lib/file-operations/search/match-strategy.js +2 -1
- package/dist/lib/file-operations/search/match-strategy.js.map +1 -1
- package/dist/lib/file-operations/search/types.d.ts +3 -0
- package/dist/lib/file-operations/search/types.d.ts.map +1 -1
- package/dist/lib/file-operations/search-definitions/matchers.d.ts +12 -0
- package/dist/lib/file-operations/search-definitions/matchers.d.ts.map +1 -0
- package/dist/lib/file-operations/search-definitions/matchers.js +122 -0
- package/dist/lib/file-operations/search-definitions/matchers.js.map +1 -0
- package/dist/lib/file-operations/search-definitions/patterns.d.ts +14 -0
- package/dist/lib/file-operations/search-definitions/patterns.d.ts.map +1 -0
- package/dist/lib/file-operations/search-definitions/patterns.js +83 -0
- package/dist/lib/file-operations/search-definitions/patterns.js.map +1 -0
- package/dist/lib/file-operations/search-definitions.d.ts.map +1 -1
- package/dist/lib/file-operations/search-definitions.js +3 -208
- package/dist/lib/file-operations/search-definitions.js.map +1 -1
- package/dist/lib/file-operations/search-files-helpers.d.ts +2 -2
- package/dist/lib/file-operations/search-files-helpers.d.ts.map +1 -1
- package/dist/lib/file-operations/search-files-helpers.js +102 -14
- package/dist/lib/file-operations/search-files-helpers.js.map +1 -1
- package/dist/lib/file-operations/search-files-options.d.ts +4 -2
- package/dist/lib/file-operations/search-files-options.d.ts.map +1 -1
- package/dist/lib/file-operations/search-files-options.js.map +1 -1
- package/dist/lib/file-operations/search-files.d.ts.map +1 -1
- package/dist/lib/file-operations/search-files.js +7 -2
- package/dist/lib/file-operations/search-files.js.map +1 -1
- package/dist/lib/file-operations/sorting.d.ts.map +1 -1
- package/dist/lib/file-operations/sorting.js +39 -14
- package/dist/lib/file-operations/sorting.js.map +1 -1
- package/dist/lib/file-operations.d.ts +0 -5
- package/dist/lib/file-operations.d.ts.map +1 -1
- package/dist/lib/file-operations.js +0 -5
- package/dist/lib/file-operations.js.map +1 -1
- package/dist/lib/fs-helpers/abort.d.ts +3 -0
- package/dist/lib/fs-helpers/abort.d.ts.map +1 -0
- package/dist/lib/fs-helpers/abort.js +15 -0
- package/dist/lib/fs-helpers/abort.js.map +1 -0
- package/dist/lib/fs-helpers/concurrency.d.ts +1 -1
- package/dist/lib/fs-helpers/concurrency.d.ts.map +1 -1
- package/dist/lib/fs-helpers/concurrency.js +54 -6
- package/dist/lib/fs-helpers/concurrency.js.map +1 -1
- package/dist/lib/fs-helpers/readers/head-file.d.ts +1 -1
- package/dist/lib/fs-helpers/readers/head-file.d.ts.map +1 -1
- package/dist/lib/fs-helpers/readers/head-file.js +7 -4
- package/dist/lib/fs-helpers/readers/head-file.js.map +1 -1
- package/dist/lib/fs-helpers/readers/line-range.d.ts +1 -1
- package/dist/lib/fs-helpers/readers/line-range.d.ts.map +1 -1
- package/dist/lib/fs-helpers/readers/line-range.js +17 -3
- package/dist/lib/fs-helpers/readers/line-range.js.map +1 -1
- package/dist/lib/fs-helpers/readers/read-buffer.d.ts +2 -0
- package/dist/lib/fs-helpers/readers/read-buffer.d.ts.map +1 -0
- package/dist/lib/fs-helpers/readers/read-buffer.js +64 -0
- package/dist/lib/fs-helpers/readers/read-buffer.js.map +1 -0
- package/dist/lib/fs-helpers/readers/read-file-content.d.ts +11 -1
- package/dist/lib/fs-helpers/readers/read-file-content.d.ts.map +1 -1
- package/dist/lib/fs-helpers/readers/read-file-content.js +33 -9
- package/dist/lib/fs-helpers/readers/read-file-content.js.map +1 -1
- package/dist/lib/fs-helpers/readers/read-file.d.ts +11 -0
- package/dist/lib/fs-helpers/readers/read-file.d.ts.map +1 -1
- package/dist/lib/fs-helpers/readers/read-file.js +52 -15
- package/dist/lib/fs-helpers/readers/read-file.js.map +1 -1
- package/dist/lib/fs-helpers/readers/tail-file.d.ts +1 -1
- package/dist/lib/fs-helpers/readers/tail-file.d.ts.map +1 -1
- package/dist/lib/fs-helpers/readers/tail-file.js +7 -4
- package/dist/lib/fs-helpers/readers/tail-file.js.map +1 -1
- package/dist/lib/fs-helpers/readers.d.ts +1 -1
- package/dist/lib/fs-helpers/readers.d.ts.map +1 -1
- package/dist/lib/fs-helpers/readers.js +1 -1
- package/dist/lib/fs-helpers/readers.js.map +1 -1
- package/dist/lib/fs-helpers.d.ts +1 -1
- package/dist/lib/fs-helpers.d.ts.map +1 -1
- package/dist/lib/fs-helpers.js +1 -1
- package/dist/lib/fs-helpers.js.map +1 -1
- package/dist/lib/path-utils.d.ts +1 -0
- package/dist/lib/path-utils.d.ts.map +1 -1
- package/dist/lib/path-utils.js +12 -0
- package/dist/lib/path-utils.js.map +1 -1
- package/dist/lib/path-validation/allowed-directories.d.ts.map +1 -1
- package/dist/lib/path-validation/allowed-directories.js +2 -9
- package/dist/lib/path-validation/allowed-directories.js.map +1 -1
- package/dist/lib/path-validation/errors.js +2 -2
- package/dist/lib/path-validation/errors.js.map +1 -1
- package/dist/lib/path-validation/validators.d.ts.map +1 -1
- package/dist/lib/path-validation/validators.js +3 -1
- package/dist/lib/path-validation/validators.js.map +1 -1
- package/dist/schemas/common.d.ts +0 -18
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/schemas/common.js +0 -10
- package/dist/schemas/common.js.map +1 -1
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +2 -2
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/input-helpers.d.ts +1 -4
- package/dist/schemas/input-helpers.d.ts.map +1 -1
- package/dist/schemas/input-helpers.js +9 -33
- package/dist/schemas/input-helpers.js.map +1 -1
- package/dist/schemas/inputs/checksums.d.ts +0 -2
- package/dist/schemas/inputs/checksums.d.ts.map +1 -1
- package/dist/schemas/inputs/checksums.js +2 -7
- package/dist/schemas/inputs/checksums.js.map +1 -1
- package/dist/schemas/inputs/directory.d.ts +0 -16
- package/dist/schemas/inputs/directory.d.ts.map +1 -1
- package/dist/schemas/inputs/directory.js +2 -44
- package/dist/schemas/inputs/directory.js.map +1 -1
- package/dist/schemas/inputs/read.d.ts +0 -4
- package/dist/schemas/inputs/read.d.ts.map +1 -1
- package/dist/schemas/inputs/read.js +0 -15
- package/dist/schemas/inputs/read.js.map +1 -1
- package/dist/schemas/inputs/search.d.ts +1 -12
- package/dist/schemas/inputs/search.d.ts.map +1 -1
- package/dist/schemas/inputs/search.js +4 -30
- package/dist/schemas/inputs/search.js.map +1 -1
- package/dist/schemas/inputs.d.ts +3 -4
- package/dist/schemas/inputs.d.ts.map +1 -1
- package/dist/schemas/inputs.js +3 -4
- package/dist/schemas/inputs.js.map +1 -1
- package/dist/schemas/output-helpers.d.ts +59 -0
- package/dist/schemas/output-helpers.d.ts.map +1 -1
- package/dist/schemas/output-helpers.js +31 -0
- package/dist/schemas/output-helpers.js.map +1 -1
- package/dist/schemas/outputs/checksums.d.ts +4 -4
- package/dist/schemas/outputs/checksums.d.ts.map +1 -1
- package/dist/schemas/outputs/checksums.js +2 -7
- package/dist/schemas/outputs/checksums.js.map +1 -1
- package/dist/schemas/outputs/directory.d.ts +68 -230
- package/dist/schemas/outputs/directory.d.ts.map +1 -1
- package/dist/schemas/outputs/directory.js +14 -32
- package/dist/schemas/outputs/directory.js.map +1 -1
- package/dist/schemas/outputs/file-info.d.ts +14 -14
- package/dist/schemas/outputs/file-info.d.ts.map +1 -1
- package/dist/schemas/outputs/file-info.js +4 -31
- package/dist/schemas/outputs/file-info.js.map +1 -1
- package/dist/schemas/outputs/read.d.ts +141 -46
- package/dist/schemas/outputs/read.d.ts.map +1 -1
- package/dist/schemas/outputs/read.js +35 -12
- package/dist/schemas/outputs/read.js.map +1 -1
- package/dist/schemas/outputs/search.d.ts +134 -124
- package/dist/schemas/outputs/search.d.ts.map +1 -1
- package/dist/schemas/outputs/search.js +33 -35
- package/dist/schemas/outputs/search.js.map +1 -1
- package/dist/schemas/outputs.d.ts +3 -4
- package/dist/schemas/outputs.d.ts.map +1 -1
- package/dist/schemas/outputs.js +3 -4
- package/dist/schemas/outputs.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -1
- package/dist/server.js.map +1 -1
- package/dist/tools/analyze-directory.d.ts.map +1 -1
- package/dist/tools/analyze-directory.js +26 -28
- package/dist/tools/analyze-directory.js.map +1 -1
- package/dist/tools/compute-checksums.d.ts.map +1 -1
- package/dist/tools/compute-checksums.js +13 -21
- package/dist/tools/compute-checksums.js.map +1 -1
- package/dist/tools/directory-tree.d.ts.map +1 -1
- package/dist/tools/directory-tree.js +11 -9
- package/dist/tools/directory-tree.js.map +1 -1
- package/dist/tools/get-file-info.d.ts.map +1 -1
- package/dist/tools/get-file-info.js +8 -44
- package/dist/tools/get-file-info.js.map +1 -1
- package/dist/tools/get-multiple-file-info.d.ts.map +1 -1
- package/dist/tools/get-multiple-file-info.js +13 -55
- package/dist/tools/get-multiple-file-info.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +0 -10
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/list-allowed-dirs.d.ts.map +1 -1
- package/dist/tools/list-allowed-dirs.js +37 -31
- package/dist/tools/list-allowed-dirs.js.map +1 -1
- package/dist/tools/list-directory.d.ts.map +1 -1
- package/dist/tools/list-directory.js +83 -83
- package/dist/tools/list-directory.js.map +1 -1
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +66 -43
- package/dist/tools/read-file.js.map +1 -1
- package/dist/tools/read-media-file.d.ts.map +1 -1
- package/dist/tools/read-media-file.js +8 -6
- package/dist/tools/read-media-file.js.map +1 -1
- package/dist/tools/read-multiple-files.d.ts.map +1 -1
- package/dist/tools/read-multiple-files.js +64 -25
- package/dist/tools/read-multiple-files.js.map +1 -1
- package/dist/tools/search-content.d.ts.map +1 -1
- package/dist/tools/search-content.js +14 -16
- package/dist/tools/search-content.js.map +1 -1
- package/dist/tools/search-definitions.d.ts.map +1 -1
- package/dist/tools/search-definitions.js +11 -8
- package/dist/tools/search-definitions.js.map +1 -1
- package/dist/tools/search-files.d.ts.map +1 -1
- package/dist/tools/search-files.js +61 -45
- package/dist/tools/search-files.js.map +1 -1
- package/dist/tools/shared/abort.d.ts +5 -0
- package/dist/tools/shared/abort.d.ts.map +1 -0
- package/dist/tools/shared/abort.js +41 -0
- package/dist/tools/shared/abort.js.map +1 -0
- package/dist/tools/shared/file-info.d.ts +17 -0
- package/dist/tools/shared/file-info.d.ts.map +1 -0
- package/dist/tools/shared/file-info.js +40 -0
- package/dist/tools/shared/file-info.js.map +1 -0
- package/dist/tools/shared/formatting.d.ts +5 -0
- package/dist/tools/shared/formatting.d.ts.map +1 -1
- package/dist/tools/shared/formatting.js +21 -1
- package/dist/tools/shared/formatting.js.map +1 -1
- package/dist/tools/shared/read-range.d.ts +7 -0
- package/dist/tools/shared/read-range.d.ts.map +1 -0
- package/dist/tools/shared/read-range.js +22 -0
- package/dist/tools/shared/read-range.js.map +1 -0
- package/dist/tools/shared/search-formatting.d.ts.map +1 -1
- package/dist/tools/shared/search-formatting.js +53 -28
- package/dist/tools/shared/search-formatting.js.map +1 -1
- package/dist/tools/tool-response.d.ts +22 -0
- package/dist/tools/tool-response.d.ts.map +1 -1
- package/dist/tools/tool-response.js +30 -0
- package/dist/tools/tool-response.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Filesystem Context MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="docs/logo.png" alt="Filesystem Context MCP Server Logo" width="125">
|
|
4
4
|
|
|
5
5
|
A secure, read-only MCP server for filesystem scanning, searching, and analysis with comprehensive security validation.
|
|
6
6
|
|
|
@@ -16,56 +16,49 @@ A secure, read-only MCP server for filesystem scanning, searching, and analysis
|
|
|
16
16
|
|
|
17
17
|
[](https://cursor.com/install-mcp?name=filesystem-context&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovZmlsZXN5c3RlbS1jb250ZXh0LW1jcEBsYXRlc3QiLCIke3dvcmtzcGFjZUZvbGRlcn0iXX0=)
|
|
18
18
|
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
| Batch get file metadata | `get_multiple_file_info` |
|
|
47
|
-
| Compute file checksums/hashes | `compute_checksums` |
|
|
48
|
-
| Read images or binary files | `read_media_file` |
|
|
49
|
-
| Check available directories | `list_allowed_directories` |
|
|
50
|
-
|
|
51
|
-
## 🚀 Quick Start
|
|
52
|
-
|
|
53
|
-
### NPX (Recommended - Zero Config)
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- Directory listing with recursive support
|
|
22
|
+
- File search with glob patterns
|
|
23
|
+
- Content search with regex and context lines
|
|
24
|
+
- File reading with head/tail/line ranges
|
|
25
|
+
- Batch reads and metadata lookups in parallel
|
|
26
|
+
- Security: path validation, symlink escape protection, read-only operations
|
|
27
|
+
|
|
28
|
+
## When to Use
|
|
29
|
+
|
|
30
|
+
| Task | Tool |
|
|
31
|
+
| ------------------------------- | -------------------------- |
|
|
32
|
+
| Explore project structure | `list_directory` |
|
|
33
|
+
| Find specific file types | `search_files` |
|
|
34
|
+
| Search for code patterns/text | `search_content` |
|
|
35
|
+
| Read source code | `read_file` |
|
|
36
|
+
| Batch read multiple files | `read_multiple_files` |
|
|
37
|
+
| Get file metadata (size, dates) | `get_file_info` |
|
|
38
|
+
| Batch get file metadata | `get_multiple_file_info` |
|
|
39
|
+
| Check available directories | `list_allowed_directories` |
|
|
40
|
+
|
|
41
|
+
## Quick Start
|
|
42
|
+
|
|
43
|
+
### NPX (recommended)
|
|
44
|
+
|
|
45
|
+
Allow the current working directory explicitly:
|
|
54
46
|
|
|
55
47
|
```bash
|
|
56
|
-
|
|
57
|
-
npx -y @j0hanz/filesystem-context-mcp@latest
|
|
48
|
+
npx -y @j0hanz/filesystem-context-mcp@latest --allow-cwd
|
|
58
49
|
```
|
|
59
50
|
|
|
60
|
-
Or
|
|
51
|
+
Or pass explicit directories:
|
|
61
52
|
|
|
62
53
|
```bash
|
|
63
|
-
npx -y @j0hanz/filesystem-context-mcp@latest /path/to/
|
|
54
|
+
npx -y @j0hanz/filesystem-context-mcp@latest /path/to/project /path/to/docs
|
|
64
55
|
```
|
|
65
56
|
|
|
66
|
-
|
|
57
|
+
If your MCP client supports the Roots protocol, you can omit directory arguments and let the client provide allowed directories. Otherwise, pass explicit directories or use `--allow-cwd`.
|
|
58
|
+
|
|
59
|
+
### VS Code (workspace folder)
|
|
67
60
|
|
|
68
|
-
Add to
|
|
61
|
+
Add to `.vscode/mcp.json`:
|
|
69
62
|
|
|
70
63
|
```json
|
|
71
64
|
{
|
|
@@ -82,41 +75,22 @@ Add to your VS Code settings (`.vscode/mcp.json`):
|
|
|
82
75
|
}
|
|
83
76
|
```
|
|
84
77
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
### Claude Desktop
|
|
88
|
-
|
|
89
|
-
Add to your Claude Desktop configuration (`claude_desktop_config.json`):
|
|
90
|
-
|
|
91
|
-
```json
|
|
92
|
-
{
|
|
93
|
-
"mcpServers": {
|
|
94
|
-
"filesystem-context": {
|
|
95
|
-
"command": "npx",
|
|
96
|
-
"args": ["-y", "@j0hanz/filesystem-context-mcp@latest"]
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
> **Note:** Claude Desktop will use the current working directory automatically. No path arguments needed!
|
|
103
|
-
|
|
104
|
-
## 📦 Installation
|
|
78
|
+
## Installation
|
|
105
79
|
|
|
106
|
-
### NPX (
|
|
80
|
+
### NPX (no install)
|
|
107
81
|
|
|
108
82
|
```bash
|
|
109
83
|
npx -y @j0hanz/filesystem-context-mcp@latest /path/to/dir1 /path/to/dir2
|
|
110
84
|
```
|
|
111
85
|
|
|
112
|
-
### Global
|
|
86
|
+
### Global installation
|
|
113
87
|
|
|
114
88
|
```bash
|
|
115
89
|
npm install -g @j0hanz/filesystem-context-mcp
|
|
116
90
|
filesystem-context-mcp /path/to/your/project
|
|
117
91
|
```
|
|
118
92
|
|
|
119
|
-
### From
|
|
93
|
+
### From source
|
|
120
94
|
|
|
121
95
|
```bash
|
|
122
96
|
git clone https://github.com/j0hanz/filesystem-context-mcp-server.git
|
|
@@ -126,89 +100,83 @@ npm run build
|
|
|
126
100
|
node dist/index.js /path/to/your/project
|
|
127
101
|
```
|
|
128
102
|
|
|
129
|
-
##
|
|
103
|
+
## Directory Access and Resolution
|
|
130
104
|
|
|
131
|
-
|
|
105
|
+
Access is always restricted to explicitly allowed directories.
|
|
132
106
|
|
|
133
|
-
|
|
107
|
+
1. CLI directories are validated and added first (if provided).
|
|
108
|
+
2. `--allow-cwd` optionally adds the current working directory.
|
|
109
|
+
3. MCP Roots from the client are used next:
|
|
110
|
+
- If CLI and/or `--allow-cwd` are provided, only roots inside those baseline directories are accepted.
|
|
111
|
+
- If no baseline is provided, roots become the allowed directories.
|
|
112
|
+
4. If nothing is configured and the client provides no roots, the server has no access and logs a warning.
|
|
134
113
|
|
|
135
|
-
|
|
136
|
-
2. **MCP Roots Protocol** - Directories provided by the MCP client
|
|
137
|
-
3. **Current Working Directory** - Automatic fallback for plug-and-play experience
|
|
114
|
+
Notes:
|
|
138
115
|
|
|
139
|
-
|
|
116
|
+
- Windows drive-relative paths like `C:path` are rejected. Use `C:\path` or `C:/path`.
|
|
117
|
+
- Reserved Windows device names (e.g., `CON`, `NUL`) are blocked.
|
|
140
118
|
|
|
141
|
-
|
|
119
|
+
## Configuration
|
|
142
120
|
|
|
143
|
-
|
|
121
|
+
All configuration is optional. Values are integers unless noted. Sizes are in bytes, timeouts in milliseconds.
|
|
144
122
|
|
|
145
|
-
|
|
146
|
-
filesystem-context-mcp /home/user/project /home/user/docs
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### MCP Roots Protocol
|
|
150
|
-
|
|
151
|
-
If no CLI arguments are provided, the server will use the MCP Roots protocol to receive allowed directories from the client (if supported).
|
|
123
|
+
### Environment Variables
|
|
152
124
|
|
|
153
|
-
|
|
125
|
+
| Variable | Default | Range | Description |
|
|
126
|
+
| -------------------------------- | ----------------------- | ----------- | ---------------------------------------------------------------- |
|
|
127
|
+
| `UV_THREADPOOL_SIZE` | (unset) | 1-1024 | libuv threadpool size. If set, caps parallelism. |
|
|
128
|
+
| `FILESYSTEM_CONTEXT_CONCURRENCY` | Auto (2x cores, cap 50) | 1-100 | Parallel file operations. Further capped by `UV_THREADPOOL_SIZE` |
|
|
129
|
+
| `TRAVERSAL_JOBS` | 8 | 1-50 | Directory traversal concurrency |
|
|
130
|
+
| `REGEX_TIMEOUT` | 100 | 50-1000 | Regex timeout per line (prevents ReDoS) |
|
|
131
|
+
| `MAX_FILE_SIZE` | 10MB | 1MB-100MB | Max text file size (`read_file`, `read_multiple_files`) |
|
|
132
|
+
| `MAX_SEARCH_SIZE` | 1MB | 100KB-10MB | Max file size for content search (`search_content`) |
|
|
133
|
+
| `DEFAULT_DEPTH` | 10 | 1-100 | Default max depth (`list_directory`, `search_files`) |
|
|
134
|
+
| `DEFAULT_RESULTS` | 100 | 10-10000 | Default max results (`search_files`, `search_content`) |
|
|
135
|
+
| `DEFAULT_LIST_MAX_ENTRIES` | 10000 | 100-100000 | Default max entries (`list_directory`) |
|
|
136
|
+
| `DEFAULT_SEARCH_MAX_FILES` | 20000 | 100-100000 | Default max files scanned (`search_files`, `search_content`) |
|
|
137
|
+
| `DEFAULT_SEARCH_TIMEOUT` | 30000 | 100-3600000 | Default search timeout (`search_files`, `search_content`) |
|
|
154
138
|
|
|
155
|
-
|
|
139
|
+
See [CONFIGURATION.md](CONFIGURATION.md) for profiles and examples.
|
|
156
140
|
|
|
157
|
-
|
|
141
|
+
## Tools
|
|
158
142
|
|
|
159
|
-
All
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
| -------------------------------- | --------------- | ----------- | ---------------------------------------- |
|
|
163
|
-
| `FILESYSTEM_CONTEXT_CONCURRENCY` | Auto (2x cores) | 1-100 | Maximum parallel file operations |
|
|
164
|
-
| `TRAVERSAL_JOBS` | 8 | 1-50 | Directory traversal concurrency |
|
|
165
|
-
| `REGEX_TIMEOUT` | 100 | 50-1000 | Regex matching timeout (milliseconds) |
|
|
166
|
-
| `MAX_FILE_SIZE` | 10MB | 1MB-100MB | Maximum text file size (bytes) |
|
|
167
|
-
| `MAX_MEDIA_SIZE` | 50MB | 1MB-500MB | Maximum media file size (bytes) |
|
|
168
|
-
| `MAX_SEARCH_SIZE` | 1MB | 100KB-10MB | Maximum file size for content search |
|
|
169
|
-
| `DEFAULT_DEPTH` | 10 | 1-100 | Default maximum recursion depth |
|
|
170
|
-
| `DEFAULT_RESULTS` | 100 | 10-10000 | Default maximum search results |
|
|
171
|
-
| `DEFAULT_LIST_MAX_ENTRIES` | 10000 | 100-100000 | Default max entries for list_directory |
|
|
172
|
-
| `DEFAULT_SEARCH_MAX_FILES` | 20000 | 100-100000 | Default max files to scan in searches |
|
|
173
|
-
| `DEFAULT_SEARCH_TIMEOUT` | 30000 | 100-3600000 | Default search timeout (milliseconds) |
|
|
174
|
-
| `DEFAULT_TOP` | 10 | 1-1000 | Default top N items in analysis |
|
|
175
|
-
| `DEFAULT_ANALYZE_MAX_ENTRIES` | 20000 | 100-100000 | Default max entries in analyze_directory |
|
|
176
|
-
| `DEFAULT_TREE` | 5 | 1-50 | Default directory tree depth |
|
|
177
|
-
| `DEFAULT_TREE_MAX_FILES` | 5000 | 100-200000 | Default max files in directory tree |
|
|
178
|
-
|
|
179
|
-
> **💡 Tip:** See [CONFIGURATION.md](CONFIGURATION.md) for detailed environment variable usage examples, configuration profiles, and best practices for different use cases.
|
|
180
|
-
|
|
181
|
-
## 🔧 Tools
|
|
143
|
+
All tools return both human-readable text and structured JSON. Structured
|
|
144
|
+
responses include `ok`, `error` (with `code`, `message`, `path`, `suggestion`),
|
|
145
|
+
and `effectiveOptions`/`summary` fields where applicable.
|
|
182
146
|
|
|
183
147
|
### `list_allowed_directories`
|
|
184
148
|
|
|
185
|
-
List all directories that this server
|
|
149
|
+
List all directories that this server can access.
|
|
186
150
|
|
|
187
|
-
| Parameter | Type | Required | Default | Description
|
|
188
|
-
| --------- | ---- | -------- | ------- |
|
|
189
|
-
|
|
|
151
|
+
| Parameter | Type | Required | Default | Description |
|
|
152
|
+
| --------- | ---- | -------- | ------- | ----------- |
|
|
153
|
+
| (none) | - | - | - | - |
|
|
190
154
|
|
|
191
|
-
|
|
155
|
+
Returns: Allowed directory paths plus access status (accessible/readable),
|
|
156
|
+
count, and a configuration hint in structured output.
|
|
192
157
|
|
|
193
158
|
---
|
|
194
159
|
|
|
195
160
|
### `list_directory`
|
|
196
161
|
|
|
197
|
-
List contents of a directory with optional
|
|
198
|
-
|
|
199
|
-
| Parameter | Type | Required | Default | Description
|
|
200
|
-
| ----------------------- | -------- | -------- | ------- |
|
|
201
|
-
| `path` | string |
|
|
202
|
-
| `recursive` | boolean |
|
|
203
|
-
| `includeHidden` | boolean |
|
|
204
|
-
| `excludePatterns` | string[] |
|
|
205
|
-
| `pattern` | string |
|
|
206
|
-
| `maxDepth` | number |
|
|
207
|
-
| `maxEntries` | number |
|
|
208
|
-
| `sortBy` | string |
|
|
209
|
-
| `includeSymlinkTargets` | boolean |
|
|
210
|
-
|
|
211
|
-
|
|
162
|
+
List contents of a directory with optional recursion.
|
|
163
|
+
|
|
164
|
+
| Parameter | Type | Required | Default | Description |
|
|
165
|
+
| ----------------------- | -------- | -------- | ------- | -------------------------------------------------------- |
|
|
166
|
+
| `path` | string | Yes | - | Directory path to list |
|
|
167
|
+
| `recursive` | boolean | No | `false` | List subdirectories recursively |
|
|
168
|
+
| `includeHidden` | boolean | No | `false` | Include hidden files and directories |
|
|
169
|
+
| `excludePatterns` | string[] | No | `[]` | Glob patterns to exclude |
|
|
170
|
+
| `pattern` | string | No | - | Glob pattern to include (relative, no `..`) |
|
|
171
|
+
| `maxDepth` | number | No | `10` | Maximum depth for recursive listing (0-100) |
|
|
172
|
+
| `maxEntries` | number | No | `10000` | Maximum entries to return (1-100000) |
|
|
173
|
+
| `sortBy` | string | No | `name` | Sort by: `name`, `size`, `modified`, `type` |
|
|
174
|
+
| `includeSymlinkTargets` | boolean | No | `false` | Include symlink target paths (symlinks are not followed) |
|
|
175
|
+
|
|
176
|
+
Returns: Entries with name, relativePath, type, extension, size, modified time,
|
|
177
|
+
and symlink target. Structured output includes `effectiveOptions` and a
|
|
178
|
+
`summary` (totals, maxDepthReached, truncated/stoppedReason, entriesScanned,
|
|
179
|
+
entriesVisible, skippedInaccessible, symlinksNotFollowed).
|
|
212
180
|
|
|
213
181
|
---
|
|
214
182
|
|
|
@@ -216,28 +184,23 @@ List contents of a directory with optional recursive listing.
|
|
|
216
184
|
|
|
217
185
|
Search for files (not directories) using glob patterns.
|
|
218
186
|
|
|
219
|
-
| Parameter | Type | Required | Default
|
|
220
|
-
| ----------------- | -------- | -------- |
|
|
221
|
-
| `path` | string |
|
|
222
|
-
| `pattern` | string |
|
|
223
|
-
| `excludePatterns` | string[] |
|
|
224
|
-
| `maxResults` | number |
|
|
225
|
-
| `sortBy` | string |
|
|
226
|
-
| `maxDepth` | number |
|
|
227
|
-
| `maxFilesScanned` | number |
|
|
228
|
-
| `timeoutMs` | number |
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
"path": "/project",
|
|
237
|
-
"pattern": "**/*.ts",
|
|
238
|
-
"excludePatterns": ["node_modules/**", "dist/**"]
|
|
239
|
-
}
|
|
240
|
-
```
|
|
187
|
+
| Parameter | Type | Required | Default | Description |
|
|
188
|
+
| ----------------- | -------- | -------- | --------------------- | ------------------------------------------------------------ |
|
|
189
|
+
| `path` | string | Yes | - | Base directory to search from |
|
|
190
|
+
| `pattern` | string | Yes | - | Glob pattern (e.g., `**/*.ts`, `src/**/*.js`) |
|
|
191
|
+
| `excludePatterns` | string[] | No | built-in exclude list | Glob patterns to exclude |
|
|
192
|
+
| `maxResults` | number | No | `100` | Maximum matches to return (1-10000) |
|
|
193
|
+
| `sortBy` | string | No | `path` | Sort by: `name`, `size`, `modified`, `path` |
|
|
194
|
+
| `maxDepth` | number | No | `10` | Maximum directory depth to search (0-100) |
|
|
195
|
+
| `maxFilesScanned` | number | No | `20000` | Maximum files to scan before stopping |
|
|
196
|
+
| `timeoutMs` | number | No | `30000` | Timeout in milliseconds |
|
|
197
|
+
| `baseNameMatch` | boolean | No | `false` | Match patterns without slashes against basenames |
|
|
198
|
+
| `skipSymlinks` | boolean | No | `true` | Must remain true; symlink traversal is disabled for security |
|
|
199
|
+
| `includeHidden` | boolean | No | `false` | Include hidden files and directories |
|
|
200
|
+
|
|
201
|
+
Returns: Matching files with relative path, type, size, and modified date.
|
|
202
|
+
Structured output includes `effectiveOptions` and a `summary` (matched,
|
|
203
|
+
filesScanned, truncated/stoppedReason, skippedInaccessible).
|
|
241
204
|
|
|
242
205
|
---
|
|
243
206
|
|
|
@@ -245,88 +208,48 @@ Search for files (not directories) using glob patterns.
|
|
|
245
208
|
|
|
246
209
|
Read the contents of a text file.
|
|
247
210
|
|
|
248
|
-
| Parameter | Type | Required | Default | Description
|
|
249
|
-
| ------------ | ------- | -------- | ------- |
|
|
250
|
-
| `path` | string |
|
|
251
|
-
| `encoding` | string |
|
|
252
|
-
| `maxSize` | number |
|
|
253
|
-
| `skipBinary` | boolean |
|
|
254
|
-
| `lineStart` | number |
|
|
255
|
-
| `lineEnd` | number |
|
|
256
|
-
| `head` | number |
|
|
257
|
-
| `tail` | number |
|
|
211
|
+
| Parameter | Type | Required | Default | Description |
|
|
212
|
+
| ------------ | ------- | -------- | ------- | ----------------------------------------------------------- |
|
|
213
|
+
| `path` | string | Yes | - | File path to read |
|
|
214
|
+
| `encoding` | string | No | `utf-8` | File encoding (`utf-8`, `ascii`, `base64`, `hex`, `latin1`) |
|
|
215
|
+
| `maxSize` | number | No | 10MB | Maximum file size in bytes (capped by `MAX_FILE_SIZE`) |
|
|
216
|
+
| `skipBinary` | boolean | No | `true` | Reject likely-binary files |
|
|
217
|
+
| `lineStart` | number | No | - | Start line (1-indexed) for range reading |
|
|
218
|
+
| `lineEnd` | number | No | - | End line (inclusive) for range reading |
|
|
219
|
+
| `head` | number | No | - | Read only first N lines |
|
|
220
|
+
| `tail` | number | No | - | Read only last N lines |
|
|
258
221
|
|
|
259
|
-
|
|
222
|
+
Notes:
|
|
260
223
|
|
|
261
|
-
|
|
224
|
+
- `head`, `tail`, and `lineStart/lineEnd` are mutually exclusive.
|
|
262
225
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
### `read_multiple_files`
|
|
266
|
-
|
|
267
|
-
Read multiple files in parallel for efficient batch operations.
|
|
268
|
-
|
|
269
|
-
| Parameter | Type | Required | Default | Description |
|
|
270
|
-
| -------------- | -------- | -------- | ------- | ------------------------------------------ |
|
|
271
|
-
| `paths` | string[] | ✅ | - | Array of file paths to read (max 100) |
|
|
272
|
-
| `encoding` | string | ❌ | `utf-8` | File encoding |
|
|
273
|
-
| `maxSize` | number | ❌ | 10MB | Maximum size per file in bytes |
|
|
274
|
-
| `maxTotalSize` | number | ❌ | 100MB | Maximum total size for all files combined |
|
|
275
|
-
| `head` | number | ❌ | - | Read only first N lines of each file |
|
|
276
|
-
| `tail` | number | ❌ | - | Read only last N lines of each file |
|
|
277
|
-
| `lineStart` | number | ❌ | - | Start line (1-indexed) for reading a range |
|
|
278
|
-
| `lineEnd` | number | ❌ | - | End line (inclusive) for reading a range |
|
|
279
|
-
|
|
280
|
-
**Returns:** Array of file contents with individual success/error status.
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
### `get_multiple_file_info`
|
|
285
|
-
|
|
286
|
-
Get metadata for multiple files/directories in parallel.
|
|
287
|
-
|
|
288
|
-
| Parameter | Type | Required | Default | Description |
|
|
289
|
-
| ----------------- | -------- | -------- | ------- | --------------------------------- |
|
|
290
|
-
| `paths` | string[] | ✅ | - | Array of paths to query (max 100) |
|
|
291
|
-
| `includeMimeType` | boolean | ❌ | `true` | Include MIME type detection |
|
|
292
|
-
|
|
293
|
-
**Returns:** Array of file info (name, path, type, size, timestamps, permissions, mimeType) with individual success/error status, plus summary.
|
|
226
|
+
Returns: File content plus structured metadata (readMode, linesRead,
|
|
227
|
+
totalLines, hasMoreLines, truncated, effectiveOptions).
|
|
294
228
|
|
|
295
229
|
---
|
|
296
230
|
|
|
297
|
-
### `
|
|
298
|
-
|
|
299
|
-
Compute cryptographic checksums for files using memory-efficient streaming.
|
|
300
|
-
|
|
301
|
-
| Parameter | Type | Required | Default | Description |
|
|
302
|
-
| ------------- | -------- | -------- | -------- | ------------------------------------------------- |
|
|
303
|
-
| `paths` | string[] | ✅ | - | Array of file paths (max 50) |
|
|
304
|
-
| `algorithm` | string | ❌ | `sha256` | Hash algorithm: `md5`, `sha1`, `sha256`, `sha512` |
|
|
305
|
-
| `encoding` | string | ❌ | `hex` | Output encoding: `hex` or `base64` |
|
|
306
|
-
| `maxFileSize` | number | ❌ | 100MB | Skip files larger than this |
|
|
307
|
-
|
|
308
|
-
**Returns:** Array of checksums with file sizes, plus summary (total, succeeded, failed).
|
|
231
|
+
### `read_multiple_files`
|
|
309
232
|
|
|
310
|
-
|
|
233
|
+
Read multiple files in parallel.
|
|
311
234
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
-
|
|
235
|
+
| Parameter | Type | Required | Default | Description |
|
|
236
|
+
| -------------- | -------- | -------- | ------- | ---------------------------------------------------------- |
|
|
237
|
+
| `paths` | string[] | Yes | - | Array of file paths (max 100) |
|
|
238
|
+
| `encoding` | string | No | `utf-8` | File encoding |
|
|
239
|
+
| `maxSize` | number | No | 10MB | Maximum size per file in bytes (capped by `MAX_FILE_SIZE`) |
|
|
240
|
+
| `maxTotalSize` | number | No | 100MB | Maximum total size across all files |
|
|
241
|
+
| `head` | number | No | - | Read only first N lines of each file |
|
|
242
|
+
| `tail` | number | No | - | Read only last N lines of each file |
|
|
243
|
+
| `lineStart` | number | No | - | Start line (1-indexed) for each file |
|
|
244
|
+
| `lineEnd` | number | No | - | End line (inclusive) for each file |
|
|
315
245
|
|
|
316
|
-
|
|
246
|
+
Notes:
|
|
317
247
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
| `paths` | string[] | ✅ | - | Array of file paths (max 100) |
|
|
321
|
-
| `encoding` | string | ❌ | `utf-8` | File encoding |
|
|
322
|
-
| `maxSize` | number | ❌ | 10MB | Maximum file size per file |
|
|
323
|
-
| `maxTotalSize` | number | ❌ | 100MB | Maximum total size for all files combined |
|
|
324
|
-
| `head` | number | ❌ | - | Read only first N lines of each file |
|
|
325
|
-
| `tail` | number | ❌ | - | Read only last N lines of each file |
|
|
248
|
+
- `lineStart` and `lineEnd` must be provided together.
|
|
249
|
+
- `head`, `tail`, and `lineStart/lineEnd` are mutually exclusive.
|
|
326
250
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
**Returns:** Array of results with content or error for each file.
|
|
251
|
+
Returns: Per-file content or error, plus structured summary and
|
|
252
|
+
effectiveOptions.
|
|
330
253
|
|
|
331
254
|
---
|
|
332
255
|
|
|
@@ -336,145 +259,80 @@ Get detailed metadata about a file or directory.
|
|
|
336
259
|
|
|
337
260
|
| Parameter | Type | Required | Default | Description |
|
|
338
261
|
| --------- | ------ | -------- | ------- | ------------------------- |
|
|
339
|
-
| `path` | string |
|
|
340
|
-
|
|
341
|
-
**Returns:** Metadata including name, type, size, created/modified/accessed timestamps, permissions, MIME type, and symlink target (if applicable).
|
|
342
|
-
|
|
343
|
-
---
|
|
344
|
-
|
|
345
|
-
### `search_content`
|
|
346
|
-
|
|
347
|
-
Search for text content within files using regular expressions.
|
|
348
|
-
|
|
349
|
-
| Parameter | Type | Required | Default | Description |
|
|
350
|
-
| ----------------- | -------- | -------- | ------- | ------------------------------------------------ |
|
|
351
|
-
| `path` | string | ✅ | - | Base directory to search in |
|
|
352
|
-
| `pattern` | string | ✅ | - | Regex pattern to search for |
|
|
353
|
-
| `filePattern` | string | ❌ | `**/*` | Glob pattern to filter files |
|
|
354
|
-
| `excludePatterns` | string[] | ❌ | `[]` | Glob patterns to exclude |
|
|
355
|
-
| `caseSensitive` | boolean | ❌ | `false` | Case-sensitive search |
|
|
356
|
-
| `maxResults` | number | ❌ | `100` | Maximum number of results (1-10,000) |
|
|
357
|
-
| `maxFileSize` | number | ❌ | 1MB | Maximum file size to scan |
|
|
358
|
-
| `maxFilesScanned` | number | ❌ | `20000` | Maximum files to scan before stopping |
|
|
359
|
-
| `timeoutMs` | number | ❌ | `30000` | Timeout in milliseconds (100-3,600,000) |
|
|
360
|
-
| `skipBinary` | boolean | ❌ | `true` | Skip binary files |
|
|
361
|
-
| `includeHidden` | boolean | ❌ | `false` | Include hidden files and directories |
|
|
362
|
-
| `contextLines` | number | ❌ | `0` | Lines of context before/after match (0-10) |
|
|
363
|
-
| `wholeWord` | boolean | ❌ | `false` | Match whole words only |
|
|
364
|
-
| `isLiteral` | boolean | ❌ | `false` | Treat pattern as literal string (escape special) |
|
|
365
|
-
|
|
366
|
-
**Returns:** Matching lines with file path, line number, content, and optional context.
|
|
367
|
-
|
|
368
|
-
**Example:**
|
|
369
|
-
|
|
370
|
-
```json
|
|
371
|
-
{
|
|
372
|
-
"path": "/project/src",
|
|
373
|
-
"pattern": "TODO|FIXME",
|
|
374
|
-
"filePattern": "**/*.ts",
|
|
375
|
-
"contextLines": 2
|
|
376
|
-
}
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
---
|
|
380
|
-
|
|
381
|
-
### `search_definitions`
|
|
382
|
-
|
|
383
|
-
Find code definitions (classes, functions, interfaces, types, enums, variables) in TypeScript/JavaScript files without manual regex construction.
|
|
384
|
-
|
|
385
|
-
| Parameter | Type | Required | Default | Description |
|
|
386
|
-
| ----------------- | -------- | -------- | ------- | ------------------------------------------------------------------------------------- |
|
|
387
|
-
| `path` | string | ❌ | - | Base directory to search in |
|
|
388
|
-
| `name` | string | ❌ | - | Definition name to search for |
|
|
389
|
-
| `type` | string | ❌ | - | Definition type to find: `class`, `function`, `interface`, `type`, `enum`, `variable` |
|
|
390
|
-
| `caseSensitive` | boolean | ❌ | `true` | Case-sensitive name matching |
|
|
391
|
-
| `maxResults` | number | ❌ | `100` | Maximum number of results (1-10,000) |
|
|
392
|
-
| `excludePatterns` | string[] | ❌ | `[]` | Glob patterns to exclude |
|
|
393
|
-
| `includeHidden` | boolean | ❌ | `false` | Include hidden files and directories |
|
|
394
|
-
| `contextLines` | number | ❌ | `0` | Lines of context before/after match (0-10) |
|
|
395
|
-
|
|
396
|
-
**Returns:** List of definitions with name, type (class/function/interface/type/enum/variable), file path, line number, exported status, and code preview.
|
|
397
|
-
|
|
398
|
-
**Use cases:**
|
|
399
|
-
|
|
400
|
-
- **Find by name:** Search for a specific definition like `UserService`
|
|
401
|
-
- **Discovery mode:** Find all definitions of a type (e.g., all interfaces)
|
|
402
|
-
- **Combined:** Find definitions matching a name pattern and type
|
|
403
|
-
|
|
404
|
-
**Examples:**
|
|
405
|
-
|
|
406
|
-
```json
|
|
407
|
-
{
|
|
408
|
-
"path": "/project/src",
|
|
409
|
-
"name": "UserService"
|
|
410
|
-
}
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
```json
|
|
414
|
-
{
|
|
415
|
-
"path": "/project/src",
|
|
416
|
-
"type": "interface"
|
|
417
|
-
}
|
|
418
|
-
```
|
|
262
|
+
| `path` | string | Yes | - | Path to file or directory |
|
|
419
263
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
"path": "/project/src",
|
|
423
|
-
"name": "Handler",
|
|
424
|
-
"type": "class"
|
|
425
|
-
}
|
|
426
|
-
```
|
|
264
|
+
Returns: name, path, type, size, created/modified/accessed timestamps,
|
|
265
|
+
permissions, isHidden, MIME type, and symlink target (if applicable).
|
|
427
266
|
|
|
428
267
|
---
|
|
429
268
|
|
|
430
|
-
### `
|
|
269
|
+
### `get_multiple_file_info`
|
|
431
270
|
|
|
432
|
-
|
|
271
|
+
Get metadata for multiple files/directories in parallel.
|
|
433
272
|
|
|
434
|
-
| Parameter | Type | Required | Default | Description
|
|
435
|
-
| ----------------- | -------- | -------- | ------- |
|
|
436
|
-
| `
|
|
437
|
-
| `
|
|
438
|
-
| `topN` | number | ❌ | `10` | Number of top items to return (max 1000) |
|
|
439
|
-
| `maxEntries` | number | ? | `20000` | Maximum entries to scan (1-100,000) |
|
|
440
|
-
| `excludePatterns` | string[] | ❌ | `[]` | Glob patterns to exclude |
|
|
441
|
-
| `includeHidden` | boolean | ❌ | `false` | Include hidden files and directories |
|
|
273
|
+
| Parameter | Type | Required | Default | Description |
|
|
274
|
+
| ----------------- | -------- | -------- | ------- | --------------------------------- |
|
|
275
|
+
| `paths` | string[] | Yes | - | Array of paths to query (max 100) |
|
|
276
|
+
| `includeMimeType` | boolean | No | `true` | Include MIME type detection |
|
|
442
277
|
|
|
443
|
-
|
|
278
|
+
Returns: Array of file info with individual success/error status, plus summary
|
|
279
|
+
(total, succeeded, failed, totalSize).
|
|
444
280
|
|
|
445
281
|
---
|
|
446
282
|
|
|
447
|
-
### `
|
|
448
|
-
|
|
449
|
-
Get a JSON tree structure of a directory, optimized for AI parsing.
|
|
283
|
+
### `search_content`
|
|
450
284
|
|
|
451
|
-
|
|
452
|
-
| ----------------- | -------- | -------- | ------- | -------------------------------------------- |
|
|
453
|
-
| `path` | string | ✅ | - | Directory path to build tree from |
|
|
454
|
-
| `maxDepth` | number | ❌ | `5` | Maximum depth to traverse (0-50) |
|
|
455
|
-
| `excludePatterns` | string[] | ❌ | `[]` | Glob patterns to exclude |
|
|
456
|
-
| `includeHidden` | boolean | ❌ | `false` | Include hidden files and directories |
|
|
457
|
-
| `includeSize` | boolean | ❌ | `false` | Include file sizes in the tree |
|
|
458
|
-
| `maxFiles` | number | ❌ | - | Maximum total files to include (max 100,000) |
|
|
285
|
+
Search for text content within files using regular expressions.
|
|
459
286
|
|
|
460
|
-
|
|
287
|
+
| Parameter | Type | Required | Default | Description |
|
|
288
|
+
| ------------------------ | -------- | -------- | --------------------- | ---------------------------------------------------------- |
|
|
289
|
+
| `path` | string | Yes | - | Base directory to search in |
|
|
290
|
+
| `pattern` | string | Yes | - | Regex pattern to search for |
|
|
291
|
+
| `filePattern` | string | No | `**/*` | Glob pattern to filter files |
|
|
292
|
+
| `excludePatterns` | string[] | No | built-in exclude list | Glob patterns to exclude |
|
|
293
|
+
| `caseSensitive` | boolean | No | `false` | Case-sensitive search |
|
|
294
|
+
| `maxResults` | number | No | `100` | Maximum number of results |
|
|
295
|
+
| `maxFileSize` | number | No | 1MB | Maximum file size to scan (default from `MAX_SEARCH_SIZE`) |
|
|
296
|
+
| `maxFilesScanned` | number | No | `20000` | Maximum files to scan before stopping |
|
|
297
|
+
| `timeoutMs` | number | No | `30000` | Timeout in milliseconds |
|
|
298
|
+
| `skipBinary` | boolean | No | `true` | Skip likely-binary files |
|
|
299
|
+
| `includeHidden` | boolean | No | `false` | Include hidden files and directories |
|
|
300
|
+
| `contextLines` | number | No | `0` | Lines of context before/after match (0-10) |
|
|
301
|
+
| `wholeWord` | boolean | No | `false` | Match whole words only |
|
|
302
|
+
| `isLiteral` | boolean | No | `false` | Treat pattern as literal string (escape regex chars) |
|
|
303
|
+
| `baseNameMatch` | boolean | No | `false` | Match file patterns without slashes against basenames |
|
|
304
|
+
| `caseSensitiveFileMatch` | boolean | No | `true` | Case-sensitive filename matching |
|
|
305
|
+
|
|
306
|
+
Returns: Matching lines with file path, line number, content, and optional
|
|
307
|
+
context. Structured output includes `effectiveOptions` and a `summary`
|
|
308
|
+
(filesScanned/filesMatched, totalMatches, truncated/stoppedReason,
|
|
309
|
+
skippedTooLarge/skippedBinary/skippedInaccessible,
|
|
310
|
+
linesSkippedDueToRegexTimeout).
|
|
461
311
|
|
|
462
312
|
---
|
|
463
313
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
314
|
+
Built-in exclude list: common dependency/build/output directories (e.g.,
|
|
315
|
+
`node_modules`, `dist`, `build`, `coverage`, `.git`, `.vscode`, `.idea`,
|
|
316
|
+
`.cache`, `.next`, `.nuxt`, `.svelte-kit`). Pass `excludePatterns: []` to
|
|
317
|
+
disable it.
|
|
318
|
+
|
|
319
|
+
## Error Codes
|
|
320
|
+
|
|
321
|
+
| Code | Meaning |
|
|
322
|
+
| ----------------------- | ----------------------------- |
|
|
323
|
+
| `E_ACCESS_DENIED` | Path outside allowed roots |
|
|
324
|
+
| `E_NOT_FOUND` | Path does not exist |
|
|
325
|
+
| `E_NOT_FILE` | Expected file, got directory |
|
|
326
|
+
| `E_NOT_DIRECTORY` | Expected directory, got file |
|
|
327
|
+
| `E_TOO_LARGE` | File exceeds size limits |
|
|
328
|
+
| `E_TIMEOUT` | Operation timed out |
|
|
329
|
+
| `E_INVALID_PATTERN` | Invalid glob/regex pattern |
|
|
330
|
+
| `E_INVALID_INPUT` | Invalid argument(s) |
|
|
331
|
+
| `E_PERMISSION_DENIED` | OS-level permission denied |
|
|
332
|
+
| `E_SYMLINK_NOT_ALLOWED` | Symlink escapes allowed roots |
|
|
333
|
+
| `E_UNKNOWN` | Unexpected error |
|
|
334
|
+
|
|
335
|
+
## Client Configuration
|
|
478
336
|
|
|
479
337
|
<details>
|
|
480
338
|
<summary><b>VS Code</b></summary>
|
|
@@ -496,8 +354,6 @@ Add to `.vscode/mcp.json` (recommended) or `.vscode/settings.json`:
|
|
|
496
354
|
}
|
|
497
355
|
```
|
|
498
356
|
|
|
499
|
-
> **Note:** `${workspaceFolder}` is expanded by VS Code to the current workspace path.
|
|
500
|
-
|
|
501
357
|
</details>
|
|
502
358
|
|
|
503
359
|
<details>
|
|
@@ -511,12 +367,18 @@ Add to `.vscode/mcp.json` (recommended) or `.vscode/settings.json`:
|
|
|
511
367
|
"mcpServers": {
|
|
512
368
|
"filesystem-context": {
|
|
513
369
|
"command": "npx",
|
|
514
|
-
"args": [
|
|
370
|
+
"args": [
|
|
371
|
+
"-y",
|
|
372
|
+
"@j0hanz/filesystem-context-mcp@latest",
|
|
373
|
+
"C:\\path\\to\\project"
|
|
374
|
+
]
|
|
515
375
|
}
|
|
516
376
|
}
|
|
517
377
|
}
|
|
518
378
|
```
|
|
519
379
|
|
|
380
|
+
If your client supports MCP Roots, you can omit the path. Otherwise, pass a path or `--allow-cwd`.
|
|
381
|
+
|
|
520
382
|
</details>
|
|
521
383
|
|
|
522
384
|
<details>
|
|
@@ -529,7 +391,11 @@ Add to Cursor's MCP configuration:
|
|
|
529
391
|
"mcpServers": {
|
|
530
392
|
"filesystem-context": {
|
|
531
393
|
"command": "npx",
|
|
532
|
-
"args": [
|
|
394
|
+
"args": [
|
|
395
|
+
"-y",
|
|
396
|
+
"@j0hanz/filesystem-context-mcp@latest",
|
|
397
|
+
"${workspaceFolder}"
|
|
398
|
+
]
|
|
533
399
|
}
|
|
534
400
|
}
|
|
535
401
|
}
|
|
@@ -542,31 +408,13 @@ Add to Cursor's MCP configuration:
|
|
|
542
408
|
|
|
543
409
|
Add to `~/.codex/config.toml`:
|
|
544
410
|
|
|
545
|
-
**Basic Configuration (auto-detects current directory):**
|
|
546
|
-
|
|
547
|
-
```toml
|
|
548
|
-
[mcp_servers.filesystem-context]
|
|
549
|
-
command = "npx"
|
|
550
|
-
args = ["-y", "@j0hanz/filesystem-context-mcp@latest"]
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
**Configuration with Explicit Directory:**
|
|
554
|
-
|
|
555
411
|
```toml
|
|
556
412
|
[mcp_servers.filesystem-context]
|
|
557
413
|
command = "npx"
|
|
558
414
|
args = ["-y", "@j0hanz/filesystem-context-mcp@latest", "/path/to/your/project"]
|
|
559
415
|
```
|
|
560
416
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
```toml
|
|
564
|
-
[mcp_servers.filesystem-context]
|
|
565
|
-
command = "npx"
|
|
566
|
-
args = ["-y", "@j0hanz/filesystem-context-mcp@latest", "/path/to/project1", "/path/to/project2"]
|
|
567
|
-
```
|
|
568
|
-
|
|
569
|
-
> **Note:** You can access the config file via Codex IDE by clicking the gear icon → "Codex Settings > Open config.toml". If no directories are specified, it will use the current working directory automatically.
|
|
417
|
+
If your client supports MCP Roots, you can omit the path. Otherwise, pass a path or `--allow-cwd`.
|
|
570
418
|
|
|
571
419
|
</details>
|
|
572
420
|
|
|
@@ -580,7 +428,11 @@ Add to Windsurf's MCP configuration:
|
|
|
580
428
|
"mcpServers": {
|
|
581
429
|
"filesystem-context": {
|
|
582
430
|
"command": "npx",
|
|
583
|
-
"args": [
|
|
431
|
+
"args": [
|
|
432
|
+
"-y",
|
|
433
|
+
"@j0hanz/filesystem-context-mcp@latest",
|
|
434
|
+
"${workspaceFolder}"
|
|
435
|
+
]
|
|
584
436
|
}
|
|
585
437
|
}
|
|
586
438
|
}
|
|
@@ -588,55 +440,21 @@ Add to Windsurf's MCP configuration:
|
|
|
588
440
|
|
|
589
441
|
</details>
|
|
590
442
|
|
|
591
|
-
##
|
|
443
|
+
## Security
|
|
592
444
|
|
|
593
445
|
This server implements multiple layers of security:
|
|
594
446
|
|
|
595
|
-
| Protection
|
|
596
|
-
|
|
|
597
|
-
|
|
|
598
|
-
|
|
|
599
|
-
|
|
|
600
|
-
|
|
|
601
|
-
|
|
|
602
|
-
|
|
|
603
|
-
|
|
|
447
|
+
| Protection | Description |
|
|
448
|
+
| ------------------------- | ------------------------------------------------------------- |
|
|
449
|
+
| Access control | Only explicitly allowed directories are accessible |
|
|
450
|
+
| Path validation | All paths are validated before any filesystem operation |
|
|
451
|
+
| Symlink protection | Symlinks that resolve outside allowed directories are blocked |
|
|
452
|
+
| Path traversal prevention | Attempts to escape via `..` are detected and blocked |
|
|
453
|
+
| Read-only operations | No writes, deletes, or modifications |
|
|
454
|
+
| Safe regex | Regex validation and timeouts prevent ReDoS |
|
|
455
|
+
| Size limits | Configurable limits prevent resource exhaustion |
|
|
604
456
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
```text
|
|
608
|
-
┌─────────────────────────────────────────────────────────┐
|
|
609
|
-
│ MCP Client │
|
|
610
|
-
└─────────────────────┬───────────────────────────────────┘
|
|
611
|
-
│
|
|
612
|
-
▼
|
|
613
|
-
┌─────────────────────────────────────────────────────────┐
|
|
614
|
-
│ Filesystem Context MCP Server │
|
|
615
|
-
│ ┌───────────────────────────────────────────────────┐ │
|
|
616
|
-
│ │ Path Validation Layer │ │
|
|
617
|
-
│ │ • Normalize paths │ │
|
|
618
|
-
│ │ • Check against allowed directories │ │
|
|
619
|
-
│ │ • Resolve and validate symlinks │ │
|
|
620
|
-
│ │ • Block traversal attempts │ │
|
|
621
|
-
│ └───────────────────────────────────────────────────┘ │
|
|
622
|
-
│ │ │
|
|
623
|
-
│ ▼ │
|
|
624
|
-
│ ┌───────────────────────────────────────────────────┐ │
|
|
625
|
-
│ │ Read-Only File Operations │ │
|
|
626
|
-
│ └───────────────────────────────────────────────────┘ │
|
|
627
|
-
└─────────────────────────────────────────────────────────┘
|
|
628
|
-
│
|
|
629
|
-
▼
|
|
630
|
-
┌─────────────────────────────────────────────────────────┐
|
|
631
|
-
│ Allowed Directories Only │
|
|
632
|
-
│ /home/user/project ✅ │
|
|
633
|
-
│ /home/user/docs ✅ │
|
|
634
|
-
│ /etc/passwd ❌ (blocked) │
|
|
635
|
-
│ ../../../etc ❌ (blocked) │
|
|
636
|
-
└─────────────────────────────────────────────────────────┘
|
|
637
|
-
```
|
|
638
|
-
|
|
639
|
-
## 🛠️ Development
|
|
457
|
+
## Development
|
|
640
458
|
|
|
641
459
|
### Prerequisites
|
|
642
460
|
|
|
@@ -656,107 +474,36 @@ This server implements multiple layers of security:
|
|
|
656
474
|
| `npm run lint` | Run ESLint |
|
|
657
475
|
| `npm run format` | Format code with Prettier |
|
|
658
476
|
| `npm run type-check` | TypeScript type checking |
|
|
477
|
+
| `npm run bench` | Run benchmarks |
|
|
659
478
|
| `npm run inspector` | Test with MCP Inspector |
|
|
660
479
|
|
|
661
480
|
### Project Structure
|
|
662
481
|
|
|
663
482
|
```text
|
|
664
483
|
src/
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
│ ├── file-operations.ts# Core filesystem operations (exports)
|
|
674
|
-
│ ├── path-utils.ts # Path manipulation utilities
|
|
675
|
-
│ ├── path-validation.ts# Security: path validation layer
|
|
676
|
-
│ ├── fs-helpers.ts # Low-level filesystem helpers (exports)
|
|
677
|
-
│ ├── file-operations/ # Core filesystem operations
|
|
678
|
-
│ │ ├── analyze-directory.ts
|
|
679
|
-
│ │ ├── directory-helpers.ts
|
|
680
|
-
│ │ ├── directory-tree.ts
|
|
681
|
-
│ │ ├── file-info.ts
|
|
682
|
-
│ │ ├── list-directory.ts
|
|
683
|
-
│ │ ├── pattern-validator.ts
|
|
684
|
-
│ │ ├── read-media-file.ts
|
|
685
|
-
│ │ ├── read-multiple-files.ts
|
|
686
|
-
│ │ ├── search-content.ts
|
|
687
|
-
│ │ ├── search-definitions.ts
|
|
688
|
-
│ │ ├── search-files.ts
|
|
689
|
-
│ │ └── sorting.ts
|
|
690
|
-
│ ├── fs-helpers/ # Low-level filesystem helpers
|
|
691
|
-
│ │ ├── binary-detect.ts
|
|
692
|
-
│ │ ├── concurrency.ts
|
|
693
|
-
│ │ ├── fs-utils.ts
|
|
694
|
-
│ │ ├── readers.ts
|
|
695
|
-
│ │ └── readers/ # File reading utilities
|
|
696
|
-
│ │ ├── head-file.ts
|
|
697
|
-
│ │ ├── line-range.ts
|
|
698
|
-
│ │ ├── read-file.ts
|
|
699
|
-
│ │ ├── tail-file.ts
|
|
700
|
-
│ │ └── utf8.ts
|
|
701
|
-
│ └── path-validation/ # Security: path validation
|
|
702
|
-
│ ├── allowed-directories.ts
|
|
703
|
-
│ ├── errors.ts
|
|
704
|
-
│ ├── roots.ts
|
|
705
|
-
│ └── validators.ts
|
|
706
|
-
├── schemas/
|
|
707
|
-
│ ├── common.ts # Shared Zod schemas
|
|
708
|
-
│ ├── input-helpers.ts # Input validation helpers
|
|
709
|
-
│ ├── inputs.ts # Input validation schemas
|
|
710
|
-
│ ├── output-helpers.ts # Output formatting helpers
|
|
711
|
-
│ ├── outputs.ts # Output validation schemas
|
|
712
|
-
│ └── index.ts # Schema exports
|
|
713
|
-
├── tools/
|
|
714
|
-
│ ├── analyze-directory.ts
|
|
715
|
-
│ ├── directory-tree.ts
|
|
716
|
-
│ ├── get-file-info.ts
|
|
717
|
-
│ ├── list-allowed-dirs.ts
|
|
718
|
-
│ ├── list-directory.ts
|
|
719
|
-
│ ├── read-file.ts
|
|
720
|
-
│ ├── read-media-file.ts
|
|
721
|
-
│ ├── read-multiple-files.ts
|
|
722
|
-
│ ├── search-content.ts
|
|
723
|
-
│ ├── search-definitions.ts
|
|
724
|
-
│ ├── search-files.ts
|
|
725
|
-
│ ├── tool-response.ts # Tool response formatting
|
|
726
|
-
│ └── index.ts # Tool registration
|
|
727
|
-
└── __tests__/ # Test files
|
|
728
|
-
├── lib/
|
|
729
|
-
│ ├── errors.test.ts
|
|
730
|
-
│ ├── file-operations.test.ts
|
|
731
|
-
│ ├── fs-helpers.test.ts
|
|
732
|
-
│ └── path-validation.test.ts
|
|
733
|
-
├── schemas/
|
|
734
|
-
│ └── validators.test.ts
|
|
735
|
-
└── security/
|
|
736
|
-
└── filesystem-boundary.test.ts
|
|
484
|
+
index.ts # CLI entry point
|
|
485
|
+
server.ts # MCP server wiring and roots handling
|
|
486
|
+
instructions.md # Tool usage instructions (bundled in dist)
|
|
487
|
+
config/ # Shared types and formatting helpers
|
|
488
|
+
lib/ # Core logic and filesystem operations
|
|
489
|
+
schemas/ # Zod input/output schemas
|
|
490
|
+
tools/ # MCP tool registration
|
|
491
|
+
__tests__/ # Vitest tests
|
|
737
492
|
```
|
|
738
493
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
```bash
|
|
742
|
-
npm run inspector
|
|
743
|
-
```
|
|
744
|
-
|
|
745
|
-
This launches the MCP Inspector for interactive testing of all tools.
|
|
746
|
-
|
|
747
|
-
## ❓ Troubleshooting
|
|
494
|
+
## Troubleshooting
|
|
748
495
|
|
|
749
|
-
| Issue
|
|
750
|
-
|
|
|
751
|
-
| "Access denied" error
|
|
752
|
-
| "Path does not exist"
|
|
753
|
-
| "File too large"
|
|
754
|
-
| "Binary file" warning
|
|
755
|
-
|
|
|
756
|
-
| Symlink blocked
|
|
757
|
-
| Regex timeout
|
|
496
|
+
| Issue | Solution |
|
|
497
|
+
| ------------------------ | ---------------------------------------------------------------------------------------- |
|
|
498
|
+
| "Access denied" error | Ensure the path is within an allowed directory. Use `list_allowed_directories` to check. |
|
|
499
|
+
| "Path does not exist" | Verify the path exists. Use `list_directory` to explore available files. |
|
|
500
|
+
| "File too large" | Use `head`/`tail` or increase `maxSize`. |
|
|
501
|
+
| "Binary file" warning | Set `skipBinary=false` in `read_file` to read as text. |
|
|
502
|
+
| No directories available | Pass explicit paths, use `--allow-cwd`, or ensure the client provides MCP Roots. |
|
|
503
|
+
| Symlink blocked | Symlinks that resolve outside allowed directories are blocked. |
|
|
504
|
+
| Regex timeout | Simplify the regex or increase `REGEX_TIMEOUT`. |
|
|
758
505
|
|
|
759
|
-
##
|
|
506
|
+
## Contributing
|
|
760
507
|
|
|
761
508
|
Contributions are welcome! Please follow these steps:
|
|
762
509
|
|