Ebook-MCP

Ebook-MCP

A Model Context Protocol server for conversational e-book interaction and AI integration.

132
Stars
23
Forks
132
Watchers
4
Issues
Ebook-MCP acts as a Model Context Protocol (MCP) server enabling seamless interaction between large language model (LLM) applications and electronic books such as EPUB and PDF. It standardizes APIs for AI-powered reading, searching, and managing digital libraries. Through natural language interfaces, it provides smart library management, content navigation, and interactive learning within digital books. Ebook-MCP integrates with modern AI-powered IDEs and supports multi-format digital book processing.

Key Features

Model Context Protocol (MCP) server implementation
Standardized APIs for LLM applications
Support for EPUB and PDF formats
Natural language querying of book content
Smart library organization and search
Integration with AI-powered IDEs (like Cursor, Claude)
Interactive content navigation
Quiz and exercise generation from e-book content
Multilingual documentation
Conversational reading and learning assistance

Use Cases

Smart management and search of digital book libraries
Conversational querying and summarization of book sections
Generating quizzes and exercises based on book content
Content navigation within e-books via natural language
Extracting key concepts and summaries from chapters
AI-driven interactive learning from e-books
Integrating digital books with LLM-powered tools
Finding specific topics or discussions across a personal library
Supporting reading assistance for education and study
Automated feedback and question generation for comprehension testing

README

MseeP.ai Security Assessment Badge

Ebook-MCP

English | 中文 | 日本語 | 한국어 | Français | Deutsch

Ebook-MCP is a powerful Model Context Protocol (MCP) server for processing electronic books. Built on the Model Context Protocol, it provides a set of standardized APIs for seamless integration between LLM applications and e-book processing capabilities. Currently supports EPUB and PDF formats.

Use Cases & Value

Ebook-MCP transforms how you interact with your digital books by enabling natural language conversations with your reading materials. It seamlessly integrates with modern AI-powered IDEs like Cursor and Claude, allowing you to:

  • Smart Library Management: Simply ask "Show me all EPUB files in my downloads folder" or "Find books about GenAI in my library"
  • Interactive Reading Experience: Have natural conversations about your books:
    • "Give me a brief introduction to 'LLM Engineer Handbook'"
    • "What's covered in Chapter 3?"
    • "Summarize the key points about RAG from this book"
  • Active Learning Support: Enhance your learning through AI-powered interactions:
    • "Create a quiz based on the RAG concepts from Chapter 5"
    • "Explain the differences between the architectures discussed in this chapter"
    • "Give me practical exercises based on the concepts in this section"
  • Content Navigation: Easily navigate through your books with natural language queries:
    • "Find all sections discussing prompt engineering"
    • "Show me the chapters about fine-tuning"
    • "Take me to the part about vector databases"

By bridging the gap between traditional e-books and AI capabilities, Ebook-MCP helps readers extract more value from their digital library through intuitive, conversation-based interactions.

Quick demo - Run with DeepSeek (Please check all the examples with Claude/OpenAI under mcp-client-example folder)

Query:Please check all the epub books in my download folder. user id is onebird.
......

Query: Can you ask me a few questions to test my understanding of this book?


Answer: Sure! Here are 5 questions about Elon Musk by Walter Isaacson to test your understanding of the book. Please answer based on your knowledge — I’ll give feedback and add details after each response.

Question 1:
How did Musk’s childhood and family background shape his personality and career later in life?
(Hint: His relationship with his father, growing up in South Africa, etc.)

Question 2:
Zip2 and X.com (later PayPal) were Musk’s early startups. What problems did they solve? How did Musk eventually exit from these companies?
(Hint: Zip2’s business model, X.com’s merger with Confinity, etc.)

Question 3:
In 2008, both SpaceX and Tesla were on the verge of bankruptcy. How did Musk save these two companies?
(Hint: Falcon 1’s fourth launch, NASA contract, Tesla’s last-minute rescue, etc.)

Question 4:
What controversies surround Musk’s management style? What specific incidents in the book illustrate his “hardcore” or “extreme” work culture?
(Hint: Fremont factory’s “production hell,” Twitter layoffs, etc.)

Question 5:
What is Musk’s attitude toward Artificial Intelligence (AI)? Why did he simultaneously support both OpenAI and Neuralink, which seem to have conflicting goals?
(Hint: AI as an existential threat, brain-machine interface vision, etc.)

