Skip to main content
Glama
ispyridis

Calibre RAG MCP Server

by ispyridis

Calibre RAG MCP Server

Enhanced Calibre MCP server with RAG (Retrieval-Augmented Generation) capabilities for project-based vector search and contextual conversations.

Features

  • RAG-Enhanced Search: Vector-based semantic search using FAISS and Transformers

  • Project-Based Organization: Create isolated vector search projects for different contexts

  • Multi-Format Support: Process books in various formats (EPUB, PDF, MOBI, etc.)

  • OCR Capabilities: Extract text from images and scanned PDFs using Tesseract

  • Advanced Text Processing: Natural language processing for better content understanding

  • Windows Compatible: Designed specifically for Windows environments

Related MCP server: Personal Research Assistant MCP

Technologies Used

  • Vector Search: FAISS for efficient similarity search

  • Embeddings: Xenova Transformers for local embedding generation

  • OCR: Tesseract for optical character recognition

  • PDF Processing: Multiple PDF parsing libraries (pdf-parse, pdf-poppler, pdf2pic)

  • Image Processing: Sharp for image manipulation

  • NLP: Natural language processing with multiple libraries

Prerequisites

  • Node.js >= 16.0.0

  • Calibre installed on Windows

  • ImageMagick (for enhanced image processing)

  • Tesseract OCR (for text extraction from images)

Installation

  1. Clone this repository:

git clone https://github.com/yourusername/calibre-rag-mcp-nodejs.git
cd calibre-rag-mcp-nodejs
  1. Install dependencies:

npm install
  1. Run setup (Windows):

setup.bat

Configuration

The server automatically detects your Calibre library location. For custom configurations, modify the settings in server.js.

Usage

Starting the Server

npm start

Available Tools

  • search: Semantic search across your ebook library

  • fetch: Retrieve specific content from books

  • list_projects: List all RAG projects

  • create_project: Create a new RAG project

  • add_books_to_project: Add books to a project for vectorization

  • search_project_context: Search within specific projects

Example MCP Configuration

Add to your MCP client configuration:

{
  "mcpServers": {
    "calibre-rag": {
      "command": "node",
      "args": ["path/to/calibre-rag-mcp-nodejs/server.js"]
    }
  }
}

Project Structure

calibre-rag-mcp-nodejs/
├── server.js              # Main MCP server
├── package.json           # Dependencies and scripts
├── setup.bat              # Windows setup script
├── test-*.js              # Various test files
├── projects/              # RAG projects storage
├── CONFIG.md              # Configuration documentation
├── USAGE_EXAMPLES.md      # Usage examples
└── QUICK_TEST.md          # Quick testing guide

Testing

Run the test suite:

npm test

Individual test files:

  • test-enhanced-server.js - Enhanced server functionality

  • test-ocr-full.js - OCR capabilities

  • test-pdf-approaches.js - PDF processing

  • test-enhanced-auto.js - Automated testing

Documentation

Requirements

System Requirements

  • Windows 10/11

  • Node.js 16+

  • Calibre installed

  • At least 4GB RAM (8GB+ recommended for large libraries)

Optional Dependencies

  • ImageMagick (for enhanced image processing)

  • Tesseract OCR (for text extraction from scanned documents)

Troubleshooting

Common Issues

  1. FAISS Installation: If FAISS fails to install, ensure you have proper build tools

  2. Tesseract Not Found: Install Tesseract and add to PATH

  3. Memory Issues: Reduce batch sizes for large document processing

Debug Mode

Enable verbose logging by setting environment variable:

set DEBUG=calibre-rag:*
npm start

Contributing

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes

  4. Add tests for new functionality

  5. Submit a pull request

License

Licensed under the Apache License 2.0. See LICENSE file for details.

Support

For issues and questions, please open an issue on GitHub.

Changelog

v1.0.0

  • Initial release with RAG capabilities

  • Project-based vector search

  • Multi-format document support

  • OCR integration

  • Windows optimization

Available Tools

7 tools
add_books_to_projectC

Add books to a RAG project for vectorization and context search

