Openlibrary Mcp Server

io.github.cyanheads由 GitHub 帳號 cyanheads 發布v0.4.0更新於 Oct 26, 2026

Search books and authors, fetch editions, browse subjects, and resolve cover images.

已驗證Streamable HTTP可網頁執行網頁搜尋與抓取知識與記憶

概覽

AI 產生的概覽

唯讀存取 Open Library 書目:搜尋書籍、作者與主題,查看版本,檢索掃描書全文,並產生封面圖片連結。

可以做什麼
  • 依書名、作者、主題、出版社、ISBN 或語言搜尋作品,支援排序與分頁
  • 查詢作品詳情、列出其版本,並依 ISBN、OCLC、LCCN 或版本 OLID 批次解析版本
  • 依姓名搜尋作者,取得作者簡介與外部識別碼連結,並列出該作者的作品
  • 依主題標籤瀏覽作品並取得作品總數
  • 在 Internet Archive 掃描書中進行全文檢索,找出包含某段文字的书
  • 產生書籍封面或作者照片的圖片連結,可選小、中、大尺寸
適用情境
適合需要書目研究的場合:依書名、作者或 ISBN 確認一本書,比較不同印次與譯本,整理閱讀清單或參考書目,或在掃描書中找出記得的一段引文。
執行需求
不需 API 金鑰或帳號。可連線託管的 Streamable HTTP 端點,或以 npx 在本機執行(需 Node.js 24 以上或 Bun 1.4 以上),另提供 Docker 映像。選用環境變數可設定傳輸方式、連接埠、端點路徑、驗證模式、日誌等級、儲存後端、User-Agent 與限制截斷。
安裝前請注意
所有工具皆為唯讀且免金鑰,但查詢內容與識別碼會經網路傳送給 Open Library 與 Internet Archive。掃描書全文檢索較慢,通常需 10 至 30 秒。封面連結僅為拼接產生,不會驗證圖片是否存在。主題標籤由使用者貢獻且不一致,空結果相當常見。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Openlibrary Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.cyanheads%2Fopenlibrary-mcp-server/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "openlibrary": {
      "type": "http",
      "url": "https://openlibrary.caseyjhand.com/mcp"
    }
  }
}

README

@cyanheads/openlibrary-mcp-server

Search books and authors, fetch editions, browse subjects, and resolve cover images from Open Library via MCP. STDIO or Streamable HTTP.

10 Tools • 2 Catalog Resources • 1 Agent Skill


Overview

Open Library's catalog of 20M+ books, editions, authors, and subjects, plus full-text search inside Internet Archive's scanned books. Search and browse, drill from a work into its editions or an author into their works, and construct cover image URLs.

Tools

ToolDescription
openlibrary_search_booksCatalog search with field filters (title, author, subject, publisher, ISBN, language), a provider-selected edition, pagination, and optional live reading availability
openlibrary_get_workFetch a work by Open Library Work ID (OL…W) — title, description, subjects, cover IDs, and author IDs
openlibrary_get_editionsList editions of a work — publishers, languages, formats, ISBNs, and print run details
openlibrary_get_editionResolve up to 50 distinct identifiers per call by ISBN-10, ISBN-13, OCLC, LCCN, or Open Library Edition ID (OL…M), reporting misses and unprocessed identifiers
openlibrary_search_authorsSearch authors by name — returns Author IDs, birth/death dates, top works, and subject associations
openlibrary_get_authorFetch author detail by Open Library Author ID (OL…A) — bio, dates, photo IDs, and linked identifiers from Wikidata, VIAF, ISNI, Goodreads, and LibraryThing
openlibrary_get_author_worksList works by an author — titles, cover IDs, and Work OLIDs for drilling into editions or details
openlibrary_get_subjectBrowse works by subject tag — returns matching works with edition counts and cover IDs plus the total work count
openlibrary_search_insideFull-text search inside the scanned text of Internet Archive books — returns matching items with snippets
openlibrary_get_cover_urlResolve a cover image URL for a book or author photo in S/M/L size — returns a direct HTTPS URL embeddable in markdown

Resources

ResourceDescription
openlibrary://works/{work_id}Work detail by Open Library Work ID — title, description, subjects, cover IDs, and author IDs as injectable context
openlibrary://authors/{author_id}Author detail by Open Library Author ID — name, bio, dates, photo IDs, and linked external identifiers as injectable context

Both resources mirror data also available via openlibrary_get_work and openlibrary_get_author — useful for clients that don't surface MCP resources.

Agent skill