Please answer each question. I’ll provide feedback and additional details or correct any misunderstandings!
(If a question isn’t clear, feel free to ask me.)

Query:
Question 1: His father’s abusive attitude made him less empathetic towards others.
Question 2: Zip2 solved the problem of electronic maps and online yellow pages. X.com solved online payments.
Question 3: He secured a contract with NASA. Tesla solved its production problems by building a factory in China.
Question 4: I don’t know. Please answer for me.
Question 5: He believes open-source technology is necessary to ensure AI is safe and open.

Answer: Your answers have captured some key points from the book. Let me add details, correct some inaccuracies, and provide further background for Questions 4 and 5:

Question 1 — Correction & Supplement
Influence of His Father:
Musk's father, Errol, was indeed extremely harsh — for example, forcing young Elon to kneel and count grains of rice for hours. The book emphasizes that this emotional desensitization shaped Musk into an extremely goal-oriented person — indifferent to others’ suffering but obsessively committed to his goals.

Reverse Impact:
It’s not that Musk is incapable of empathy — it’s selective. For instance, he may treat employees coldly but personally study medical equipment for his son X’s health issues.

Question 2 — Correction & Supplement
Zip2:
Essentially an online Yellow Pages + map navigation service (helping newspapers go online). Musk wrote much of the early code himself and slept in the office. Eventually, Compaq acquired Zip2 for $307 million (Musk received $22 million).

X.com:
Not just online payments — it was Musk’s attempt to create a comprehensive financial platform (aiming to replace banks). Later merged with Confinity (the precursor of PayPal). Musk was ousted due to internal conflicts, but when eBay acquired PayPal, Musk earned $180 million.
(Note: Musk later bought back the domain X.com — it’s now Twitter’s parent company name).

Question 3 — Correction & Supplement
SpaceX:
In 2008, Falcon 1 succeeded on its fourth launch (after three failures drained their funds). Right after that, SpaceX secured a $1.6 billion NASA contract for cargo resupply — a lifeline for the company.

Tesla:
In 2008, Tesla survived through a $50 million investment from Daimler and a loan from the U.S. Department of Energy.
Building the Gigafactory in China (2019) came much later. In the early years, survival depended on the launch of Model S (2012) and Musk’s personal gamble — selling all his real estate to fund Tesla.

Question 4 — Explanation: Controversy Around His Management Style
“Hardcore” Culture:

At SpaceX/Tesla: Musk demanded employees work 80+ hours per week, even sleeping at the factory. ("If you’re not here, your replacement is.")

After acquiring Twitter: He immediately laid off 75% of staff and asked the remaining employees to sign a "hardcore commitment" — agreeing to long hours and high-intensity output.

Extreme Cases:

At the Fremont Factory: During the "production hell" of the Model 3, Musk slept on the production line and once yelled at employees calling them "worse than dogs" (he later apologized).

Firing Executives: Musk once fired a senior Tesla executive on the spot because the font size in their PowerPoint presentation wasn’t big enough.

Question 5 — Correction & Supplement
AI Threat Theory:
Musk believes that AI could destroy humanity ("more dangerous than nuclear weapons"). Therefore:

OpenAI: He initially supported it to promote safe, open-source AI (but left later due to disputes over control).

Neuralink: He aims to use brain-machine interfaces to merge humans with AI — to prevent humans from being left behind.

Contradictions:
While warning about AI risks, Musk is simultaneously pushing for Full Self-Driving (FSD) technology at Tesla and has founded xAI to research Artificial General Intelligence (AGI).

Overall Evaluation:
✅ You have captured the key events accurately, but the details need to be strengthened (such as timelines and specific figures).
🔍 Recommended areas for further study: Musk's multi-threaded management style (running five companies simultaneously) and his skill in media manipulation (governing through Twitter).

Features

EPUB Support

  • Extract metadata (title, author, publication date, etc.)
  • Extract table of contents
  • Extract chapter content (with Markdown output)
  • Batch process EPUB files

PDF Support

  • Extract metadata (title, author, creation date, etc.)
  • Extract table of contents
  • Extract content by page number
  • Extract content by chapter title
  • Markdown output support
  • Batch process PDF files

Installation

  1. Clone the repository:
