calibre_mcp_server

ajtudela/calibre_mcp_server

3.2

If you are the rightful owner of calibre_mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Calibre MCP Server is a Model Context Protocol server designed to facilitate interaction with a Calibre e-book library, enabling users to search and retrieve book metadata efficiently.

Tools
10
Resources
0
Prompts
0

Calibre MCP Server

License

An MCP (Model Context Protocol) server that provides tools to interact with a Calibre e-book library, allowing search and retrieval of book metadata through the MCP protocol.

Tools

ToolDescriptionParameters
search_books_by_titleSearch books by title pattern with wildcardstitle_pattern: str
search_authors_by_nameSearch authors by name pattern with wildcardsname_pattern: str
get_books_by_authorGet all books by a specific author nameauthor_name: str
get_books_by_author_idGet all books by a specific author IDauthor_id: int
get_books_by_seriesGet all books in a series, ordered by indexseries_name: str
get_books_by_tagGet all books with a specific tagtag_name: str
search_books_by_tag_patternSearch books by tag pattern with wildcardstag_pattern: str
get_book_detailsGet complete details for a specific bookbook_id: int
get_library_statsGet comprehensive library statistics
get_all_tagsGet all available tags in the library

Configuration

The server supports flexible configuration through environment variables:

VariableDefaultDescription
CALIBRE_LIBRARY_PATHRequired path to Calibre library
CALIBRE_DB_FILENAMEmetadata.dbDatabase filename within library
LOG_LEVELINFOLogging level (DEBUG, INFO, WARNING, ERROR)
LOG_FORMATDefault formatCustom logging format string
MCP_SERVER_NAMECalibre MCP ServerServer name for MCP protocol
TRANSPORT_MODEstdioTransport mode (stdio or http)
HTTP_HOST0.0.0.0HTTP host when using HTTP transport
HTTP_PORT9001HTTP port when using HTTP transport

Environment Setup

  1. Copy the example environment file:
cp .env.example .env
  1. Edit .env with your settings:
# Required
CALIBRE_LIBRARY_PATH=/path/to/your/calibre/library

# Optional
LOG_LEVEL=DEBUG
TRANSPORT_MODE=http

Features

  • Advanced search capabilities: Search books by title, author, series, and tags with wildcard support
  • Comprehensive metadata: Retrieve complete book information including publication dates, series info, and tags
  • Library statistics: Get insights into your Calibre library with comprehensive statistics
  • Tag management: Browse and search through all available tags in your library
  • Author discovery: Find authors and explore their complete bibliographies
  • Series tracking: Access books in series with proper ordering by series index

Installation

Install with uv (recommended)

Clone the repository and install with uv:

git clone https://github.com/ajtudela/calibre_mcp_server.git
cd calibre_mcp_server
cp .env.example .env
# Edit .env file with your Calibre library path
uv sync

Or install directly from the repository:

uv add git+https://github.com/ajtudela/calibre_mcp_server.git

Install with pip

Install the package in mode:

git clone https://github.com/ajtudela/calibre_mcp_server.git
cd calibre_mcp_server
cp .env.example .env
# Edit .env file with your Calibre library path
python3 -m pip install .

Or install directly from the repository:

python3 -m pip install git+https://github.com/ajtudela/calibre_mcp_server.git

Usage

Running with uv

uv run calibre_mcp_server

Running with pip installation

python3 -m calibre_mcp_server

HTTP Mode (for containers)

To run in HTTP mode for containerized environments:

# Set environment variable
export TRANSPORT_MODE=http
export HTTP_HOST=0.0.0.0
export HTTP_PORT=9001

Configuration example for Claude Desktop/Cursor/VSCode

Using uv (recommended)

Add this configuration to your application's settings (mcp.json):

{
  "calibre mcp server": {
    "type": "stdio",
    "command": "uv",
    "args": [
      "run",
      "--directory",
      "/path/to/calibre_mcp_server",
      "calibre_mcp_server"
    ],
    "env": {
        "CALIBRE_LIBRARY_PATH": "YOUR_CALIBRE_LIBRARY_PATH"
    }
  }
}
Using pip installation
{
  "calibre mcp server": {
    "type": "stdio",
    "command": "python3",
    "args": [
      "-m",
      "calibre_mcp_server"
    ],
    "env": {
        "CALIBRE_LIBRARY_PATH": "YOUR_CALIBRE_LIBRARY_PATH"
    }
  }
}

Technical Notes

  • Database connection: Automatic connection management with proper error handling
  • Configuration validation: Startup validation ensures all required settings are present
  • SQLite optimization: Efficient queries with proper indexing and connection pooling
  • Search patterns: Support for SQL LIKE wildcards (%) for flexible pattern matching
  • Read-only access: Safe, read-only access to Calibre library database
  • Memory efficient: Optimized queries and proper resource cleanup
  • Error recovery: Graceful handling of database errors and network issues

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes following the established patterns
  4. Ensure all modules compile without errors
  5. Update documentation as needed
  6. Submit a pull request

License

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