ParametersJSON Schema
NameRequiredDescriptionDefault
project_nameYesName of the project
book_idsYesArray of book IDs to add to the project

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool adds books for vectorization and context search, implying a write operation, but doesn't cover critical aspects like permissions required, whether this is idempotent, rate limits, error handling, or what happens if books are already in the project. The description is minimal and misses key behavioral traits for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action and purpose without wasted words. It's appropriately sized for the tool's complexity, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no annotations, no output schema, and involves a mutation (adding books), the description is incomplete. It lacks details on behavioral traits, return values, error conditions, and integration with siblings. For a tool that modifies data, more context is needed to ensure safe and correct usage by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('project_name' and 'book_ids') adequately. The description adds no additional meaning beyond what the schema provides, such as explaining what 'book IDs' refer to or constraints on 'project_name'. Baseline score of 3 is appropriate as the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Add books') and the resource ('to a RAG project'), specifying the purpose for vectorization and context search. It distinguishes from siblings like 'create_project' or 'get_project_info' by focusing on adding existing books rather than creating projects or fetching information. However, it doesn't explicitly differentiate from potential similar tools like 'search_project_context' in terms of scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether the project must exist, if books need to be available), exclusions, or comparisons to siblings like 'search' or 'fetch'. Usage is implied by the action but lacks explicit context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

create_projectB

Create a new RAG project for vector-based book search

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesProject name (alphanumeric and underscores only)
descriptionNoProject description

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Create' implies a write/mutation operation, the description doesn't address important behavioral aspects like: what permissions are required, whether the creation is idempotent, what happens on duplicate names, what the response contains, or any rate limits. For a creation tool with zero annotation coverage, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the purpose without unnecessary words. It's appropriately sized for a simple creation tool and front-loads the essential information. Every word earns its place in this concise formulation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a creation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what a 'RAG project' entails, what 'vector-based book search' means operationally, what happens after creation, or what the agent should expect as a result. Given the complexity implied by 'RAG' and 'vector-based' terminology, more context would be helpful for proper tool selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters (name with format constraints, description as optional). The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain naming conventions, description best practices, or how these parameters affect the created project. Baseline 3 is appropriate when the schema does all the parameter documentation work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Create a new RAG project') and the resource type ('for vector-based book search'), distinguishing it from siblings like 'add_books_to_project' or 'list_projects'. It provides a concrete use case that helps differentiate this creation tool from other project-related operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'add_books_to_project' or 'get_project_info'. It doesn't mention prerequisites, dependencies, or whether this should be used before or after other operations. The agent must infer usage context from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

fetchC

