Skip to main content
Glama

Pergamos

Tests

Pergamos is a read-only MCP server that lets Claude Desktop search and inspect a Calibre library through the Calibre Content Server.

Requirements

  • macOS with Python 3.10 or newer

  • Calibre with the Content Server running

  • The official MCP Python SDK, installed by the project setup below

Start the Calibre Content Server from Connect/share > Start Content server. The default address is http://127.0.0.1:8080.

Related MCP server: calibre-mcp

Install

cd /path/to/pergamos
python3 -m venv .venv
.venv/bin/python -m pip install -e .

Configure Claude Desktop

Add a server entry to Claude Desktop's configuration file, usually ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "pergamos-calibre": {
      "command": "/path/to/pergamos/.venv/bin/pergamos",
      "env": {
        "CALIBRE_SERVER_URL": "http://127.0.0.1:8080"
      }
    }
  }
}

For a Content Server with authentication, add CALIBRE_USERNAME and CALIBRE_PASSWORD to the same env object. CALIBRE_REQUEST_TIMEOUT may be set to a positive number of seconds. A URL prefix such as http://127.0.0.1:8080/calibre is supported.

Restart Claude Desktop after changing its configuration.

For the optional RAG tools, add the PERGAMOS_RAG_DIR environment variable if you want the vector store to live somewhere other than the default .pergamos_index directory:

{
  "mcpServers": {
    "pergamos-calibre": {
      "command": "/path/to/pergamos/.venv/bin/pergamos",
      "env": {
        "CALIBRE_SERVER_URL": "http://127.0.0.1:8080",
        "PERGAMOS_RAG_DIR": "/path/to/pergamos/.pergamos_index"
      }
    }
  }
}

Tools

  • list_libraries: checks the server and returns the root OPDS feed.

  • search_books: performs a Calibre library-wide search across the metadata fields indexed by Calibre, including titles, authors, tags, comments, and identifiers. It accepts query, limit (1-100), and offset, and follows OPDS pagination up to the requested limit.

  • get_book_details: returns metadata and available format links for a Calibre book identifier.

  • index_book_content: downloads a selected book file, extracts the text, splits it into chunks, and stores the embeddings for semantic retrieval.

  • search_book_content: searches the indexed text chunks for one or more book IDs using a semantic query.

The server does not change the library or download files. Format URLs are returned as metadata so Claude can identify available editions.

Calibre's Content Server search is metadata search. It does not search the full body text of EPUB, PDF, or other book files.

Example workflow

This is the recommended pattern for doing RAG with a Calibre library:

# 1) Discover likely books by metadata
search = {
    "query": "distributed systems",
    "limit": 5,
    "offset": 0,
}

# 2) Inspect the chosen book and pick the format to index
book = {
    "id": "42",
    "title": "Distributed Systems",
    "formats": [
        {"format": "epub", "url": "http://127.0.0.1:8080/get/42/epub"},
    ],
}

# 3) Index the full text of the selected book
index_book_content(
    book_id="42",
    title="Distributed Systems",
    download_url="http://127.0.0.1:8080/get/42/epub",
    format_name="epub",
)

# 4) Run semantic search over the indexed text for that book
search_book_content(
    query="What does the book say about consensus?",
    book_ids=["42"],
    k=5,
)

In practice, Claude Desktop can call the tools in that order:

  1. search_books to find candidate books

  2. get_book_details to fetch the exact metadata and format URLs

  3. index_book_content to add the book contents to the RAG index

  4. search_book_content to answer question-style queries over the indexed text

This gives you metadata retrieval plus semantic content retrieval without replacing the Calibre search layer.

Dual-layer RAG pattern

For true RAG, keep Pergamos as the metadata/discovery layer and add a separate content indexer for the actual book files. The metadata server should answer questions like "which books match this topic?" while the content layer downloads the selected EPUB/PDF, extracts the text, chunks it, embeds it, and stores the vectors for semantic search.

A minimal starter implementation is included under src/pergamos/rag/:

  • extractors.py handles text extraction and chunking

  • indexer.py downloads a book, extracts text, and indexes embeddings

  • search.py exposes a simple semantic search wrapper

Install the optional RAG extras with:

python3 -m pip install -e '.[rag]'

This keeps the library browsing layer read-only while enabling a full-text retrieval pipeline on top of the same book metadata.

Runnable examples

The repo includes a few ready-to-run examples under examples/:

  • examples/rag_example.py: full orchestration example using the metadata + content tools in sequence.

  • examples/one_book_index.py: indexes a single book into the local vector store.

Run them with:

.venv/bin/python examples/rag_example.py
.venv/bin/python examples/one_book_index.py

Docker Compose

A minimal stack can be started with Docker Compose for local development:

docker compose up --build

This starts:

  • pergamos: the MCP server

  • calibre: the Calibre web content server

The stack uses a named volume for the local vector index and binds the Calibre content server to port 8080.

You can customize the runtime variables by copying the example environment file:

cp .env.example .env

