@mrxkun/mcfast-mcp 3.5.4 → 3.5.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +17 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrxkun/mcfast-mcp",
3
- "version": "3.5.4",
3
+ "version": "3.5.6",
4
4
  "description": "Ultra-fast code editing with WASM acceleration, fuzzy patching, multi-layer caching, and 8 unified tools. Optimized for AI code assistants with 80-98% latency reduction.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -203,7 +203,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
203
203
  // CORE TOOL 1: edit (consolidates apply_fast + edit_file + apply_search_replace)
204
204
  {
205
205
  name: "edit",
206
- description: "**PRIMARY TOOL FOR EDITING FILES** - Intelligent auto-switching strategies: (1) Search & Replace (Fastest) - use 'Replace X with Y', (2) Placeholder (Efficient) - use '// ... existing code ...', (3) Mercury AI (Intelligent) - for complex refactoring. Includes Auto-Rollback for syntax errors.",
206
+ description: "**PRIMARY TOOL FOR EDITING FILES** - Intelligent auto-switching strategies: (1) Search & Replace (Fastest) - use 'Replace X with Y', (2) Placeholder (Efficient) - use '// ... existing code ...' placeholders to save tokens, (3) Mercury AI (Intelligent) - for complex refactoring. Includes Auto-Rollback for syntax errors.",
207
207
  inputSchema: {
208
208
  type: "object",
209
209
  properties: {
@@ -1216,6 +1216,7 @@ async function handleReadFileInternal({ path: filePath, start_line, end_line, ma
1216
1216
  let endLine = end_line ? parseInt(end_line) : -1;
1217
1217
  let outputContent;
1218
1218
  let totalLines;
1219
+ let lineRangeInfo = '';
1219
1220
 
1220
1221
  if ((stats.size > STREAM_THRESHOLD && (start_line || end_line)) || stats.size > 10 * 1024 * 1024) {
1221
1222
  const { Readable } = await import('stream');
@@ -1614,6 +1615,7 @@ async function handleReadFile({ path: filePath, start_line, end_line }) {
1614
1615
  let endLine = end_line ? parseInt(end_line) : -1;
1615
1616
  let outputContent;
1616
1617
  let totalLines;
1618
+ let lineRangeInfo = '';
1617
1619
 
1618
1620
  if ((stats.size > STREAM_THRESHOLD && (start_line || end_line)) || stats.size > 10 * 1024 * 1024) {
1619
1621
  const { Readable } = await import('stream');
@@ -1841,6 +1843,13 @@ async function handleSearchCodeAI({ query, files, contextLines = 2 }) {
1841
1843
  async function handleGetDefinition({ path: filePath, symbol }) {
1842
1844
  if (!filePath || !symbol) throw new Error("Missing path or symbol");
1843
1845
 
1846
+ // Check if path is a directory
1847
+ const absolutePath = path.resolve(filePath);
1848
+ const stats = await fs.stat(absolutePath);
1849
+ if (!stats.isFile()) {
1850
+ throw new Error(`Path is not a file: ${filePath}`);
1851
+ }
1852
+
1844
1853
  // Read file content first
1845
1854
  const content = await fs.readFile(filePath, 'utf8');
1846
1855
  const definitions = await findDefinition(content, filePath, symbol);
@@ -1861,6 +1870,13 @@ async function handleGetDefinition({ path: filePath, symbol }) {
1861
1870
  async function handleFindReferences({ path: filePath, symbol }) {
1862
1871
  if (!filePath || !symbol) throw new Error("Missing path or symbol");
1863
1872
 
1873
+ // Check if path is a directory
1874
+ const absolutePath = path.resolve(filePath);
1875
+ const stats = await fs.stat(absolutePath);
1876
+ if (!stats.isFile()) {
1877
+ throw new Error(`Path is not a file: ${filePath}`);
1878
+ }
1879
+
1864
1880
  const content = await fs.readFile(filePath, 'utf8');
1865
1881
  const references = await findReferences(content, filePath, symbol);
1866
1882