@mrxkun/mcfast-mcp 4.1.4 → 4.1.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/README.md +8 -0
- package/package.json +2 -2
- package/src/index.js +14 -0
- package/src/intelligence/strategy-selector.js +1 -1
- package/src/memory/bootstrap/agents-md.js +3 -3
- package/src/memory/layers/curated-memory.js +3 -3
- package/src/memory/stores/codebase-database.js +1 -1
- package/src/memory/stores/memory-database.js +1 -1
- package/src/memory/utils/context-analyzer.js +2 -2
- package/src/memory/utils/daily-logs.js +1 -1
- package/src/memory/utils/embedder.js +8 -8
- package/src/memory/utils/sync-engine.js +4 -4
- package/src/memory/utils/ultra-embedder.js +3 -3
package/README.md
CHANGED
|
@@ -623,6 +623,14 @@ Read API (Total: 6ms)
|
|
|
623
623
|
|
|
624
624
|
## 📝 Changelog
|
|
625
625
|
|
|
626
|
+
### v4.1.5 (2026-02-17) 🐛 Critical MCP Fix
|
|
627
|
+
|
|
628
|
+
- 🔧 **Fixed JSON-RPC Stream Corruption**
|
|
629
|
+
- Replaced ALL `console.log` with `console.error` (35+ statements)
|
|
630
|
+
- MCP protocol uses `stdout` for JSON-RPC - console.log corrupts stream
|
|
631
|
+
- Error `[FileWatche..." is not valid JSON` now resolved
|
|
632
|
+
- Fixed in 10 files: strategy-selector, agents-md, curated-memory, databases, context-analyzer, daily-logs, embedder, sync-engine, ultra-embedder
|
|
633
|
+
|
|
626
634
|
### v4.1.4 (2026-02-17) 🎉 ContextAnalyzer API
|
|
627
635
|
|
|
628
636
|
- ✨ **ContextAnalyzer Integration**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrxkun/mcfast-mcp",
|
|
3
|
-
"version": "4.1.
|
|
4
|
-
"description": "Ultra-fast code editing with WASM acceleration, fuzzy patching, multi-layer caching, and 8 unified tools. v4.1.
|
|
3
|
+
"version": "4.1.6",
|
|
4
|
+
"description": "Ultra-fast code editing with WASM acceleration, fuzzy patching, multi-layer caching, and 8 unified tools. v4.1.6: Critical MCP fix - Redirect stdout to stderr to prevent JSON-RPC stream corruption.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"mcfast-mcp": "src/index.js"
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,20 @@
|
|
|
5
5
|
* Proxies code edit requests to mcfast Cloud (Vercel)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
// CRITICAL: Redirect all stdout writes to stderr to prevent JSON parsing errors in MCP
|
|
9
|
+
// MCP protocol requires stdout to contain ONLY JSON-RPC messages
|
|
10
|
+
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
11
|
+
process.stdout.write = function(chunk, encoding, callback) {
|
|
12
|
+
// Redirect all stdout writes to stderr
|
|
13
|
+
return process.stderr.write(chunk, encoding, callback);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// Also override console.log to use stderr
|
|
17
|
+
const originalConsoleLog = console.log;
|
|
18
|
+
console.log = function(...args) {
|
|
19
|
+
console.error(...args);
|
|
20
|
+
};
|
|
21
|
+
|
|
8
22
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
9
23
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
10
24
|
import { ListToolsRequestSchema, CallToolRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
@@ -29,14 +29,14 @@ export class AgentsMdBootstrap {
|
|
|
29
29
|
*/
|
|
30
30
|
async bootstrap() {
|
|
31
31
|
if (await this.exists()) {
|
|
32
|
-
console.
|
|
32
|
+
console.error(`[AgentsMdBootstrap] AGENTS.md already exists`);
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
await fs.mkdir(path.dirname(this.agentsFile), { recursive: true });
|
|
37
37
|
await fs.writeFile(this.agentsFile, this.getContent());
|
|
38
38
|
|
|
39
|
-
console.
|
|
39
|
+
console.error(`[AgentsMdBootstrap] Created ${this.agentsFile}`);
|
|
40
40
|
return true;
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -47,7 +47,7 @@ export class AgentsMdBootstrap {
|
|
|
47
47
|
await fs.mkdir(path.dirname(this.agentsFile), { recursive: true });
|
|
48
48
|
await fs.writeFile(this.agentsFile, this.getContent());
|
|
49
49
|
|
|
50
|
-
console.
|
|
50
|
+
console.error(`[AgentsMdBootstrap] Regenerated ${this.agentsFile}`);
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -25,7 +25,7 @@ export class CuratedMemory {
|
|
|
25
25
|
const defaultContent = this.getDefaultContent();
|
|
26
26
|
await fs.mkdir(path.dirname(this.memoryFile), { recursive: true });
|
|
27
27
|
await fs.writeFile(this.memoryFile, defaultContent);
|
|
28
|
-
console.
|
|
28
|
+
console.error(`[CuratedMemory] Created ${this.memoryFile}`);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -118,7 +118,7 @@ This file contains curated, persistent knowledge.
|
|
|
118
118
|
);
|
|
119
119
|
|
|
120
120
|
await fs.writeFile(this.memoryFile, fileContent);
|
|
121
|
-
console.
|
|
121
|
+
console.error(`[CuratedMemory] Updated section: ${sectionName}`);
|
|
122
122
|
|
|
123
123
|
return true;
|
|
124
124
|
}
|
|
@@ -315,7 +315,7 @@ This file contains curated, persistent knowledge.
|
|
|
315
315
|
async promoteFromDailyLog(date, entryTitle, sectionName) {
|
|
316
316
|
// This would require reading from daily log file
|
|
317
317
|
// Implementation depends on DailyLogs integration
|
|
318
|
-
console.
|
|
318
|
+
console.error(`[CuratedMemory] Promote: ${entryTitle} from ${date} to ${sectionName}`);
|
|
319
319
|
// TODO: Implement promotion logic
|
|
320
320
|
return true;
|
|
321
321
|
}
|
|
@@ -33,7 +33,7 @@ export class ContextAnalyzer {
|
|
|
33
33
|
patterns: []
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
console.
|
|
36
|
+
console.error('[ContextAnalyzer] Initialized with mcfast API');
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
@@ -309,7 +309,7 @@ Return ONLY valid JSON, no markdown formatting.`;
|
|
|
309
309
|
);
|
|
310
310
|
|
|
311
311
|
await fs.writeFile(memoryPath, content);
|
|
312
|
-
console.
|
|
312
|
+
console.error(`[ContextAnalyzer] Updated MEMORY.md: ${analysis.memorySection}`);
|
|
313
313
|
|
|
314
314
|
} catch (error) {
|
|
315
315
|
console.error('[ContextAnalyzer] Failed to update MEMORY.md:', error.message);
|
|
@@ -238,7 +238,7 @@ export class DailyLogs {
|
|
|
238
238
|
const fileDate = file.replace('.md', '');
|
|
239
239
|
if (fileDate < cutoffStr) {
|
|
240
240
|
fs.unlinkSync(path.join(this.memoryPath, file));
|
|
241
|
-
console.
|
|
241
|
+
console.error(`[DailyLogs] Cleaned up: ${file}`);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
}
|
|
@@ -27,12 +27,12 @@ export class Embedder {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
async initialize() {
|
|
30
|
-
console.
|
|
31
|
-
console.
|
|
32
|
-
console.
|
|
33
|
-
console.
|
|
34
|
-
console.
|
|
35
|
-
console.
|
|
30
|
+
console.error('[Embedder] Ultra-Enhanced Embedder initialized');
|
|
31
|
+
console.error('[Embedder] Dimension:', this.ultra.dimension);
|
|
32
|
+
console.error('[Embedder] Synonyms:', this.ultra.getStats().synonymCount);
|
|
33
|
+
console.error('[Embedder] Domain patterns:', this.ultra.getStats().domainPatterns);
|
|
34
|
+
console.error('[Embedder] Target accuracy: 90% (Option A - Fast & Offline)');
|
|
35
|
+
console.error('[Embedder] Mercury re-ranking:', this.ultra.mercuryConfig.enabled ? 'ENABLED' : 'DISABLED (Option B ready)');
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -159,7 +159,7 @@ export class Embedder {
|
|
|
159
159
|
*/
|
|
160
160
|
enableMercuryReRanking(apiKey, options = {}) {
|
|
161
161
|
this.ultra.enableMercuryReRanking(apiKey, options);
|
|
162
|
-
console.
|
|
162
|
+
console.error('[Embedder] ✨ Mercury re-ranking enabled! Accuracy target: 95%');
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
/**
|
|
@@ -167,7 +167,7 @@ export class Embedder {
|
|
|
167
167
|
*/
|
|
168
168
|
disableMercuryReRanking() {
|
|
169
169
|
this.ultra.disableMercuryReRanking();
|
|
170
|
-
console.
|
|
170
|
+
console.error('[Embedder] Mercury re-ranking disabled. Using 90% accuracy mode.');
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
/**
|
|
@@ -50,7 +50,7 @@ export class SyncEngine {
|
|
|
50
50
|
// Start periodic sync
|
|
51
51
|
this.startPeriodicSync();
|
|
52
52
|
|
|
53
|
-
console.
|
|
53
|
+
console.error(`[SyncEngine] Initialized. Last sync: ${this.lastSyncTime ? new Date(this.lastSyncTime).toISOString() : 'Never'}`);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/**
|
|
@@ -82,7 +82,7 @@ export class SyncEngine {
|
|
|
82
82
|
* Handle online event
|
|
83
83
|
*/
|
|
84
84
|
handleOnline() {
|
|
85
|
-
console.
|
|
85
|
+
console.error('[SyncEngine] Back online, triggering sync...');
|
|
86
86
|
this.isOnline = true;
|
|
87
87
|
this.sync().catch(err => console.warn('[SyncEngine] Sync after reconnect failed:', err.message));
|
|
88
88
|
this.emit('online');
|
|
@@ -92,7 +92,7 @@ export class SyncEngine {
|
|
|
92
92
|
* Handle offline event
|
|
93
93
|
*/
|
|
94
94
|
handleOffline() {
|
|
95
|
-
console.
|
|
95
|
+
console.error('[SyncEngine] Went offline');
|
|
96
96
|
this.isOnline = false;
|
|
97
97
|
this.emit('offline');
|
|
98
98
|
}
|
|
@@ -188,7 +188,7 @@ export class SyncEngine {
|
|
|
188
188
|
duration: `${duration}ms`
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
console.
|
|
191
|
+
console.error(`[SyncEngine] ✅ Sync complete:`, result);
|
|
192
192
|
this.emit('sync', result);
|
|
193
193
|
|
|
194
194
|
return result;
|
|
@@ -1129,7 +1129,7 @@ export class UltraEnhancedEmbedder {
|
|
|
1129
1129
|
this.mercuryConfig.apiKey = apiKey;
|
|
1130
1130
|
this.mercuryConfig.rerankTopK = options.topK || 20;
|
|
1131
1131
|
this.mercuryConfig.minScore = options.minScore || 0.3;
|
|
1132
|
-
console.
|
|
1132
|
+
console.error('[UltraEnhancedEmbedder] Mercury re-ranking enabled');
|
|
1133
1133
|
}
|
|
1134
1134
|
|
|
1135
1135
|
/**
|
|
@@ -1137,7 +1137,7 @@ export class UltraEnhancedEmbedder {
|
|
|
1137
1137
|
*/
|
|
1138
1138
|
disableMercuryReRanking() {
|
|
1139
1139
|
this.mercuryConfig.enabled = false;
|
|
1140
|
-
console.
|
|
1140
|
+
console.error('[UltraEnhancedEmbedder] Mercury re-ranking disabled');
|
|
1141
1141
|
}
|
|
1142
1142
|
|
|
1143
1143
|
/**
|
|
@@ -1204,7 +1204,7 @@ ${context}`;
|
|
|
1204
1204
|
// const bestIndex = parseInt(response.choices[0].message.content) - 1;
|
|
1205
1205
|
|
|
1206
1206
|
// For now, return candidates unchanged (implement Mercury integration later)
|
|
1207
|
-
console.
|
|
1207
|
+
console.error('[UltraEnhancedEmbedder] Mercury re-ranking would be called here');
|
|
1208
1208
|
return candidates;
|
|
1209
1209
|
|
|
1210
1210
|
} catch (error) {
|