Then edit .env with your local Calibre URL and credentials. The Compose file can also be pointed at http://calibre:8080 if you want the containerized service name instead of a host-bound URL.

Common commands

Use the included Makefile for the main project tasks:

make install
make test
make run
make docker-up
make docker-down

Manual run

Claude Desktop communicates with the server over stdio. To run it directly for diagnostics:

CALIBRE_SERVER_URL=http://127.0.0.1:8080 .venv/bin/pergamos

Do not print diagnostic messages to stdout because stdout is reserved for MCP protocol traffic.

Security

Prefer a local Calibre server bound to 127.0.0.1. If the server is reachable over a network, enable Calibre authentication and HTTPS. Keep credentials in Claude Desktop's environment configuration and do not commit that file.

Security checklist for commits

Before creating an initial commit or submitting a PR, confirm that:

  • .env, .env.local, and any credential file are excluded from git

  • generated data such as .pergamos_index/ and local caches are ignored

  • documentation uses neutral examples like /path/to/pergamos instead of machine-specific paths

  • real Calibre URLs, usernames, and passwords are never hard-coded into the repository

  • example config files are safe placeholders, not live local configuration

A quick review command is:

git status --short
git ls-files .env .pergamos_index .venv .pytest_cache

Development

.venv/bin/python -m pip install pytest
.venv/bin/python -m pytest -q

Available Tools

5 tools
get_book_detailsA

Return detailed metadata and available format links for one Calibre book.

ParametersJSON Schema
NameRequiredDescriptionDefault
identifierYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior3/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. It describes the observable behavior—returning metadata and format links—but does not mention side effects, authentication needs, or failure behavior. For an apparently read-only 'get' tool this is acceptable, though not fully transparent.

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 well-structured sentence that conveys the action, resource, and scope with no wasted words. It is front-loaded and easy to scan.

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?

The tool is simple, has an output schema, and the description covers the core behavior. However, it omits guidance on how to obtain the identifier and does not connect to sibling tools like search_books. These gaps reduce completeness for an agent that needs to invoke the tool correctly.

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

Parameters2/5

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

The schema provides only a parameter named 'identifier' with no description, and schema description coverage is 0%. The description says 'for one Calibre book,' slightly clarifying that identifier refers to a book, but it does not explain what kind of identifier to use or where it might come from. The description does not adequately compensate for the low schema coverage.

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 uses a specific verb ('Return') and clearly identifies the resource ('detailed metadata and available format links') and scope ('one Calibre book'). This makes the purpose distinct from sibling tools like search_books, which return search results rather than details for a single known book.

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

Usage Guidelines3/5

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

The description implies the use case: obtaining metadata for a specific, already-identified book. However, it does not explicitly state when to prefer this tool over siblings, when not to use it, or that the identifier should likely come from search_books.

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

index_book_contentA

Download a book file, extract text, split it into chunks, and index the content for semantic search.

ParametersJSON Schema
NameRequiredDescriptionDefault
titleYes
book_idYes
format_nameYes
download_urlYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.5/5.0
Behavior3/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. It usefully reveals that the tool will download, extract, split, and index content, but it does not disclose important side effects such as whether existing index entries are overwritten, whether duplicate indexing is handled, or whether network access or special permissions are required.

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, front-loaded sentence with no filler. Each phrase adds meaning, and the sequence of actions is easy to scan.

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?

Even though an output schema exists and covers return values, the definition is incomplete for a tool with four required parameters and no annotations. It lacks parameter-level explanation, sibling differentiation, and any warning about side effects or prerequisites. An agent would struggle to know the exact meaning of format_name or what indexing does to prior indexed content.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for the schema's lack of parameter documentation. It only loosely supports download_url via 'Download a book file' and gives no specific meaning for format_name, book_id, or title. The critical format_name parameter is entirely unexplained, including what values are accepted or how it relates to the download URL.

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 states a clear, specific multi-step action: download a book file, extract text, split it into chunks, and index the content for semantic search. This clearly distinguishes it from sibling tools like search_book_content, which would query rather than build the index, and get_book_details, which would not perform chunking or indexing.

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

Usage Guidelines3/5

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

The phrase 'for semantic search' implies the tool is used to prepare book content for semantic search, but the description does not explicitly state when to use this tool versus alternatives. It does not name sibling tools such as search_book_content as the appropriate choice for actually searching the indexed content.

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

list_librariesA

List the libraries exposed by the configured Calibre Content Server.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.1/5.0
Behavior3/5

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

There are no annotations, so the description carries the behavioral burden. It accurately states a read-only listing operation, which is non-destructive, but it does not disclose potential output behaviors such as empty results, pagination, or connectivity requirements. The output schema covers return format, leaving some gaps in broader behavioral 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 one concise sentence that immediately states the verb and the target resource. There is no wasted wording or redundant information.

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

Completeness5/5

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

