Skip to main content
Glama
N3uraX

Tafa MCP Server

by N3uraX
README.md
# ๐Ÿš€ Tafa MCP Server

**Tafa** (meaning "quick" in several African languages) is a production-ready Model Context Protocol (MCP) server that provides comprehensive file system management capabilities for seamless integration with Claude Desktop.

## โœจ Features

### ๐Ÿ—‚๏ธ File Operations
- **read_file** - Read complete file contents with UTF-8 encoding
- **write_file** - Create new files or overwrite existing ones (with backup)
- **append_file** - Add content to existing files
- **copy_file** - Copy files to new locations
- **move_file** - Move/rename files
- **delete_file** - Remove files with confirmation and backup
- **get_file_info** - Get detailed file metadata (size, dates, permissions, hash)

### ๐Ÿ“ Directory Operations
- **create_directory** - Create directories with parent creation
- **list_directory** - List contents with file/directory indicators (recursive option)
- **delete_directory** - Remove directories with confirmation and backup
- **get_directory_info** - Get directory metadata and statistics

### ๐Ÿ” Search Operations
- **search_files** - Recursive file search with pattern matching
- **search_content** - Search within file contents (grep-like functionality)
- **find_duplicates** - Find duplicate files by content hash

### ๐Ÿ”’ Security Features
- **Sandboxed Operations** - Only allow operations within specified directories
- **Automatic Backups** - Creates backups before destructive operations
- **Path Validation** - Prevents directory traversal attacks
- **File Size Limits** - Prevents operations on extremely large files
- **Permission Checks** - Validates read/write permissions before operations

## ๐Ÿ› ๏ธ Installation

### Quick Install (NPM)
```bash
npm install -g tafa-mcp
```

### Manual Installation
```bash
git clone https://github.com/your-org/tafa-mcp.git
cd tafa-mcp
npm install
npm run install-global
```

## โš™๏ธ Configuration

### Claude Desktop Configuration

Add to your Claude Desktop configuration file:

**macOS/Linux**: `~/.config/claude/claude_desktop_config.json`
**Windows**: `%APPDATA%\claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "tafa-mcp": {
      "command": "tafa-mcp",
      "args": [
        "/Users/username/Documents",
        "/Users/username/Desktop",
        "/Users/username/Downloads"
      ]
    }
  }
}
```

### Docker Configuration
```json
{
  "mcpServers": {
    "tafa-mcp": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "--mount", "type=bind,src=/Users/username/Documents,dst=/workspace/Documents",
        "--mount", "type=bind,src=/Users/username/Desktop,dst=/workspace/Desktop",
        "tafa-mcp",
        "/workspace"
      ]
    }
  }
}
```

## ๐Ÿš€ Usage

### Starting the Server
```bash
tafa-mcp /path/to/directory1 /path/to/directory2
```

### Example Usage with Claude

Once configured, you can use Claude to perform file operations:

```
"Can you read the contents of my README.md file?"
"Please create a new file called notes.txt with some sample content"
"Search for all JavaScript files in my project directory"
"Find duplicate files in my Downloads folder"
```

## ๐Ÿ”ง Available Tools

### File Operations
- `read_file(path)` - Read file contents
- `write_file(path, content, backup=true)` - Write file with optional backup
- `append_file(path, content)` - Append content to file
- `copy_file(source, destination)` - Copy file
- `move_file(source, destination)` - Move/rename file
- `delete_file(path, backup=true)` - Delete file with optional backup
- `get_file_info(path)` - Get file metadata

### Directory Operations
- `create_directory(path)` - Create directory
- `list_directory(path, recursive=false, showHidden=false)` - List directory contents
- `delete_directory(path, backup=true)` - Delete directory with backup

### Search Operations
- `search_files(directory, pattern, recursive=true)` - Search files by name pattern
- `search_content(directory, searchTerm, filePattern="*", recursive=true)` - Search file contents

### Utility
- `get_server_info()` - Get server information and available tools

## ๐Ÿ” Security

Tafa MCP implements several security measures:

1. **Directory Sandboxing**: Operations are restricted to specified directories
2. **Path Validation**: Prevents directory traversal attacks
3. **Permission Checks**: Validates file system permissions
4. **File Size Limits**: Prevents operations on extremely large files (100MB default)
5. **Automatic Backups**: Creates backups before destructive operations

## ๐Ÿ—‚๏ธ Project Structure

```
tafa-mcp/
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.js              # Main server entry point
โ”‚   โ””โ”€โ”€ tools/
โ”‚       โ”œโ”€โ”€ fileOperations.js     # File operation handlers
โ”‚       โ”œโ”€โ”€ directoryOperations.js # Directory operation handlers
โ”‚       โ”œโ”€โ”€ searchOperations.js   # Search operation handlers
โ”‚       โ””โ”€โ”€ securityManager.js    # Security and validation
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ claude_desktop_config.example.json
โ””โ”€โ”€ tests/
    โ””โ”€โ”€ basic-tests.js
```

## ๐Ÿงช Testing

Run basic tests:
```bash
npm test
```

## ๐Ÿค Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Submit a pull request

## ๐Ÿ“„ License

MIT License - see LICENSE file for details.

## ๐Ÿ†˜ Support

For issues and support:
- GitHub Issues: [Report a bug](https://github.com/your-org/tafa-mcp/issues)
- Documentation: [Full documentation](https://github.com/your-org/tafa-mcp/wiki)

## ๐Ÿš€ Roadmap

- [ ] Archive operations (ZIP/TAR)
- [ ] File synchronization
- [ ] Batch operations
- [ ] File organization tools
- [ ] Git integration
- [ ] Extended search capabilities

---

**Tafa MCP** - Making file system operations fast and efficient for Claude Desktop! ๐Ÿš€