SuperAPI AI Directory

mcp-open-library

mcp-open-library is a Model Context Protocol (MCP)-based server for interfacing with the Internet Archive's Open Library API, enabling AI assistants to search for book and author information. It provides seven read-only tools covering bibliographic searches by fields such as title, author, subject, publisher, and ISBN, author lookup by name, retrieval of author details via Open Library key, and retrieval of URLs for book covers and author photos. The server returns JSON projections of Open Library responses rather than raw data, and supports pagination and sorting. No installation or build is required; it can be run directly via npx and connected to MCP clients such as Claude Desktop, and can also be installed by name from the official MCP Registry.

Open website

About this tool

mcp-open-library is a Model Context Protocol (MCP) server for connecting to the Internet Archive's Open Library API, enabling AI assistants to search for book and author information. The project is maintained by 8enSmith.

Purpose: This project implements an MCP server that provides AI assistants with tools for interacting with Open Library. It allows searching the catalog by title, author, subject, and other fields, searching for authors by name, retrieving detailed author information via Open Library key, and retrieving URLs for book covers and author photos. The server returns JSON projections of Open Library responses rather than raw payloads.

Key capabilities (seven read-only tools):

  • search_books: Search across title, author, subject, place, person, publisher, and ISBN, with support for sorting and pagination.
  • get_book_by_title: Search for book information by title.
  • get_authors_by_name: Search for author information by name, with support for pagination.
  • get_author_info: Retrieve detailed information about a specific author using an Open Library Author Key.
  • get_author_photo: Retrieve the photo URL for an author using their Open Library ID (OLID).
  • get_book_cover: Retrieve the book cover image URL using various identifiers (ISBN, OCLC, LCCN, OLID, ID).
  • get_book_by_id: Retrieve detailed book information using various identifiers (ISBN, LCCN, OCLC, OLID).

Pagination and results notes: All search tools return at most limit results (default 10, maximum 50), along with num_found (the total number of matches), and can page through results via offset (maximum 1000). The two cover tools check whether the image actually exists, and if it does not, they state this explicitly rather than returning a URL pointing to a blank placeholder image.

Read-only and error handling: Each tool is a read-only query and declares its nature through readOnlyHint and openWorldHint annotations, which may allow clients to skip confirmation prompts shown for tools that could modify content. These are only hints: MCP The specification states that clients treat annotations as untrusted unless the server is trusted, so the confirmation policy is decided by the client. Failure cases (API unreachable, parameters rejected) are returned as tool results marked with isError, so the assistant can read the error reason and correct the next call, rather than the request failing outright.

Usage (install/run with npx): no installation or build required. Point the MCP client at this package and use npx; it will be fetched automatically on first run. In Claude Desktop, the configuration is written to claude_desktop_config.json; other clients use the same form. After restarting the client, the seven tools become available. Since v1.0.3, this server has been published to the official MCP Registry under the name io.github.8enSmith/mcp-open-library, and clients that support that registry can install it by this name.

Manual installation: Running the server requires node v22.21.1 (newer versions may also work, but this is the version used for testing). If nvm is installed, run nvm use. In the mcp-open-library root directory, run npm run build, then run npm run inspector. After building, click the URL with the MCP_PROXY_AUTH_TOKEN query string parameter to open the Inspector. In the Inspector, select the 'STDIO' transport, make sure the command is set to 'build/index.js', click the 'Connect' button to connect to the server, click 'Tools' in the menu bar at the top right, and you can try running tools, for example click get_book_by_title, enter 'The Hobbit' in the title box and click 'Run Tool'; the server will return the book details.

Tool parameters and examples: search_books requires at least one of q, title, author, subject, place, person, publisher, or isbn; otherwise the request is rejected, because an unfiltered search would match the entire catalog. q accepts free-form Solr queries, for example subject:cyberpunk AND first_publish_year:[1980 TO 1990]. language is an optional 3-letter MARC language code (such as eng, fre). sort is an optional sort order: new, old, random, key, rating, readinglog, want_to_read, currently_reading, already_read, or title; if omitted, relevance is used. limit is optional, 1–50, default 10; offset is optional, 0–1000, default 0.

