Skip to main content
Glama
download-books-mcp

download-books-mcp

by mateogon

download-books-mcp

Local MCP server and Codex skill for agent-driven book search and download through LibGen and Z-Library / Zeta Library.

This repo wraps two existing Python clients:

The purpose is to make those sources usable from MCP clients such as Codex, Claude Code, and other agents while keeping provider-specific details out of the agent-facing tool contract. The README is explicit for humans and GitHub search; the MCP tools and skill use neutral provider labels and clean IDs.

The MCP surface is intentionally small:

  • search_books(...) returns clean candidates with a temporary id.

  • download_book(id=...) downloads the selected candidate into a local library folder.

Internally, the server can query LibGen, Z-Library / Zeta Library, or both. Externally, provider internals stay behind neutral labels (provider_1, provider_2, all) so agents can use the MCP tools without handling provider-specific links, hashes, mirrors, URLs, or identifiers.

Use only sources, credentials, and documents you are authorized to access.

Install

git clone https://github.com/mateogon/download-books-mcp.git
cd download-books-mcp
uv sync

Copy the environment example and fill local values:

cp .env.example .env

Important settings:

DOWNLOAD_BOOKS_PROVIDER=all
DOWNLOAD_BOOKS_LIBRARY_DIR=~/Downloads/books
BOOK_PROVIDER_2_EMAIL=
BOOK_PROVIDER_2_PASSWORD=

Related MCP server: zlib-mcp

Agent Installation

There are two pieces:

  • MCP server: the runtime tools agents call.

  • Skill: the workflow that tells Codex how to use those tools cleanly.

Add the MCP server to Codex by copying examples/codex-config.toml into ~/.codex/config.toml and replacing /absolute/path/to/download-books-mcp with your clone path.

Install the Codex skill:

./scripts/install-codex-skill.sh

Restart Codex after changing MCP config or installing the skill.

For Hermes, use examples/hermes-mcp.yaml.

MCP Tools

search_books

Parameters:

query: str
limit: int = 10
preferred_language: str = "English"
provider_name: str = "default"  # default | all | provider_1 | provider_2
search_type: str = "default"    # default | title | author
topic: str = "books"
preferred_author: str | None = None

Clean results include:

id, title, author, year, language, extension, size, publisher, pages, score

Raw provider internals are cached locally for download_book, but they are not returned in normal MCP results.

download_book

Parameters:

id: str | int
library_dir: str | None = None

If library_dir is omitted, the server uses DOWNLOAD_BOOKS_LIBRARY_DIR.

Default output layout:

<library_dir>/Sources/<Author - Title>/00 - Fuentes/<Title>.<extension>

CLI

Search clean candidates:

uv run download-books search "The Embodied Mind" --search-type title --limit 10

Download a selected result:

uv run download-books download <ID>

Local diagnostic output:

uv run download-books search "The Embodied Mind" --raw --json

Provider Routing

Visible provider options are:

  • default uses DOWNLOAD_BOOKS_PROVIDER, defaulting to all

  • all searches every available configured provider

  • provider_1 searches only the LibGen adapter

  • provider_2 searches only the Z-Library / Zeta Library adapter

Agents should normally leave provider routing at default.

The MCP and skill intentionally keep the neutral names. Humans reading this repo should understand the mapping; agents using the tool should not need to.

Development

uv run --extra dev pytest
uv run python -m compileall src

Available Tools

2 tools
download_bookA

Download a book selected by its id from a previous search_books result.

Inputs: id (required), library_dir_path. Returns: object

search_booksA

Search book metadata through configured providers. Returns clean results with an id for download_book.

Inputs: query (required), limit, topic, search_type, +3 more. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly distinct purposes: one searches for books and returns metadata with IDs, the other downloads a specific book by ID. There is no overlap or ambiguity between them.

    Naming Consistency5/5

    Both tools follow a consistent verb_noun pattern: search_books and download_book. The slight singular/plural difference is natural and does not create inconsistency.

    Tool Count4/5

    With only 2 tools, the server is on the thin side, but given its narrow purpose of searching and downloading books, this count is appropriate and each tool clearly earns its place.

    Completeness5/5

    The server covers the essential workflow for its domain: discover books via search, then download via ID. This forms a complete user journey with no dead ends or obvious missing operations.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables browsing, searching, and quote verification of a local ebook library via MCP, providing deterministic RAG with no embeddings or network.
      6
      77 PyPI
      2
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that lets AI agents search and download books from z-library using the user's own account credentials.
      4
      70 npm
      9
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to search 1m+ open-access papers, standards, textbooks, and legal documents, resolve identifiers such as RFCs, DOIs, and legal citations, download PDFs, and retrieve citations and metadata through MCP tools.
      9
      MIT