@j0hanz/fs-context-mcp 2.0.5 → 2.0.6

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 (2) hide show
  1. package/dist/instructions.md +49 -144
  2. package/package.json +1 -1
@@ -6,56 +6,27 @@ Use this server to explore, search, and read filesystem content within allowed w
6
6
 
7
7
  ## Operating Rules
8
8
 
9
- - Use tools only when you need to verify, discover, or read filesystem state.
10
- - Call `roots` first to confirm accessible directories before any other operation.
11
- - Operate by paths (relative to roots when practical) rather than guessing file locations.
12
- - Batch operations when available: use `read_many` for 2+ files, `stat_many` for 2+ metadata checks.
13
- - All tools are read-only; no destructive operations exist.
14
- - Keep operations atomic; if a request is vague, ask a clarifying question before calling tools.
9
+ - Call `roots` first to confirm accessible directories.
10
+ - Operate by paths relative to roots rather than guessing locations.
11
+ - Batch operations: `read_many` for 2+ files, `stat_many` for 2+ checks.
12
+ - If request is vague, ask clarifying questions before calling tools.
15
13
 
16
- ### Quick Decision Rules
14
+ ### Strategies
17
15
 
18
- - If you are unsure what directories are accessible: call `roots` first.
19
- - If you need to locate files by name or pattern: use `find` (glob search).
20
- - If you need to locate text inside files: use `grep` (content search).
21
- - If reading multiple files: use `read_many` (up to 100 paths).
22
- - If unsure whether a file is text or binary: use `stat` to check `mimeType` first.
23
- - If a file is too large: use `head` parameter to preview first N lines.
24
-
25
- ### Client UX Notes (VS Code)
26
-
27
- - Non-read-only tools typically require user confirmation — this server has none.
28
- - Tool lists can be cached; users can reset cached tools via **MCP: Reset Cached Tools**.
29
- - Only run MCP servers from trusted sources; VS Code prompts users to trust servers.
16
+ - **Discovery:** Unsure directories? Call `roots`. File name pattern? `find`. Content text? `grep`.
17
+ - **Reading:** Multiple files? `read_many`. Large file? `read` with `head`. Binary check? `stat`.
30
18
 
31
19
  ---
32
20
 
33
- ## Data Model (What the Server Operates On)
34
-
35
- ### Workspace Roots
36
-
37
- - Absolute directory paths the server is allowed to access.
38
- - Configured via CLI arguments, `--allow-cwd` flag, or client-provided MCP Roots protocol.
39
- - All path operations are validated against these roots.
21
+ ## Data Model
40
22
 
41
- ### File/Directory Entries
42
-
43
- - `name` basename of the entry
44
- - `path` — absolute or relative path
45
- - `type` — `file` | `directory` | `symlink` | `other`
46
- - `size` — bytes (optional for directories)
47
- - `modified` — ISO 8601 timestamp
48
- - `mimeType` — extension-based MIME type (for `stat` results)
49
-
50
- ### Search Matches (grep)
51
-
52
- - `file` — relative path from search base
53
- - `line` — 1-based line number
54
- - `content` — matched line text (truncated to 200 chars)
23
+ - **Workspace Roots:** Absolute paths; all operations validated against these.
24
+ - **Entries:** `name`, `path` (abs/rel), `type` (file/directory/symlink), `size`, `modified`.
25
+ - **Search Matches:** `file` (relative), `line`, `content` (truncated).
55
26
 
56
27
  ---
57
28
 
58
- ## Workflows (Recommended)
29
+ ## Workflows
59
30
 
60
31
  ### 1) Project Discovery
61
32
 
@@ -73,7 +44,7 @@ grep(path="src", pattern="registerTool") → find references
73
44
  read(path="src/tools.ts", head=100) → read implementation
74
45
  ```
75
46
 
76
- ### 3) Check Before Reading (Avoid Binary/Huge Files)
47
+ ### 3) Check Before Reading
77
48
 
78
49
  ```text
79
50
  stat(path="docs/logo.png") → confirm type/size
@@ -82,145 +53,79 @@ stat_many(paths=["README.md", "dist/index.js"])→ batch metadata check
82
53
 