openlibrary-guide covers edition selection, bibliography resolution, passage identification, and incomplete metadata. It is included in npm, Docker, and desktop bundles and served through MCP skill discovery and skill:// resources.

Capability reference

Paginated tools return at most 100 rows per call. Larger positive integer limits are clamped with a notice showing the applied limit and next offset. OPENLIBRARY_CLAMP_LIMITS=false restores schema rejection above 100. Text and structured output carry the same complete domain data, including arrays and numeric precision.

openlibrary_search_books tool

  • Free-text query with Solr field prefixes (title:, author:, subject:, publisher:, isbn:, language:) or dedicated filter parameters; 1–100 results per page (default 10), offset pagination
  • sort: relevance (default), new, old, rating, editions
  • language accepts a 3-letter MARC code or a translatable 2-letter ISO code; an untranslatable 2-letter code fails as unknown_language_code rather than being silently dropped
  • include_availability adds live Internet Archive borrow/read status (~200ms latency), off by default; flags Open Library leaves out are omitted rather than reported as false, and availability: null means none was returned for the work
  • Returns work-level records with edition counts, cover IDs, subjects, and Internet Archive identifiers
  • Optional matching_edition and matching_edition_count preserve the Search API's selected edition and matching count. The selected edition is provider-ranked; it does not prove that every unfielded search term matches that edition
  • invalid_search_query reports upstream HTTP 422 validation with recovery guidance; empty queries with specific filters remain supported

openlibrary_get_work tool

  • Fetch by Open Library Work ID (OL…W), optionally /works/-prefixed; anything else — an ISBN, an edition or author OLID — fails input validation before any request, naming openlibrary_get_edition (id_type: "isbn") as the route from an ISBN to its work
  • Returns title, description, subjects (plus place/time/people breakdowns), cover IDs, and author IDs — no author names (use openlibrary_get_author or openlibrary_search_books)
  • A merged work ID stays reachable — the redirect chain is followed to the canonical record, work_id reports the canonical ID, and an enrichment notice names both IDs when they differ
  • not_found when the Work ID doesn't exist or its redirect chain reaches no work

openlibrary_get_editions tool

  • List editions of a work by Work ID (OL…W), optionally /works/-prefixed; 1–100 per page (default 10), offset pagination, with the requested offset echoed in the output
  • Same work_id validation as openlibrary_get_work — an ISBN resolves to its work through openlibrary_get_edition (id_type: "isbn")
  • Returns ISBN-10/13, publishers, languages, page count, cover IDs, and edition OLIDs (OL…M), plus physical_format and edition_name when recorded
  • A merged work ID stays reachable — the editions of the canonical work come back under its ID in work_id, with an enrichment notice naming both IDs; a live work still costs one request
  • not_found when the Work ID doesn't exist or its redirect chain reaches no work

openlibrary_get_edition tool

  • Accepts 1–1,000 input strings, deduplicates exact strings, and processes the first 50 distinct identifiers in one upstream batch; the remainder is returned as unprocessed for resubmission. Every identifier shares one id_type: isbn (10 or 13 digits, an ISBN-10 may end in an X check digit), oclc (numeric), lccn (unchecked), or olid (OL…M). With OPENLIBRARY_CLAMP_LIMITS=false, the input array is limited to 50 entries
  • Partial success: identifiers that resolve return in editions (request order); the rest land in unresolved with invalid_identifier (malformed, never sent upstream) or not_found (well-formed, no record) — the call fails only when nothing resolves
  • upstream_unavailable (retryable) when Open Library's batch lookup itself fails — an HTTP error status other than a rate limit, or an HTML page — so an upstream outage never reads as a missing edition
  • Authors come inline — the edition's own credits, or ones marked source: "work" recovered from the parent work when the edition itself lists none; if those lookups fail, the batch still returns, and an enrichment notice names the editions whose authors are missing or shown by ID
  • Returns ISBN-10/13, OCLC, LCCN, LC call numbers, publishers, all cataloged languages, page count, cover IDs, parent work ID, and an Internet Archive ebook_url when one exists. The singular language remains the first cataloged language; physical_format and edition_name preserve the catalog's wording when present
  • If no processed identifier resolves, the existing typed error also carries every unprocessed identifier in its data and recovery hint

openlibrary_search_authors tool

  • Search by name — partial and alternate names match; 1–100 per page (default 10), offset pagination
  • Returns Author ID (OL…A), alternate names, birth/death dates, top work, work count, top subjects, and average rating