bash
git clone https://github.com/yourusername/ebook-mcp.git
cd ebook-mcp
  1. Install dependencies using uv:
bash
uv pip install -e .

Usage

Starting the MCP Server in development mode

Run the server in development mode:

bash
uv run mcp dev src/ebook_mcp/main.py

You can visit http://localhost:5173/ for testing & debugging purpose You can also install the inspector for the test.

npx @modelcontextprotocol/inspector uv --directory . run src/ebook_mcp/main.py

Starting the MCP Server in Prod mode

Run the server:

bash
uv run src/ebook_mcp/main.py

Configure the MCP in Cursor

Add the following configuration in Cursor

bash
"ebook-mcp":{
            "command": "uv",
            "args": [
                "--directory",
                "/Users/onebird/github/ebook-mcp/src/ebook_mcp/",
                "run",
                "main.py"
            ]
        }

EPUB Processing Examples

python
# Get all EPUB files in a directory
epub_files = get_all_epub_files("/path/to/books")

# Get EPUB metadata
metadata = get_metadata("/path/to/book.epub")

# Get table of contents
toc = get_toc("/path/to/book.epub")

# Get specific chapter content (in Markdown format)
chapter_content = get_chapter_markdown("/path/to/book.epub", "chapter_id")

PDF Processing Examples

python
# Get all PDF files in a directory
pdf_files = get_all_pdf_files("/path/to/books")

# Get PDF metadata
metadata = get_pdf_metadata("/path/to/book.pdf")

# Get table of contents
toc = get_pdf_toc("/path/to/book.pdf")

# Get specific page content
page_text = get_pdf_page_text("/path/to/book.pdf", 1)
page_markdown = get_pdf_page_markdown("/path/to/book.pdf", 1)

# Get specific chapter content
chapter_content, page_numbers = get_pdf_chapter_content("/path/to/book.pdf", "Chapter 1")

API Reference

EPUB APIs

get_all_epub_files(path: str) -> List[str]

Get all EPUB files in the specified directory.

get_metadata(epub_path: str) -> Dict[str, Union[str, List[str]]]

Get metadata from an EPUB file.

get_toc(epub_path: str) -> List[Tuple[str, str]]

Get table of contents from an EPUB file.

get_chapter_markdown(epub_path: str, chapter_id: str) -> str

Get chapter content in Markdown format.

PDF APIs

get_all_pdf_files(path: str) -> List[str]

Get all PDF files in the specified directory.

get_pdf_metadata(pdf_path: str) -> Dict[str, Union[str, List[str]]]

Get metadata from a PDF file.

get_pdf_toc(pdf_path: str) -> List[Tuple[str, int]]

Get table of contents from a PDF file.

get_pdf_page_text(pdf_path: str, page_number: int) -> str

Get plain text content from a specific page.

get_pdf_page_markdown(pdf_path: str, page_number: int) -> str

Get Markdown formatted content from a specific page.

get_pdf_chapter_content(pdf_path: str, chapter_title: str) -> Tuple[str, List[int]]

Get chapter content and corresponding page numbers by chapter title.

Dependencies

Key dependencies include:

  • ebooklib: EPUB file processing
  • PyPDF2: Basic PDF processing
  • PyMuPDF: Advanced PDF processing
  • beautifulsoup4: HTML parsing
  • html2text: HTML to Markdown conversion
  • pydantic: Data validation
  • fastmcp: MCP server framework

Important Notes

  1. PDF processing relies on the document's table of contents. Some features may not work if TOC is not available.
  2. For large PDF files, it's recommended to process by page ranges to avoid loading the entire file at once.
  3. EPUB chapter IDs must be obtained from the table of contents structure.

Architecture

           ┌────────────────────────────┐
           │         Agent Layer        │
           │  - Translation Strategy    │
           │  - Style Consistency Check │
           │  - LLM Call & Interaction │
           └────────────▲─────────────┘
                        │ Tool Calls
           ┌────────────┴─────────────┐
           │        MCP Tool Layer     │
           │  - extract_chapter        │
           │  - write_translated_chapter│
           │  - generate_epub          │
           └────────────▲─────────────┘
                        │ System/IO Calls
           ┌────────────┴─────────────┐
           │     System Base Layer     │
           │  - File Reading          │
           │  - ebooklib Parsing      │
           │  - File Path Storage/Check│
           └────────────────────────────┘