83
54
  ---
84
55
 
85
- ## Tools (What to Use, When)
56
+ ## Tools
86
57
 
87
58
  ### roots
88
59
 
89
- List workspace roots this server can access.
60
+ List accessible workspace roots.
90
61
 
91
- - Use when: first call in any session, or when access errors occur.
92
- - Args: none
93
- - Notes: If empty, no other tools will work until roots are configured.
62
+ - **Use when:** First call, or access errors.
94
63
 
95
64
  ### ls
96
65
 
97
- List immediate contents of a directory (non-recursive).
66
+ List immediate directory contents (non-recursive).
98
67
 
99
- - Use when: orienting in a directory, seeing what files exist.
100
- - Args:
101
- - `path` (optional) — directory to list; omit for first root
102
- - `includeHidden` (optional, default false) — include dotfiles
103
- - Notes: Returns name, relativePath, type, size, modified. Use `find` for recursive search.
68
+ - **Args:** `path` (opt), `includeHidden` (opt/false).
69
+ - **Returns:** Name, type, size, modified.
104
70
 
105
71
  ### find
106
72
 
107
- Find files by glob pattern (e.g., `**/*.ts`).
73
+ Find files by glob pattern.
108
74
 
109
- - Use when: locating files by name/extension pattern.
110
- - Args:
111
- - `pattern` (required) — glob pattern (max 1000 chars, no absolute paths)
112
- - `path` (optional) — base directory; omit for first root
113
- - `maxResults` (optional, default 100, max 10000)
114
- - `includeIgnored` (optional, default false) — include node_modules, dist, .git, etc.
115
- - Notes: Default excludes common build/dependency directories. Returns relative paths.
75
+ - **Args:** `pattern` (req, max 1000ch), `path` (opt), `maxResults` (opt/100), `includeIgnored` (opt/false).
76
+ - **Ref:** `**/*.ts` (recursive), `src/*` (flat). Matches relative paths.
116
77
 
117
78
  ### grep
118
79
 
119
- Search for text within file contents (case-insensitive, literal match).
80
+ Search text within file contents (literal, case-insensitive).
120
81
 
121
- - Use when: finding references, function usages, or specific text in code.
122
- - Args:
123
- - `pattern` (required) — text to search for (max 1000 chars)
124
- - `path` (optional) — directory or single file to search; omit for first root
125
- - `includeHidden` (optional, default false) — include dotfiles
126
- - Notes: Skips binary files and files > 1MB (configurable). Returns file, line, content.
82
+ - **Args:** `pattern` (req), `path` (opt), `includeHidden` (opt/false).
83
+ - **Ref:** Skips binary files and >1MB files.
127
84
 
128
85
  ### read
129
86
 
130
- Read text contents of a single file.
87
+ Read single text file content.
131
88
 
132
- - Use when: opening one file, previewing large files.
133
- - Args:
134
- - `path` (required) — file path
135
- - `head` (optional, 1-100000) — read only first N lines
136
- - Notes: Rejects binary files. Use `head` for large files to avoid E_TOO_LARGE.
89
+ - **Args:** `path` (req), `head` (opt/lines).
90
+ - **Ref:** Rejects binary. Use `head` for large files.
137
91
 
138
92
  ### read_many
139
93
 
140
- Read multiple text files in one request.
141
-
142
- - Use when: opening 2+ files efficiently.
143
- - Args:
144
- - `paths` (required) — array of file paths (max 100)
145
- - `head` (optional) — limit lines per file
146
- - Notes: Does not detect binary; use `stat_many` first if unsure. Returns per-file results with content or error.
94
+ Read multiple text files.
147
95
 
148
- ### stat
96
+ - **Args:** `paths` (req, max 100), `head` (opt).
97
+ - **Ref:** No binary detection (use `stat` first). Returns per-file result/error.
149
98
 
150
- Get metadata for a single file or directory.
99
+ ### stat / stat_many
151
100
 
152
- - Use when: checking file type, size, or mimeType before reading.
153
- - Args:
154
- - `path` (required) — file or directory path
155
- - Notes: Returns name, path, type, size, modified, permissions, mimeType, symlinkTarget.
101
+ Get metadata for single or multiple paths.
156
102
 
