zlib-mcp
A local MCP server that connects AI clients to Z-Library book search, download links, and account quotas. It uses your own account over stdio and can save selected books locally when a download directory is configured.
Project overview
zlib-mcp wraps Z-Library search and download operations as MCP tools. In an existing AI client, you can find books, compare editions, and then choose whether to request a link or save a file. The server runs locally over stdio and contacts the configured upstream with your own account. It does not provide shared credentials, a web reader, or full-text analysis. Its source code is MIT-licensed; access only material you are authorized to obtain.
Core capabilities
zlib_search book search
Search by title, author, or ISBN with format, language, year range, sorting, and pagination options. The default page size is 10, with a maximum of 50. Results retain book metadata and the id/hash pair needed for downloads.
zlib_get_download_url links
Use the id/hash pair from one search result to obtain a short-lived, session-bound URL without saving a file. The tool description warns that this consumes daily download quota.
zlib_download local files
Registered only when ZLIB_DOWNLOAD_DIR is set. Streams a file into that directory and returns its path, filename, and byte count. It sanitizes filenames, adds a numeric suffix when a name already exists, and defaults to a 524288000-byte limit. An explicit allow_large option can override the size limit.
zlib_limits account quotas
Reads downloads used, the account limit, remaining allowance, and premium status so you can check the account before requesting a download link.
zlib_login credential exchange
Accepts email and password and returns a remix ID/key pair. It does not replace the running credential configuration automatically; save the settings and restart. Existing remix credentials can also be provided directly through environment variables.
Setup and connection
Prepare Node.js 20+, add the README's npx launch configuration to your MCP client, and supply a complete remix ID/key pair. Omit the download directory for search and links only; enable it when you need local files.
Let an AI Agent install it
Send this prompt to Codex, Claude Code, or another AI agent that can work with your local environment.
Help me install zlib-mcp from https://github.com/shiyi-0x7f/zlib-mcp. First read README.md, README.zh-CN.md, package.json, src/config.ts, and src/credentials.ts, then confirm the Node.js 20+ requirement and target client. Use the repository's npx -y zlib-mcp configuration for local stdio MCP, preserving existing client settings. Prefer a complete ZLIB_REMIX_ID and ZLIB_REMIX_KEY pair; set ZLIB_DOWNLOAD_DIR only if I need downloads. Ask before requesting credentials, granting additional permissions, or overwriting files. Do not expose secrets in responses, logs, or version control, and do not select an unknown upstream yourself. After restarting, verify that 4 or 5 tools are present, then with my agreement check quota and search for a specified title. Confirm the exact item and quota cost before requesting a link or saving a file. If no real account is available or the upstream is unreachable, clearly record what remains unverified instead of treating local tests as a successful real download.- Node.js 20+ with npx available
- Claude Code, Claude Desktop, Cursor, or Codex CLI
- Your own account and an upstream domain you have confirmed you trust
- A directory the client can write to, if local downloads are needed
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- 1Prepare the account and runtime
Ensure Node.js 20+ is available. Prepare both ZLIB_REMIX_ID and ZLIB_REMIX_KEY and confirm that you trust the upstream. Do not commit real credentials to a repository. If you want local files, choose a dedicated download directory.
- 2Add the launch configuration to one client
For Claude Code, copy the add command on this page and replace the credentials. For Claude Desktop, merge the JSON into ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows. Cursor uses .cursor/mcp.json or ~/.cursor/mcp.json. Preserve existing mcpServers entries, replace the example download path with your own, and remove ZLIB_DOWNLOAD_DIR if local downloads are unnecessary.
- 3Restart and check search tools
Restart the selected client and check for 4 or 5 tools. Call zlib_limits first, then search for a specific title or author with zlib_search. Add extensions, languages, or year filters as needed and inspect the edition metadata and id/hash.
- 4Retrieve a file after selecting an item
Take both id and hash from the same search result. Use zlib_get_download_url for a link or zlib_download to save into the configured directory, only after accepting the quota cost. Check the returned path, filename, and byte count. Resolve account or upstream errors before retrying instead of repeatedly requesting downloads.
Restart the client and inspect the tool list: expect 4 tools without a download directory, or 5 with one. Call zlib_limits to check account access, then use zlib_search with a specific title or author and look for id/hash in the results. Test a link or actual download only after the user selects an item and accepts the quota cost.
- The README defaults ZLIB_HOST to pkuedu.xyz. Its reachability and trustworthiness were not verified here; check before sending credentials.
- Email/password fallback logs in lazily and can cache a session. The disk cache cannot replace environment configuration by itself; save a complete remix ID/key pair for ongoing use.
- Set ZLIB_CREDENTIAL_CACHE=0 to disable caching. The default file is ~/.zlib-mcp/credentials.json.
- zlib_login arguments and returned credentials may appear in client history; protect them according to your client's behavior.
Use cases
Compare book editions in a conversation
Search by title or author, narrow results by language, year, and file format, then retain candidate id/hash pairs for the user to select.
Save selected material to a reading folder
After the user confirms access rights to an item, check quota and download it into the designated folder. Reading and parsing the file require other tools.
Assessment
This assessment is based on the README, configuration and tool code, license, and commit history, supplemented by a source build and 82 mocked tests. Tools have distinct roles, local downloads require explicit configuration, and several clients have documented setup examples. The project is small, and practical use depends on its upstream, account status, and quotas. No real account was tested, so this review cannot establish live service reliability.
Why it may be useful
- Separate search, link, download, and quota tools support deliberate access decisions
- English and Chinese README files include configuration examples for several clients
- Source build and 82 mocked tests passed, covering credentials, paths, and error handling
What to know first
- Only 5 Stars and 3 Forks, with a short public commit history
- Upstream availability and real login/download behavior were not tested here
- Filename and path handling is not a complete filesystem security sandbox
README
zlib-mcp
Overview
A local MCP server that connects AI clients to Z-Library book search, download links, and account quotas. It uses your own account over stdio and can save selected books locally when a download directory is configured.
Getting started
- Prepare Node.js 20+, add the README's npx launch configuration to your MCP client, and supply a complete remix ID/key pair. Omit the download directory for search and links only; enable it when you need local files.
- The README describes a bring-your-own-account Z-Library MCP server launched with Node.js 20+ and npx for local stdio clients.
- Configure a remix ID/key pair or exchange email/password credentials on demand. The local download tool is available only when ZLIB_DOWNLOAD_DIR is set.
- Restart the client and inspect the tool list: expect 4 tools without a download directory, or 5 with one. Call zlib_limits to check account access, then use zlib_search with a specific title or author and look for id/hash in the results. Test a link or actual download only after the user selects an item and accepts the quota cost.
Configuration
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-mcpRead the complete README on GitHub →