openlibrary_get_author tool

  • Fetch by Author ID (OL…A); a leading /authors/ prefix is stripped
  • Returns bio, birth/death dates, photo IDs, and linked identifiers (Wikidata, VIAF, ISNI, Goodreads, LibraryThing)
  • A merged author ID stays reachable — the response is the canonical record, and an enrichment notice names the canonical ID when it differs from the one requested
  • not_found when the Author ID doesn't exist, names a record that is not an author (a work or edition OLID), or its redirect chain reaches no author

openlibrary_get_author_works tool

  • List works by Author ID (OL…A); 1–100 per page (default 20), offset pagination, with the requested offset echoed in the output
  • Returns title, first-publish date, cover IDs, and Work ID (OL…W) per work
  • A merged author ID stays reachable — an enrichment notice names the canonical ID when it differs from the one requested
  • not_found when the Author ID doesn't exist, names a record that is not an author (a work or edition OLID), or its redirect chain reaches no author

openlibrary_get_subject tool

  • Subject name is trimmed, lowercased, and normalized from whitespace to underscores; 1–100 per page (default 12), offset pagination, with the requested offset echoed in the output
  • Blank input fails as invalid_subject before any request
  • Returns canonical subject name, normalized subject key, total work count, and per-work author names, edition count, and cover ID
  • Empty results carry a recovery notice suggesting a different word form, synonym, or broader term — subject tags are user-contributed and inconsistent

openlibrary_search_inside tool

  • Full-text search across Internet Archive's scanned book text — the only tool that answers "which book contains this passage?"; quote a phrase for an exact match, unquoted terms match independently
  • Usually takes 10–30 s against the live index, far above the metadata tools — reach for it deliberately, not as a general book search
  • 1–100 results per page (default 10), offset pagination; each result carries a relevance score comparable only within its own result set
  • Results key on Internet Archive ia_identifier, not Open Library work IDs — match it against ia_identifiers from openlibrary_search_books to reach the catalogue record
  • upstream_unavailable (retryable) when the index answers without a result set, so a failed search never reads as "no book contains this"

openlibrary_get_cover_url tool

  • Resolves a cover or author-photo URL from id (numeric), isbn (10 or 13 digits, an ISBN-10 may end in an X check digit), or olid (OL…M for target: "book", OL…A for target: "author"); size is S/M/L (default M)
  • Identifiers are validated locally before any request — path separators, .., and control characters fail as invalid_identifier, and an author lookup by isbn fails as invalid_target
  • The tool constructs the URL without fetching it; a returned URL does not verify that a cover exists
  • Output URL is ready to embed directly as ![cover](url)

openlibrary://works/{work_id} resource

  • Same fields as openlibrary_get_work, as injectable application/json context for a conversation about a specific book
  • work_id comes from openlibrary_search_books or openlibrary_get_author_works; a merged ID resolves to the canonical work, whose ID the returned work_id carries, and an ID that is not a work (an edition or author OLID) is not found

openlibrary://authors/{author_id} resource

  • Same fields as openlibrary_get_author, as injectable application/json context for a conversation about a specific author
  • author_id comes from openlibrary_search_authors; a merged ID resolves to the canonical author, whose ID the returned author_id carries, and an ID that is not an author (a work or edition OLID) is not found

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

Open Library-specific:

  • Open Library Search, Search Inside (full-text), Books, Authors, and Subjects APIs, cover URL construction, and Internet Archive availability lookups
  • Work → editions and author → works drill-down, with explicit OLID cross-links between tool outputs
  • Configurable User-Agent header (OPENLIBRARY_USER_AGENT) identifying the server per Open Library's bot-blocking convention
  • Batch edition resolution — up to 50 ISBN/OCLC/LCCN/OLID identifiers in one upstream call, with per-identifier partial-failure reporting
  • Timeouts sized per endpoint class (10 s record lookups, 30 s searches, 45 s full-text) inside a 50 s retry budget, so a slow upstream is waited on and a failing one returns a classified error before a typical 60 s client timeout; gateway errors are not retried in a loop

Agent-friendly output:

  • Recovery guidance on every empty result — echoes the search criteria and suggests how to broaden a query or which offset to retry
  • Merged-record disclosure — openlibrary_get_author, openlibrary_get_author_works, openlibrary_get_work, and openlibrary_get_editions follow merge redirects and surface the canonical ID via an enrichment notice when a requested ID was merged
  • Per-item partial failure — openlibrary_get_edition returns resolved editions alongside typed unresolved reasons instead of failing the whole batch
  • Complete text and structured output, with clamp and recovery notices preserved on both surfaces