157
- ### stat_many
158
-
159
- Get metadata for multiple files/directories in one request.
160
-
161
- - Use when: batch checking 2+ paths.
162
- - Args:
163
- - `paths` (required) — array of paths (max 100)
164
- - Notes: Returns per-path results with info or error.
103
+ - **Args:** `path` (req) / `paths` (req).
104
+ - **Returns:** Type, size, modified, permissions, mimeType.
165
105
 
166
106
  ---
167
107
 
168
108
  ## Response Shape
169
109
 
170
- All tools return structured JSON with:
171
-
172
- ```json
173
- {
174
- "ok": true
175
- // ... tool-specific data
176
- }
177
- ```
178
-
179
- On error:
180
-
181
- ```json
182
- {
183
- "ok": false,
184
- "error": {
185
- "code": "E_NOT_FOUND",
186
- "message": "File not found: src/missing.ts",
187
- "path": "src/missing.ts",
188
- "suggestion": "Check the path exists within allowed roots"
189
- }
190
- }
191
- ```
110
+ Success: `{ "ok": true, ...data }`
111
+ Error: `{ "ok": false, "error": { "code": "E_...", "message": "...", "suggestion": "..." } }`
192
112
 
193
- ### Common Error Codes
113
+ ### Common Errors
194
114
 
195
- | Code | Meaning | Resolution |
196
- | --------------------- | ----------------------- | --------------------------------- |
197
- | `E_ACCESS_DENIED` | Path outside roots | Check `roots`, use valid path |
198
- | `E_NOT_FOUND` | Path does not exist | Verify path with `ls` or `find` |
199
- | `E_NOT_FILE` | Expected file, got dir | Use `ls` instead |
200
- | `E_NOT_DIRECTORY` | Expected dir, got file | Use `read` instead |
201
- | `E_TOO_LARGE` | File exceeds size limit | Use `head` parameter |
202
- | `E_TIMEOUT` | Operation took too long | Narrow scope, reduce `maxResults` |
203
- | `E_INVALID_PATTERN` | Malformed glob pattern | Simplify pattern |
204
- | `E_PERMISSION_DENIED` | OS-level access denied | Check file permissions |
115
+ - `E_ACCESS_DENIED`: Path outside roots.
116
+ - `E_NOT_FOUND`: Path missing.
117
+ - `E_TOO_LARGE`: File exceeds limit (use `head`).
118
+ - `E_TIMEOUT`: Reduce scope/results.
205
119
 
206
120
  ---
207
121
 
208
- ## Limits & Defaults
122
+ ## Limits
209
123
 
210
- | Limit | Default | Configurable Via |
211
- | ----------------------- | ---------- | ------------------------- |
212
- | Max file size (read) | 10 MB | `MAX_FILE_SIZE` env |
213
- | Max search file size | 1 MB | `MAX_SEARCH_SIZE` env |
214
- | Search timeout | 30 seconds | `DEFAULT_SEARCH_TIMEOUT` |
215
- | Max results (find) | 100 | `maxResults` arg (≤10000) |
216
- | Max paths (read_many) | 100 | — |
217
- | Line content truncation | 200 chars | — |
218
-
219
- ---
124
+ - **Max Read:** 10MB (file), 1MB (search).
125
+ - **Max Items:** 100 (read/stat batch), 100 (find default).
126
+ - **Timeout:** 30s.
220
127
 
221
- ## Security Notes
128
+ ## Security
222
129
 
223
- - **Read-only:** no writes, deletes, or modifications.
224
- - **Path validation:** symlinks cannot escape allowed roots.
225
- - **Binary detection:** `read` rejects binary files; `grep` skips them.
226
- - **Input sanitization:** glob patterns validated to prevent ReDoS.
130
+ - **Read-only:** No writes/deletes.
131
+ - **Sandboxed:** Symlinks cannot escape roots.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j0hanz/fs-context-mcp",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "mcpName": "io.github.j0hanz/fs-context",
5
5
  "description": "🔍 Read-only MCP server for secure filesystem exploration, searching, and analysis",
6
6
  "type": "module",