MCP Duplicate File Manager Server
Enables LLM agents to find and safely delete duplicate files using content-based detection, with smart copy prioritization and dry-run mode.
README
MCP Duplicate File Manager Server
A Model Context Protocol (MCP) server that enables LLM-based AI agents to manage duplicate files efficiently. Designed for seamless integration with LLMs and AI agents using the MCP protocol with intelligent duplicate detection and safe deletion capabilities.
Features
- Exposes file management tools for LLM agents via MCP:
list_files: List files in directories with optional filteringfind_duplicates: Find duplicate files based on content hash (MD5)delete_duplicates: Safely delete duplicate files with intelligent copy detection
- Smart copy detection: Prioritizes deleting files with copy indicators ("copy", "(1)", "(2)", etc.)
- Content-based duplicate detection using MD5 hashing for accuracy
- Recursive directory scanning with optional pattern matching
- Dry-run mode for safe preview before actual deletion
- Simple integration with Claude, MCP clients, or other LLM-based agents
Quickstart
1. Install & Run
Run the MCP Duplicate File Manager Server using uvx:
uvx --from git+https://github.com/deerajd/DuplicateFileRemover-MCP.git mcp-server
2. Integrate with Your LLM Agent
Add the following to your tool configuration (for Claude, MCP clients, etc.):
{
"mcpServers": {
"DuplicateListor": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/deerajd/DuplicateFileRemover-MCP.git",
"mcp-server"
]
}
}
}
This configuration launches the MCP Duplicate File Manager Server as a subprocess, exposing file management tools to your LLM agent.
3. Usage
From your LLM agent, you can call:
List Files in Directory
list_files(directory="./Documents", pattern="*.pdf") # List PDF files
list_files(directory="/home/user", include_hidden=True) # Include hidden files
list_files() # List all files in current directory
Find Duplicate Files
find_duplicates(directory="./Downloads") # Find duplicates in Downloads
find_duplicates(directory="/Users/john/Desktop", recursive=False) # Non-recursive search
find_duplicates() # Find duplicates in current directory
Delete Duplicate Files
delete_duplicates(directory="./Documents", dry_run=True) # Preview what would be deleted
delete_duplicates(directory="./Documents", dry_run=False) # Actually delete duplicates
delete_duplicates(directory="./Pictures", recursive=True) # Recursive deletion with preview
The server provides detailed responses including:
- List of files with metadata (name, size, type, path)
- Duplicate file groups organized by content hash
- Deletion results with preserved originals and deleted copies
- Error handling for inaccessible files or directories
API Reference
list_files(directory=".", pattern="*", include_hidden=False)
- Parameters:
directory(str): Directory path to list files from (default: current directory)pattern(str): File pattern to match (e.g., ".py", ".txt") (default: "*")include_hidden(bool): Whether to include hidden files (default: False)
- Returns: List of dictionaries containing file information (name, size, type, path, modified)
find_duplicates(directory=".", recursive=True)
- Parameters:
directory(str): Directory path to search for duplicates (default: current directory)recursive(bool): Whether to search recursively in subdirectories (default: True)
- Returns: Dictionary with hash as key and list of duplicate file paths as values
delete_duplicates(directory=".", recursive=True, dry_run=True)
- Parameters:
directory(str): Directory path to search for duplicates (default: current directory)recursive(bool): Whether to search recursively in subdirectories (default: True)dry_run(bool): If True, only show what would be deleted without actually deleting (default: True)
- Returns: Dictionary with information about deleted files and preserved originals
Smart Copy Detection
The server intelligently identifies and prioritizes deletion of files with copy indicators:
copy- Files containing "copy" in the filename(1),(2), etc. - Files with numbered suffixes_copy,-copy- Files with copy prefixes/suffixesduplicate,dup- Files marked as duplicates- Multiple language variants (copie, kopia, copia)
Development
Requirements
- Python 3.8+
hashlibfor MD5 hashingpathlibfor file path operationsFastMCPfor MCP server implementation
Project Structure
DuplicateListor/
├── duplicatelist.py # Main server implementation
├── main.py # Entry point
├── pyproject.toml # Project configuration
└── README.md # This file
Safety Features
- Dry-run Mode: Preview changes before actual deletion
- Smart Original Detection: Preserves files without copy indicators
- Error Handling: Graceful handling of inaccessible files
- Content-based Matching: Uses MD5 hashing for accurate duplicate detection
- Detailed Reporting: Comprehensive feedback on all operations
License
MIT License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。