MCP Server Open Library Book Search
Search Open Library with an MCP server to let AI assistants find book and author details from the Internet Archive.
npx -y @8enSmith/mcp-open-libraryOverview
MCP Server Open Library Book Search is a small Model Context Protocol (MCP) server that lets AI assistants query Open Library / Internet Archive data as tools. It exposes a set of MCP-compatible resources for searching books, looking up works and authors, and fetching edition metadata. By running this server alongside an assistant that supports MCP, you can let models retrieve factual book and author details from Open Library in real time.
This is useful when building assistants that need up-to-date bibliographic information, citations, cover links, author bios, or edition-level identifiers. Instead of embedding a large, stale database in the model, the assistant can call the MCP server to fetch live results and incorporate them into responses or reasoning chains.
Features
- MCP-compatible server that exposes book and author search tools
- Wraps Open Library / Internet Archive APIs and returns structured JSON
- Simple local deployment via Docker or Python
- Optional caching layer (to reduce repeated Open Library requests)
- Tools for: title/author search, work lookup, author lookup, editions listing, and cover URLs
- Small, readable codebase intended to be extended for custom needs
Installation / Configuration
Requirements: Python 3.10+ (or Docker).
Clone and run locally with pip:
# run the server (default port 8080)
Run with environment variables:
# Example environment variables
# seconds
Run with Docker:
# Build and run
Configuration options you may see in the repo:
- PORT: network port to bind (default 8080)
- CACHE_ENABLED: enable in-memory cache (true/false)
- CACHE_TTL: cache time-to-live in seconds
- OPEN_LIBRARY_BASE: base URL for Open Library API (useful for proxying/testing)
Available Tools / Available Resources
The server exposes a set of MCP-style tools/resources your assistant can call. Below is a compact summary.
| Tool name | Purpose | Input (example) | Output (summary) |
|---|---|---|---|
| open_library.search | Search for works/editions by query | {“q”:“Dune Herbert”} | list of matching works/editions with keys and scores |
| open_library.get_work | Fetch work metadata by work key | {“work_key”:“/works/OL123W”} | title, description, subjects, first_publish_date |
| open_library.get_author | Fetch author details by author key | {“author_key”:“/authors/OL456A”} | name, bio, birth/death dates, key |
| open_library.get_editions | List editions for a work | {“work_key”:“/works/OL123W”,“limit”:10} | editions with ISBNs, publish dates, publishers |
| open_library.get_cover | Resolve cover image URL for an edition | {“cover_id”:12345,“size”:“L”} | direct cover image URL (or null) |
These tools return structured JSON suitable for downstream reasoning or display by an assistant. The server acts as a thin adapter: it translates tool calls to Open Library endpoints, normalizes fields, and applies optional caching.
Use Cases
- Research assistant: An assistant can call open_library.search to find editions and then open_library.get_work to include a work description and basic publication facts in a reply.
- Library catalog enrichment: Fetch edition-level metadata and ISBNs to populate or verify a local catalogue.
- Citation helper: Use get_editions to pull publisher and year information to construct citations.
- Book discovery: Build a chat experience that suggests books by querying titles, authors, or subjects with the search tool.
Concrete examples
- Search for a book via curl against the MCP server (example tool route shown for clarity — the exact RPC endpoint depends on how you integrate MCP):
Server response (trimmed):
- From an assistant using MCP: the model issues a tool invocation with name “open_library.get_work” and args {“work_key”:“/works/OL262758W”}, and the server returns the work metadata for the model to cite or use.
Extending and Troubleshooting
- Extend tools by adding new routes that call other Open Library endpoints (covers, subject pages, etc.).
- If responses are missing expected fields, check the Open Library base URL and whether rate limits are hit; enable caching to reduce repeated requests.
- Logs usually print requests and errors to help debug malformed tool args.
Repository and issues: https://github.com/8enSmith/mcp-open-library — consult the repo for exact CLI names, manifest formats, and any updates to env vars or available resources.