How onebirdrocks/ebook-mcp works
Project type and purpose
• Ebook-MCP is an open-source Model Context Protocol (MCP) server written in Python.
• It exposes standardized APIs allowing LLM-powered clients (e.g., Cursor, Claude, custom scripts) to process and interact with EPUB/PDF e-books.
File structure
• Top-level:
• .github/workflows/cli.yml – CI for tests or release
• pyproject.toml / requirements.txt – build & dependencies
• README.md – project overview & architecture sketch
• src/ebook_mcp/
• main.py – entrypoint launching the FastMCP server
• mcp-client-example/ – sample clients demonstrating calls to the running MCP server (Anthropic, DeepSeek, OpenAI)
• tools/ – core modules for EPUB/PDF processing (epub_helper.py, pdf_helper.py), plus logger setup
• tests/ – unit tests for file format support (e.g., test_azw.py, test_epub_helper.py)
README for additional insights
• It defines three logical layers:
• Agent Layer – strategy, LLM calls, conversation orchestration
• MCP Tool Layer – individual “tool” handlers such as extract_chapter, get_metadata
• System Base Layer – low-level file I/O, parsing via ebooklib/PyPDF2/PyMuPDF, HTML→Markdown conversion
Diagramming best-practices
Client → Server.Agent → Server.Tools → System.IO/Parsing → back up
• Clients & external services (e.g., green)
• Server layers (e.g., blue for Agent, yellow for Tool, gray for System)
• File system / persistent store (e.g., brown)