npm @cyanheads/openlibrary-mcp-serverstreamable-httpApache-2.0updated 14d ago
@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 Resources
openlibrary mcp server 能做什么?
Public Hosted Server: https://openlibrary.caseyjhand.com/mcp
Tools
10 tools for working with Open Library's catalog of 20M+ books, editions, authors, and subjects:
| Tool | Description |
|---|---|
openlibrary_search_books |
Full-text book search with field filters (title, author, subject, publisher, ISBN, language), sort options, pagination, and optional live reading availability |
openlibrary_get_work |
Fetch a work by Open Library Work ID (OL…W) — title, description, subjects, cover IDs, and author IDs |
openlibrary_get_editions |
List editions of a work — publishers, languages, formats, ISBNs, and print run details |
openlibrary_get_edition |
Resolve up to 50 editions in one call by ISBN-10, ISBN-13, OCLC, LCCN, or Open Library Edition ID (OL…M), reporting per-identifier misses |
openlibrary_search_authors |
Search authors by name — returns Author IDs, birth/death dates, top works, and subject associations |
openlibrary_get_author |
Fetch 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_works |
List works by an author — titles, cover IDs, and Work OLIDs for drilling into editions or details |
openlibrary_get_subject |
Browse works by subject tag — returns matching works with edition counts and cover IDs plus the total work count |
openlibrary_search_inside |
Full-text search inside the scanned text of Internet Archive books — returns matching items with snippets |
openlibrary_get_cover_url |
Resolve a cover image URL for a book or author photo in S/M/L size — returns a direct HTTPS URL embeddable in markdown |
openlibrary_search_books
Full-text book search across Open Library works.
- Free-text query with Solr field prefixes:
title:,author:,subject:,publisher:,isbn:,language: - Dedicated filter parameters for title, author, subject, publisher, ISBN, and language
- Sort by relevance, newest, oldest, community rating, or edition count
- Pagination via offset for paging through large result sets
- Optional live reading availability from Internet Archive (borrow/browse/read status) — adds ~200ms latency; off by default
- Returns work-level records with edition counts, cover IDs, Internet Archive identifiers, and e-book access status
openlibrary_get_work
Fetch a work by Open Library Work ID (OL…W).
- Title, description, subjects, cover IDs, and linked author IDs
- Works represent the abstract book concept independent of any specific edition
- Author names are not included — use
openlibrary_get_authororopenlibrary_search_booksfor names
openlibrary_get_editions
List editions of a work — different publishers, languages, formats, and print runs.
- Returns ISBNs, publisher, language, page count, and edition OLIDs
- Pagination via offset
- Use after
openlibrary_get_workoropenlibrary_search_booksto find a specific printing
openlibrary_get_edition
Resolve one or more editions by identifier.
- Accepts ISBN-10, ISBN-13, OCLC, LCCN, or Open Library Edition ID (OL…M)
- Takes 1–50 identifiers per call, all of the same
id_type, resolved in a single upstream request — a bibliography or shelf export costs one call rather than one per book - Pass
id_type "isbn"for both ISBN-10 and ISBN-13 - Returns full edition metadata: authors, publisher, language, all identifier types, and the parent work ID
- Partial success: identifiers that resolve come back in
editions, the rest inunresolvedwith a reason (invalid_identifierfor a value that cannot be the given type,not_foundfor one Open Library holds no record for). The call fails only when nothing resolved
openlibrary_search_authors
Search Open Library authors by name.
- Partial names and alternate names work
- Returns Open Library Author IDs, names, birth/death dates, top works, and subject associations
- Use author IDs for
openlibrary_get_author(bio, remote IDs) oropenlibrary_get_author_works(list of works)
openlibrary_get_author
Fetch author detail by Open Library Author ID (OL…A).
- Bio, birth/death dates, photo IDs
- Linked external identifiers: Wikidata, VIAF, ISNI, Goodreads, and LibraryThing
- Use
openlibrary_search_authorsto find an author ID first
openlibrary_get_author_works
List works by an author.
- Returns titles, cover IDs, and Work OLIDs for drilling into editions or details
- Use
openlibrary_get_authorfor author bio and details, oropenlibrary_get_editionsto explore specific printings
openlibrary_get_subject
Browse works by subject tag.
- Returns matching works with edition counts and cover IDs, plus the total work count for the subject
- Subjects are user-contributed and may be inconsistent ("science fiction", "Science fiction", "SF" are separate tags)
- Try lowercase forms first
openlibrary_search_inside
Full-text search inside books scanned by the Internet Archive.
- Answers "which book contains this passage?" — the one question the metadata tools cannot
- Quote a phrase for an exact-phrase match; unquoted terms match independently
- Returns Internet Archive items with the matching passages as snippets and a relevance score
- Snippets are capped in the text output and complete in
structuredContent, with the omitted count disclosed - Seconds-slow against the live index, an order of magnitude above the metadata endpoints — reach for it deliberately
- Results key on Internet Archive items, not Open Library works: match the returned
ia_identifieragainst theia_identifiersonopenlibrary_search_booksresults to reach the catalogue record
openlibrary_get_cover_url
Resolve a cover image URL for a book or author photo.
- Returns a direct HTTPS URL in the requested size (S/M/L)
- URLs can be embedded in markdown as
 - The Covers API always returns HTTP 200 — missing covers return a 1×1 placeholder GIF, not a 404, so the identifier format is validated locally first:
