Skip to main content
Glama
README.md
# 📚 KCC CBZ-to-Kindle EPUB MCP Server

[![License](https://img.shields.io/badge/License-See%20LICENSE-blue.svg)](LICENSE)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![MCP Standard](https://img.shields.io/badge/MCP-Standard-green.svg)](https://modelcontextprotocol.io)
[![NVIDIA CUDA](https://img.shields.io/badge/CUDA-12.0%2B-76B900.svg?logo=nvidia)](https://developer.nvidia.com/cuda-zone)

An advanced **Model Context Protocol (MCP)** server built on top of **Kindle Comic Converter (KCC)** and **PyTorch CUDA GPU acceleration**. 

Specifically designed to handle large comic archives (`.cbz`, `.cbr`, zip files up to **1GB+**) and convert them into Kindle-optimized EPUB volumes cleanly partitioned under the **~200MB limit for Amazon's Send to Kindle service**.

---

## ✨ Features

- ⚡ **GPU VRAM Acceleration**: Leverages PyTorch CUDA for batch image scaling, grayscale conversion, and gamma processing directly in VRAM.
- 📦 **Send-to-Kindle Smart Chunking**: Automatically partitions 1GB+ multi-volume comics into ~190MB EPUB chunks to guarantee compliance with Amazon's 200MB upload limit.
- 📱 **Multi-Device Target Profiles**: Custom E-ink display optimization for:
  - **Kindle Paperwhite 5** (`KPW5` — 1236×1648)
  - **Kindle Scribe** (`KS` — 1860×2480)
  - **Kindle Oasis** (`KO` — 1264×1680)
  - **Kindle Paperwhite 3/4** (`KPW34` — 1072×1448)
  - **Kindle Voyage / 11** (`KV` / `K11` — 1072×1448)
- 📖 **Manga & Comic Support**: Full support for Right-to-Left (RTL Manga) and Left-to-Right (LTR Western Comics) reading styles.
- 🔍 **Archive Inspector**: Inspect total pages, uncompressed sizes, and estimated volume chunks before converting.

---

## 🛠️ Provided MCP Tools

| MCP Tool Name | Description | Key Parameters |
| :--- | :--- | :--- |
| `convert_cbz_to_kindle_epub` | Main tool to convert CBZ/CBR to Kindle EPUB chunks | `file_path`, `profile`, `max_chunk_mb` (default `190.0`), `manga_mode`, `upscale`, `use_gpu` |
| `inspect_cbz` | Inspects image counts, size, volume estimates & GPU status | `file_path` |
| `split_cbz_archive` | Pre-splits a CBZ archive into smaller volume archives | `file_path`, `output_dir`, `max_chunk_mb` |
| `list_supported_profiles` | Lists device profile resolutions & CUDA device status | None |

---

## ⚙️ Requirements & Installation

### System Prerequisites
- Python 3.10+
- `KindleComicConverter` (`kcc-c2e`) CLI binary
- NVIDIA GPU with CUDA drivers (Optional, for GPU acceleration)

### Installation

```bash
# 1. Clone Repository
git clone https://github.com/AmitKumarMyT/kcc-epub-converter-mcp.git
cd kcc-epub-converter-mcp

# 2. Install Dependencies
pip install -r requirements.txt
```

---

## 🔌 Integrating with MCP Clients

Add the server entry to your MCP client configuration (`mcp_config.json` for Claude Desktop, Gemini Antigravity, or VS Code MCP Extension):

```json
{
  "mcpServers": {
    "kcc-epub-converter": {
      "command": "python3",
      "args": [
        "/absolute/path/to/kcc-epub-converter-mcp/mcp_server.py"
      ],
      "env": {
        "PATH": "/home/myt/.local/bin:/usr/local/bin:/usr/bin:/bin"
      }
    }
  }
}
```

---

## 📜 License

This project is licensed under the terms specified in the [LICENSE](LICENSE) file.