File Operations
STDIOEnhanced file operation capabilities with streaming, patching, and change tracking support.
Enhanced file operation capabilities with streaming, patching, and change tracking support.
A Model Context Protocol (MCP) server that provides enhanced file operation capabilities with streaming, patching, and change tracking support.
To install File Operations Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @bsmi021/mcp-file-operations-server --client claude
npm install
npm start
For development with auto-reloading:
npm run dev
copy_file
: Copy a file to a new locationread_file
: Read content from a filewrite_file
: Write content to a filemove_file
: Move/rename a filedelete_file
: Delete a fileappend_file
: Append content to a filemake_directory
: Create a directoryremove_directory
: Remove a directorycopy_directory
: Copy a directory recursively (with progress reporting)watch_directory
: Start watching a directory for changesunwatch_directory
: Stop watching a directoryget_changes
: Get the list of recorded changesclear_changes
: Clear all recorded changesfile:///recent-changes
: List of recent file system changesfile://{path}
: Access file contentsmetadata://{path}
: Access file metadatadirectory://{path}
: List directory contents// Copy a file await fileOperations.copyFile({ source: 'source.txt', destination: 'destination.txt', overwrite: false }); // Watch a directory await fileOperations.watchDirectory({ path: './watched-dir', recursive: true }); // Access file contents through resource const resource = await mcp.readResource('file:///path/to/file.txt'); console.log(resource.contents[0].text); // Copy directory with progress tracking const result = await fileOperations.copyDirectory({ source: './source-dir', destination: './dest-dir', overwrite: false }); // Progress token in result can be used to track progress console.log(result.progressToken);
The server implements rate limiting to prevent abuse:
Rate limit errors include a retry-after period in the error message.
All file paths are validated to prevent directory traversal attacks:
../
)Long-running operations like directory copying provide progress updates:
interface ProgressUpdate { token: string | number; message: string; percentage: number; }
Progress can be tracked through the progress token returned in the operation result.
npm run build
npm run lint
npm run format
npm test
The server can be configured through various settings:
The server provides detailed error information through the FileOperationError
class and MCP error codes:
InvalidRequest
: Invalid parameters or request formatMethodNotFound
: Unknown tool or resource requestedInvalidParams
: Invalid parameters (e.g., path validation failure)InternalError
: Server-side errorsEach error includes:
git checkout -b feature/amazing-feature
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.