idmust be numeric,isbn10 or 13 digits,olidan edition OLID (OL…M) for targetbookand an author OLID (OL…A) for targetauthor
Resources
| Type | Name | Description |
|---|---|---|
| Resource | openlibrary://works/{work_id} |
Work detail by Open Library Work ID — title, description, subjects, cover IDs, and author IDs as injectable context |
| Resource | openlibrary://authors/{author_id} |
Author detail by Open Library Author ID — name, bio, dates, photo IDs, and linked external identifiers as injectable context |
Features
Built on @cyanheads/mcp-ts-core:
- Declarative tool definitions — single file per tool, framework handles registration and validation
- Unified error handling across all tools
- Pluggable auth (
none,jwt,oauth) - Swappable storage backends:
in-memory,filesystem,Supabase,Cloudflare KV/R2/D1 - Structured logging with optional OpenTelemetry tracing
- Runs locally (stdio/HTTP) or on Cloudflare Workers from the same codebase
Open Library-specific:
- Complete Open Library REST API integration — Search API, Search Inside (full-text) API, Books API, Authors API, Subjects API, Covers API
- Configurable
User-Agentheader for well-behaved bot identification per community convention - Work → editions → edition drill-down pattern with explicit linking between OLIDs across tools
- Internet Archive availability lookup (opt-in) for borrow/read status on search results
Agent-friendly output:
- Explicit recovery hints on empty results — echoes search criteria and suggests how to broaden
- All OLID cross-links surfaced in responses so agents can chain tool calls without re-searching
- Cover URLs rendered as embeddable markdown image syntax
Getting started
Self-Hosted / Local
Add the following to your MCP client configuration file.
{
"mcpServers": {
"openlibrary-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/openlibrary-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}
Or with npx (no Bun required):
{
"mcpServers": {
"openlibrary-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/openlibrary-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}
Or with Docker:
{
"mcpServers": {
"openlibrary-mcp-server": {
"type": "stdio",
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/openlibrary-mcp-server:latest"]
}
}
}
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcp
Prerequisites
- Bun v1.3.0 or higher (or Node.js ≥ 24.0.0).
- No API key required — Open Library is a free, public API.
Installation
- Clone the repository:
git clone https://github.com/cyanheads/openlibrary-mcp-server.git
- Navigate into the directory:
cd openlibrary-mcp-server
- Install dependencies:
bun install
Configuration
All configuration is validated at startup via Zod schemas in src/config/server-config.ts. Key environment variables:
| Variable | Description | Default |
|---|---|---|
MCP_TRANSPORT_TYPE |
Transport: stdio or http |
stdio |
MCP_HTTP_PORT |
HTTP server port | 3010 |
MCP_HTTP_ENDPOINT_PATH |
HTTP endpoint path where the MCP server is mounted | /mcp |
MCP_PUBLIC_URL |
Public origin override for TLS-terminating reverse-proxy deployments | none |
MCP_AUTH_MODE |
Authentication: none, jwt, or oauth |
none |
MCP_LOG_LEVEL |
Log level (debug, info, warning, error, etc.) |
info |
MCP_GC_PRESSURE_INTERVAL_MS |
Opt-in Bun-only forced-GC pressure loop (ms). Recommended starting point if heap growth is observed: 60000. |
0 (disabled) |
LOGS_DIR |
Directory for log files (Node.js only) | <project-root>/logs |
STORAGE_PROVIDER_TYPE |
Storage backend: in-memory, filesystem, supabase, cloudflare-kv/r2/d1 |
in-memory |
OPENLIBRARY_USER_AGENT |
User-Agent sent with all Open Library API requests. Include a contact email per community convention. | openlibrary-mcp-server/1.0 (openlibrary@archive.org) |
OTEL_ENABLED |
Enable OpenTelemetry | false |
Running the server
Local development
-
Build and run the production version:
# One-time build bun run rebuild # Run the built server bun run start:http # or bun run start:stdio -
Run checks and tests:
bun run devcheck # Lints, formats, type-checks, and more bun run test # Runs the test suite
Project structure
| Directory | Purpose |
|---|---|
src/mcp-server/tools |
Tool definitions (*.tool.ts). Ten tools across Search, Books, Authors, Subjects, and Covers. |
src/mcp-server/resources |
Resource definitions. Work and Author resources. |
src/services/open-library |
Open Library service layer — API client and domain types. |
src/config |
Server-specific environment variable parsing and validation with Zod. |
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/catchin tool logic - Use
ctx.logfor logging,ctx.statefor storage - Register new tools and resources in the
createApp()arrays
Contributing
Issues and pull requests are welcome. Run checks and tests before submitting:
bun run devcheck
bun run test
License
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
安装
把 openlibrary mcp server 添加到你的客户端。选择你正在使用的那个。
{
"servers": {
"openlibrary-mcp-server": {
"type": "http",
"url": "https://openlibrary.caseyjhand.com/mcp"
}
}
}Add to `.vscode/mcp.json` in your workspace.
claude mcp add openlibrary-mcp-server -- npx -y @cyanheads/openlibrary-mcp-servercodex mcp add openlibrary-mcp-server -- npx -y @cyanheads/openlibrary-mcp-serveramp mcp add openlibrary-mcp-server -- npx -y @cyanheads/openlibrary-mcp-server{
"mcpServers": {
"openlibrary-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/openlibrary-mcp-server"
]
}
}
}Add to `claude_desktop_config.json`, then restart Claude Desktop.
{
"mcpServers": {
"openlibrary-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/openlibrary-mcp-server"
]
}
}
}Add to `~/.cursor/mcp.json`, or `.cursor/mcp.json` for a single project.
{
"mcpServers": {
"openlibrary-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/openlibrary-mcp-server"
]
}
}
}Add to `~/.codeium/windsurf/mcp_config.json`.
{
"mcpServers": {
"openlibrary-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/openlibrary-mcp-server"
]
}
}
}Add to `cline_mcp_settings.json` via the MCP Servers panel.
{
"mcpServers": {
"openlibrary-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/openlibrary-mcp-server"
]
}
}
}Add to `~/.gemini/settings.json`.
{
"mcpServers": {
"openlibrary-mcp-server": {
"type": "local",
"command": "npx",
"args": [
"-y",
"@cyanheads/openlibrary-mcp-server"
],
"tools": [
"*"
]
}
}
}Add to `~/.copilot/mcp-config.json`, or run `/mcp add` inside the CLI.
{
"context_servers": {
"openlibrary-mcp-server": {
"command": {
"path": "npx",
"args": [
"-y",
"@cyanheads/openlibrary-mcp-server"
]
}
}
}
}Add to your Zed `settings.json`.
npx -y @cyanheads/openlibrary-mcp-serverRun `goose configure`, choose **Add Extension → Command-line Extension**, and paste this command.
10 个工具
openlibrary mcp server 向已连接的智能体提供 10 个工具。
- openlibrary_search_books
- Full-text book search with field filters (title, author, subject, publisher, ISBN, language), sort options, pagination, and optional live reading availability
- openlibrary_get_work
- Fetch a work by Open Library Work ID (OL…W) — title, description, subjects, cover IDs, and author IDs
- openlibrary_get_editions
- List editions of a work — publishers, languages, formats, ISBNs, and print run details
- openlibrary_get_edition
- Resolve up to 50 editions in one call by ISBN-10, ISBN-13, OCLC, LCCN, or Open Library Edition ID (OL…M), reporting per-identifier misses
- openlibrary_search_authors
- Search authors by name — returns Author IDs, birth/death dates, top works, and subject associations
- openlibrary_get_author
- Fetch 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_works
- List works by an author — titles, cover IDs, and Work OLIDs for drilling into editions or details
- openlibrary_get_subject
- Browse works by subject tag — returns matching works with edition counts and cover IDs plus the total work count
- openlibrary_search_inside
- Full-text search inside the scanned text of Internet Archive books — returns matching items with snippets
- openlibrary_get_cover_url
- Resolve a cover image URL for a book or author photo in S/M/L size — returns a direct HTTPS URL embeddable in markdown
评分
89 / 100
优秀
- 文档25/25
- 维护25/25
- 可信度13/20
- 能力11/15
- 安装体验15/15
- Documents what it does and how to connect
- Has a resolvable package or endpoint
- Exposes at least one tool, prompt or resource
- README has substantive content
- Includes a code example
- Documents its configuration
- Mentions credentials or security posture
- Last commit 7 days ago
- Has a release history
- Repository is not archived
- Licensed Apache-2.0
- Namespace verified in the official MCP registry
- Claimed by its owner
- Published under an organisation
- 10 tool(s) documented
- Provides prompt templates
- Provides resources
- 18 documented install method(s)
- Published to a package registry
- Offers a hosted endpoint — no local install
版本历史
| 版本 | 发布于 |
|---|---|
| 0.2.4最新 | 2026年8月25日 |
| 0.2.3 | 2026年7月26日 |
| 0.2.2 | 2026年7月26日 |
| 0.2.1 | 2026年7月26日 |
| 0.2.0 | 2026年7月26日 |
| 0.1.20 | 2026年7月26日 |
| 0.1.19 | 2026年7月25日 |
| 0.1.18 | 2026年7月13日 |
| 0.1.17 | 2026年7月13日 |
| 0.1.16 | 2026年6月20日 |
| 0.1.15 | 2026年6月16日 |
| 0.1.14 | 2026年6月16日 |
| 0.1.13 | 2026年6月13日 |
| 0.1.12 | 2026年6月4日 |
| 0.1.11 | 2026年6月2日 |
| 0.1.10 | 2026年5月30日 |
| 0.1.9 | 2026年5月29日 |
| 0.1.7 | 2026年5月24日 |
| 0.1.6 | 2026年5月24日 |
| 0.1.5 | 2026年5月24日 |
| 0.1.4 | 2026年5月24日 |
| 0.1.3 | 2026年5月24日 |
| 0.1.2 | 2026年5月24日 |