Files

Files

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

7
Stars
5
Forks
0
Releases

Overview

mcp-files is an MCP server that enables AI agents to rapidly locate and surgically edit code across a codebase. It exposes a suite of type-safe tools for symbol-level code operations, including read_symbol for cross-repository symbol discovery, insert_text for precise edits, import_symbol for module inspection, search_replace for resilient text modifications, and os_notification for system alerts. It supports multiple transport modes (stdio, HTTP) and can be run via NPX, Docker, or an HTTP transport, with environment variables to configure transport, port, and debug mode. The server emphasizes cross-codebase intelligence—finding symbols anywhere with exact locations—and surgical editing that targets exact functions, classes, or blocks without disturbing surrounding code. It supports zero-error refactoring by enabling changes to API surfaces across files. The architecture uses type-safe tools with Zod validation, self-contained modules, and cross-platform support, with memoization and descriptive error messages for performance and reliability. A dedicated code-optimization feature can strip comments, normalize indentation, collapse blank lines, and remove common leading indentation to shrink AI-context token usage. CLI examples and deployment options cover NPX, Docker, and HTTP transport.

Details

Owner
flesler
Language
TypeScript
License
MIT License
Updated
2025-12-07

Features

read_symbol: Symbol Discovery Across the Codebase

Find and extract code blocks by symbol names anywhere in the repository; supports multiple symbols; optional optimize to prepare code for AI processing.

insert_text: Surgical Editing at Exact Line Ranges

Replace or insert code using precise line ranges (from_line, to_line); supports citations like 12:15:file.ts; enables surgical edits without disrupting surrounding code.

import_symbol: Inspect Modules and Properties

Import and inspect JavaScript/TypeScript modules and their properties.

search_replace: Intelligent Text Replacement

Search and replace with whitespace handling and automation-friendly multi-match resolution; supports file_path, old_string, new_string, allow_multiple_matches.

os_notification: OS Notifications

Send OS notifications using native notification systems.

Code Optimization for AI Context

An optimize parameter for read_symbol that strips comments, collapses newlines, normalizes indentation, and removes base indentation to reduce token count while preserving structure; CLI mode always uses optimization.

Tags

MCPcode editingsymbol discoverysurgical editsrefactoringCLIcross-codebaseAI context optimization