@mrxkun/mcfast-mcp 4.1.6 → 4.1.8
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/package.json +2 -2
- package/src/index.js +25 -8
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.8",
|
|
4
|
+
"description": "Ultra-fast code editing with WASM acceleration, fuzzy patching, multi-layer caching, and 8 unified tools. v4.1.8: Debug mode - Write logs to .mcfast/mcp-debug.log",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"mcfast-mcp": "src/index.js"
|
package/src/index.js
CHANGED
|
@@ -5,18 +5,35 @@
|
|
|
5
5
|
* Proxies code edit requests to mcfast Cloud (Vercel)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
// CRITICAL:
|
|
8
|
+
// CRITICAL: Suppress ALL console output in MCP mode to prevent JSON parsing errors
|
|
9
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
10
|
|
|
16
|
-
// Also override console.log to
|
|
11
|
+
// Also override console.log - log to file in MCP mode
|
|
17
12
|
const originalConsoleLog = console.log;
|
|
18
13
|
console.log = function(...args) {
|
|
19
|
-
|
|
14
|
+
// Write to log file in project directory
|
|
15
|
+
try {
|
|
16
|
+
const logDir = process.cwd();
|
|
17
|
+
const logFile = logDir + '/.mcfast/mcp-debug.log';
|
|
18
|
+
const message = `[${new Date().toISOString()}] [LOG] ${args.join(' ')}\n`;
|
|
19
|
+
require('fs').appendFileSync(logFile, message);
|
|
20
|
+
} catch (e) {
|
|
21
|
+
// Ignore if can't write
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Override console.error - log to file in MCP mode
|
|
26
|
+
const originalConsoleError = console.error;
|
|
27
|
+
console.error = function(...args) {
|
|
28
|
+
// Write to log file in project directory
|
|
29
|
+
try {
|
|
30
|
+
const logDir = process.cwd();
|
|
31
|
+
const logFile = logDir + '/.mcfast/mcp-debug.log';
|
|
32
|
+
const message = `[${new Date().toISOString()}] [ERROR] ${args.join(' ')}\n`;
|
|
33
|
+
require('fs').appendFileSync(logFile, message);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
// Ignore if can't write
|
|
36
|
+
}
|
|
20
37
|
};
|
|
21
38
|
|
|
22
39
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|