@j0hanz/filesystem-mcp 1.14.1 → 1.15.0

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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -53
  3. package/package.json +1 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 j0hanz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -8,6 +8,24 @@
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
 
11
+ ## Table of Contents
12
+
13
+ - [Overview](#overview)
14
+ - [Key Features](#key-features)
15
+ - [Quick Start](#quick-start) — [Docker](#docker) · [CLI Usage](#cli-usage)
16
+ - [Client Configuration](#client-configuration)
17
+ - [Use Cases](#use-cases)
18
+ - [Architecture](#architecture)
19
+ - [MCP Surface](#mcp-surface) — [Tools](#tools) · [Resources](#resources) · [Prompts](#prompts)
20
+ - [MCP Capabilities](#mcp-capabilities) — [Tool Annotations](#tool-annotations) · [Structured Output](#structured-output)
21
+ - [Configuration](#configuration) — [HTTP & Auth](#http--auth) · [File Size Limits](#file-size-limits) · [Access Control](#access-control) · [Output & Inline Limits](#output--inline-limits) · [Tasks](#tasks) · [Logging & Diagnostics](#logging--diagnostics) · [Performance](#performance)
22
+ - [HTTP Endpoints](#http-endpoints)
23
+ - [Security](#security)
24
+ - [Development](#development)
25
+ - [Troubleshooting](#troubleshooting)
26
+ - [Credits](#credits)
27
+ - [Contributing and License](#contributing-and-license)
28
+
11
29
  ## Overview
12
30
 
13
31
  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.
@@ -469,37 +487,39 @@ Add to VS Code `settings.json` under `augment.advanced`:
469
487
 
470
488
  </details>
471
489
 
490
+ [↑ Back to top](#table-of-contents)
491
+
472
492
  ## Use Cases
473
493
 
474
494
  ### Explore and Understand a Codebase
475
495
 
476
496
  Discover project structure and navigate unfamiliar repositories. Start with `roots` to see allowed directories, use `tree` for an overview, `find` to locate files by pattern, and `read` or `read_many` to inspect contents.
477
497
 
478
- **Relevant tools:** `roots`, `ls`, `find`, `tree`, `read`, `read_many`, `stat`
498
+ **Relevant tools:** [`roots`](#roots), [`ls`](#ls), [`find`](#find), [`tree`](#tree), [`read`](#read), [`read_many`](#read_many), [`stat`](#stat)
479
499
 
480
500
  ### Search Across Files
481
501
 
482
502
  Locate specific code patterns, function definitions, or configuration values across a project. Use `grep` for content search with regex support and `find` for file name matching.
483
503
 
484
- **Relevant tools:** `grep`, `find`
504
+ **Relevant tools:** [`grep`](#grep), [`find`](#find)
485
505
 
486
506
  ### Edit and Refactor Code
487
507
 
488
508
  Make precise, targeted edits to source files. Use `edit` for surgical replacements with dry-run preview, or `search_and_replace` for bulk changes across multiple files matching a glob pattern.
489
509
 
490
- **Relevant tools:** `edit`, `search_and_replace`, `write`
510
+ **Relevant tools:** [`edit`](#edit), [`search_and_replace`](#search_and_replace), [`write`](#write)
491
511
 
492
512
  ### Diff and Patch Workflow
493
513
 
494
514
  Compare file versions and apply patches. Generate a unified diff with `diff_files`, preview with `apply_patch(dryRun: true)`, then apply. Supports both single-file and multi-file patches (best-effort per file with per-file `results[]`).
495
515
 
496
- **Relevant tools:** `diff_files`, `apply_patch`
516
+ **Relevant tools:** [`diff_files`](#diff_files), [`apply_patch`](#apply_patch)
497
517
 
498
518
  ### File Management
499
519
 
500
520
  Create directories, move/rename files, delete files, and verify file integrity via SHA-256 hashing.
501
521
 
502
- **Relevant tools:** `mkdir`, `mv`, `rm`, `calculate_hash`, `write`
522
+ **Relevant tools:** [`mkdir`](#mkdir), [`mv`](#mv), [`rm`](#rm), [`calculate_hash`](#calculate_hash), [`write`](#write)
503
523
 
504
524
  ## Architecture
505
525
 
@@ -565,6 +585,8 @@ Create directories, move/rename files, delete files, and verify file integrity v
565
585
 
566
586
  ### Tools
567
587
 
588
+ [`roots`](#roots) · [`ls`](#ls) · [`find`](#find) · [`tree`](#tree) · [`read`](#read) · [`read_many`](#read_many) · [`stat`](#stat) · [`stat_many`](#stat_many) · [`grep`](#grep) · [`mkdir`](#mkdir) · [`write`](#write) · [`edit`](#edit) · [`mv`](#mv) · [`rm`](#rm) · [`calculate_hash`](#calculate_hash) · [`diff_files`](#diff_files) · [`apply_patch`](#apply_patch) · [`search_and_replace`](#search_and_replace)
589
+
568
590
  #### `roots`
569
591
 
570
592
  List allowed workspace roots. Call first — all other tools are scoped to these directories.
@@ -582,8 +604,8 @@ List immediate directory contents: name, path, type, size, modified date.
582
604
  | `path` | string | no | Base directory (default: root) |
583
605
  | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
584
606
  | `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 |
607
+ | `maxDepth` | integer | no | Max recursion depth (1-50) when pattern is provided |
608
+ | `maxEntries` | integer | no | Max entries before truncation. Default: 20000, Max: 20000 |
587
609
  | `sortBy` | enum | no | `name` \| `size` \| `modified` \| `type`. Default: `name` |
588
610
  | `pattern` | string | no | Relative glob filter (e.g. `**/*.ts`). Absolute paths and `..` are rejected |
589
611
  | `includeSymlinkTargets` | boolean | no | Resolve symlink targets. Default: `false` |
@@ -599,11 +621,11 @@ Find files by glob pattern. Returns matching files with metadata.
599
621
  | ---------------- | ------- | -------- | ---------------------------------------------------------------------------- |
600
622
  | `path` | string | no | Base directory (default: root) |
601
623
  | `pattern` | string | **yes** | Relative glob pattern (e.g. `**/*.ts`). Absolute paths and `..` are rejected |
602
- | `maxResults` | integer | no | Max results (1-100000). Default: 1000 |
624
+ | `maxResults` | integer | no | Max results (1-10000). Default: 100 |
603
625
  | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
604
626
  | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
605
627
  | `sortBy` | enum | no | `path` \| `name` \| `size` \| `modified`. Default: `path` |
606
- | `maxDepth` | integer | no | Max directory depth (0-1000) |
628
+ | `maxDepth` | integer | no | Max directory depth (0-100) |
607
629
  | `cursor` | string | no | Pagination cursor |
608
630
 
609
631
  ---
@@ -615,8 +637,8 @@ Render a directory tree with bounded recursion. Returns ASCII tree + structured
615
637
  | Parameter | Type | Required | Description |
616
638
  | ---------------- | ------- | -------- | ---------------------------------------------------- |
617
639
  | `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 |
640
+ | `maxDepth` | integer | no | Depth (0 = root node only). Default: 5, Max: 50 |
641
+ | `maxEntries` | integer | no | Max entries. Default: 1000, Max: 20000 |
620
642
  | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
621
643
  | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
622
644
  | `includeSizes` | boolean | no | Include file sizes in tree entries. Default: `false` |
@@ -676,18 +698,18 @@ Get metadata for multiple files/directories in one request.
676
698
 
677
699
  Search file contents (grep-like). Returns matching lines with optional context.
678
700
 
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` |
701
+ | Parameter | Type | Required | Description |
702
+ | ---------------- | ------- | -------- | ------------------------------------------------------------------- |
703
+ | `path` | string | no | Base directory (default: root) |
704
+ | `pattern` | string | **yes** | Search text or RE2 regex when `isRegex=true` |
705
+ | `isRegex` | boolean | no | Treat pattern as RE2 regex. Default: `false` |
706
+ | `caseSensitive` | boolean | no | Case-sensitive matching. Default: `false` |
707
+ | `wholeWord` | boolean | no | Match whole words only. Default: `false` |
708
+ | `contextLines` | integer | no | Lines of context before/after (0-50). Default: 0 |
709
+ | `maxResults` | integer | no | Max match rows (0-10000). Default: 500 |
710
+ | `filePattern` | string | no | Relative glob for candidate files (e.g. `**/*.ts`). Default: `**/*` |
711
+ | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
712
+ | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
691
713
 
692
714
  ---
693
715
 
@@ -792,19 +814,19 @@ Apply a unified diff patch to one or more files. Single-file: throws on failure.
792
814
 
793
815
  Bulk search-and-replace across files matching a glob. Replaces **all** occurrences per file. Always `dryRun: true` first.
794
816
 
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` |
817
+ | Parameter | Type | Required | Description |
818
+ | ---------------- | ------- | -------- | ------------------------------------------------------- |
819
+ | `path` | string | no | Base directory (default: root) |
820
+ | `filePattern` | string | no | Relative glob pattern (e.g. `**/*.ts`). Default: `**/*` |
821
+ | `searchPattern` | string | **yes** | Text to search. RE2 regex when `isRegex=true` |
822
+ | `replacement` | string | **yes** | Replacement text. Supports `$1`, `$2` with regex |
823
+ | `isRegex` | boolean | no | Treat as RE2 regex. Default: `false` |
824
+ | `dryRun` | boolean | no | Preview matches with diff. Default: `false` |
825
+ | `includeHidden` | boolean | no | Include dotfiles. Default: `false` |
826
+ | `includeIgnored` | boolean | no | Include ignored items. Default: `false` |
827
+ | `returnDiff` | boolean | no | Return diff even when not dry-run. Default: `false` |
828
+ | `maxFiles` | integer | no | Max files to process before stopping (1-10000) |
829
+ | `caseSensitive` | boolean | no | Case-sensitive matching. Default: `true` |
808
830
 
809
831
  ### Resources
810
832
 
@@ -849,21 +871,69 @@ Bulk search-and-replace across files matching a glob. Replaces **all** occurrenc
849
871
 
850
872
  All 18 tools define `outputSchema` (Zod -> JSON Schema) and return `structuredContent` alongside text `content`. Set `FS_CONTEXT_STRIP_STRUCTURED=true` to strip output schemas from tool definitions (reduces token usage for LLMs that don't use structured output).
851
873
 
874
+ [↑ Back to top](#table-of-contents)
875
+
852
876
  ## Configuration
853
877
 
854
- | Variable | Default | Description |
855
- | ---------------------------------- | ---------------- | ------------------------------------------------------------------------------ |
856
- | `FILESYSTEM_MCP_API_KEY` | _(none)_ | Bearer token required when binding HTTP to a non-loopback host |
857
- | `FILESYSTEM_MCP_MAX_HTTP_SESSIONS` | `100` | Max concurrent HTTP sessions (1-10,000) |
858
- | `FILESYSTEM_MCP_HTTP_HOST` | `127.0.0.1` | HTTP server bind address |
859
- | `FS_CONTEXT_MAX_REQUEST_BYTES` | `4194304` (4 MB) | Max HTTP request body size (1 KB - 256 MB) |
860
- | `FS_CONTEXT_MAX_INLINE_CHARS` | _(auto)_ | Max inline result chars before externalizing to `filesystem-mcp://result/{id}` |
861
- | `FS_CONTEXT_MAX_INLINE_MATCHES` | `50` | Max inline search matches before truncation |
862
- | `FS_CONTEXT_STRIP_STRUCTURED` | `false` | Strip `outputSchema` from tool definitions |
863
- | `FS_CONTEXT_DIAGNOSTICS` | `false` | Enable diagnostic logging |
864
- | `FS_CONTEXT_DIAGNOSTICS_DETAIL` | `false` | Enable detailed diagnostic output |
865
- | `FS_CONTEXT_TOOL_LOG_ERRORS` | `false` | Log tool errors to stderr |
866
- | `FS_CONTEXT_SEARCH_WORKERS_DEBUG` | `false` | Debug logging for search worker pool |
878
+ ### HTTP & Auth
879
+
880
+ | Variable | Default | Description |
881
+ | ---------------------------------- | ---------------- | -------------------------------------------------------------- |
882
+ | `FILESYSTEM_MCP_API_KEY` | _(none)_ | Bearer token required when binding HTTP to a non-loopback host |
883
+ | `FILESYSTEM_MCP_MAX_HTTP_SESSIONS` | `100` | Max concurrent HTTP sessions (1-10,000) |
884
+ | `FILESYSTEM_MCP_HTTP_HOST` | `127.0.0.1` | HTTP server bind address |
885
+ | `FS_CONTEXT_MAX_REQUEST_BYTES` | `4194304` (4 MB) | Max HTTP request body size (1 KB - 256 MB) |
886
+
887
+ ### File Size Limits
888
+
889
+ | Variable | Default | Description |
890
+ | -------------------------- | ------------------ | ------------------------------------------------------------- |
891
+ | `MAX_FILE_SIZE` | `10485760` (10 MB) | Max file size for text read operations (1 MB - 100 MB) |
892
+ | `MAX_SEARCH_SIZE` | `1048576` (1 MB) | Max file size for content search/grep (100 KB - 10 MB) |
893
+ | `MAX_READ_MANY_TOTAL_SIZE` | `524288` (512 KB) | Max cumulative size for `read_many` requests (10 KB - 100 MB) |
894
+ | `DEFAULT_SEARCH_TIMEOUT` | `5000` | Search operation timeout in ms (100 - 60,000) |
895
+
896
+ ### Access Control
897
+
898
+ | Variable | Default | Description |
899
+ | ---------------------------- | -------- | ------------------------------------------------------------------------------- |
900
+ | `FS_CONTEXT_ALLOW_SENSITIVE` | `false` | Allow reading sensitive files (.env, .key, credentials, tokens) |
901
+ | `FS_CONTEXT_DENYLIST` | _(none)_ | CSV/newline-separated glob patterns to block (in addition to built-in denylist) |
902
+ | `FS_CONTEXT_ALLOWLIST` | _(none)_ | CSV/newline-separated glob patterns to permit (overrides denylist) |
903
+
904
+ ### Output & Inline Limits
905
+
906
+ | Variable | Default | Description |
907
+ | ------------------------------- | ------- | ------------------------------------------------------------------------------ |
908
+ | `FS_CONTEXT_MAX_INLINE_CHARS` | `20000` | Max inline result chars before externalizing to `filesystem-mcp://result/{id}` |
909
+ | `FS_CONTEXT_MAX_INLINE_MATCHES` | `50` | Max inline search matches before truncation |
910
+ | `FS_CONTEXT_STRIP_STRUCTURED` | `false` | Strip `outputSchema` from tool definitions (reduces tokens) |
911
+
912
+ ### Tasks
913
+
914
+ | Variable | Default | Description |
915
+ | ------------------------------------- | ---------------- | ----------------------------------------------- |
916
+ | `FILESYSTEM_MCP_MAX_TASK_TTL_MS` | `3600000` (1 hr) | Max task TTL before auto-eviction (1 s - 24 hr) |
917
+ | `FILESYSTEM_MCP_MAX_CONCURRENT_TASKS` | `100` | Max simultaneous task executions (1-10,000) |
918
+
919
+ ### Logging & Diagnostics
920
+
921
+ | Variable | Default | Description |
922
+ | --------------------------------- | ------- | ------------------------------------------------------------------------------ |
923
+ | `FILESYSTEM_MCP_LOG_LEVEL` | `info` | MCP log level: debug, info, notice, warning, error, critical, alert, emergency |
924
+ | `FS_CONTEXT_DIAGNOSTICS` | `false` | Enable diagnostic logging |
925
+ | `FS_CONTEXT_DIAGNOSTICS_DETAIL` | `false` | Enable detailed diagnostic output |
926
+ | `FS_CONTEXT_TOOL_LOG_ERRORS` | `false` | Log tool errors to stderr |
927
+ | `FS_CONTEXT_SEARCH_WORKERS_DEBUG` | `false` | Debug logging for search worker pool |
928
+
929
+ ### Performance
930
+
931
+ | Variable | Default | Description |
932
+ | ------------------------------- | ---------------- | ---------------------------------------- |
933
+ | `FS_CONTEXT_SEARCH_WORKERS` | CPU cores (≤ 8) | Concurrent search worker threads (1-16) |
934
+ | `FS_CONTEXT_LIST_CURSOR_TTL_MS` | `300000` (5 min) | Cursor TTL for `ls` pagination snapshots |
935
+
936
+ [↑ Back to top](#table-of-contents)
867
937
 
868
938
  ## HTTP Endpoints
869
939
 
@@ -898,6 +968,8 @@ When started with `--port <number>`, the server exposes a single MCP endpoint:
898
968
  | Request body limit | confirmed | `src/server/bootstrap.ts` — configurable max request size (413 on overflow) |
899
969
  | Remote bind guard | confirmed | `src/server/bootstrap.ts` — refuses non-loopback bind without `FILESYSTEM_MCP_API_KEY` |
900
970
 
971
+ [↑ Back to top](#table-of-contents)
972
+
901
973
  ## Development
902
974
 
903
975
  - `dev` — `tsc --watch --preserveWatchOutput` — Watch mode TypeScript compilation
@@ -935,10 +1007,10 @@ When started with `--port <number>`, the server exposes a single MCP endpoint:
935
1007
  | [diff](https://www.npmjs.com/package/diff) | Unified diff generation and patch application |
936
1008
  | [ignore](https://www.npmjs.com/package/ignore) | `.gitignore` pattern matching |
937
1009
  | [re2](https://www.npmjs.com/package/re2) | Safe RE2 regex engine (no ReDoS) |
938
- | [safe-regex2](https://www.npmjs.com/package/safe-regex2) | Regex safety validation |
939
1010
  | [zod](https://www.npmjs.com/package/zod) | Schema validation and JSON Schema generation |
940
1011
 
941
- ## Contributing and License
1012
+ ## License
1013
+
1014
+ MIT License. See [LICENSE](LICENSE) for details.
942
1015
 
943
- - **License:** MIT
944
- - Contributions welcome via pull requests.
1016
+ [↑ Back to top](#table-of-contents)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j0hanz/filesystem-mcp",
3
- "version": "1.14.1",
3
+ "version": "1.15.0",
4
4
  "mcpName": "io.github.j0hanz/filesystem-mcp",
5
5
  "description": "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.",
6
6
  "type": "module",