FilerMoverMcp
A file mover tool that stages and executes file moves safely. Works as both a CLI tool and an MCP server for AI agents.
FileMoverMcp
A file mover tool that stages and executes file moves safely. Works as both a CLI tool and an MCP (Model Context Protocol) server for AI agents.
Features
- Session-based workflow: Stage multiple file moves, preview them, then commit all at once
- Safety first: Preview changes before executing, validate file paths and conflicts
- Dual mode: Works as both a command-line tool (
fm) and an MCP server for AI agents - Overwrite control: Explicit opt-in for overwriting existing files
- Clear error messages: Actionable guidance when things go wrong
Installation
As a .NET Global Tool
dotnet tool install --global FileMoverMcp
After installation, the fm command will be available globally, the CLI is ready to use.
If you want it as an MCP tool in for example Cursor, add this to your MCP configuration:
{
"mcpServers": {
"filemover": {
"command": "fm",
"args": ["--mcp"]
}
}
}
Usage
CLI Tool
Workflow
- Initialize a session in a directory
- Stage file moves
- Preview the changes
- Commit (or cancel) the moves
Commands
Initialize a session:
fm init [path] # Initialize at specific path
fm init # Initialize at current directory
Stage file moves:
fm mv <source> <dest> # Stage a file move
fm mv <source> <dest> --overwrite # Allow overwriting
Preview staged changes:
fm preview # See all staged moves
Execute or cancel:
fm commit # Execute all staged moves
fm cancel # Discard all staged moves
Get help:
fm help # Show help information
Examples
# Move files on desktop
fm init "c:/users/adam/desktop"
fm mv "old-folder/file.png" "new-folder/file.png"
fm mv "document.txt" "archive/document-backup.txt"
fm preview
fm commit
# Overwrite an existing file
fm init
fm mv "source.txt" "destination.txt" --overwrite
fm commit
# Cancel without executing
fm init
fm mv "file1.txt" "file2.txt"
fm preview
fm cancel
As MCP Server
Run the tool in MCP server mode:
fm --mcp
Or using dotnet run during development:
dotnet run --project FileMoverMcp.Cli/FileMoverMcp.Cli.csproj -- --mcp
MCP Tools
When running as an MCP server, the following tools are available:
fm_init(path?: string)- Initialize a sessionfm_move(source: string, destination: string, overwrite: boolean)- Stage a movefm_preview()- Preview staged movesfm_commit()- Execute staged movesfm_cancel()- Cancel sessionfm_help()- Get help
MCP Configuration Example
Add to your MCP client configuration:
{
"mcpServers": {
"filemover": {
"command": "fm",
"args": ["--mcp"]
}
}
}
Architecture
The project follows clean architecture principles:
-
FileMoverMcp.Core - Core business logic, interfaces, and models
- Commands (Init, Move, Preview, Commit, Cancel, Help)
- Services (SessionManager, SessionStorage, FileOperationService)
- Models (Session, FileMove)
- Interfaces (ICommand, ISessionManager, etc.)
-
FileMoverMcp.Cli - CLI and MCP server entry point
- Program.cs - Dual-mode entry point
- McpTools.cs - MCP tool definitions
-
FileMoverMcp.Tests - Comprehensive test suite
- Unit tests for all commands and services
- Integration tests for full workflows
Key Design Decisions
- Session storage in temp directory - Sessions survive across CLI invocations and are cleaned up by the OS
- Files only - Simplified scope, no directory recursion
- Overwrite flag - Explicit opt-in for safety
- Shared sessions - CLI and MCP modes share the same session storage
- Command pattern - Clean, testable, extensible architecture
- EasyReasy.FileStorage - Secure file operations with directory traversal protection
Error Handling
The tool provides clear, actionable error messages:
- No session initialized:
"Error: No session initialized. Run 'fm init' first." - Session already exists:
"Error: Session already active at [path]. Use 'fm preview' to review or 'fm cancel' to discard." - Source file not found:
"Error: Source file not found: [path]" - Destination exists:
"Error: Destination exists: [path]. Use --overwrite flag to replace." - Path outside base directory:
"Error: Path is outside initialized directory: [path]"
Testing
The project includes comprehensive tests:
# Run all tests
dotnet test
# Run with detailed output
dotnet test --logger "console;verbosity=detailed"
Test Coverage:
- 31 unit tests covering all commands and services
- 8 integration tests covering full workflows
- All tests passing ✓
Dependencies
- .NET 8.0 - Target framework
- ModelContextProtocol (0.5.0-preview.1) - MCP server functionality
- EasyReasy.FileStorage (2.0.2) - Secure file operations
- Microsoft.Extensions.DependencyInjection - Dependency injection
- Microsoft.Extensions.Hosting - Hosting infrastructure
Development
Getting the repository
git clone <repository-url>
cd FileMoverMcp
Building
dotnet build FileMoverMcp.sln
Running Tests
dotnet test FileMoverMcp.sln
Packaging
dotnet pack FileMoverMcp.Cli/FileMoverMcp.Cli.csproj --configuration Release
The package will be created in FileMoverMcp.Cli/nupkg/.
Project Structure
FileMoverMcp/
├── FileMoverMcp.Core/
│ ├── Commands/ # Command implementations
│ ├── Interfaces/ # Core interfaces
│ ├── Models/ # Domain models
│ └── Services/ # Business logic services
├── FileMoverMcp.Cli/
│ ├── Program.cs # Entry point
│ └── McpTools.cs # MCP tool definitions
├── FileMoverMcp.Tests/
│ ├── Commands/ # Command unit tests
│ ├── Services/ # Service unit tests
│ └── Integration/ # Integration tests
└── README.md
License
MIT License
Contributing
Contributions are welcome! Please ensure all tests pass before submitting a pull request.
Related Servers
Music Collection MCP Server
Access and manage local music collections with advanced metadata, classification, and analytics.
File MCP Server
A server providing comprehensive file system operations, automatically downloaded and built on first use.
HDFS MCP Server
Access and manage files on HDFS clusters using the MCP protocol, supporting operations like upload, download, move, and copy.
PDF Splitter
Provides random access to PDF contents, allowing selective extraction of pages and content to reduce reading costs.
LDIMS MCP
Provides an MCP interface for the LDIMS document management system.
Fast Filesystem MCP
A high-performance Model Context Protocol (MCP) server that provides secure filesystem access and AI-optimized code development tools for Claude and other AI assistants.
Paths Tree Generator
Converts a flat list of filesystem paths into a JSON directory tree.
CData FTP Server
A read-only MCP server for querying live FTP data using the CData JDBC Driver.
Filesystem
Secure file operations with configurable access controls
MCP Filesystem Server
Provides secure access to the local filesystem via the Model Context Protocol (MCP).