mcp-files is a comprehensive MCP (Model Context Protocol) server whose goal is to provide AI agents such as Cursor and Claude Desktop with tools for finding and editing code in a codebase, enabling agents to locate and modify code with high precision.
The main capabilities revolve around two tools: read_symbol is used to find any symbol in the codebase, supporting location across the entire repository; insert_text is used to make modifications based on exact line ranges. Combined, the two enable precise editing: locating a specific function, class, or code block, replacing an implementation without affecting surrounding code, inserting enhancements at the appropriate location, and updating function signatures, modifying APIs, and fixing defects across files.
read_symbol provides an optimize parameter for optimizing code for AI processing: removing //, /* /, and /* */ comments; collapsing multiple consecutive newlines into a single newline; normalizing space indentation to tabs (automatically detecting the indentation unit); and removing common leading whitespace. This optimization helps reduce the number of tokens in the AI context window while preserving code structure and readability.
There are three usage methods: Option 1 is NPX (recommended), adding the configuration to Cursor's ~/.cursor/mcp.json or Claude Desktop's ~/.config/claude_desktop_config.json; Option 2 is Docker; Option 3 is HTTP transport, which requires running the server first. All tools can also be used directly from the command line.
In terms of architecture, the tools use Zod for type-safe validation, modules are self-contained in src/tools/, Linux, macOS, Windows, and WSL are supported cross-platform, memoization is used to optimize performance, and clear error handling with descriptive messages is provided.
Limitations and notes: Node.js 20 or later is required. If ERR_MODULE_NOT_FOUND occurs when running npx mcp-files (for example, @modelcontextprotocol/sdk/dist/esm/server/index.js cannot be found), it may be due to a corrupted or incomplete npx cache; you can run npx clear-npx-cache and try again; this issue may occur in Node.js v20 and v22. If the MCP client does not show the tools, confirm that the Node.js version is not lower than 20, and restart the client after modifying the configuration. If file operations fail, check the target file permissions, use absolute paths where possible, and confirm that the file exists and is accessible. The project uses the MIT license.