@sammysnake/fast-context-mcp 1.2.0 → 1.3.0-beta.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 CHANGED
@@ -10,25 +10,36 @@ Any MCP-compatible client (Claude Code, Claude Desktop, Cursor, etc.) can use th
10
10
  You: "where is the authentication logic?"
11
11
 
12
12
 
13
- ┌─────────────────────────┐
14
- │ Fast Context MCP
15
- (local MCP server)
16
-
17
- 1. Maps project/codebase
18
- 2. Sends query to Windsurf Devstral API
19
- 3. AI generates rg/readfile/tree commands
20
- 4. Executes commands locally (built-in rg)
21
- 5. Returns results to AI
22
- 6. Repeats for N rounds
23
- 7. Returns file paths + line ranges
24
- + suggested search keywords
25
- └─────────────────────────┘
13
+ ┌──────────────────────────────────────────────────────┐
14
+ │ Fast Context MCP (local MCP server)
15
+
16
+ Phase 1: Bootstrap (optional)
17
+ 1. Mini-tree scanDevstral API │
18
+ 2. Returns hot directories + rg patterns │
19
+
20
+ Phase 2: Directory Scoring │
21
+ 3. BM25F + Probe grep + Git RFM + File Agg │
22
+ 4. RRF fusion adaptive topK selection │
23
+ (Kneedle gap + entropy + tail threshold) │
24
+ 5. Path spine extraction (scored file hints) │
25
+ │ │
26
+ │ Phase 3: Main Search (N rounds) │
27
+ │ 6. Query + optimized repo map → Devstral API │
28
+ │ (tree + hotspot subtrees + path spines) │
29
+ │ 7. AI generates rg/readfile/tree/ls commands │
30
+ │ 8. Execute locally (built-in rg) → return results │
31
+ │ 9. Repeat for N rounds │
32
+ │ 10. Final answer: file paths + line ranges │
33
+ │ + suggested search keywords │
34
+ └──────────────────────────────────────────────────────┘
26
35
 
27
36
 
28
- Found 3 relevant files.
29
- [1/3] /project/src/auth/handler.py (L10-60)
30
- [2/3] /project/src/middleware/jwt.py (L1-40)
31
- [3/3] /project/src/models/user.py (L20-80)
37
+ Found 5 relevant files.
38
+ [1/5] /project/src/auth/handler.py (L10-60)
39
+ [2/5] /project/src/middleware/jwt.py (L1-40)
40
+ [3/5] /project/src/models/user.py (L20-80)
41
+ [4/5] /project/src/routes/login.py (L5-35)
42
+ [5/5] /project/src/utils/token.py (L1-25)
32
43
 
33
44
  Suggested search keywords:
34
45
  authenticate, jwt.*verify, session.*token
@@ -43,6 +54,18 @@ No need to install ripgrep — it's bundled via `@vscode/ripgrep`.
43
54
 
44
55
  ## Installation
45
56
 
57
+ ### Option 1: npm (Recommended)
58
+
59
+ ```bash
60
+ # Latest stable release
61
+ npm install @sammysnake/fast-context-mcp
62
+
63
+ # Or beta/next release
64
+ npm install @sammysnake/fast-context-mcp@next
65
+ ```
66
+
67
+ ### Option 2: From Source
68
+
46
69
  ```bash
47
70
  git clone https://github.com/SammySnake-d/fast-context-mcp.git
48
71
  cd fast-context-mcp
@@ -72,8 +95,22 @@ Add to `~/.claude.json` under `mcpServers`:
72
95
  ```json