Getting started

Add the hosted server to Claude Code — no API key required:

sh
claude mcp add --transport http openlibrary-mcp-server https://openlibrary.caseyjhand.com/mcp

Or run it locally:

sh
claude mcp add openlibrary-mcp-server -- npx -y @cyanheads/openlibrary-mcp-server

For other clients, add this to the MCP config file:

json
{  "mcpServers": {    "openlibrary-mcp-server": {      "command": "npx",      "args": ["-y", "@cyanheads/openlibrary-mcp-server"]    }  }}

For Docker or a source build, see Running the server.

Configuration

VariableDescriptionDefault
MCP_TRANSPORT_TYPETransport: stdio or httpstdio
MCP_HTTP_PORTHTTP server port3010
MCP_HTTP_ENDPOINT_PATHHTTP endpoint path where the MCP server is mounted/mcp
MCP_SESSION_MODEHTTP session posture: stateless, stateful, or auto. Overrides the stateless declared in src/index.ts.stateless
MCP_PUBLIC_URLPublic origin override for TLS-terminating reverse-proxy deploymentsnone
MCP_AUTH_MODEAuthentication: none, jwt, or oauthnone
MCP_LOG_LEVELLog level (debug, info, warning, error, etc.)info
MCP_GC_PRESSURE_INTERVAL_MSOpt-in Bun-only forced-GC pressure loop (ms). Recommended starting point if heap growth is observed: 60000.0 (disabled)
LOGS_DIRDirectory for log files (Node.js only)<project-root>/logs
STORAGE_PROVIDER_TYPEStorage backend: in-memory, filesystem, supabase, cloudflare-kv/r2/d1in-memory
OPENLIBRARY_USER_AGENTUser-Agent sent with all Open Library API requests. Include a contact email per community convention.openlibrary-mcp-server [email protected]
OPENLIBRARY_CLAMP_LIMITSClamp page limits to 100 and process the first 50 distinct edition identifiers, returning the remainder. false restores strict input bounds of 100 rows and 50 raw identifiers.true
OTEL_ENABLEDEnable OpenTelemetryfalse

See .env.example for the full list of optional overrides.

Running the server

Local development

Requires Bun v1.4.0 or higher (or Node.js ≥ 24.0.0).

  • Clone and install:

    sh
    git clone https://github.com/cyanheads/openlibrary-mcp-server.gitcd openlibrary-mcp-server && bun installcp .env.example .env   # optional overrides; no required variables
  • Build and run the production version:

    sh
    # One-time buildbun run rebuild
    # Run the built serverbun run start:http# orbun run start:stdio
  • Run checks and tests:

    sh
    bun run devcheck  # Lint, format, typecheck, securitybun run test      # Vitest test suitebun run lint:mcp  # Validate MCP definitions against spec

Docker

sh
docker run --rm -p 3010:3010 ghcr.io/cyanheads/openlibrary-mcp-server:latest

The image defaults to HTTP transport, stateless session mode, and logs to /var/log/openlibrary-mcp-server. To run it over stdio from an MCP client, use "command": "docker" with "args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/openlibrary-mcp-server:latest"]. To build locally, run docker build -t openlibrary-mcp-server .; OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.

Project structure

DirectoryPurpose
src/index.tscreateApp() entry point — registers tools and resources.
src/configServer-specific environment variable parsing and validation with Zod.
src/mcp-server/toolsTool definitions (*.tool.ts) — ten tools across Search, Books, Authors, Subjects, and Covers.
src/mcp-server/resourcesResource definitions (*.resource.ts) — Work and Author.
src/services/open-libraryOpen Library service layer — API client and domain types.
skills/Published agent guidance, also served through MCP skill discovery.
tests/Unit and integration tests mirroring the src/ structure.

Development guide

See CLAUDE.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic
  • Use ctx.log for logging, ctx.state for storage
  • Register new tools and resources in the createApp() arrays
  • Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields

Contributing

Issues are welcome. Run checks and tests before submitting:

sh
bun run devcheckbun run test

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

來源:README.md,提交 e45a574

工具

10

openlibrary_search_books

Search Books

Full-text book search across Open Library works. Supports field filters (title, author, subject, publisher, ISBN, language) and returns work-level records with edition counts, cover IDs, and reading availability. Use query for general search or combine specific field filters. Results are work-level — drill into editions via openlibrary_get_editions.

輸入參數isbnsortlimitquerytitleauthoroffsetsubjectlanguagepublisherinclude_availability

openlibrary_search_inside

Search Inside Books

