EPUB Reader MCP Server
EPUB Reader MCPサーバー
AIエージェントのための「Kindle」として機能し、MCPのTools APIを通じてEPUBファイルの内容を公開するModel Context Protocol (MCP) サーバーです。
概要
EPUB Reader MCPサーバーは、AIエージェントがEPUBファイルを読み込み、操作する機能を提供します。Model Context Protocol (MCP) を実装しており、EPUBファイルのオープン、目次やページの移動、コンテンツの検索、脚注の確認、読書セッションの管理を可能にする13のツールを公開しています。
機能
EPUBファイルのオープン: EPUBファイルの検証と解析、読書セッションの作成
コンテンツのナビゲーション: ページの前方/後方への移動、特定のページや章へのジャンプ
コンテンツの探索: 目次、メタデータ、章の要約の表示
検索機能: コンテキスト付きの章をまたいだ全文検索
参照ツール: 脚注参照の解決、読書位置の取得
セッション管理: 開いている書籍の一覧表示、セッションの終了、リソース管理
Related MCP server: Readbook MCP Server
前提条件
npm または互換性のあるパッケージマネージャー
読み込むEPUBファイル (
.epub形式)
インストール
ソースからインストール
git clone https://github.com/your-username/mcp-epub-reader.git
cd mcp-epub-reader
npm install
npm run build使用方法
サーバーの実行
このサーバーはstdioトランスポートを使用するため、Claude DesktopのようなMCPクライアントとの統合に最適です。
stdio (ローカル統合)
Claude Desktopやその他のMCPクライアントとの統合用:
node build/index.jsサーバーは、MCP JSON-RPCプロトコルを使用してstdin/stdout経由で通信します。
設定
Claude Desktopの設定
Claude Desktopの設定ファイル (~/Library/Application Support/Claude/claude_desktop_config.json (macOSの場合)) にサーバーを追加します:
{
"mcpServers": {
"epub-reader": {
"command": "node",
"args": ["/absolute/path/to/mcp-epub-reader/build/index.js"],
"env": {
"LOG_LEVEL": "info"
}
}
}
}環境変数
変数 | 説明 | 必須 | デフォルト |
| ログレベル ( | いいえ |
|
ツールリファレンス
サーバーはEPUBファイル操作のために13のツールを提供します:
ツール | 説明 | 入力パラメータ |
| EPUBファイルを開き、読書セッションを作成する |
|
| 読書セッションを閉じ、リソースを解放する |
|
| 現在開いているすべてのEPUBセッションを一覧表示する | (なし) |
| 現在のセッションで次のページに移動する |
|
| 現在のセッションで前のページに移動する |
|
| 特定のページ番号にジャンプする |
|
| 特定の章にジャンプする (タイトルまたはインデックス) |
|
| 現在の読書位置と進捗を取得する |
|
| すべての章を対象にテキストを検索する |
|
| 階層化された目次を取得する |
|
| EPUBメタデータ(タイトル、著者、出版社など)を取得する |
|
| IDで脚注参照を解決する |
|
| 現在の章の要約を取得する |
|
ツールの詳細
ebook/open
EPUBファイルを開き、内容を解析し、読書セッションを作成してメタデータを返します。
入力スキーマ:
{
filePath: string; // Absolute or relative path to EPUB file
autoNavigate?: boolean; // Whether to auto-navigate to first page (default: false)
}リクエスト例:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ebook/open",
"arguments": {
"filePath": "/path/to/book.epub",
"autoNavigate": true
}
}
}レスポンス例:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "{\"sessionId\":\"sess_123\",\"metadata\":{\"title\":\"Sample Book\",\"author\":\"Author Name\",\"totalPages\":250,\"totalChapters\":12}}"
}
]
}
}ebook/close
読書セッションを閉じ、関連するリソースを解放します。
入力スキーマ:
{
sessionId: string; // Session ID returned by ebook/open
}ebook/list_open_books
現在アクティブなすべての読書セッションを一覧表示します。
入力スキーマ: (なし)
レスポンス例:
{
"sessions": [
{
"sessionId": "sess_123",
"filePath": "/path/to/book.epub",
"metadata": {
"title": "Sample Book",
"author": "Author Name",
"currentPage": 42,
"totalPages": 250
}
}
]
}ebook/navigate_next および ebook/navigate_previous
ページを前方または後方に移動します。
入力スキーマ:
{
sessionId: string;
}レスポンス例:
{
"sessionId": "sess_123",
"currentPage": 43,
"content": "Page content here...",
"chapterTitle": "Chapter 3: The Adventure Begins"
}ebook/jump_to_page
特定のページ番号にジャンプします。
入力スキーマ:
{
sessionId: string;
pageNumber: number; // 1-based page number
}ebook/jump_to_chapter
タイトル(大文字小文字を区別しない部分一致)または章インデックス(1始まり)で特定の章にジャンプします。
入力スキーマ:
{
sessionId: string;
chapter: string | number; // Chapter title or index
}ebook/get_position
現在の読書位置と進捗統計を取得します。
レスポンス例:
{
"sessionId": "sess_123",
"currentPage": 42,
"totalPages": 250,
"progress": 0.168,
"chapterTitle": "Chapter 3: The Adventure Begins",
"chapterIndex": 3
}ebook/search
オプションのコンテキスト単語数を使用して、すべての章を対象にテキストを検索します。
入力スキーマ:
{
sessionId: string;
query: string;
contextWords?: number; // Number of context words around matches (default: 50)
}レスポンス例:
{
"sessionId": "sess_123",
"query": "adventure",
"matches": [
{
"chapterIndex": 3,
"chapterTitle": "Chapter 3: The Adventure Begins",
"pageNumber": 42,
"context": "...the great adventure began when...",
"position": 1250
}
],
"totalMatches": 1
}ebook/get_toc
階層化された目次を取得します。
レスポンス例:
{
"sessionId": "sess_123",
"toc": [
{
"title": "Chapter 1: Introduction",
"level": 1,
"pageNumber": 1,
"children": []
},
{
"title": "Part I: The Beginning",
"level": 1,
"pageNumber": 10,
"children": [
{
"title": "Chapter 2: First Steps",
"level": 2,
"pageNumber": 12,
"children": []
}
]
}
]
}ebook/get_metadata
完全なEPUBメタデータを取得します。
レスポンス例:
{
"sessionId": "sess_123",
"metadata": {
"title": "Sample Book",
"author": "Author Name",
"publisher": "Publisher Name",
"description": "Book description...",
"language": "en",
"publishedDate": "2023-01-01",
"totalPages": 250,
"totalChapters": 12
}
}ebook/get_footnote
IDで脚注参照を解決します。
入力スキーマ:
{
sessionId: string;
footnoteId: string; // Footnote reference ID (e.g., "fn1")
}レスポンス例:
{
"sessionId": "sess_123",
"footnoteId": "fn1",
"content": "Footnote content here...",
"referencingPage": 42
}ebook/get_chapter_summary
主要な文の抽出を使用して、現在の章の要約を取得します。
入力スキーマ:
{
sessionId: string;
maxSentences?: number; // Maximum sentences in summary (default: 3)
}レスポンス例:
{
"sessionId": "sess_123",
"chapterTitle": "Chapter 3: The Adventure Begins",
"summary": [
"The protagonist begins their journey.",
"They encounter their first challenge.",
"A mysterious figure offers guidance."
]
}開発
プロジェクト構造
mcp-epub-reader/
├── src/
│ ├── epub/ # EPUB domain logic
│ │ ├── parser.ts # EPUB parsing and metadata extraction
│ │ ├── paginator.ts # Page splitting and content retrieval
│ │ └── types.ts # EPUB domain types
│ ├── server/ # MCP server implementation
│ │ ├── index.ts # Server entry point (stdio transport)
│ │ ├── book-manager.ts # Session lifecycle management
│ │ ├── tool-registration.ts # Tool registration and routing
│ │ └── types.ts # Server-side types
│ ├── tools/ # All 13 tool implementations
│ │ ├── open.ts # ebook/open tool
│ │ ├── close.ts # ebook/close tool
│ │ ├── list-books.ts # ebook/list_open_books tool
│ │ ├── navigate.ts # Navigation tools (next/previous)
│ │ ├── jump.ts # Jump tools (page/chapter)
│ │ ├── position.ts # ebook/get_position tool
│ │ ├── search.ts # ebook/search tool
│ │ ├── toc.ts # ebook/get_toc tool
│ │ ├── metadata.ts # ebook/get_metadata tool
│ │ ├── footnote.ts # ebook/get_footnote tool
│ │ └── summary.ts # ebook/get_chapter_summary tool
│ └── utils/ # Shared utilities
│ └── validation.ts # Zod schemas and input validation
├── tests/ # Test suites
│ ├── unit/ # Unit tests
│ └── integration/ # Integration tests
├── package.json
├── tsconfig.json
└── jest.config.jsソースからのビルド
# Install dependencies
npm install
# Build the project (TypeScript → JavaScript)
npm run build
# Output goes to `build/` directoryテスト
# Run all tests
npm test
# Run tests with coverage
npm test -- --coverage
# Run specific test file
npm test -- tests/unit/epub/parser.test.ts新しいツールの追加
src/tools/にツール実装用の新しいファイルを作成します:
// src/tools/example.ts
import { BookManager } from '../server/book-manager';
import { ExampleToolInput, ExampleToolOutput } from '../server/types';
export async function handleExampleTool(
input: ExampleToolInput,
bookManager: BookManager
): Promise<ExampleToolOutput> {
// Tool implementation
return { result: 'success' };
}
export function createExampleTool(bookManager: BookManager) {
return {
name: 'ebook/example' as const,
handler: (input: ExampleToolInput) => handleExampleTool(input, bookManager),
};
}src/utils/validation.tsにZodスキーマを追加します:
export const ExampleToolSchema = z.object({
sessionId: z.string(),
// ... other parameters
});src/server/tool-registration.tsでインポートして登録します:
import { createExampleTool } from '../tools/example';
const toolFactories = {
// ... existing tools
'ebook/example': createExampleTool,
};コントリビューション
コントリビューションを歓迎します!以下の手順に従ってください:
リポジトリをフォークする
フィーチャーブランチを作成する (
git checkout -b feature/amazing-feature)変更をコミットする (
git commit -m 'Add amazing feature')ブランチにプッシュする (
git push origin feature/amazing-feature)プルリクエストを開く
開発セットアップ
# Clone the repository
git clone https://github.com/your-username/mcp-epub-reader.git
cd mcp-epub-reader
# Install dependencies
npm install
# Set up environment
cp .env.example .env # if applicable
# Run development server with watch mode
npm run devコード標準
厳密な型定義を用いたTypeScriptのベストプラクティスに従う
可能であれば不変性を持つ純粋関数を書く
テスト容易性のために依存性の注入を使用する
包括的なユニットテスト(AAAパターン)を含める
公開APIと複雑なロジックを文書化する
ライセンス
このプロジェクトは MIT License の下でライセンスされています。
謝辞
プロトコル仕様を提供してくれた Model Context Protocol
SDKを提供してくれた MCP TypeScript SDK
EPUB解析のための epub library
開発標準とワークフローを提供してくれた OpenAgents
参照
変更履歴
バージョン履歴については CHANGELOG.md を参照してください。
注: このサーバーはClaude DesktopのようなMCPクライアントで使用するように設計されています。セッションの分離とリソース管理を維持しながら、AIエージェントにEPUB読書機能を提供します。
This server cannot be deployed
Maintenance
Related MCP Connectors
Generate and read PDFs for AI agents: a generate_pdf and a read_pdf tool, priced per document.
- JunifyeOAuthpro.publifye
Write books, studies & commentaries with your AI — EPUB, print-ready PDF, web reader, ISBN, RTL
PDF, image, video, OCR, screenshot, SQL, QR and text tools for agents. No API key, no signup.
- AchriomOAuthcom.achriom
Media memory for AI agents and their humans: books, movies, music, shows, anime, podcasts, games.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides AI agents with research capabilities for local Calibre e-book libraries, including fulltext search across titles, ISBNs, and comments, plus structured excerpt retrieval from books.2GPL 3.0
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to help users manage their reading experience by searching books, tracking reading progress, managing bookmarks, and generating personalized recommendations and summaries.-
- AlicenseNot gradedqualityDmaintenanceEnables searching, reading, and managing a Calibre ebook library through natural language, with features like metadata search, full-text search, content extraction, and library management.40 npmApache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables natural language interaction with e-books, extracting metadata, table of contents, and chapter content from EPUB and PDF files.390Apache 2.0