73
96
  {
74
97
  "fast-context": {
75
- "command": "node",
76
- "args": ["/absolute/path/to/fast-context-mcp/src/server.mjs"],
98
+ "command": "npx",
99
+ "args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp"],
100
+ "env": {
101
+ "WINDSURF_API_KEY": "sk-ws-01-xxxxx"
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ For beta/next release:
108
+
109
+ ```json
110
+ {
111
+ "fast-context": {
112
+ "command": "npx",
113
+ "args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp@next"],
77
114
  "env": {
78
115
  "WINDSURF_API_KEY": "sk-ws-01-xxxxx"
79
116
  }
@@ -88,8 +125,22 @@ Add to `claude_desktop_config.json` under `mcpServers`:
88
125
  ```json
89
126
  {
90
127
  "fast-context": {
91
- "command": "node",
92
- "args": ["/absolute/path/to/fast-context-mcp/src/server.mjs"],
128
+ "command": "npx",
129
+ "args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp"],
130
+ "env": {
131
+ "WINDSURF_API_KEY": "sk-ws-01-xxxxx"
132
+ }
133
+ }
134
+ }
135
+ ```
136
+
137
+ For beta/next release:
138
+
139
+ ```json
140
+ {
141
+ "fast-context": {
142
+ "command": "npx",
143
+ "args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp@next"],
93
144
  "env": {
94
145
  "WINDSURF_API_KEY": "sk-ws-01-xxxxx"
95
146
  }
@@ -107,8 +158,18 @@ Add to `claude_desktop_config.json` under `mcpServers`:
107
158
  | `FC_MAX_TURNS` | `3` | Search rounds per query (more = deeper but slower) |
108
159
  | `FC_MAX_COMMANDS` | `8` | Max parallel commands per round |
109
160
  | `FC_TIMEOUT_MS` | `30000` | Connect-Timeout-Ms for streaming requests |
161
+ | `FC_REPO_MAP_MODE` | `bootstrap_hotspot` | Repo map strategy (`classic` or `bootstrap_hotspot`) |
162
+ | `FC_BOOTSTRAP_TREE_DEPTH` | `1` | Bootstrap mini-tree depth |
163
+ | `FC_HOTSPOT_TOP_K` | `4` | Base hotspot dirs (adaptive topK overrides via Kneedle + entropy) |
164
+ | `FC_HOTSPOT_TREE_DEPTH` | `2` | Tree depth for each hotspot subtree |
165
+ | `FC_HOTSPOT_MAX_BYTES` | `122880` | Max bytes budget for optimized repo map |
166
+ | `FC_BOOTSTRAP_ENABLED` | `true` | Enable standalone bootstrap phase |
167
+ | `FC_BOOTSTRAP_MAX_TURNS` | `2` | Bootstrap phase turns |
168
+ | `FC_BOOTSTRAP_MAX_COMMANDS` | `6` | Bootstrap commands per turn |
110
169
  | `FC_RESULT_MAX_LINES` | `50` | Max lines per command output (truncation) |
111
170
  | `FC_LINE_MAX_CHARS` | `250` | Max characters per output line (truncation) |
171
+ | `FC_PROFILE_CACHE_TTL` | `120` | Directory profile cache TTL in seconds |
172
+ | `FC_GIT_CACHE_TTL` | `300` | Git RFM analysis cache TTL in seconds |
112
173
  | `WS_MODEL` | `MODEL_SWE_1_6_FAST` | Windsurf model name |
113
174
  | `WS_APP_VER` | `1.48.2` | Windsurf app version (protocol metadata) |
114
175
  | `WS_LS_VER` | `1.9544.35` | Windsurf language server version (protocol metadata) |
@@ -131,9 +192,18 @@ AI-driven semantic code search with tunable parameters.
131
192
  |-----------|------|----------|---------|-------------|
132
193
  | `query` | string | Yes | — | Natural language search query |
133
194
  | `project_path` | string | No | cwd | Absolute path to project root |
134
- | `tree_depth` | integer | No | `3` | Directory tree depth for repo map (1-6). Higher = more context but larger payload. Auto falls back to lower depth if tree exceeds 250KB. Use 1-2 for huge monorepos (>5000 files), 3 for most projects, 4-6 for small projects. |
135
- | `max_turns` | integer | No | `3` | Search rounds (1-5). More = deeper search but slower. Use 1-2 for simple lookups, 3 for most queries, 4-5 for complex analysis. |
136
- | `max_results` | integer | No | `10` | Maximum number of files to return (1-30). Smaller = more focused, larger = broader exploration. |
195
+ | `tree_depth` | integer | No | `3` | Repo map depth for `classic` mode only (`0-6`, `0=auto`). Ignored in `bootstrap_hotspot` mode use `bootstrap_tree_depth` and `hotspot_tree_depth` instead. |
196
+ | `max_turns` | integer | No | `3` | Main-phase search rounds (`1-5`). More = deeper search but slower. |
197
+ | `max_results` | integer | No | `10` | Maximum number of files to return (`1-30`). |
198
+ | `exclude_paths` | string[] | No | `[]` | Extra exclude patterns merged with built-in default excludes (`node_modules`, `.git`, `dist`, `build`, `coverage`, `.venv`, ...). |
199
+ | `repo_map_mode` | enum | No | `bootstrap_hotspot` | Repo map strategy: `classic` or `bootstrap_hotspot`. |
200
+ | `bootstrap_tree_depth` | integer | No | `1` | Bootstrap phase mini-tree depth (`1-3`). |
201
+ | `hotspot_top_k` | integer | No | `4` | Base hotspot dirs (`0-8`). Adaptive topK may expand this based on score distribution. |
202
+ | `hotspot_tree_depth` | integer | No | `2` | Tree depth per hotspot subtree (`1-4`). |
203
+ | `hotspot_max_bytes` | integer | No | `122880` | Max byte budget for optimized repo map (`16384-262144`). |
204
+ | `bootstrap_enabled` | boolean | No | `true` | Enable standalone bootstrap phase before main search. |
205
+ | `bootstrap_max_turns` | integer | No | `2` | Bootstrap turns (`1-3`). Independent from `max_turns`. |
206
+ | `bootstrap_max_commands` | integer | No | `6` | Bootstrap commands per turn (`1-8`). Independent from main commands. |
137
207
 
138
208
  Returns:
139
209
  1. **Relevant files** with line ranges
@@ -178,11 +248,12 @@ Extract Windsurf API Key from local installation. No parameters.
178
248
  fast-context-mcp/
179
249
  ├── package.json
180
250
  ├── src/
181
- │ ├── server.mjs # MCP server entry point
182
- │ ├── core.mjs # Auth, message building, streaming, search loop
183
- │ ├── executor.mjs # Tool executor: rg, readfile, tree, ls, glob
184
- │ ├── extract-key.mjs # Windsurf API Key extraction (SQLite)
185
- └── protobuf.mjs # Protobuf encoder/decoder + Connect-RPC frames
251
+ │ ├── server.mjs # MCP server entry point
252
+ │ ├── core.mjs # Auth, message building, streaming, search loop
253
+ │ ├── executor.mjs # Tool executor: rg, readfile, tree, ls, glob
254
+ │ ├── directory-scorer.mjs # BM25F + Probe + Git RFM directory scoring
255
+ ├── extract-key.mjs # Windsurf API Key extraction (SQLite)
256
+ │ └── protobuf.mjs # Protobuf encoder/decoder + Connect-RPC frames
186
257
  ├── README.md
187
258
  └── LICENSE
188
259
  ```
@@ -190,14 +261,35 @@ fast-context-mcp/
190
261
  ## How the Search Works
191
262
 
192
263
  1. Project directory is mapped to virtual `/codebase` path
193
- 2. Directory tree generated at requested depth (default L=3), with **automatic fallback** to lower depth if tree exceeds 250KB
194
- 3. Query + directory tree sent to Windsurf's Devstral model via Connect-RPC/Protobuf
195
- 4. Devstral generates tool commands (ripgrep, file reads, tree, ls, glob)
196
- 5. Commands executed locally in parallel (up to `FC_MAX_COMMANDS` per round)
197
- 6. Results sent back to Devstral for the next round
198
- 7. After `max_turns` rounds, Devstral returns file paths + line ranges
199
- 8. All rg patterns used during search are collected as suggested keywords
200
- 9. Diagnostic metadata appended to help the calling AI tune parameters
264
+ 2. **Directory scoring** via 5-signal RRF fusion:
265
+ - **BM25F**: multi-field scoring (dir name, file paths, metadata, headers)
266
+ - **Probe grep**: single ripgrep call with regex alternation for content matching
267
+ - **Bootstrap keywords**: terms from optional bootstrap pre-scan
268
+ - **Git RFM**: Recency-Frequency-Modification model from git history
269
+ - **File aggregation**: file-level Log-Sum scoring per directory
270
+ 3. **Adaptive hotspot selection** based on IR literature:
271
+ - **Kneedle gap detection** (Taguchi 2025 Adaptive-k): finds the largest score drop as a natural cutoff
272
+ - **Entropy scaling** (CMU Selective Search): flat score distributions auto-expand K; peaked distributions keep K tight
273
+ - **Adaptive tail threshold**: includes strong dirs beyond cutoff based on score decay rate (replaces fixed 0.6 ratio)
274
+ 4. **Path spine extraction**: scored file paths as navigation hints, with source-code path boost and noise path penalty
275
+ 5. Query + optimized repo map (tree + hotspot subtrees + path spines) sent to Windsurf Devstral via Connect-RPC/Protobuf
276
+ 6. Devstral generates tool commands (ripgrep, file reads, tree, ls, glob)
277
+ 7. Commands executed locally in parallel (up to `FC_MAX_COMMANDS` per round)
278
+ 8. Results sent back to Devstral for the next round
279
+ 9. After `max_turns` rounds, Devstral returns file paths + line ranges
280
+ 10. All rg patterns used during search are collected as suggested keywords
281
+ 11. Diagnostic metadata appended to help the calling AI tune parameters
282
+
283
+ ### Caching
284
+
285
+ Directory profiles and Git history analysis are cached at the process level to avoid redundant filesystem walks across repeated queries:
286
+
287
+ | Cache | TTL | Configurable via |
288
+ |-------|-----|------------------|
289
+ | Directory profiles | 120s | `FC_PROFILE_CACHE_TTL` |
290
+ | Git RFM analysis | 300s | `FC_GIT_CACHE_TTL` |
291
+
292
+ Caches are scoped to the MCP server process lifetime and automatically expire. No manual invalidation needed for normal development workflows.
201
293
 
202
294
  ## Technical Details
203
295
 
@@ -214,7 +306,7 @@ fast-context-mcp/
214
306
  | `@modelcontextprotocol/sdk` | MCP server framework |
215
307
  | `@vscode/ripgrep` | Bundled ripgrep binary (cross-platform) |
216
308
  | `tree-node-cli` | Cross-platform directory tree (replaces system `tree`) |
217
- | `better-sqlite3` | Read Windsurf's local SQLite DB |
309
+ | `sql.js` | Read Windsurf's local SQLite DB (WASM, no native deps) |
218
310
  | `zod` | Schema validation (MCP SDK requirement) |
219
311
 
220
312
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sammysnake/fast-context-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.3.0-beta.2",
4
4
  "description": "AI-driven semantic code search via reverse-engineered Windsurf protocol (Node.js)",
5
5
  "type": "module",
6
6
  "main": "src/server.mjs",
@@ -44,4 +44,4 @@
44
44
  "zod": "^3.23.0"
45
45
  },
46
46
  "license": "MIT"
47
- }
47
+ }