Fetch specific content from a book using epub:// URL

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesepub:// URL from search results

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool fetches content but doesn't describe what 'fetch' entails operationally—e.g., whether it retrieves metadata, full text, or specific sections; whether it requires authentication; or what the output format might be. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to understand at a glance. Every part of the sentence contributes essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of fetching content (which could involve various outputs like text, metadata, or errors), the lack of annotations and output schema means the description is incomplete. It doesn't explain what is returned, potential errors, or behavioral nuances. For a tool with no structured support, the description should provide more context to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'url' fully documented in the schema as 'epub:// URL from search results'. The description adds no additional meaning beyond this, such as URL format examples or constraints. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't enhance parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Fetch specific content from a book using epub:// URL'. It specifies the action (fetch), resource (content from a book), and input mechanism (epub:// URL). However, it doesn't explicitly distinguish this tool from sibling tools like 'search' or 'search_project_context', which might also retrieve book content in different ways.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance on when to use this tool. It implies usage when you have an 'epub:// URL from search results', but doesn't specify when to choose this over alternatives like 'search' or 'search_project_context', nor does it mention prerequisites or exclusions. No explicit when/when-not instructions are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_project_infoB

Get detailed information about a specific RAG project

ParametersJSON Schema
NameRequiredDescriptionDefault
project_nameYesName of the project

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is a read operation ('Get'), but doesn't mention potential side effects, authentication requirements, rate limits, error conditions, or what 'detailed information' includes. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple lookup tool and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read operation with one parameter and no output schema, the description is minimally adequate. However, without annotations or output schema, it doesn't explain what 'detailed information' includes or potential behavioral aspects. Given the low complexity, it meets basic needs but could be more complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'project_name' clearly documented. The description doesn't add any parameter-specific information beyond what the schema provides, such as format examples or constraints. With high schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('detailed information about a specific RAG project'), making the purpose immediately understandable. However, it doesn't distinguish this tool from potential siblings like 'list_projects' or 'search_project_context', which might also retrieve project information in different ways.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_projects' or 'search_project_context'. It mentions 'specific RAG project', which implies it's for individual projects, but doesn't explicitly state this or provide exclusion criteria or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_projectsB

List all available RAG projects

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While 'List all available' implies a read-only operation, it doesn't specify important behavioral aspects like whether results are paginated, sorted, or limited in scope. The description lacks details about permissions, rate limits, or what 'available' means in this context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core purpose without any wasted words. It's appropriately sized for a simple listing tool and gets straight to the point.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter listing tool without annotations or output schema, the description provides the minimum viable information about what the tool does. However, it lacks important context about the return format, scope limitations, or how this differs from similar sibling tools, leaving gaps in understanding when and how to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters with 100% schema description coverage, so the schema already fully documents the parameter situation. The description appropriately doesn't waste space discussing parameters that don't exist, earning a baseline score of 4 for this dimension.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('RAG projects'), making the purpose immediately understandable. However, it doesn't differentiate this tool from potential sibling tools like 'search' or 'get_project_info', which might also retrieve project information in different ways.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'search', 'get_project_info', or 'search_project_context'. It doesn't specify whether this returns all projects without filtering, or if there are specific contexts where this tool is preferred over others.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_project_contextC

Search for relevant context chunks within a RAG project using vector similarity

ParametersJSON Schema
NameRequiredDescriptionDefault
project_nameYesName of the project to search
queryYesQuery to find relevant context
limitNoMaximum number of context chunks to return (default: 5)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but lacks behavioral details. It mentions 'vector similarity' as the search method but doesn't disclose expected outputs (e.g., format of context chunks), error conditions, permissions needed, or performance traits like rate limits. This is inadequate for a search tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste—it directly states the tool's purpose and method. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a search operation with behavioral unknowns, the description is incomplete. It doesn't explain what 'context chunks' are, their format, or how results are returned, leaving gaps for an agent to use the tool effectively in a RAG context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents parameters (project_name, query, limit). The description adds no additional meaning beyond implying 'query' is used for vector similarity search, which is already suggested by the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('search for relevant context chunks') and resource ('within a RAG project'), specifying vector similarity as the method. It distinguishes from 'search' (a generic sibling) by focusing on project context, but doesn't explicitly contrast with other siblings like 'get_project_info' or 'fetch'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'search' (generic), 'get_project_info' (project metadata), or 'fetch' (unclear purpose). The description implies usage for retrieving context chunks but offers no explicit when/when-not criteria or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.4/5.0
Disambiguation4/5

Most tools have distinct purposes, with clear boundaries between project management (create_project, list_projects, get_project_info, add_books_to_project, search_project_context), book content access (fetch), and general library search (search). The only potential overlap is between 'search' and 'search_project_context', but their descriptions clarify that one searches the library while the other searches within a specific project's vectorized context.

Naming Consistency5/5

All tools follow a consistent snake_case verb_noun pattern with clear, descriptive names. The naming convention is uniform throughout: create_project, list_projects, get_project_info, add_books_to_project, search_project_context, fetch, and search. No deviations or mixed styles are present.

Tool Count5/5

With 7 tools, the count is well-scoped for the server's purpose of managing Calibre RAG projects and searching ebook content. Each tool appears to earn its place, covering project lifecycle operations, content retrieval, and search functionality without being overly sparse or bloated.

Completeness4/5

The tool set provides good coverage for RAG project management (create, list, get info, add books, search context) and book access/search (fetch, search). A minor gap is the lack of project deletion or update tools, which could limit full lifecycle management, but core workflows for creating, populating, and querying projects are well-supported.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides 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.
    2
    GPL 3.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables semantic search and conversational querying across a personal research library of PDFs, DOCX, and other documents using a vector database. It provides tools for document summarization, finding related papers, and high-accuracy retrieval for AI clients like Claude Desktop.
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables searching, reading, and managing a Calibre ebook library through natural language, with features like metadata search, full-text search, content extraction, and library management.
    221
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ispyridis/calibre-rag-mcp-nodejs'

If you have feedback or need assistance with the MCP directory API, please join our Discord server