@j0hanz/fs-context-mcp 2.0.4 → 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.
- package/dist/instructions.md +88 -69
- package/package.json +1 -1
package/dist/instructions.md
CHANGED
|
@@ -1,112 +1,131 @@
|
|
|
1
|
-
# FS Context MCP Server
|
|
1
|
+
# FS Context MCP Server — AI Usage Instructions
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
This server can only access explicitly allowed “workspace roots” and never writes to disk.
|
|
3
|
+
Use this server to explore, search, and read filesystem content within allowed workspace roots. All operations are read-only. Prefer using these tools over "remembering" file contents in chat.
|
|
5
4
|
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
##
|
|
7
|
+
## Operating Rules
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
5. `read` / `read_many` → open the exact files you need
|
|
15
|
-
6. `stat` / `stat_many` → confirm type/size/mime before reading
|
|
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.
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Key Rules (Avoid Surprises)
|
|
14
|
+
### Strategies
|
|
20
15
|
|
|
21
|
-
- **
|
|
22
|
-
- **
|
|
23
|
-
- **`find` is glob search; `grep` is content search:** use `find` to locate files, `grep` to locate text inside files.
|
|
24
|
-
- **Symlink policy:** directory scans do not traverse symlinked directories; direct symlink targets are allowed only if they resolve within roots.
|
|
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`.
|
|
25
18
|
|
|
26
19
|
---
|
|
27
20
|
|
|
28
|
-
##
|
|
21
|
+
## Data Model
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| List a directory | `ls` | Non-recursive; `includeHidden` optional |
|
|
34
|
-
| Find files | `find` | Glob patterns; default excludes common build/deps unless `includeIgnored=true` |
|
|
35
|
-
| Search text | `grep` | Literal, case-insensitive text search; can scan a dir or a single file |
|
|
36
|
-
| Read one file | `read` | UTF-8 text; rejects binary; use `head` to preview |
|
|
37
|
-
| Read many files | `read_many` | Up to 100 paths; may skip files if combined reads exceed budget |
|
|
38
|
-
| File metadata | `stat` | Type, size, modified, permissions, mimeType (extension-based) |
|
|
39
|
-
| Metadata batch | `stat_many` | Prefer for 2+ paths |
|
|
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).
|
|
40
26
|
|
|
41
27
|
---
|
|
42
28
|
|
|
43
|
-
##
|
|
29
|
+
## Workflows
|
|
44
30
|
|
|
45
|
-
### Project
|
|
31
|
+
### 1) Project Discovery
|
|
46
32
|
|
|
47
33
|
```text
|
|
48
|
-
roots
|
|
49
|
-
ls(path=".")
|
|
50
|
-
read_many(paths=["package.json", "README.md"]
|
|
34
|
+
roots → confirm access
|
|
35
|
+
ls(path=".") → see top-level structure
|
|
36
|
+
read_many(paths=["package.json", "README.md"]) → understand project
|
|
51
37
|
```
|
|
52
38
|
|
|
53
|
-
###
|
|
39
|
+
### 2) Find & Read Code
|
|
54
40
|
|
|
55
41
|
```text
|
|
56
|
-
find(pattern="
|
|
57
|
-
grep(path="src", pattern="registerTool")
|
|
58
|
-
read(path="src/tools.ts", head=
|
|
42
|
+
find(pattern="**/*.ts", maxResults=500) → locate candidates
|
|
43
|
+
grep(path="src", pattern="registerTool") → find references
|
|
44
|
+
read(path="src/tools.ts", head=100) → read implementation
|
|
59
45
|
```
|
|
60
46
|
|
|
61
|
-
### Check
|
|
47
|
+
### 3) Check Before Reading
|
|
62
48
|
|
|
63
49
|
```text
|
|
64
|
-
stat(path="docs/logo.png")
|
|
65
|
-
stat_many(paths=["README.md", "dist/index.js"])
|
|
50
|
+
stat(path="docs/logo.png") → confirm type/size
|
|
51
|
+
stat_many(paths=["README.md", "dist/index.js"])→ batch metadata check
|
|
66
52
|
```
|
|
67
53
|
|
|
68
54
|
---
|
|
69
55
|
|
|
70
|
-
##
|
|
56
|
+
## Tools
|
|
57
|
+
|
|
58
|
+
### roots
|
|
59
|
+
|
|
60
|
+
List accessible workspace roots.
|
|
61
|
+
|
|
62
|
+
- **Use when:** First call, or access errors.
|
|
63
|
+
|
|
64
|
+
### ls
|
|
65
|
+
|
|
66
|
+
List immediate directory contents (non-recursive).
|
|
67
|
+
|
|
68
|
+
- **Args:** `path` (opt), `includeHidden` (opt/false).
|
|
69
|
+
- **Returns:** Name, type, size, modified.
|
|
70
|
+
|
|
71
|
+
### find
|
|
72
|
+
|
|
73
|
+
Find files by glob pattern.
|
|
74
|
+
|
|
75
|
+
- **Args:** `pattern` (req, max 1000ch), `path` (opt), `maxResults` (opt/100), `includeIgnored` (opt/false).
|
|
76
|
+
- **Ref:** `**/*.ts` (recursive), `src/*` (flat). Matches relative paths.
|
|
71
77
|
|
|
72
|
-
###
|
|
78
|
+
### grep
|
|
73
79
|
|
|
74
|
-
|
|
75
|
-
- Default behavior excludes common directories like `node_modules`, `dist`, `.git`, etc.
|
|
76
|
-
Use `includeIgnored=true` when you explicitly want to search those.
|
|
77
|
-
- Prefer scoping with `path` and limiting with `maxResults` for large repos.
|
|
80
|
+
Search text within file contents (literal, case-insensitive).
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
- **Args:** `pattern` (req), `path` (opt), `includeHidden` (opt/false).
|
|
83
|
+
- **Ref:** Skips binary files and >1MB files.
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
### read
|
|
86
|
+
|
|
87
|
+
Read single text file content.
|
|
88
|
+
|
|
89
|
+
- **Args:** `path` (req), `head` (opt/lines).
|
|
90
|
+
- **Ref:** Rejects binary. Use `head` for large files.
|
|
91
|
+
|
|
92
|
+
### read_many
|
|
93
|
+
|
|
94
|
+
Read multiple text files.
|
|
95
|
+
|
|
96
|
+
- **Args:** `paths` (req, max 100), `head` (opt).
|
|
97
|
+
- **Ref:** No binary detection (use `stat` first). Returns per-file result/error.
|
|
98
|
+
|
|
99
|
+
### stat / stat_many
|
|
100
|
+
|
|
101
|
+
Get metadata for single or multiple paths.
|
|
102
|
+
|
|
103
|
+
- **Args:** `path` (req) / `paths` (req).
|
|
104
|
+
- **Returns:** Type, size, modified, permissions, mimeType.
|
|
105
|
+
|
|
106
|
+
---
|
|
84
107
|
|
|
85
|
-
|
|
108
|
+
## Response Shape
|
|
86
109
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
- By design, it **skips binary files** and **skips very large files** (size limits are configurable by the server environment).
|
|
90
|
-
“No matches” is not proof that a string doesn’t exist in a binary/large file.
|
|
110
|
+
Success: `{ "ok": true, ...data }`
|
|
111
|
+
Error: `{ "ok": false, "error": { "code": "E_...", "message": "...", "suggestion": "..." } }`
|
|
91
112
|
|
|
92
|
-
###
|
|
113
|
+
### Common Errors
|
|
93
114
|
|
|
94
|
-
- `
|
|
95
|
-
- `
|
|
96
|
-
|
|
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.
|
|
97
119
|
|
|
98
120
|
---
|
|
99
121
|
|
|
100
|
-
##
|
|
122
|
+
## Limits
|
|
101
123
|
|
|
102
|
-
-
|
|
103
|
-
-
|
|
124
|
+
- **Max Read:** 10MB (file), 1MB (search).
|
|
125
|
+
- **Max Items:** 100 (read/stat batch), 100 (find default).
|
|
126
|
+
- **Timeout:** 30s.
|
|
104
127
|
|
|
105
|
-
|
|
128
|
+
## Security
|
|
106
129
|
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
- `E_TOO_LARGE` (use `head`)
|
|
110
|
-
- `E_INVALID_PATTERN` (glob pattern issues in `find`)
|
|
111
|
-
- `E_TIMEOUT` (narrow scope, reduce results)
|
|
112
|
-
- `E_PERMISSION_DENIED`
|
|
130
|
+
- **Read-only:** No writes/deletes.
|
|
131
|
+
- **Sandboxed:** Symlinks cannot escape roots.
|
package/package.json
CHANGED