For a zero-parameter list operation with an output schema available, the description is complete. It gives the necessary context about the Calibre Content Server and leaves return-value details to the output schema. Nothing essential is missing for correct invocation.

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 and the schema coverage is 100%, so there is nothing for the description to add. The baseline for a parameterless tool is 4, and the description adequately introduces the operation without needing parameter details.

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 uses a specific verb ('List') and a clear resource ('libraries exposed by the configured Calibre Content Server'). It is easily distinguishable from sibling tools like search_books or get_book_details, which have different purposes.

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

Usage Guidelines3/5

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

The description implies when to use the tool: to enumerate available libraries. However, it does not explicitly mention alternatives or conditions when this tool should be avoided. For a zero-parameter listing tool this is acceptable but not fully explicit.

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

search_book_contentB

Search the indexed text for relevant chunks within one or more Calibre books.

ParametersJSON Schema
NameRequiredDescriptionDefault
kNo
queryYes
book_idsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/5.0
Behavior3/5

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

With no annotations, the description carries the burden of behavior. It discloses that the operation is a read-style search over indexed content and that results are chunks, but it does not explain what happens if books aren't indexed, whether content is ranked, or how book_ids scoping behaves in edge cases.

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?

A single front-loaded sentence with no filler; every component (verb, indexed source, chunk output, scope) earns its place.

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?

The output schema covers return shape, but with no annotations and no usage guidance or parameter semantics, the definition is not complete enough for an agent to confidently decide when to use it or how to set k. It is a minimum-viable description at best.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. 'Within one or more Calibre books' clarifies book_ids, but query is only implied and k is not explained at all, leaving an important parameter undocumented.

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 states a specific verb ('Search'), a precise resource ('indexed text ... within one or more Calibre books'), and an output granularity ('relevant chunks'). This clearly differentiates it from search_books and index_book_content even without naming them.

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 given about when to choose this tool over search_books or when to run index_book_content first. The phrase 'indexed text' implies a prerequisite, but the description never states it explicitly or lists alternatives.

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

search_booksB

Search Calibre books by full text and return metadata plus available formats.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes
offsetNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior3/5

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

No annotations exist, so the description carries the burden. It discloses the operation is a read-oriented search and that it returns metadata and available formats, but it does not mention whether content must be indexed first, what scope of books is searched, or any pagination or side-effect behavior. Some transparency is present, but significant behavioral context is missing.

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, tight sentence that front-loads the action, target, mode, and return payload. There is no filler or repetition; every part of the sentence contributes useful 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?

An output schema exists, so return-value details do not need to be repeated, but the description still lacks guidance for choosing between this and similar sibling tools, parameter semantics, and any prerequisites. It supports a basic invocation with defaults but is not complete enough for reliable tool selection in a context with 'search_book_content' and 'index_book_content' as siblings.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It only implies that 'query' is a full-text search string, and says nothing about 'limit' or 'offset' pagination behavior or defaults. The parameter names are self-explanatory, but the description does not add enough meaning to make up for the missing schema documentation.

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 gives a clear verb and resource: 'Search Calibre books by full text,' and states the output payload ('metadata plus available formats'). However, it does not explicitly distinguish this from the sibling 'search_book_content', so an agent cannot tell whether this searches across the library or within a single book's content without inferring from the names.

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

Usage Guidelines3/5

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

The description implies this tool is for finding books by matching full-text content, but it gives no explicit guidance on when to prefer it over 'search_book_content' or 'get_book_details', and no exclusions. The usage signal is only implied by the phrase 'by full text.'

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

TDQS

A3.7/5.0
Disambiguation4/5

Most tools have clearly distinct purposes: list_libraries, search_books, get_book_details, index_book_content, and search_book_content are all separate operations in the workflow. The only potential confusion is between search_books (full-text metadata search) and search_book_content (semantic search over indexed chunks), but the descriptions make the distinction clear enough.

Naming Consistency5/5

All tool names follow a consistent verb_noun snake_case pattern: list_, search_, get_, index_, search_. The verbs and object nouns match their operations, making the naming predictable and easy to navigate.

Tool Count5/5

Five tools is a well-scoped size for a Calibre Content Server integration. Each tool covers a distinct stage of the library browsing and content-search workflow without unnecessary redundancy or bloat.

Completeness4/5

The toolset covers the main library discovery path (list, search, details), plus the custom indexing and semantic search pipeline. However, there is no way to delete indexed content or check indexing status, which is a minor lifecycle gap.

Maintenance

ActivityMaintained
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
    A
    maintenance
    Enables semantic search over local Calibre libraries via MCP, allowing AI assistants to query books, annotations, and export bibliographies while keeping data private.
    8
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables read-only search, browsing, and metadata retrieval from a local Calibre e-book library using natural language queries.
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables conversational management of a Calibre ebook library via MCP, including search, metadata editing, adding, converting, deduplicating, removing, and emailing books with human-in-the-loop safety.
    1
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Connects MCP clients to a Calibre ebook library for semantic search, metadata curation, and library management via natural language.
    14
    221
    12
    MIT

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/gonzalochief/pergamos'

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