Contributing

We welcome Issues and Pull Requests!

For detailed information about recent changes, please see CHANGELOG.md.

Star History

Star History Chart

Repository Owner

Repository Details

Language Python
Default Branch main
Size 46,482 KB
Contributors 3
License Apache License 2.0
MCP Verified Nov 12, 2025

Programming Languages

Python
98.71%
Shell
1.29%

Tags

Topics

ebook epub examples mcp mcp-client mcp-examples mcp-server pdf

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • MCP Content Summarizer Server

    MCP Content Summarizer Server

    Intelligent multi-format content summarization via MCP interface.

    MCP Content Summarizer Server provides intelligent summarization of various content types including text, web pages, PDF documents, and EPUB books using Google's Gemini 1.5 Pro model. Through the Model Context Protocol, it supports customizable, multi-language summaries with options for style and focus. It is designed for integration with applications as an MCP server and offers tools for both summarization and testing. The solution maintains key information while producing concise and context-aware summaries from diverse content sources.

    • 142
    • MCP
    • 0xshellming/mcp-summarizer
  • PDF Tools MCP

    PDF Tools MCP

    Comprehensive PDF manipulation via MCP protocol.

    PDF Tools MCP provides an extensive suite of PDF manipulation operations using the Model Context Protocol framework. It supports both local and remote PDF tasks, such as rendering pages, merging, extracting metadata, retrieving text, and combining documents. The tool registers endpoints through the MCP protocol, enabling seamless server-based PDF processing for various clients. Built with Python, it emphasizes secure handling and compatibility with Claude Desktop via the Smithery ecosystem.

    • 31
    • MCP
    • danielkennedy1/pdf-tools-mcp
  • Raindrop.io MCP Server

    Raindrop.io MCP Server

    Enable LLMs to manage and search Raindrop.io bookmarks via the Model Context Protocol.

    Raindrop.io MCP Server is an integration that allows large language models to interact with Raindrop.io bookmarks using the Model Context Protocol. It provides tools to create and search bookmarks, including filtering by tags, and is designed for interoperability with environments like Claude for Desktop. Installation can be done via Smithery or manually, and configuration is managed through environment variables. The project is open source and optimized for secure, tokenized access to Raindrop.io.

    • 63
    • MCP
    • hiromitsusasaki/raindrop-io-mcp-server
  • NCBI Literature Search MCP Server

    NCBI Literature Search MCP Server

    Seamless PubMed literature search via Model Context Protocol server.

    NCBI Literature Search MCP Server provides a Model Context Protocol (MCP) interface to search the vast PubMed database using natural language queries. It enables AI assistants to conduct comprehensive and advanced literature searches across biological and biomedical disciplines, returning metadata such as abstracts, author lists, MeSH terms, and DOIs. Designed for integration with AI tools, it supports advanced query capabilities and streamlines literature review and research discovery processes.

    • 6
    • MCP
    • vitorpavinato/ncbi-mcp-server
  • BoldSign MCP Server

    BoldSign MCP Server

    Bridge Large Language Models with BoldSign's e-signature API via the Model Context Protocol.

    BoldSign MCP Server enables interaction between Large Language Models (LLMs) and the BoldSign API using the Model Context Protocol (MCP). It allows LLMs to manage templates and documents for e-signature workflows as autonomous agents connected to external systems. The server can be seamlessly integrated with various MCP-compatible clients such as Cursor, VS Code, Windsurf, and Claude Desktop. Configuration is made easy through standard environment variables and client-specific setup instructions.

    • 3
    • MCP
    • boldsign/boldsign-mcp
  • Zettelkasten MCP Server

    Zettelkasten MCP Server

    A Zettelkasten-based knowledge management system implementing the Model Context Protocol.

    Zettelkasten MCP Server provides an implementation of the Zettelkasten note-taking methodology, enriched with bidirectional linking, semantic relationships, and categorization of notes. It enables creation, exploration, and synthesis of atomic knowledge using MCP for AI-assisted workflows. The system integrates with clients such as Claude and supports markdown, advanced search, and a structured prompt framework for large language models. The dual storage architecture and synchronous operation model ensure flexibility and reliability for managing personal or collaborative knowledge bases.

    • 114
    • MCP
    • entanglr/zettelkasten-mcp
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results