The best_edition in search results is one specific edition of the work—the edition Open Library ranks best for the query—with that edition's own identifiers. Search results usually identify a work (open_library_work_key), but no tool accepts that key, so best_edition is the path from a search hit to a specific book. Its edition_key is an OLID and can be passed directly to get_book_by_id to get the full edition record, including its complete ISBN array. When Open Library does not have an ISBN for that edition, the isbn_13 / isbn_10 fields are omitted (about one third of results are like this), while edition_key is almost always present. When an edition lists multiple ISBNs of the same kind, only the first is reported; get_book_by_id returns all of them.

get_book_by_title searches for book information by title. get_authors_by_name searches for author information by name; the key of each result can be passed to get_author_info to get the author's full record (alternate_names is truncated in the example). get_author_info uses the Open Library Author Key to get detailed author information. get_author_photo uses the author OLID to get a photo URL; when Open Library does not have a photo for that author, the tool says so instead of returning a URL. get_book_cover accepts parameters: key (identifier type: ISBN, OCLC, LCCN, OLID, or ID), value (identifier value), size (optional cover size: S small, M medium, L large, default L); when there is no cover, it likewise returns a message instead of a URL. get_book_by_id accepts parameters: idType (identifier type: isbn, lccn, oclc, olid), idValue (identifier value).

Available scripts: npm run build builds the TypeScript code; npm run watch watches for changes and rebuilds; npm test runs the test suite in watch mode; npm run test:precommit runs the tests once and exits; npm run lint / npm run lint:fix use ESLint to check src and scripts; npm run format formats the code with Prettier; npm run inspector runs MCP Inspector against the server. npm test starts Vitest in watch mode; for a single run (used by the pre-commit hook and CI), use npm run test:precommit; there are also corresponding ways to run a single file or a single test case.

Release process: releases are automated. Pushing a v* tag triggers publish-mcp.yml, which runs checks, publishes the package to npm, registers the new version with the MCP Registry, and then creates a GitHub Release using that version's CHANGELOG.md section as the description. Both npm and the registry authenticate via GitHub OIDC, so there is no need to manage publish secrets. The version in package.json is the single source of truth. npm version derives everything else via version lifecycle hooks, so releasing takes just one command. There are two things to note before running: first write the changelog entry under the ## [Unreleased] heading in CHANGELOG.md; npm version will fail if that heading is missing; the working tree must be clean, and the pre-commit hook (lint + full test suite) runs within npm version. CI re-confirms before release that the tag, package.json, server.json, and CHANGELOG.md are consistent.

Project structure: src/index.ts is the MCP server, builds the HTTP client, and drives the two request handlers from the tool registry; src/index.test.ts tests the server wiring, including a snapshot of the published tool schemas; src/tools/<tool-name>/ has one directory per tool, containing index.ts (the handler, its Zod parameter schema, and ToolDefinition), index.test.ts, and, for tools with non-trivial API responses, types.ts describing the shape of that response; src/tools/registry.ts is the TOOLS array, the single list of what the server exposes; src/tools/types.ts is the ToolDefinition and ToolHandler contract; src/utils/ is shared plumbing; scripts/ is the release automation and its tests. A tool's input contract is declared once, as a Zod schema; the JSON Schema that MCP clients see is generated by toInputSchema, so the two cannot drift apart. Field descriptions come from .describe() on the Zod schema. Note that .refine() constraints are dropped in the conversion — cross-field rules must also be stated in the tool description, otherwise clients will never know about them. Adding a tool means creating a directory and adding an entry to TOOLS in src/tools/registry.ts.

Use cases: MCP client environments that need to query Open Library book and author information, or get cover or author photo URLs, through an AI assistant, such as Claude Desktop.

Limitations: all tools are read-only queries; search result pagination is limited (limit max 50, offset max 1000); when some editions lack an ISBN or a cover/photo, an explanation is returned instead of a link; the project is in English and does not provide a Chinese interface description. More contribution and acknowledgment information can be found in the repository.

Acknowledgments: Open Library API, Model Context Protocol.