A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.npmjs.com/package/mcp-files below:

mcp-files - npm

Enables agents to quickly find and edit code in a codebase with surgical precision. Find symbols, edit them everywhere.

Option 1: NPX (Recommended)

Add this to ~/.cursor/mcp.json for Cursor, ~/.config/claude_desktop_config.json for Claude Desktop.

{
  "mcpServers": {
    "mcp-files": {
      "command": "npx",
      "args": ["-y", "mcp-files"]
    }
  }
}
{
  "mcpServers": {
    "mcp-files": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "flesler/mcp-files"
      ]
    }
  }
}

First run the server:

TRANSPORT=http PORT=3000 npx mcp-files

Then:

{
  "mcpServers": {
    "mcp-files": {
      "type": "streamableHttp",
      "url": "http://localhost:3000/mcp"
    }
  }
}
Tool Description Parameters read_symbol Find and extract code blocks by symbol name from files symbol, file_paths[]?, limit? import_symbol Import and inspect JavaScript/TypeScript modules and their properties module_path, property? search_replace Search and replace with intelligent whitespace handling and automation-friendly multiple match resolution file_path, old_string, new_string, allow_multiple_matches? insert_text Insert/replace text at precise line ranges. Perfect for direct line operations from code citations (12:15:file.ts) and surgical edits in large files file_path, from_line, text, to_line os_notification Send OS notifications using native notification systems message, title? ⚡ Surgical Code Editing: Surgical Precision

The combination of read_symbol + insert_text unlocks revolutionary code editing capabilities that transform how AI agents work with codebases.

1. Symbol Discovery (read_symbol) - Find ANY symbol ANYWHERE in your codebase:

// Find function/class/interface anywhere in repo
read_symbol("generateApiKey")
// → Returns: exact location (lines 45-52 in src/auth/tokens.ts)

2. Surgical Editing (insert_text) - Make precise modifications using exact line ranges:

// Replace specific lines with surgical precision
insert_text(file: "src/auth/tokens.ts", from_line: 45, to_line: 52, text: "improved implementation")

// Insert new code without disruption
insert_text(file: "src/auth/tokens.ts", from_line: 45, text: "// Added security enhancement")
🚀 Superpowers Unlocked

🔍 Cross-Codebase Intelligence

✂️ Precision Surgery

🎛️ Zero-Error Refactoring

# Find and enhance any function
read_symbol("validateEmail") → lines 23-35 in utils/validation.ts
insert_text(from_line: 23, to_line: 35, text: "enhanced validation with regex")

# Add documentation to any symbol
read_symbol("processPayment") → line 87 in payment/processor.ts
insert_text(from_line: 87, text: "/** Secure payment processing with fraud detection */")

# Fix bugs anywhere in codebase
read_symbol("parseUserInput") → lines 156-162 in input/parser.ts
insert_text(from_line: 156, to_line: 162, text: "sanitized parsing logic")

This transforms AI from "helpful assistant" to "surgical code surgeon" 🦾

🎛️ Environment Variables Variable Default Description TRANSPORT stdio Transport mode: stdio or http PORT 4657 HTTP server port (when TRANSPORT=http) DEBUG false Enable debug mode and utils_debug tool

You can either install and use mcp-files or npx mcp-files.

# Show help
mcp-files --help

# Default: stdio transport
mcp-files

# HTTP transport
TRANSPORT=http mcp-files
TRANSPORT=http PORT=8080 mcp-files

# With debug mode
DEBUG=true mcp-files

All tools can be used directly from the command line:

# Find symbol in code (specific file)
mcp-files read_symbol "MyInterface" src/types.ts

# Find symbol in current directory (default)
mcp-files read_symbol "MyInterface"

# Inspect imports
mcp-files import_symbol lodash get

# Replace text with smart whitespace handling
mcp-files replace_text config.json "old_value" "new_value"

# Send notifications
mcp-files os_notification "Task completed"
# Install dependencies
npm install

# Build
npm run build

# Development mode
npm run dev

# Lint
npm run lint:full

# Test
npm run ts test/index.test.ts

# CLI testing
node dist/index.js read_symbol "functionName" file.ts

# Or search current directory
node dist/index.js read_symbol "functionName"

ERR_MODULE_NOT_FOUND when running npx mcp-files

Tools not showing up in MCP client:

File operations failing:

MIT - see LICENSE file.

Built for AI agents 🤖


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4