Skip to main content
Glama
README.md
# Claude Reader

Most book readers treat AI as an afterthought — a chatbot bolted onto the side. Claude Reader is different. It gives Claude **direct access to what you're reading** through MCP, so you can highlight a passage and ask "what does this mean?", search across your entire library for a half-remembered idea, or have Claude navigate to the exact paragraph it's referencing. It turns reading into a conversation.

![Claude Reader](claude-reader.png)

## Features

- **EPUB and PDF support** with automatic chapter detection - Only for DRM free books you own
- **Apple Books integration** on macOS (optional) 
- **Full-text search** across all books (FTS5)
- **Resume reading** from your last position
- **Drag-and-drop reordering** of your reading list
- **Real-time highlighting** via SSE when Claude points out passages

## Quick Start

Requires [uv](https://docs.astral.sh/uv/) and Python 3.10+.

```bash
git clone https://github.com/JasonBates/claude-reader.git
cd claude-reader
uv run server.py
```

Open [localhost:8123](http://localhost:8123). Import a book and start reading.

## Reading with Claude

Claude Reader includes an MCP server that gives Claude direct access to your reading. Select a passage and press `Cmd+Shift+C` to send it to Claude, or just ask about what you're reading.

> "What do you think about this passage I just highlighted?"
>
> "Can you summarize the main argument in chapter 3?"
>
> "Where does the author first introduce the concept of awareness?"

### Setup

Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "claude-reader": {
      "command": "uv",
      "args": ["run", "mcp_server.py"],
      "cwd": "/path/to/claude-reader"
    }
  }
}
```

Restart Claude Desktop, then start the reader with `uv run server.py`.

### MCP Tools

| Tool | Description |
|------|-------------|
| `get_current_chapter` | Chapter currently open in the browser |
| `get_highlight` | Text sent via Cmd+Shift+C |
| `get_books` | List all books in the library |
| `get_book_info` | Book metadata and chapter index |
| `get_chapter` | Retrieve any chapter by spine index |
| `search_book` | Full-text search within a book |
| `search_library` | Full-text search across all books |
| `goto` | Navigate the reader to a specific location |
| `highlight_in_chapter` | Navigate and highlight specific sentences |
| `highlight_sentences` | Highlight sentences in the current chapter |
| `clear_highlights` | Clear all highlights from the reader |

## Importing Books

Your **Apple Books library on macOS** is scanned automatically when you open the web UI. Available EPUBs and PDFs appear in the library — click any title to import it. DRM-protected books are automatically skipped.

To read a book from [Project Gutenberg](https://www.gutenberg.org/) or another source, add it to Apple Books first, then import from there.

## Project Structure

```
claude-reader/
├── server.py              # Entry point (port 8123)
├── mcp_server.py          # MCP server for Claude Desktop
├── app/
│   ├── config.py          # Configuration & shared state
│   ├── database.py        # SQLite + Turso sync layer
│   ├── search.py          # FTS5 full-text search
│   ├── routes/
│   │   ├── views.py       # HTML pages
│   │   ├── api.py         # JSON API
│   │   ├── actions.py     # Form actions (import, delete)
│   │   └── sse.py         # Server-Sent Events
│   └── services/
│       ├── library.py     # Book loading & caching
│       ├── epub.py        # EPUB parsing
│       ├── pdf.py         # PDF parsing
│       └── apple_books.py # macOS integration
├── static/                # CSS and JavaScript
└── templates/             # Jinja2 HTML templates
```

## Testing

```bash
uv run pytest                    # All tests
uv run pytest -m "not slow"      # Skip slow tests
uv run pytest tests/test_api.py  # Specific file
```

## Based On

Forked from [karpathy/reader3](https://github.com/karpathy/reader3) with Claude integration, PDF support, full-text search, and modular architecture.

## Legal Notice

Claude Reader is designed for use with **DRM-free books** that you have the legal right to read and process. This includes public domain works, open-access publications, DRM-free purchases, and books you have created or have permission to use. The software automatically skips DRM-protected files.

This project does not facilitate, encourage, or support the circumvention of digital rights management or copyright protections.

## Disclaimer

This is an independent, personal project and is **not affiliated with, endorsed by, or sponsored by Anthropic**. "Claude" refers to Anthropic's AI assistant, which this reader integrates with via the public MCP protocol.

## License

MIT