Search books and authors, fetch editions, browse subjects, and resolve cover images.
Search books and authors, fetch editions, browse subjects, and resolve cover images from Open Library via MCP. STDIO or Streamable HTTP.
Open Library's catalog of 20M+ books, editions, authors, and subjects, plus full-text search across Internet Archive's scanned books. Search and browse from any MCP client, drill from a work into its editions or an author into their works, and resolve cover and author-photo URLs. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
| 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 |
| Resource | Description |
|---|---|
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.
openlibrary_search_books tooltitle:, author:, subject:, publisher:, isbn:, language:) or dedicated filter parameters; 1–100 results per page (default 10), offset paginationsort: relevance (default), new, old, rating, editionslanguage 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 droppedinclude_availability adds live Internet Archive borrow/read status (~200ms latency), off by defaultcontent[] text caps Internet Archive IDs and subjects at 5 each per work, structuredContent carries every oneopenlibrary_get_work tool/works/ prefix is strippedopenlibrary_get_author or openlibrary_search_books)content[] text caps subjects at 10; structuredContent carries the complete listnot_found when the Work ID doesn't existopenlibrary_get_editions toolnot_found when the Work ID doesn't existopenlibrary_get_edition toolid_type: isbn (10 or 13 digits), oclc (numeric), lccn (unchecked), or olid (OL…M)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 resolvessource: "work" recovered from the parent work when the edition itself lists noneebook_url when one existsopenlibrary_search_authors toolcontent[] text caps top subjects at 5 per author; structuredContent carries the complete listopenlibrary_get_author tool/authors/ prefix is strippednot_found when the Author ID doesn't existopenlibrary_get_author_works toolnot_found when the Author ID doesn't existopenlibrary_get_subject toolopenlibrary_search_inside toolia_identifier, not Open Library work IDs — match it against ia_identifiers from openlibrary_search_books to reach the catalogue recordcontent[] text caps snippets at 3 per item; structuredContent carries every snippetopenlibrary_get_cover_url toolid (numeric), isbn (10 or 13 digits), or olid (OL…M for target: "book", OL…A for target: "author"); size is S/M/L (default M).., and control characters fail as invalid_identifier, and an author lookup by isbn fails as invalid_targetopenlibrary://works/{work_id} resourceopenlibrary_get_work, as injectable application/json context for a conversation about a specific bookwork_id comes from openlibrary_search_books or openlibrary_get_author_worksopenlibrary://authors/{author_id} resourceopenlibrary_get_author, as injectable application/json context for a conversation about a specific authorauthor_id comes from openlibrary_search_authorsBuilt 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:
User-Agent header (OPENLIBRARY_USER_AGENT) identifying the server per Open Library's bot-blocking conventionAgent-friendly output:
openlibrary_get_author and openlibrary_get_author_works surface the canonical ID via an enrichment notice when a requested ID was mergedopenlibrary_get_edition returns resolved editions alongside typed unresolved reasons instead of failing the whole batchstructuredContent always carries the complete listA public instance is available at https://openlibrary.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"openlibrary-mcp-server": {
"type": "streamable-http",
"url": "https://openlibrary.caseyjhand.com/mcp"
}
}
}
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
git clone https://github.com/cyanheads/openlibrary-mcp-server.git
cd openlibrary-mcp-server
bun install
cp .env.example .env
# edit .env to override defaults — no required vars
| 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_SESSION_MODE | HTTP session posture: stateless, stateful, or auto. Overrides the stateless declared in src/index.ts. | stateless |
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 casey@caseyjhand.com |
OTEL_ENABLED | Enable OpenTelemetry | false |
See .env.example for the full list of optional overrides.
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 # Lint, format, typecheck, security
bun run test # Vitest test suite
bun run lint:mcp # Validate MCP definitions against spec
docker build -t openlibrary-mcp-server .
docker run --rm -p 3010:3010 openlibrary-mcp-server
The Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/openlibrary-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
| Directory | Purpose |
|---|---|
src/index.ts | createApp() entry point — registers tools and resources. |
src/config | Server-specific environment variable parsing and validation with Zod. |
src/mcp-server/tools | Tool definitions (*.tool.ts) — ten tools across Search, Books, Authors, Subjects, and Covers. |
src/mcp-server/resources | Resource definitions (*.resource.ts) — Work and Author. |
src/services/open-library | Open Library service layer — API client and domain types. |
tests/ | Unit and integration tests mirroring the src/ structure. |
See CLAUDE.md for development guidelines and architectural rules. The short version:
try/catch in tool logicctx.log for logging, ctx.state for storagecreateApp() arraysIssues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run test
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
Source-derived launch command. Check the maintainer’s required arguments and credentials before running:
npx -y @cyanheads/openlibrary-mcp-serverMerge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.
{
"mcpServers": {
"io-github-cyanheads-openlibrary-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/openlibrary-mcp-server"
]
}
}
}Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.
Claude Desktop setup referenceio.github.cyanheads/openlibrary-mcp-server works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.