npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sylweriusz/komga-book-search

v0.6.0

Published

Search and read your Komga ebook collection through AI using Model Context Protocol

Downloads

4

Readme

Komga Ebook Library

Search and read your Komga ebook collection through AI using Model Context Protocol

NPM Version License: MIT

Connect your Komga digital library to AI assistants like Claude, enabling intelligent book discovery, content reading, and full-text search across your ebook collection.

🎯 Purpose

Bridge AI assistants with digital library infrastructure to provide authoritative source access for research, fact-checking, and academic citation. Core philosophy: Komga finds books, we search IN books.

✨ Key Features

  • Smart Format Detection: Automatic EPUB vs PDF handling
  • Full-Text Search: FlexSearch integration for instant content discovery
  • Claude Vision OCR: Intelligent PDF processing for non-text content
  • Session Caching: Optimized performance for repeated access
  • Conservative Fallbacks: Graceful degradation prevents poor user experience

📚 Format Support Matrix

| Format | Content Extraction | Search Capability | Performance | |--------|-------------------|-------------------|-------------| | EPUB | XHTML text extraction | FlexSearch full-text search | <1s after indexing | | PDF (Text) | pdf-parse extraction | FlexSearch full-text search | 2-5s initial, <1s cached | | PDF (Image) | Sharp compression + Claude Vision | Guidance to specific pages | Real-time |

🚀 Quick Start

Installation

# Via NPM (recommended)
npx @sylweriusz/komga-ebook-library

# Via Smithery (for Claude Desktop)
npx @smithery/cli install @sylweriusz/komga-ebook-library --client claude

Configuration

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "komga-ebook-library": {
      "command": "npx",
      "args": ["@sylweriusz/komga-ebook-library"],
      "env": {
        "KOMGA_URL": "http://your-komga-server:25600",
        "KOMGA_USERNAME": "your-username",
        "KOMGA_PASSWORD": "your-password",
        "KOMGA_LIBRARY": "your-library-filter"
      }
    }
  }
}

🛠️ MCP Tools

search_library_books(query, library_filter?)

Discover books across library collections with format detection.

// Find academic books on specific topics
{
  "query": "artificial intelligence",
  "library_filter": "academic"  // optional
}

get_book_overview(book_id)

Retrieve complete book metadata including page count and format information.

{
  "book_id": "0K79C4PQAEH7J"
}

read_book_pages(book_id, start_page, end_page)

Access book content with intelligent format routing (max 15 pages).

  • EPUBs: Returns clean text with chapter delimiters
  • PDFs: Returns compressed images optimized for Claude Vision OCR

search_within_book(book_id, search_term)

Full-text search within individual books.

  • EPUBs & Text PDFs: FlexSearch with context and highlights
  • Image PDFs: Guidance to use read_book_pages with Claude Vision

💡 Use Cases

  • Academic Research: Search scholarly books for citations and references
  • Fact Verification: Cross-reference claims against authoritative sources
  • Language Learning: Find conversation examples and vocabulary in context
  • Technical Documentation: Navigate complex technical manuals efficiently

🏗️ Architecture

Built with Lean Architectural Methodology (LAM):

  • Vertical Feature Slicing: Each MCP tool as self-contained feature
  • Dependency Injection: Constructor-based, no singletons
  • Strict Type Safety: Zero any types, comprehensive TypeScript
  • Single Responsibility: One file, one purpose
  • No Circular Dependencies: Clear dependency direction

📋 Requirements

  • Node.js: 18.0.0 or higher
  • Komga Server: Running instance with API access
  • TypeScript: Included in dependencies

🔧 Development

# Clone and setup
git clone https://github.com/sylweriusz/komga-ebook-library.git
cd komga-ebook-library
npm install

# Build and run
npm run build
npm start

# Development mode
npm run dev

📝 Configuration Variables

| Variable | Description | Required | Example | |----------|-------------|----------|---------| | KOMGA_URL | Komga server URL | ✅ | http://localhost:25600 | | KOMGA_USERNAME | Authentication username | ✅ | [email protected] | | KOMGA_PASSWORD | Authentication password | ✅ | your-password | | KOMGA_LIBRARY | Library filter (partial match) | ✅ | academic |

🐛 Troubleshooting

Connection Issues

  • Verify Komga server is accessible
  • Check authentication credentials
  • Ensure user has PAGE_STREAMING role

Search Problems

  • Confirm KOMGA_LIBRARY filter matches existing libraries
  • Check book format support (EPUB preferred for text search)

Performance Issues

  • EPUBs index on first access (2-4 seconds)
  • Subsequent searches use cached indexes (<1 second)
  • Large PDFs may require patience for initial processing

📄 License

MIT © sylweriusz

🤝 Contributing

Contributions welcome! Please read our Contributing Guide and follow the LAM architectural principles.

🔗 Related Projects


Built for researchers, academics, and digital library enthusiasts who need AI-powered access to their book collections.