Skip to main content
Glama

grimmory-mcp

A small MCP server for Grimmory, the self-hosted ebook, comic and audiobook library. It lets an AI assistant such as Claude Code search your library and tidy metadata, tags, genres and shelves.

Built and tested against Grimmory v3.5.0. Grimmory marks its API as unstable, so check it again after you upgrade.

Tools

Tool

Kind

What it does

search_books

read

Free-text search plus facet filters (genre:Romance, shelf_status:unshelved, …), sorting, cursor paging

list_facets

read

Lists the authors, genres, tags, series, publishers and shelves already in use, so new values match existing ones

get_book

read

One book's metadata, shelves and locked fields

list_shelves

read

Regular shelves visible to the user

update_metadata

write

Changes chosen fields on one book and returns before/after values

bulk_edit_metadata

write

Tags, genres, moods, authors, series, publisher or language on up to 100 books; shows a preview first, writes only on confirm=True

create_shelf

write

Creates a shelf; refuses duplicate names

assign_shelves

write

Adds books to shelves or removes them

Related MCP server: calibre-mcp

Safety by design

These rules are enforced in code, not in a prompt:

  • No delete tools. Nothing can delete books, files, shelves, users or metadata values.

  • Locks are respected. A field locked in Grimmory is refused, never overwritten. No tool can change locks.

  • No accidental wipes. Grimmory's metadata endpoint defaults to replaceMode=REPLACE_ALL, which clears every field you don't send. This server always sends REPLACE_WHEN_PROVIDED.

  • Bulk edits are two-step. The first call returns a per-book preview. Nothing is written until the same call is repeated with confirm=True.

  • Nothing is cleared. Empty values are refused. Remove the last tag from a book in the Grimmory UI.

Use a dedicated Grimmory user for the assistant. The server is the only thing between the assistant and whatever that user is allowed to do.

Install

Requires Python 3.12+ and uv.

git clone https://github.com/jensopt/grimmory-mcp
cd grimmory-mcp
uv sync --frozen

Configuration (environment variables)

Variable

Required

Meaning

GRIMMORY_URL

yes

Base URL, e.g. https://books.example.com

GRIMMORY_USERNAME

yes

Grimmory username (not email; Grimmory logs in by username)

GRIMMORY_PASSWORD

yes

Its password

PANGOLIN_TOKEN_ID

no

Only if Grimmory sits behind Pangolin, see below

PANGOLIN_TOKEN

no

Second half of the same token

Claude Code

claude mcp add grimmory -s user \
  -e GRIMMORY_URL=https://books.example.com \
  -e GRIMMORY_USERNAME=assistant -e GRIMMORY_PASSWORD=... \
  -- uv run --quiet --frozen --project /path/to/grimmory-mcp grimmory-mcp

Restart Claude Code afterwards, because MCP servers only load at startup.

Behind Pangolin

Pangolin's header authentication won't work for this server. It is HTTP Basic auth in the Authorization header, and Grimmory needs that same header for its Bearer token. A request can only carry one.

Use a shareable link (access token) on the Grimmory resource instead. Pangolin shows it as ?p_token=<id>.<token>. Put the part before the dot in PANGOLIN_TOKEN_ID and the part after it in PANGOLIN_TOKEN. The server sends them as P-Access-Token-Id / P-Access-Token headers, which leaves Authorization free for Grimmory.

Notes

  • Access tokens last 2 hours. On v3.5.0, /api/v1/auth/refresh returned 401 in testing, so the server logs in again when the token expires.

  • Grimmory calls genres categories on a single book and genres in bulk edits. The tools use the API's names.

  • To see the full API, set API_DOCS_ENABLED=true on your instance and read /api/openapi.json.

  • Uses the mcp Python SDK 2.x (MCPServer, formerly FastMCP).

License

MIT

Available Tools

8 tools
assign_shelvesB

Put books on and/or take them off shelves (by shelf id). Never deletes books or shelves.

