@mrxkun/mcfast-mcp 4.1.7 → 4.1.9

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/package.json +2 -2
  2. package/src/index.js +33 -4
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mrxkun/mcfast-mcp",
3
- "version": "4.1.7",
4
- "description": "Ultra-fast code editing with WASM acceleration, fuzzy patching, multi-layer caching, and 8 unified tools. v4.1.7: Critical MCP fix - Suppress console output to prevent JSON-RPC stream corruption.",
3
+ "version": "4.1.9",
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
@@ -8,18 +8,47 @@
8
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
10
 
11
- // Also override console.log - suppress in MCP mode
11
+ // Also override console.log - log to file in MCP mode
12
12
  const originalConsoleLog = console.log;
13
13
  console.log = function(...args) {
14
- // Suppress in MCP mode - can enable file logging if needed
14
+ // Write to log file in project directory
15
+ try {
16
+ const logDir = process.cwd() + '/.mcfast';
17
+ const logFile = logDir + '/mcp-debug.log';
18
+ const message = `[${new Date().toISOString()}] [LOG] ${args.join(' ')}\n`;
19
+
20
+ // Ensure directory exists
21
+ require('fs').mkdirSync(logDir, { recursive: true });
22
+ require('fs').appendFileSync(logFile, message);
23
+ } catch (e) {
24
+ // Ignore if can't write
25
+ }
15
26
  };
16
27
 
17
- // Override console.error - suppress in MCP mode
28
+ // Override console.error - log to file in MCP mode
18
29
  const originalConsoleError = console.error;
19
30
  console.error = function(...args) {
20
- // Suppress in MCP mode - can enable file logging if needed
31
+ // Write to log file in project directory
32
+ try {
33
+ const logDir = process.cwd() + '/.mcfast';
34
+ const logFile = logDir + '/mcp-debug.log';
35
+ const message = `[${new Date().toISOString()}] [ERROR] ${args.join(' ')}\n`;
36
+
37
+ // Ensure directory exists
38
+ require('fs').mkdirSync(logDir, { recursive: true });
39
+ require('fs').appendFileSync(logFile, message);
40
+ } catch (e) {
41
+ // Ignore if can't write
42
+ }
21
43
  };
22
44
 
45
+ // Write startup marker
46
+ try {
47
+ const logDir = process.cwd() + '/.mcfast';
48
+ require('fs').mkdirSync(logDir, { recursive: true });
49
+ require('fs').appendFileSync(logDir + '/mcp-debug.log', `[${new Date().toISOString()}] [START] MCP initializing...\n`);
50
+ } catch (e) {}
51
+
23
52
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
24
53
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
25
54
  import { ListToolsRequestSchema, CallToolRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema } from "@modelcontextprotocol/sdk/types.js";