Search the full text of books scanned by the Internet Archive — the "which book contains this passage?" lookup that the metadata tools cannot answer. Quote a phrase for an exact-phrase match; bare terms match anywhere in the text. Each result is an Internet Archive item with the matching passages as snippets, plus a relevance score. The full-text index is far slower than the metadata endpoints, and a search usually takes 10–30 seconds. Use it when the passage is the question, and use openlibrary_search_books to search by title, author, or subject. Results key on Internet Archive items rather than Open Library works: chain the returned ia_identifier to archive.org, or match it against the ia_identifiers on openlibrary_search_books results to reach the catalogue record.

輸入參數limitquery必填offset

openlibrary_get_work

Get Work

Fetch a work by Open Library Work ID (OL…W). Returns title, description, subjects, cover IDs, and linked author IDs for follow-up lookups. Works represent the abstract book concept independent of any specific edition. A merged work ID resolves to the work it was merged into. To reach a work from an ISBN, call openlibrary_get_edition with id_type "isbn" — its work_id output is the parent work. Note: author names are not included — use openlibrary_get_author or openlibrary_search_books for names.

輸入參數work_id必填

openlibrary_get_editions

Get Editions

List editions of a work — different publishers, languages, formats, and print runs. Returns ISBNs, publisher, language, page count, and edition OLIDs. Use after openlibrary_get_work or openlibrary_search_books to find a specific printing. A merged work ID resolves to the work it was merged into. To reach a work from an ISBN, call openlibrary_get_edition with id_type "isbn" — its work_id output is the parent work.

輸入參數limitoffsetwork_id必填

openlibrary_get_edition

Get Edition

Resolve one or more editions by identifier: ISBN-10, ISBN-13, OCLC, LCCN, or Open Library Edition ID (OL…M). Every identifier in a call shares one id_type — pass id_type "isbn" for both ISBN-10 and ISBN-13. Up to 50 identifiers resolve in a single upstream batch; with limit clamping enabled, exact duplicates collapse and remaining identifiers are returned as unprocessed for another call. Returns full edition metadata including authors, publisher, languages, all identifier types, and the parent work ID. Author names come inline when recorded; otherwise bounded lookups recover parent-work credits marked as such, and a notice names any edition whose recovery failed. Identifiers that resolve come back in editions; processed misses are listed in unresolved with a reason. The call fails only when no processed identifier resolves, and any unprocessed remainder remains in its error data and recovery guidance.

輸入參數id_type必填identifiers必填

openlibrary_search_authors

Search Authors

Search Open Library authors by name. Returns Open Library Author IDs, names, birth/death dates, top works, and subject associations. Use author IDs for openlibrary_get_author (bio, remote IDs) or openlibrary_get_author_works (list of works).

輸入參數limitquery必填offset

openlibrary_get_author

Get Author

Fetch author detail by Open Library Author ID (OL…A). Returns bio, birth/death dates, photo IDs, and linked identifiers from Wikidata, VIAF, ISNI, Goodreads, and LibraryThing. Use openlibrary_search_authors to find an author ID first.

輸入參數author_id必填

openlibrary_get_author_works

Get Author Works

List works by an author. Returns titles, cover IDs, and work OLIDs for drilling into editions or details. Use openlibrary_get_author for author bio and details, or openlibrary_get_editions to explore specific printings.

輸入參數limitoffsetauthor_id必填

openlibrary_get_subject

Get Subject

Browse works by subject. Returns matching works with edition counts and cover IDs, plus the total work count for the subject. Case and spacing are normalized before lookup, so "Science Fiction" and "science_fiction" are the same request. Subject tags are user-contributed and the vocabulary varies — when a subject returns no works, try a different word form (singular/plural), a synonym, or a broader term.

輸入參數limitoffsetsubject必填

openlibrary_get_cover_url

Get Cover URL

Construct a cover image URL for a book or author photo without fetching the image. Returns a direct HTTPS URL in the requested size (S/M/L). The identifier format is validated locally: "id" must be numeric, "isbn" 10 or 13 digits (an ISBN-10 may end in an X check digit), "olid" an edition OLID (OL…M) for target "book" and an author OLID (OL…A) for target "author". Identifiers with path separators or control characters, and author-by-ISBN lookups, are rejected. A returned URL does not verify that a cover exists.

輸入參數sizetargetid_type必填identifier必填

版本歷史

4
  1. v0.4.0最新Oct 26, 2026
  2. v0.3.1Oct 9, 2026
  3. v0.3.0Sep 25, 2026
  4. v0.2.4Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分