Inputs: book_ids (required), add_to, remove_from. Returns: object

bulk_edit_metadataA
DestructiveIdempotent

Set tags/genres/moods/authors/series/publisher/language on many books at once.

Two-step: without confirm=True this only returns a per-book preview (nothing is written). Show the preview to the user, then call again with identical arguments and confirm=True. merge: True adds tags/genres/moods to existing ones; False replaces them. Authors always replace. Refuses the whole batch if any targeted field is locked on any book.

Inputs: book_ids (required), tags, merge, moods, +6 more. Returns: object

create_shelfB

Create a regular shelf for the bot user. icon is a Lucide icon name. Refuses duplicate names.

Inputs: name (required), icon, public. Returns: object

get_bookC
Read-only

One book's metadata, shelves and locked fields.

Inputs: book_id (required), with_description. Returns: object

list_facetsA
Read-only

Existing values per facet (authors, genres, tags, moods, series, publishers, languages, shelves...).

Use this to reuse existing tag/genre spellings instead of inventing near-duplicates.

Inputs: query. Returns: object

list_shelvesB
Read-only

Regular shelves visible to the bot user (id, name, bookCount, public).

Inputs: no named parameters. Returns: result

search_booksA
Read-only

Search the library. Returns compact book records, 20 per page.

query: free text over title, series, author, genre, tag, ISBN, ASIN. facets: "key:value" filters, e.g. ["genre:Romance", "author:Holly Jackson", "shelf_status:unshelved", "tag:warhammer", "series:The Naturals", "language:nl", "file_type:EPUB"]. See list_facets. facet_logic: "and" | "or" | "or not". sort: comma-separated field names, "-" prefix for descending, e.g. "seriesName,seriesNumber" or "-addedOn". cursor: pass nextCursor from a previous result to get the next page.

Inputs: sort, query, cursor, facets, +1 more. Returns: object

update_metadataA
DestructiveIdempotent

Change metadata fields on one book. Only the fields in changes are touched.

changes: any of title, subtitle, publisher, publishedDate (YYYY-MM-DD), description, seriesName, seriesNumber, seriesTotal, isbn13, isbn10, pageCount, language, narrator, authors, categories (= genres), moods, tags (lists of strings). merge_lists: True adds list values to what is there; False replaces the list. Locked fields are refused. Nothing can be cleared with this tool. Returns the before/after values of the changed fields.

Inputs: book_id (required), changes (required), merge_lists. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 8 tools

    Disambiguation4/5

    Most tools are clearly distinct by resource and action: search_books reads, get_book fetches one record, list_facets/list_shelves enumerate, and create_shelf/assign_shelves target shelves. The only potential overlap is bulk_edit_metadata vs update_metadata, but the descriptions sharply separate them (many books with preview/confirm vs one book with before/after), so confusion is unlikely.

    Naming Consistency5/5

    All eight names are snake_case verb_noun pairs following a single convention: search_books, get_book, create_shelf, list_shelves, list_facets, update_metadata, bulk_edit_metadata, assign_shelves. No camelCase or vague-verb deviations.

    Tool Count5/5

    Eight tools is well within the comfortable 3-15 range and each covers a distinct operation (query, inspect, facets, shelf creation/listing, per-book edit, bulk edit, shelf assignment). Nothing feels redundant or padded for the scope of a book-library server.

    Completeness3/5

    Read and update paths are solid, but shelf lifecycle is incomplete: shelves can be created and listed but never renamed, made private/public, or deleted. Metadata also cannot be cleared at all ('Nothing can be cleared with this tool'), which leaves agents with dead ends for common maintenance tasks.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables read-only access to local Calibre libraries for searching metadata, inspecting book formats, and extracting content samples. Supports full-text search, batch operations, and detailed book analysis through natural language queries.
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      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
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to fetch and write ebook metadata, download covers, convert books between formats, and manage an ebook library through command-line tools. Batch operations default to dry-run, so changes can be previewed before being applied.
      MIT