Skip to main content
Glama
shiyi-0x7f

zlib-mcp

by shiyi-0x7f

zlib-mcp

Сервер MCP на stdio, который даёт любому ИИ-агенту — Claude Code, Codex CLI, Cursor, Claude Desktop — возможность искать в z-library и скачивать книги.

Используйте свой аккаунт. Никакого общего бэкенда, API-ключа или прокси: сервер работает на вашей машине, общается напрямую с z-library и использует ваши учётные данные и вашу квоту.

Инструменты

Инструмент

Что делает

Нужны учётные данные

zlib_search

Поиск по названию / автору / ISBN, с фильтрами по формату, языку и году

да

zlib_get_download_url

Получить прямую ссылку на скачивание одной книги (без записи файла)

да

zlib_download

Скачать книгу в указанную вами директорию

да

zlib_limits

Проверить оставшуюся на сегодня квоту на скачивание

да

zlib_login

Разовый помощник: обменять email + пароль на remix-учётные данные

нет

zlib_download появляется только после того, как вы зададите ZLIB_DOWNLOAD_DIR — MCP-сервер, который по умолчанию может писать файлы куда угодно, не является приемлемым по умолчанию, поэтому вы должны сами указать директорию.

Related MCP server: open-public-domain

Требования

  • Node.js ≥ 20

  • Аккаунт z-library

Настройка за 5 минут

1. Получите свои учётные данные

Если вы уже знаете свои remix_userid / remix_userkey, пропустите этот шаг. В противном случае добавьте сервер, указав только email и пароль (см. примеры конфигурации ниже), затем попросите агента один раз выполнить zlib_login и вставьте полученные remix_id / remix_key в конфигурацию на постоянной основе.

Вы также можете запустить это прямо из терминала:

ZLIB_EMAIL=you@example.com ZLIB_PASSWORD='…' npx zlib-mcp

2. Добавьте сервер в ваш клиент

Каждый клиент принимает одни и те же три вещи: команду npx, аргумент zlib-mcp и блок env.

claude mcp add zlib \
  --env ZLIB_REMIX_ID=123456 \
  --env ZLIB_REMIX_KEY=your_remix_userkey \
  --env ZLIB_DOWNLOAD_DIR="$HOME/Downloads/books" \
  -- npx -y zlib-mcp

Или отредактируйте ~/.claude.json / .mcp.json напрямую, используя JSON ниже.

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "zlib": {
      "command": "npx",
      "args": ["-y", "zlib-mcp"],
      "env": {
        "ZLIB_REMIX_ID": "123456",
        "ZLIB_REMIX_KEY": "your_remix_userkey",
        "ZLIB_DOWNLOAD_DIR": "/Users/you/Downloads/books"
      }
    }
  }
}
{
  "mcpServers": {
    "zlib": {
      "command": "npx",
      "args": ["-y", "zlib-mcp"],
      "env": {
        "ZLIB_REMIX_ID": "123456",
        "ZLIB_REMIX_KEY": "your_remix_userkey",
        "ZLIB_DOWNLOAD_DIR": "/Users/you/Downloads/books"
      }
    }
  }
}
[mcp_servers.zlib]
command = "npx"
args = ["-y", "zlib-mcp"]

[mcp_servers.zlib.env]
ZLIB_REMIX_ID = "123456"
ZLIB_REMIX_KEY = "your_remix_userkey"
ZLIB_DOWNLOAD_DIR = "/Users/you/Downloads/books"

3. Попробуйте

Найдите мне книгу Клеппмана Designing Data-Intensive Applications в формате epub, затем скачайте первый результат.

Конфигурация

Переменная

Обязательная

По умолчанию

Примечания

ZLIB_REMIX_ID

одна из двух

—

Ваш remix_userid

ZLIB_REMIX_KEY

одна из двух

—

Ваш remix_userkey

ZLIB_EMAIL

одна из двух

—

Запасной вариант: обменивается на remix-учётные данные при первом использовании

ZLIB_PASSWORD

одна из двух

—

Запасной вариант, используется с ZLIB_EMAIL

ZLIB_HOST

нет

pkuedu.xyz

Внешнее зеркало; измените, если вас заблокируют

ZLIB_DOWNLOAD_DIR

нет

(не задано → zlib_download отключён)

Куда записываются загрузки

ZLIB_MAX_DOWNLOAD_BYTES

нет

524288000 (500 МБ)

Файлы больше этого требуют allow_large: true

ZLIB_TIMEOUT_MS

нет

20000

Таймаут подключения на каждый запрос

ZLIB_CREDENTIAL_CACHE

нет

1

Установите 0, чтобы никогда не записывать ~/.zlib-mcp/credentials.json

ZLIB_LOG_LEVEL

нет

