npm package: @sandraschi/winrar-mcp
Description: WinRAR MCP - FastMCP 2.13+ server for WinRAR archive operations
Author: Your Name
Latest version: 0.1.0

# WinRAR MCP

A FastMCP 2.10 server that provides programmatic access to WinRAR functionality.

## Features

- Create, extract, and manage RAR archives
- Support for password protection and encryption
- File compression with various algorithms and levels
- Batch processing of archive operations
- Secure deletion of files
- Progress tracking and notifications
- DXT package for easy deployment and integration

## Prerequisites

- Python 3.8+
- WinRAR installed and in system PATH
- (Optional) Virtual environment (recommended)
- For DXT deployment: Node.js and npm (for DXT CLI)

## Installation

### Option 1: npm/npx (Recommended)

Install via npm for easy access:

```powershell
# Install globally
npm install -g @sandraschi/winrar-mcp

# Or use npx (no installation needed)
npx @sandraschi/winrar-mcp
```

**Note:** Python 3.8+ and WinRAR must be installed separately. The npm package will check for Python during installation.

### Option 2: From Source

1. Clone the repository:

   ```powershell
   git clone https://github.com/sandraschi/winrar-mcp.git
   cd winrar-mcp
   ```

2. Create and activate a virtual environment (recommended):

   ```powershell
   python -m venv venv
   .\venv\Scripts\Activate.ps1
   ```

3. Install dependencies:

   ```powershell
   pip install -e .[dev]
   ```

### Option 3: DXT Package

1. Install the DXT CLI:

   ```bash
   npm install -g @anthropic/dxt
   ```

2. Install the WinRAR MCP package:

   ```bash
   dxt install path/to/winrarmcp-0.1.0.dxt
   ```

3. Start the server:

   ```bash
   dxt start winrarmcp
   ```

## Configuration

Copy `.env.example` to `.env` and update the settings:

```ini
# WinRAR MCP Configuration
WINRAR_PATH=C:\\Program Files\\WinRAR\\WinRAR.exe
DEFAULT_COMPRESSION_LEVEL=5  # 0-5 (0=store, 1=fastest, 3=fast, 5=normal, 7=maximum, 9=ultra)
DEFAULT_METHOD=RAR5          # RAR, RAR4, RAR5, ZIP
LOG_LEVEL=INFO
HOST=0.0.0.0
PORT=8000
```

## Usage

### Running the Server

```powershell
uvicorn winrarmcp.main:app --reload
```

### Example API Requests

Create a new archive:

```http
POST /api/v1/archive/create
Content-Type: application/json

{
  "files": ["path/to/file1.txt", "path/to/file2.txt"],
  "archive_path": "output.rar",
  "password": "secure123",
  "compression_level": 5,
  "method": "RAR5"
}
```

Extract an archive:

```http
POST /api/v1/archive/extract
Content-Type: application/json

{
  "archive_path": "archive.rar",
  "output_dir": "extracted_files",
  "password": "secure123"
}
```

## DXT Packaging

To create a DXT package:

1. Install required tools:

   ```powershell
   # Install 7-Zip if not already installed
   # Download from https://www.7-zip.org/
   ```

2. Run the packaging script:

   ```powershell
   .\package_dxt.ps1
   ```

3. The package will be created in the `dist` directory.

For detailed DXT package documentation, see [DXT_README.md](DXT_README.md).

## Development

### Running Tests

```powershell
pytest
```

### Code Formatting

```powershell
black .
isort .
```

### Type Checking

```powershell
mypy .
```

## License

MIT