@mrxkun/mcfast-mcp 1.0.2 → 1.0.3

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
@@ -81,7 +81,7 @@ replace: "api.example.com"
81
81
  ## 🔒 Privacy & Security
82
82
 
83
83
  - **Zero Persistence:** Code is processed in-memory and discarded immediately
84
- - **Open Source Client:** Audit the source at [github.com/ndpmmo/mcfast](https://github.com/ndpmmo/mcfast). Current stable version: `1.0.2`.
84
+ - **Open Source Client:** Audit the source at [github.com/ndpmmo/mcfast](https://github.com/ndpmmo/mcfast). Current stable version: `1.0.3`.
85
85
  - **Token Masking:** Your `MCFAST_TOKEN` is never logged
86
86
 
87
87
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrxkun/mcfast-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Ultra-fast code editing via Mercury Coder Cloud API.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -74,6 +74,29 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
74
74
  },
75
75
  required: ["files", "search", "replace"]
76
76
  }
77
+ },
78
+ {
79
+ name: "search_code_ai",
80
+ description: "Intelligently search for code patterns across multiple files. Returns matches with surrounding context.",
81
+ inputSchema: {
82
+ type: "object",
83
+ properties: {
84
+ query: {
85
+ type: "string",
86
+ description: "Search query (supports natural language or literal strings)"
87
+ },
88
+ files: {
89
+ type: "object",
90
+ description: "Map of file paths to content to search within.",
91
+ additionalProperties: { type: "string" }
92
+ },
93
+ contextLines: {
94
+ type: "number",
95
+ description: "Number of lines to show before/after each match (default: 2)"
96
+ }
97
+ },
98
+ required: ["query", "files"]
99
+ }
77
100
  }
78
101
  ],
79
102
  };
@@ -95,6 +118,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
95
118
  files: args.files,
96
119
  dryRun: false
97
120
  });
121
+ } else if (name === "search_code_ai") {
122
+ return await handleSearchCodeAI(args);
98
123
  }
99
124
 
100
125
  throw new Error(`Tool not found: ${name}`);
@@ -144,6 +169,55 @@ async function handleApplyFast({ instruction, files, dryRun }) {
144
169
  }
145
170
  }
146
171
 
172
+ async function handleSearchCodeAI({ query, files, contextLines = 2 }) {
173
+ try {
174
+ const response = await fetch(`${API_URL}/search-ai`, {
175
+ method: "POST",
176
+ headers: {
177
+ "Content-Type": "application/json",
178
+ "Authorization": `Bearer ${TOKEN}`,
179
+ },
180
+ body: JSON.stringify({ query, files, contextLines }),
181
+ });
182
+
183
+ if (!response.ok) {
184
+ const errorText = await response.text();
185
+ return {
186
+ content: [{ type: "text", text: `Search Error (${response.status}): ${errorText}` }],
187
+ isError: true,
188
+ };
189
+ }
190
+
191
+ const data = await response.json();
192
+
193
+ // Format results nicely
194
+ let output = `🔍 Found ${data.totalMatches} matches for "${query}"\\n\\n`;
195
+
196
+ if (data.results.length === 0) {
197
+ output += "No matches found.";
198
+ } else {
199
+ data.results.forEach((result, i) => {
200
+ output += `📄 ${result.file}:${result.lineNumber}\\n`;
201
+ result.context.forEach(ctx => {
202
+ const prefix = ctx.isMatch ? "→ " : " ";
203
+ output += `${prefix}${ctx.lineNumber}: ${ctx.content}\\n`;
204
+ });
205
+ if (i < data.results.length - 1) output += "\\n";
206
+ });
207
+ }
208
+
209
+ return {
210
+ content: [{ type: "text", text: output }],
211
+ };
212
+
213
+ } catch (error) {
214
+ return {
215
+ content: [{ type: "text", text: `Search Connection Error: ${error.message}` }],
216
+ isError: true,
217
+ };
218
+ }
219
+ }
220
+
147
221
  /**
148
222
  * Start Server
149
223
  */