epub-parser-mcp

epub-parser-mcp

A TypeScript-based MCP server for parsing EPUB files, enabling metadata extraction, table of contents parsing, text content extraction, and search within EPUB documents, designed for seamless integration with AI assistants like Claude Desktop.

Category
Visit Server

README

EPUB Parser MCP Server 📚

TypeScript MCP License: GPL Node.js

A powerful TypeScript-based Model Context Protocol (MCP) server for parsing EPUB files and extracting content with AI assistance. Built for seamless integration with AI assistants like Claude Desktop.

✨ Features

  • 📄 Metadata Extraction - Extract EPUB metadata (title, author, publisher, language, etc.)
  • 📑 Table of Contents - Parse hierarchical table of contents structure
  • 📖 Text Content Extraction - Extract clean text from chapters with formatting options
  • 🔍 Advanced Search - Search text within EPUB files with case sensitivity options
  • 🌐 Resource Access - Access EPUB resources via URI templates
  • 🚀 TypeScript - Built with TypeScript for type safety and better development experience
  • High Performance - Optimized EPUB parsing algorithms
  • 🔧 MCP Standard - Fully compliant with Model Context Protocol standards

🚀 Quick Start

Prerequisites

  • Node.js 18 or higher
  • npm or yarn

Installation

方法1: 从源码安装

# Clone the repository
git clone https://github.com/your-username/epub-parser-mcp.git
cd epub-parser-mcp

# Install dependencies
npm install

# Build the project
npm run build

方法2: 使用npx(推荐用于生产环境)

# 直接使用npx运行,无需安装
npx epub-parser-mcp

方法3: 全局安装

# 全局安装
npm install -g epub-parser-mcp

# 然后直接运行
epub-parser-mcp

🔧 MCP Configuration

服务配置 (Server Config)

以下是完整的MCP服务配置,可用于Claude Desktop或其他MCP客户端:

{
  "mcpServers": {
    "epub-parser": {
      "command": "npx",
      "args": ["-y", "epub-parser-mcp"]
    }
  }
}

环境变量配置 (Environment Variables):

{
  "env": {
    "NODE_ENV": "production"
  }
}

Claude Desktop Configuration

Add the following to your Claude Desktop configuration file:

使用npx (推荐):

{
  "mcpServers": {
    "epub-parser": {
      "command": "npx",
      "args": ["-y", "epub-parser-mcp"]
    }
  }
}

备选方案: 使用node直接运行 (如果npx不支持):

{
  "mcpServers": {
    "epub-parser": {
      "command": "node",
      "args": ["/path/to/epub-parser-mcp/build/index.js"]
    }
  }
}

注意: Claude Desktop目前支持以 python -muvuvxnpx 开头的命令。在某些环境中,node 命令可能不被支持。

Configuration File Locations

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Configuration Steps

  1. Build the project (if not already built):

    npm run build
    
  2. Locate your Claude Desktop configuration file (see locations above)

  3. Add the MCP server configuration to the mcpServers section

  4. Restart Claude Desktop to load the new configuration

  5. Verify the server is running by checking the Claude Desktop logs

Configuration Validation

After configuration, you can verify the server is working by:

  1. Check Claude Desktop logs for any MCP-related errors
  2. Test the tools by asking Claude to use the EPUB parser tools
  3. Verify server startup - the server should start automatically when Claude Desktop launches

Troubleshooting

Common Issues:

  1. Path Issues: Ensure the path to build/index.js is correct and accessible
  2. Node.js Version: Make sure Node.js 18+ is installed and in your PATH
  3. Permissions: Ensure the build files have proper execution permissions
  4. Dependencies: Run npm install if dependencies are missing

Error Messages:

  • "Command not found": Check Node.js installation and PATH
  • "File not found": Verify the path to build/index.js
  • "Permission denied": Check file permissions on build directory

Advanced Configuration

For development, you can run the server manually:

# Build and start the server
npm run build
npm start

# Or run directly
node build/index.js

The server will output connection information and any errors to the console.

📖 Usage Examples

Get EPUB Information

{
  "filePath": "/path/to/book.epub"
}

Extract Table of Contents

{
  "filePath": "/path/to/book.epub"
}

Extract Text Content

{
  "filePath": "/path/to/book.epub",
  "chapterIds": ["chapter-1", "chapter-2"],
  "maxLength": 5000
}

Search in EPUB

{
  "filePath": "/path/to/book.epub",
  "query": "artificial intelligence",
  "caseSensitive": false
}

🔧 Available Tools

1. epub_info

Get comprehensive EPUB file information including metadata and structure.

Parameters:

  • filePath (string): Path to the EPUB file

2. epub_toc

Parse and display the table of contents structure.

Parameters:

  • filePath (string): Path to the EPUB file

3. epub_extract_text

Extract text content from specified chapters.

Parameters:

  • filePath (string): Path to the EPUB file
  • chapterIds (array, optional): List of chapter IDs to extract
  • maxLength (number, optional): Maximum text length limit

4. epub_search

Search for text within the EPUB file.

Parameters:

  • filePath (string): Path to the EPUB file
  • query (string): Search query
  • caseSensitive (boolean, optional): Case-sensitive search (default: false)

🌐 Resource Templates

Access EPUB resources via URI:

  • epub://{file}/metadata - EPUB metadata in JSON format
  • epub://{file}/toc - Table of contents structure
  • epub://{file}/chapter/{id} - Specific chapter content

🛠️ Development

Project Structure

epub-parser-mcp/
├── src/
│   ├── index.ts          # MCP server implementation
│   ├── epub-parser.ts    # EPUB parsing core
│   └── types.ts          # TypeScript type definitions
├── build/                # Compiled JavaScript
├── package.json
└── README.md

Building from Source

# Install dependencies
npm install

# Build the project
npm run build

# Start the server
npm start

Testing

# Run tests (if available)
npm test

📊 Performance

  • Fast Parsing: Optimized EPUB container and content parsing
  • Memory Efficient: Stream-based processing for large EPUB files
  • Concurrent Safe: Supports multiple concurrent requests

🤝 Contributing

We welcome contributions! Please feel free to submit issues, feature requests, or pull requests.

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a pull request

Code Style

  • Use TypeScript for type safety
  • Follow existing code formatting
  • Add appropriate comments and documentation

📄 License

This project is licensed under the GPL License - see the LICENSE file for details.

🙏 Acknowledgments

Empowering AI assistants to read and understand EPUB documents

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured