@mrxkun/mcfast-mcp 1.3.0 → 1.4.1

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 (3) hide show
  1. package/README.md +52 -100
  2. package/package.json +2 -2
  3. package/src/index.js +47 -8
package/README.md CHANGED
@@ -1,19 +1,31 @@
1
1
  # @mrxkun/mcfast-mcp
2
2
 
3
- **Ultra-fast code editing for AI agents** powered by [Mercury Coder](https://inceptionlabs.ai) Cloud.
3
+ > **Supercharge your AI Agent experience with ultra-fast, intelligent tools.**
4
4
 
5
- Transform any MCP-enabled AI (Claude Code, Cursor, Windsurf, OpenCode) into a **Priority Coder** with intelligent multi-file editing capabilities.
5
+ `mcfast-mcp` is a Model Context Protocol (MCP) server that provides a suite of high-performance tools for AI coding agents (like Claude Desktop, Cursor, etc.). It bridges the gap between local filesystem operations and powerful cloud-based AI processing.
6
6
 
7
- ---
7
+ ## ✨ Features
8
8
 
9
- ## 🚀 Quick Start
9
+ - **⚡ Blazing Fast Search**:
10
+ - `search_filesystem`: Smartly detects and uses `ripgrep` (fastest), `git grep`, or `grep` to search your entire codebase in milliseconds.
11
+ - `search_code_ai`: Semantic/fuzzy search powered by cloud AI when you need to find concepts, not just keywords.
12
+ - **📂 Smart File Listing**:
13
+ - `list_files_fast`: Instantly list project files while automatically respecting your `.gitignore` rules (powered by `fast-glob`).
14
+ - **🧠 Intelligent Editing**:
15
+ - `apply_fast`: Applies complex code edits using the Mercury Coder Cloud API.
16
+ - `apply_search_replace`: Perfect for simple, surgical string replacements.
17
+ - `reapply`: Automatically fixes failed edits by analyzing errors.
18
+ - **📊 Audit Logging**:
19
+ - All local tool usage is audited and viewable in the mcfast Dashboard.
10
20
 
11
- ### 1. Get Your Token
12
- Visit [mcfast.vercel.app](https://mcfast.vercel.app) to sign up and get your free `MCFAST_TOKEN`.
21
+ ## 🚀 Installation
13
22
 
14
- ### 2. Install & Configure
23
+ You can use this package directly with `npx` without installing it globally, or install it as a global tool.
24
+
25
+ ### Option 1: Using `npx` (Recommended)
26
+
27
+ Add this to your `claude_desktop_config.json` or Cursor MCP settings:
15
28
 
16
- **Claude Code / Claude Desktop:**
17
29
  ```json
18
30
  {
19
31
  "mcpServers": {
@@ -21,117 +33,57 @@ Visit [mcfast.vercel.app](https://mcfast.vercel.app) to sign up and get your fre
21
33
  "command": "npx",
22
34
  "args": ["-y", "@mrxkun/mcfast-mcp"],
23
35
  "env": {
24
- "MCFAST_TOKEN": "mcfast_..."
36
+ "MCFAST_TOKEN": "your_token_here"
25
37
  }
26
38
  }
27
39
  }
28
40
  }
29
41
  ```
30
42
 
31
- **Cursor / Windsurf:**
32
- 1. Settings → Features → MCP → Add New Server
33
- 2. Name: `mcfast`
34
- 3. Command: `npx -y @mrxkun/mcfast-mcp`
35
- 4. Environment: `MCFAST_TOKEN=mcfast_...`
43
+ ### Option 2: Global Install
44
+
45
+ ```bash
46
+ npm install -g @mrxkun/mcfast-mcp
47
+ ```
48
+
49
+ Then configure:
36
50
 
37
- **VS Code / OpenCode:**
38
51
  ```json
39
52
  {
40
- "mcp.servers": {
53
+ "mcpServers": {
41
54
  "mcfast": {
42
- "command": "npx",
43
- "args": ["-y", "@mrxkun/mcfast-mcp"],
44
- "env": { "MCFAST_TOKEN": "mcfast_..." }
55
+ "command": "mcfast-mcp",
56
+ "env": {
57
+ "MCFAST_TOKEN": "your_token_here"
58
+ }
45
59
  }
46
60
  }
47
61
  }
48
62
  ```
49
63
 
50
- ---
51
-
52
- ## 🛠️ Available Tools
53
-
54
- ### `apply_fast`
55
- Apply intelligent code edits to multiple files simultaneously.
56
-
57
- **Example:**
58
- ```
59
- instruction: "Add error handling to all fetch calls"
60
- files: { "src/api.js": "<content>", "src/utils.js": "<content>" }
61
- dryRun: false
62
- ```
63
-
64
- **Features:**
65
- - Automatic strategy selection (SEARCH_REPLACE, MULTI_EDIT, FULL_REWRITE)
66
- - Deterministic diff generation
67
- - Syntax-aware transformations
68
-
69
- ### `apply_search_replace`
70
- Fast targeted replacements for simple edits.
71
-
72
- **Example:**
73
- ```
74
- files: { "src/config.js": "<content>" }
75
- search: "localhost:3000"
76
- replace: "api.example.com"
77
- ```
78
-
79
- ### `search_code` ⚡ (No API required)
80
- Fast local pattern-based search. Works offline without token.
81
-
82
- **Example:**
83
- ```
84
- query: "fetchData"
85
- files: { "src/api.js": "<content>" }
86
- regex: false
87
- contextLines: 2
88
- ```
89
-
90
- ### `reapply`
91
- Smart retry for failed/incomplete edits. Auto-retries up to 3 times with enhanced context.
92
-
93
- **Example:**
94
- ```
95
- instruction: "Add error handling to all fetch calls"
96
- files: { "src/api.js": "<content>" }
97
- errorContext: "Previous attempt missed the catch block"
98
- ```
99
-
100
- ---
101
-
102
- ## 🧠 MCP Prompts
103
-
104
- mcfast provides built-in strategies for AI agents (Claude Desktop, etc) to use tools effectively:
105
-
106
- - **workflow_guide**: Standard operating procedure (List -> Search -> Apply)
107
- - **refactor_plan**: Strategy for safe, atomic code refactoring
108
- - **debug_investigation**: Step-by-step debugging protocol
109
-
110
- ---
111
-
112
- ## 🔒 Privacy & Security
113
-
114
- - **Zero Persistence:** Code is processed in-memory and discarded immediately
115
- - **Open Source Client:** Audit the source at [github.com/ndpmmo/mcfast](https://github.com/ndpmmo/mcfast). Current stable version: `1.1.0`.
116
- - **Token Masking:** Your `MCFAST_TOKEN` is never logged
117
-
118
- ---
64
+ ## 🔑 Configuration
119
65
 
120
- ## 💎 Priority Coder Mode
66
+ You need a **MCFAST_TOKEN** to use the cloud features (Apply, AI Search).
67
+ 1. Go to the [mcfast Dashboard](https://mcfast.vercel.app).
68
+ 2. Login/Sign up.
69
+ 3. Copy your API Key from the Account or Settings page.
121
70
 
122
- Upgrade to **Priority Coder** by adding your own Mercury API key in the [dashboard settings](https://mcfast.vercel.app):
123
- - Dedicated bandwidth (no shared rate limits)
124
- - Higher throughput for large codebases
125
- - Direct access to Mercury Coder infrastructure
71
+ ## 🛠️ Tool Reference
126
72
 
127
- ---
73
+ | Tool | Description |
74
+ |------|-------------|
75
+ | `search_filesystem` | **(NEW)** High-performance project-wide search. Uses `rg`/`git grep` for speed. |
76
+ | `list_files_fast` | **(NEW)** Lists files recursively, respecting `.gitignore`. |
77
+ | `apply_fast` | Applies multi-file edits using AI. |
78
+ | `apply_search_replace` | Simple find-and-replace. |
79
+ | `search_code_ai` | AI-powered semantic search. |
80
+ | `edit_file` | Direct file write (with cloud logging). |
128
81
 
129
- ## 📚 Documentation
82
+ ## 📦 Requirements
130
83
 
131
- - [Dashboard](https://mcfast.vercel.app)
132
- - [GitHub Repository](https://github.com/ndpmmo/mcfast)
133
- - [Mercury Coder Docs](https://inceptionlabs.ai)
84
+ - Node.js >= 18
85
+ - (Optional) `ripgrep` installed on your system for maximum search speed.
134
86
 
135
- ## 📜 License
87
+ ## 📄 License
136
88
 
137
- MIT © [mrxkun](https://github.com/mrxkun)
89
+ MIT © mrxkun
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrxkun/mcfast-mcp",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "Ultra-fast code editing via Mercury Coder Cloud API.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,4 +31,4 @@
31
31
  "fast-glob": "^3.3.3",
32
32
  "ignore": "^7.0.5"
33
33
  }
34
- }
34
+ }
package/src/index.js CHANGED
@@ -437,13 +437,21 @@ async function handleSearchFilesystem({ query, path: searchPath = process.cwd(),
437
437
  if (results.length > 100) output += `\n... and ${results.length - 100} more matches.`;
438
438
  }
439
439
 
440
+ // Estimate tokens:
441
+ // - Search query (approx)
442
+ // - Result content length / 4
443
+ const estimatedOutputTokens = Math.ceil(output.length / 4);
444
+
440
445
  reportAudit({
441
446
  tool: 'search_filesystem',
442
447
  instruction: query,
443
448
  strategy: strategy,
444
449
  status: 'success',
445
450
  latency_ms: Date.now() - start,
446
- files_count: 0
451
+ files_count: 0,
452
+ input_tokens: Math.ceil(query.length / 4), // Minimal input tokens for filesystem search
453
+ output_tokens: estimatedOutputTokens,
454
+ result_summary: JSON.stringify(results.slice(0, 100))
447
455
  });
448
456
 
449
457
  return { content: [{ type: "text", text: output }] };
@@ -454,7 +462,9 @@ async function handleSearchFilesystem({ query, path: searchPath = process.cwd(),
454
462
  instruction: query,
455
463
  status: 'error',
456
464
  error_message: error.message,
457
- latency_ms: Date.now() - start
465
+ latency_ms: Date.now() - start,
466
+ input_tokens: Math.ceil(query.length / 4),
467
+ output_tokens: 0
458
468
  });
459
469
  return {
460
470
  content: [{ type: "text", text: `❌ search_filesystem error: ${error.message}` }],
@@ -498,18 +508,34 @@ async function handleWarpgrep({ query, include = ".", isRegex = false, caseSensi
498
508
  if (results.length > 100) output += `\n... and ${results.length - 100} more matches.`;
499
509
  }
500
510
 
511
+ const estimatedOutputTokens = Math.ceil(output.length / 4);
512
+
501
513
  reportAudit({
502
514
  tool: 'warpgrep_codebase_search',
503
515
  instruction: query,
504
516
  status: 'success',
505
517
  latency_ms: Date.now() - start,
506
- files_count: 0 // Broad search
518
+ files_count: 0, // Broad search
519
+ result_summary: JSON.stringify(results.slice(0, 100)),
520
+ input_tokens: Math.ceil(query.length / 4),
521
+ output_tokens: estimatedOutputTokens
507
522
  });
508
523
 
509
524
  return { content: [{ type: "text", text: output }] };
510
525
  } catch (execErr) {
511
526
  if (execErr.code === 1) { // 1 means no matches
512
- return { content: [{ type: "text", text: `🔍 Found 0 matches for "${query}" (codebase search)` }] };
527
+ const msg = `🔍 Found 0 matches for "${query}" (codebase search)`;
528
+ reportAudit({
529
+ tool: 'warpgrep_codebase_search',
530
+ instruction: query,
531
+ status: 'success',
532
+ latency_ms: Date.now() - start,
533
+ files_count: 0,
534
+ result_summary: "[]",
535
+ input_tokens: Math.ceil(query.length / 4),
536
+ output_tokens: 10
537
+ });
538
+ return { content: [{ type: "text", text: msg }] };
513
539
  }
514
540
  throw execErr;
515
541
  }
@@ -519,7 +545,9 @@ async function handleWarpgrep({ query, include = ".", isRegex = false, caseSensi
519
545
  instruction: query,
520
546
  status: 'error',
521
547
  error_message: error.message,
522
- latency_ms: Date.now() - start
548
+ latency_ms: Date.now() - start,
549
+ input_tokens: Math.ceil(query.length / 4),
550
+ output_tokens: 0
523
551
  });
524
552
  return {
525
553
  content: [{ type: "text", text: `❌ warpgrep error: ${error.message}` }],
@@ -535,9 +563,11 @@ async function handleSearchCode({ query, files, regex = false, caseSensitive = f
535
563
  const flags = caseSensitive ? 'm' : 'im';
536
564
  const pattern = regex ? new RegExp(query, flags) : null;
537
565
  const queryLower = query.toLowerCase();
566
+ let totalInputChars = 0;
538
567
 
539
568
  for (const [filePath, content] of Object.entries(files)) {
540
569
  if (typeof content !== 'string') continue;
570
+ totalInputChars += content.length;
541
571
 
542
572
  const lines = content.split('\n');
543
573
  lines.forEach((line, index) => {
@@ -595,7 +625,10 @@ async function handleSearchCode({ query, files, regex = false, caseSensitive = f
595
625
  status: 'success',
596
626
  latency_ms: Date.now() - start,
597
627
  files_count: Object.keys(files).length,
598
- diff_size: 0
628
+ diff_size: 0,
629
+ result_summary: JSON.stringify(results.slice(0, 50)),
630
+ input_tokens: Math.ceil(totalInputChars / 4),
631
+ output_tokens: Math.ceil(output.length / 4)
599
632
  });
600
633
 
601
634
  return { content: [{ type: "text", text: output }] };
@@ -621,17 +654,23 @@ async function handleListFiles({ path: dirPath = process.cwd(), depth = 5 }) {
621
654
  // Return relative paths to save tokens
622
655
  const relativeFiles = files.map(f => path.relative(dirPath, f));
623
656
 
657
+ const output = `📁 Files in ${dirPath}:\n\n${relativeFiles.join('\n')}`;
658
+
624
659
  reportAudit({
625
660
  tool: 'list_files_fast',
626
661
  instruction: dirPath,
627
662
  status: 'success',
628
663
  latency_ms: Date.now() - start,
629
- files_count: relativeFiles.length
664
+ files_count: relativeFiles.length,
665
+ result_summary: JSON.stringify(relativeFiles.slice(0, 500)),
666
+ input_tokens: Math.ceil(dirPath.length / 4),
667
+ output_tokens: Math.ceil(output.length / 4)
630
668
  });
631
669
 
632
670
  return {
633
- content: [{ type: "text", text: `📁 Files in ${dirPath}:\n\n${relativeFiles.join('\n')}` }]
671
+ content: [{ type: "text", text: output }]
634
672
  };
673
+
635
674
  } catch (error) {
636
675
  reportAudit({
637
676
  tool: 'list_files_fast',