@chinchillaenterprises/mcp-file-splice
v1.0.0
Published
MCP server for efficient file content splicing - cut, copy, and move lines between files without AI reading
Maintainers
Readme
MCP File Splice
An MCP (Model Context Protocol) server for efficient file content splicing - cut, copy, and move lines between files without AI reading or memorizing file contents.
What it does
This MCP server provides tools for manipulating file contents at the line level:
- Copy lines between files or within the same file
- Cut (move) lines between files or within the same file
- Create files automatically if destination doesn't exist
- Safe operations - copy first, then delete for cut operations
- Multiple modes - insert, replace, or append content
Key Features
- Efficient: Direct file manipulation without AI reading large files
- Safe: Copy-first approach prevents data loss
- Flexible: Multiple insertion modes and line range support
- Smart: Handles line number adjustments for same-file operations
- Robust: Comprehensive error handling and validation
Installation
From NPM (When Published)
# Install with user scope
claude mcp add file-splice -s user -- npx @chinchillaenterprises/mcp-file-splice
# Start Claude to use the tools
claudeFor Development
# Clone and build
cd mcp-file-splice
npm install
npm run build
# Add to Claude for testing
claude mcp add file-splice-dev -s user -- node $(pwd)/dist/index.jsAvailable Tools
📋 file_copy_lines
Copy lines from one file to another.
Parameters:
source_file- Path to source filedest_file- Path to destination file (created if doesn't exist)start_line- Starting line number (1-based)end_line- Ending line number (1-based, inclusive)dest_line- Destination line number (1-based, 0 = append)mode- How to insert: "insert", "replace", or "append"
✂️ file_cut_lines
Cut (move) lines from one file to another.
Parameters: Same as file_copy_lines
📋 file_copy_within
Copy lines within the same file to another location.
Parameters:
file_path- Path to the filestart_line- Starting line number (1-based)end_line- Ending line number (1-based, inclusive)dest_line- Destination line number (1-based)mode- How to insert: "insert", "replace", or "append"
✂️ file_cut_within
Cut (move) lines within the same file to another location.
Parameters: Same as file_copy_within
Usage Examples
Copy lines between files
Copy lines 10-15 from config.txt to backup.txt at the end:
file_copy_lines(source_file="config.txt", dest_file="backup.txt", start_line=10, end_line=15, mode="append")Cut lines between files
Move lines 5-8 from old.txt to new.txt at line 1:
file_cut_lines(source_file="old.txt", dest_file="new.txt", start_line=5, end_line=8, dest_line=1, mode="insert")Copy within same file
Duplicate lines 20-25 and place at line 50:
file_copy_within(file_path="document.txt", start_line=20, end_line=25, dest_line=50, mode="insert")Cut within same file
Move lines 100-110 to the beginning of the file:
file_cut_within(file_path="document.txt", start_line=100, end_line=110, dest_line=1, mode="insert")Modes Explained
- insert: Insert lines at destination, shifting existing lines down
- replace: Overwrite existing lines at destination
- append: Add lines to the end of file (same as dest_line=0)
Safety Features
- Validation: Checks line ranges and file accessibility
- Copy-first approach: For cut operations, copies to destination before deleting source
- Directory creation: Automatically creates directories for destination files
- Error handling: Comprehensive error messages for debugging
- Overlap detection: Prevents invalid operations in same-file cuts
Order of Operations
Copy Operations:
- Read source lines
- Insert at destination
- Done ✅
Cut Operations:
- Read source lines
- Insert at destination
- Delete from source (only after successful insertion)
- Done ✅
This ensures data is never lost during operations.
Contributing
To add features or fix issues:
- Edit
src/index.ts - Build with
npm run build - Test locally
- Submit PR
Publishing
npm run build
npm publish --access publicPart of the Chinchilla Enterprises MCP suite
