zlib-mcp
zlib-mcp
一个基于 stdio 的 MCP 服务器,让任何 AI 代理工具——Claude Code、Codex CLI、Cursor、Claude Desktop——都能搜索 z-library 并下载书籍。
自带账户。 没有共享后端、没有 API 密钥、没有代理:服务器运行在你的机器上,直接与 z-library 通信,并使用你的凭证和你的配额。
工具
工具 | 功能 | 需要凭证 |
| 按标题 / 作者 / ISBN 搜索,支持格式、语言和年份筛选 | 是 |
| 获取单本书的直接下载链接(不写入文件) | 是 |
| 将书籍下载到你配置的目录 | 是 |
| 查看今日剩余下载配额 | 是 |
| 一次性辅助工具:用邮箱 + 密码换取 remix 凭证 | 否 |
zlib_download 只有在你设置了 ZLIB_DOWNLOAD_DIR 后才会出现 —— 一个默认允许在任意位置写入文件的 MCP 服务器并不是可接受的默认行为,所以你必须自己指定目录。
Related MCP server: open-public-domain
要求
Node.js ≥ 20
一个 z-library 账户
5 分钟完成设置
1. 获取你的凭证
如果你已经知道自己的 remix_userid / remix_userkey,请跳过后面的步骤。否则,先用你的邮箱和密码添加服务器(见下面的配置示例),然后让代理运行一次 zlib_login,并将返回的 remix_id / remix_key 永久写入配置。
你也可以直接从终端运行:
ZLIB_EMAIL=you@example.com ZLIB_PASSWORD='…' npx zlib-mcp2. 将服务器添加到你的客户端
每个客户端都需要同样的三样东西:命令 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或者直接使用下面的 JSON 编辑 ~/.claude.json / .mcp.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. 试试看
帮我找 Kleppmann 的 Designing Data-Intensive Applications 的 epub 格式,然后下载第一个结果。
配置
变量 | 必填 | 默认值 | 说明 |
| 二选一 | — | 你的 |
| 二选一 | — | 你的 |
| 二选一 | — | 备用:首次使用时兑换为 remix 凭证 |
| 二选一 | — | 备用,与 |
| 否 |
| 上游镜像;如果被屏蔽就更换 |
| 否 | (未设置 → | 下载文件的写入位置 |
| 否 |
| 超过此大小的文件需要 |
| 否 |
| 每个请求的连接超时时间 |
| 否 |
| 设为 |
| 否 |
|
|
凭证优先级
ZLIB_REMIX_ID+ZLIB_REMIX_KEY之前使用
ZLIB_EMAIL登录时缓存的凭证(~/.zlib-mcp/credentials.json,权限600)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 key 已过期。重新运行 zlib_login 并更新配置。如果使用邮箱/密码备用方式,请删除 ~/.zlib-mcp/credentials.json 以强制重新登录。
“下载配额已达上限” —— 免费账户每天只有少量下载次数。zlib_limits 会显示计数器;它会在 UTC 午夜时在 z-library 侧重置。
客户端中不显示任何内容 —— 请检查客户端的 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 在所有地方都被打桩了。
法律声明
此工具仅提供对你自己的 z-library 账户的 API 访问。它不托管任何内容、不分发任何内容,也不附带任何受版权保护的内容。确保你在所在地区的使用合法是你的责任。你的账户、你的配额、你的风险——因滥用而被封禁的账户,损失由你自己承担。
许可证
MIT
Available Tools
4 toolszlib_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.
| Name | Required | Description | Default |
|---|---|---|---|
| hash | Yes | The "hash" field from the same zlib_search result. Must match the book_id. | |
| book_id | Yes | The "id" field from a zlib_search result. |
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | z-library account email. | ||
| password | Yes | z-library account password. Never echoed back, logged, or written to disk. |
TDQS
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.
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.
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.
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.
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.
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.
zlib_searchSearch z-libraryA
Search z-library for books. Returns a trimmed list — each entry carries the "id" and "hash" that zlib_get_download_url and zlib_download require, plus title/author/year/language/extension/size. Present the candidates to the user and let them pick before downloading anything.
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number, starting at 1. Default 1. | |
| limit | No | Results per page, 1-50, default 10. | |
| order | No | Upstream sort field, passed through as-is (e.g. "popular", "year"). | |
| query | Yes | Search keywords: book title, author name, or ISBN. Non-Latin scripts are supported — pass a Chinese title verbatim, do not transliterate or translate it. | |
| year_to | No | Latest publication year (inclusive). | |
| languages | No | Filter by language, e.g. ["english","chinese"]. Omit to accept any language. | |
| year_from | No | Earliest publication year (inclusive). | |
| extensions | No | Filter by file format, e.g. ["epub","pdf"]. Omit to accept any format. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and it does well: it says the result is a trimmed list, enumerates the fields each entry carries, and instructs not to download without user selection, implying a safe read-only search step. It does not mention pagination totals, error behavior, or auth requirements, which keeps it just below a 5.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences with no waste: the first states the core action, the second adds the output shape and the required user-interaction step. It is front-loaded and every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 8 parameters with full schema coverage and no output schema, the description compensates by explaining what the return entries contain and how they feed downstream tools. It is sufficient for correct invocation, though a note on pagination/total result behavior would make it fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents every parameter clearly. The description adds no extra parameter-level detail beyond the output relationship, so the baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Search z-library for books') and the resource ('z-library'), and distinguishes the tool from siblings by explaining it returns a candidate list with the id/hash that zlib_get_download_url and zlib_download require. This makes the tool's role in the download workflow immediately clear.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly tells the agent to present candidates to the user and let them pick before downloading anything, which defines when this tool should be used relative to the download siblings. It also names the downstream tools that consume its output, giving clear workflow placement.
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.
4 tool updates
v0.1.2- First observed
zlib_get_download_url - First observed
zlib_limits - First observed
zlib_login - First observed
zlib_search
TDQS
Scored across 4 tools
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.
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.
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.
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
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Official MCP server for Agentwork — delegate tasks to AI agents with human-in-the-loop
Related MCP Servers
- AlicenseAqualityCmaintenanceAn MCP server for searching and downloading books from Library Genesis, supporting EPUB, MOBI, PDF, and more through natural language queries.314 npm7MIT
- FlicenseNot gradedqualityDmaintenanceMCP server that gives AI agents access to the world's public domain library. Search, read, and navigate books and audiobooks from Project Gutenberg and LibriVox.-
- AlicenseAqualityDmaintenanceMCP server that lets AI agents search YouTube and fetch transcripts.23MIT
- AlicenseNot gradedqualityFmaintenanceMCP server for AI assistants to search and download ebooks from Z-Library and Anna's Archive, configured locally with automatic setup and download path.4AGPL 3.0