info

debug / info / warn / error / silent; все логи идут в stderr

Приоритет учётных данных

  1. ZLIB_REMIX_ID + ZLIB_REMIX_KEY

  2. Кэшированные учётные данные от предыдущего входа через ZLIB_EMAIL (~/.zlib-mcp/credentials.json, режим 600)

  3. ZLIB_EMAIL + ZLIB_PASSWORD → вход выполняется при первом вызове инструмента, а не при запуске

Кэш существует для того, чтобы перезапуск клиента не вызывал новый вход каждый раз — повторные входы — это то, что заставляет систему защиты от злоупотреблений z-library обращать на вас внимание. Он хранит только remix id и key; ваш пароль никогда не записывается на диск, не логируется и не возвращается ни одним инструментом. В Windows режим 600 не работает (ОС игнорирует права POSIX) — установите ZLIB_CREDENTIAL_CACHE=0, если это для вас важно.

Если ничего не настроено, сервер всё равно запускается и показывает свои инструменты; вызов любого из них вернёт инструкции о том, что нужно задать. Он не падает — упавший MCP-сервер просто отображается как «недоступен» в большинстве клиентов, и нечего отлаживать.

Устранение неполадок

«Внешний хост … похоже, блокирует этот запрос» — зеркало находится за анти-бот-стеной. Установите ZLIB_HOST на другое и перезапустите клиент. Известные зеркала часто меняются; 1lib.sk сейчас заблокирован, pkuedu.xyz сейчас работает. Подойдёт любой, кто обслуживает те же конечные точки /eapi/*.

«z-library отклонила текущие учётные данные» — ваш remix-ключ истёк. Запустите zlib_login снова и обновите конфигурацию. Если вы используете запасной вариант с email/паролем, удалите ~/.zlib-mcp/credentials.json, чтобы принудительно выполнить новый вход.

«достигнута квота на скачивание» — бесплатные аккаунты получают небольшое количество загрузок в день. zlib_limits показывает счётчик; он сбрасывается на стороне z-library в полночь по UTC.

В клиенте ничего не появляется — проверьте журнал MCP клиента; этот сервер записывает всю диагностику в stderr. ZLIB_LOG_LEVEL=debug делает его более разговорчивым.

zlib_download отсутствует — вы не задали ZLIB_DOWNLOAD_DIR. Это сделано намеренно.

Разработка

pnpm install
pnpm check      # format check → lint → typecheck → tests
pnpm build

Чтобы попробовать невыпущенную версию прямо из git, укажите в клиенте command/args на npx / ["-y", "github:shiyi-0x7f/zlib-mcp"] — скрипт prepare собирает его при установке.

Тесты никогда не обращаются к реальному внешнему серверу — fetch везде заглушён.

Правовая информация

Этот инструмент предоставляет только API-доступ к вашему собственному аккаунту z-library. Он ничего не хостит, ничего не распространяет и не содержит защищённого авторским правом контента. Обеспечение законности его использования в вашей юрисдикции — ваша ответственность. Ваш аккаунт, ваша квота, ваш риск — аккаунт, забаненный за злоупотребления, вы потеряете сами.

Лицензия

MIT

Available Tools

4 tools
zlib_get_download_urlGet z-library download URLA

Get a direct download URL for one book. Requires the "id" and "hash" from a zlib_search result. The link is short-lived and tied to the session that fetched it — use it right away, never cache or reuse it. Fetching a link consumes one unit of the account's daily download allowance (see zlib_limits). This server cannot save files to disk: set the ZLIB_DOWNLOAD_DIR environment variable in the MCP client config to a directory you want downloads written to, then restart the server to enable zlib_download.

ParametersJSON Schema
NameRequiredDescriptionDefault
hashYesThe "hash" field from the same zlib_search result. Must match the book_id.
book_idYesThe "id" field from a zlib_search result.

TDQS

A4.3/5.0
Behavior5/5

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

No annotations are present, so the description carries full responsibility—and it delivers: discloses short-lived session-bound links, no caching/reuse, daily allowance consumption, and the server's inability to save files unless an env var is set. This is exceptional behavioral disclosure for a tool with zero annotations.

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

Conciseness4/5

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

Four sentences, each earning its place, with the primary action stated first. Slightly long due to the environment variable note, but no redundant filler.

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

Completeness4/5

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

Covers input provenance, link lifetime, usage constraint, allowance impact, and prerequisite server configuration. Missing explicit error behavior or response shape details, but the tool's output is simple (a URL) and no output schema exists.

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%, with both book_id and hash already described, including the 'must match' relationship. The description reiterates that they come from a zlib_search result but adds no new semantic detail beyond what the schema already provides.

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?

States a specific verb and resource ('Get a direct download URL for one book') and identifies the required inputs (id and hash from zlib_search). This clearly differentiates it from siblings like zlib_search, zlib_limits, and zlib_login.

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

Usage Guidelines4/5

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

Clearly indicates when it should be used: after obtaining a zlib_search result, and warns to use the link immediately without caching or reuse. It also notes the allowance consumption and points to zlib_limits, though it doesn't explicitly state when not to use it.

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

zlib_limitsCheck z-library download quotaA

Check the z-library account's daily download allowance: how many downloads were used today, the daily cap, and how many remain. Call this before a batch of downloads, or when a download fails with a quota error. Takes no arguments and does not consume any allowance.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations provided, the description carries the burden, and it does well by stating that 'does not consume any allowance'—a key safety guarantee for a quota-check operation. It also implies the output fields (used, cap, remaining). It doesn't mention authentication requirements or error behavior if not logged in, which is a minor gap.

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?

Two sentences deliver the core purpose, usage triggers, and side-effect profile without any filler. The most important information (what it checks) is front-loaded, followed by when to use it and the safety guarantee—every clause earns its place.

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

Completeness4/5

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

For a simple zero-parameter tool without an output schema, this description is quite complete: it lists the returned values (used, cap, remain) and when to call it. The main omission is whether authentication is required before calling, given the account-specific nature and the existence of zlib_login as a sibling.

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 input schema is empty with 100% coverage, so there are no parameters to describe. The description redundantly notes 'Takes no arguments,' which adds no semantic value but does confirm the expectation. A baseline of 4 is appropriate for zero-parameter tools.

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 ('Check') and clearly identifies the resource: the z-library account's daily download allowance. It details exactly what information is provided (used today, daily cap, remaining), which sets it apart from the sibling tools focused on searching, downloading, or logging in.

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

Usage Guidelines4/5

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

It explicitly says when to call the tool: before a batch of downloads, or when a download fails with a quota error. It doesn't mention when not to use it or point to alternatives, but given there are no sibling tools that check quotas, the guidance is clear and sufficient.

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

zlib_loginExchange z-library credentialsA

Exchange a z-library email + password for the long-lived remix credentials (remix_id / remix_key). This is a one-time setup helper, not a per-call login: put the returned values into your MCP client config as ZLIB_REMIX_ID and ZLIB_REMIX_KEY, then restart the server. The password is never stored, logged, or returned. Do not call this before every search.

ParametersJSON Schema
NameRequiredDescriptionDefault
emailYesz-library account email.
passwordYesz-library account password. Never echoed back, logged, or written to disk.

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden and does so well: it discloses that the password is never stored, logged, or returned, that the returned credentials are long-lived, and that the server must be restarted. This goes well beyond the schema.

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?

Every sentence earns its place: operation, lifecycle context, security disclosure, and anti-misuse warning. It is front-loaded with the core purpose and avoids redundancy.

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?

Despite having no output schema and no annotations, the description explains what the call returns, how to use the returned values, and the one-time nature of the operation. For a two-parameter setup tool, this is complete and actionable.

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 already documents both parameters fully, so the baseline is 3. The description clarifies the overall purpose of email/password and the long-lived credentials, but adds no additional format or constraint semantics for the parameters themselves.

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?

States a specific action and resource: 'Exchange a z-library email + password for the long-lived remix credentials (remix_id / remix_key).' It clearly distinguishes itself from the sibling search/download/limit tools by positioning as a one-time setup helper rather than a per-call operation.

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

Usage Guidelines5/5

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

Explicitly says when to use ('one-time setup helper'), when not to ('not a per-call login', 'Do not call this before every search'), and what to do after calling (configure ZLIB_REMIX_ID/ZLIB_REMIX_KEY and restart). This gives an agent a clear decision boundary.

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

Tool Schema Changelog

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

  1. 4 tool updatesv0.1.2
    • First observedzlib_get_download_url
    • First observedzlib_limits
    • First observedzlib_login
    • First observedzlib_search

TDQS

A4.3/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a distinct purpose: search for books, fetch download URLs, check account limits, and handle login. No two tools overlap in functionality, making selection unambiguous.

Naming Consistency4/5

All tools share the 'zlib_' prefix and most follow a verb-based pattern (search, get_download_url, login), but 'limits' is a noun rather than a verb like 'get_limits' or 'check_limits'. Minor deviation but still coherent.

Tool Count5/5

With 4 tools covering search, URL generation, quota checking, and authentication, the set is well-scoped for a focused book download workflow. No redundant tools, and each one earns its place.

Completeness2/5

The descriptions repeatedly mention a 'zlib_download' tool and instructions for enabling it, but that tool is not included in the provided set. This leaves a critical gap in the core workflow, preventing actual file downloads.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers