MC

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.

Quick Install
npx -y @8enSmith/mcp-open-library

Overview

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:

git clone https://github.com/8enSmith/mcp-open-library.git
cd mcp-open-library
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# run the server (default port 8080)
python -m mcp_open_library.main

Run with environment variables:

# Example environment variables
export PORT=8080
export CACHE_ENABLED=true
export CACHE_TTL=300    # seconds
export OPEN_LIBRARY_BASE=https://openlibrary.org

python -m mcp_open_library.main

Run with Docker:

# Build and run
docker build -t mcp-open-library .
docker run -p 8080:8080 -e PORT=8080 mcp-open-library

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 namePurposeInput (example)Output (summary)
open_library.searchSearch for works/editions by query{“q”:“Dune Herbert”}list of matching works/editions with keys and scores
open_library.get_workFetch work metadata by work key{“work_key”:“/works/OL123W”}title, description, subjects, first_publish_date
open_library.get_authorFetch author details by author key{“author_key”:“/authors/OL456A”}name, bio, birth/death dates, key
open_library.get_editionsList editions for a work{“work_key”:“/works/OL123W”,“limit”:10}editions with ISBNs, publish dates, publishers
open_library.get_coverResolve 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

  1. 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):
curl -X POST "http://localhost:8080/tools/open_library.search" \
  -H "Content-Type: application/json" \
  -d '{"q":"title:Foundation", "limit":5}'

Server response (trimmed):

{
  "results": [
    {"key": "/works/OL262758W", "title": "Foundation", "author_name": ["Isaac Asimov"], "first_publish_year": 1951},
    ...
  ]
}
  1. 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.

Tags:search