Libgen MCP
An MCP server, written in Go, that lets your AI assistant search and download from Library Genesis — books, research papers, magazines, comics, and standards. It ships as one static binary (or a container) with three focused tools: search, get_details, and download. It works with Claude, Cursor, VS Code, and any MCP client.
You talk to your AI assistant; it does the searching and fetching. You don't need to track mirrors, MD5 hashes, or download URLs. Mirrors are discovered automatically and cached, with transparent failover, so the server keeps working as individual mirrors go up and down.
"Find me the latest edition of Clean Code." · "Download that paper by its DOI." · "Search comics for Watchmen and grab the CBR."
Install
The recommended install is a prebuilt static binary — no Docker, no Go, no dependencies to manage. Download the asset for your platform from the latest release:
# Example: Linux amd64 (macOS, Windows and arm64 builds are on the releases page)
curl -L -o libgen-mcp \
https://github.com/jmrplens/libgen-mcp/releases/latest/download/libgen-mcp-linux-amd64
chmod +x libgen-mcp && sudo mv libgen-mcp /usr/local/bin/The binary is fully static (CGO_ENABLED=0), so it runs anywhere for that OS/arch with nothing else installed. Each release ships a checksums.txt to verify the download. Then register the binary with your MCP client — see Claude Code below, or the getting-started guide for every client. No token or account is required — Library Genesis needs no credentials.
Prefer a one-click button? (Docker)
Each button below registers the Docker-based server instead (auto-pulls ghcr.io/jmrplens/libgen-mcp:latest on first run; you need Docker installed).
The Claude Desktop row instead downloads a native .mcpb desktop extension (macOS universal + Windows, no Docker) — open it with Claude Desktop and confirm the settings.
Related MCP server: MCP Open Library & File Search Server
Claude Code (claude mcp add)
Native binary (install it first — grab the prebuilt binary from Install / the latest release, or build from source — then register it):
claude mcp add libgen -- /usr/local/bin/libgen-mcpOr Docker (no install — pulls the image on first run):
claude mcp add libgen -- docker run -i --rm ghcr.io/jmrplens/libgen-mcp:latestThen just ask: open your AI client and try "Search Library Genesis for the Rust book."
Tools
search
Search the Library Genesis catalog. Returns a page of file results with metadata, MD5 hashes, and download options, plus pagination metadata.
Parameter | Type | Required | Description |
| string | yes | Search text. |
| string[] | no | Collections to search: |
| string[] | no | Fields to match: |
| int | no | Results per page: |
| int | no | Result page, starting at |
| string | no | Sort by: |
| string | no |
|
The response includes pagination metadata so the model can decide whether to page or refine:
Field | Type | Description |
| array | The file records on this page. |
| int | The page number returned. |
| int | Page size in effect. |
| string | Total matches reported by the mirror for the query. |
| int | How many of those matches were actually parsed/reachable. |
| bool |
|
| string | When truncated, a suggestion to refine the query (add author/year, title-only columns, topics). |
| bool |
|
| string | The mirror that served the query. |
get_details
Full metadata for a record (description, identifiers, DOI, cover, related edition) via the libgen JSON API. Look up by md5 or by id, not both.
Parameter | Type | Required | Description |
| string | one of | File MD5 hash from a search result (returns file + related edition). |
| string | one of | Edition or file id. |
| string | no | With |
download
Download a file to a local directory. Provide md5 for a book or doi for an article (at least one is required); the server resolves the appropriate source chain and, for book (md5) downloads, verifies the result against the expected hash (DOI/article downloads are not MD5-verified). Returns the saved path, size, and the source that served it.
Parameter | Type | Required | Description |
| string | one of | File MD5 hash from a book search result. |
| string | one of | DOI from an article search result; articles are fetched by DOI. |
| string | no | Destination directory (default: |
| string | no | Destination filename (default: a clean name from the record metadata or the mirror). |
If both md5 and doi are given, article sources are tried first, then book sources.
Environment variables
Every variable is optional; an empty or unset value uses the default. A present-but-invalid numeric value is an error rather than a silent fallback.
Variable | Default | Description |
| (auto-discovery) | Force a specific mirror, e.g. |
|
| Default destination directory for |
|
| Per-request HTTP timeout (Go duration, e.g. |
|
| Log level: |
|
| Allowed outbound requests per second. Range |
|
| Maximum rate-limiter burst. Range |
|
| Maximum download size in bytes. Range |
|
| Simultaneous downloads allowed. Range |
|
| Passes over the mirror list for page requests (search / details / link resolution), with backoff; does not govern file downloads. Range |
| (built-in contact address) | Contact email required by the Unpaywall API for DOI lookups. Set your own to be a good API citizen. |
|
| Ordered, comma-separated Sci-Hub mirror hosts (bare host, no scheme). Tried in order until one serves. |
| (all enabled) | Comma-separated allow-list of download sources: |
Multi-source downloads
download runs an ordered fallback chain and stops at the first source that delivers a valid file:
Books (by
md5):libgen(mirrorads.phpkey + CDN redirect) →randombook(fresh-mirror discovery).Articles (by
doi):unpaywall(open-access PDF) →scihub(rotating Sci-Hub hosts).Both
md5anddoigiven: article sources (unpaywall,scihub) are tried first, then book sources (libgen,randombook).
You can restrict or reorder which sources participate with LIBGEN_MCP_SOURCES. Additional guarantees:
MD5 verification — book downloads are checked against the expected hash so a corrupt or wrong file is rejected, not saved.
Resumable downloads — interrupted transfers resume via HTTP range requests instead of restarting.
Clean filenames — with no explicit
filename, book downloads are namedAuthor - Title (Year).extfrom the record metadata, falling back to the mirror-announced name.
Robustness
Mirror failover — mirrors are auto-discovered, cached, and rotated; a failed request transparently retries the next live mirror.
Retry with backoff — transient HTTP failures are retried up to
LIBGEN_MCP_RETRY_ATTEMPTStimes with exponential backoff.Rate limiting — outbound requests are throttled (
LIBGEN_MCP_RATE_RPS/LIBGEN_MCP_RATE_BURST) to stay polite to mirrors.Graceful shutdown — in-flight work is allowed to drain on termination signals; tool panics are recovered so the stdio session never dies.
Documentation
Guides live in
docs/: getting started, configuration, tools reference, architecture, and troubleshooting.Full documentation site (bilingual EN/ES): https://jmrplens.github.io/libgen-mcp/
Building
Install the binary with Go:
go install github.com/jmrplens/libgen-mcp/cmd/server@latestThis produces a binary named server in $(go env GOPATH)/bin. Rename it to libgen-mcp (or build with an explicit name) and put it on your PATH:
go build -o libgen-mcp ./cmd/serverCommon developer tasks are wrapped by the Makefile (make help lists them all):
make build # build the server binary into dist/
make test # run all tests with a coverage profile
make lint # golangci-lint + govulncheck
make format-md-tables # normalize Markdown pipe tablesBy default the server speaks MCP over stdio. To serve streamable HTTP instead, pass --http with an address (libgen-mcp --http :8080); HTTP mode also exposes a GET /health readiness endpoint that returns 200 while serving. Print the version with --version.
Maintenance
Library Genesis mirrors occasionally change their HTML layout or routes. Two tools help you detect and confirm those changes:
Live diagnostic —
go run ./cmd/probehits a live mirror and reports whether each route and parser still works. Run it if searches or downloads start failing.Opt-in end-to-end test —
go test -tags e2e ./test/e2e/queries the real site and asserts the results still parse. It is gated behind thee2ebuild tag, so it never runs under a plaingo test ./....
Responsible use
This tool accesses third-party mirrors of Library Genesis. You are responsible for respecting the copyright and intellectual-property laws that apply where you live. Use it only for content you are legally entitled to access.
License
See LICENSE. Released under the MIT License.
This server cannot be installed
Maintenance
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jmrplens/libgen-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server