Shelf-MCP
Manage a personal library of books, movies, TV shows, and games via Claude, with the ability to add items by photographing a shelf.
README
shelf-mcp
A personal library MCP server for books, movies, TV shows and games. Runs as a remote MCP server so the same library is reachable from Claude on desktop and mobile, and adds items from a photo of a shelf.
Runs entirely on free tiers: Prefect Horizon for hosting and OAuth, Neon for Postgres, Open Library and Google Books for metadata.
How the photo scan works
There is no OCR or vision service in this server, on purpose. When you attach a
shelf photo in the Claude app, the model reads the spines itself and calls
stage_scan with structured candidates. The server resolves each against Open
Library and Google Books, checks for duplicates by ISBN and title similarity,
scores its confidence, and returns the batch for review. Nothing enters the
library until you approve it and confirm_import runs.
That staging step is not ceremony. Spine reading fails in predictable ways — vertical text, occluded spines, publisher logos read as authors — and the resolver corrects most of it, but not all.
Layout
server.py MCP tools. Thin wrappers, no logic.
shelf/
config.py Environment settings
db.py asyncpg pool (PgBouncer-safe)
models.py Shared types and input models
enrich/ Open Library + Google Books, confidence scoring
repo/ SQL only
service/ Business logic — the REST API will import this
migrations/ Schema
The service layer never imports FastMCP. When the web app arrives it sits beside
server.py and calls the same functions.
Setup
Requires Python 3.11+.
git clone <your-repo> && cd shelf-mcp
pip install -e .
# Neon console -> Connect -> Pooled connection string
export DATABASE_URL="postgresql://...-pooler.../neondb?sslmode=require"
psql "$DATABASE_URL" -f migrations/001_generalize_schema.sql
fastmcp inspect server.py:mcp # shows what Horizon will see
python server.py # local stdio run
Deploying to Horizon
- Push to GitHub.
- At horizon.prefect.io, sign in with GitHub and pick the repo.
- Entrypoint
server.py:mcp. Turn Authentication on. - Add
DATABASE_URLas a secret. - Deploy. Test each tool in the Inspector before connecting anything.
- In Claude: Settings → Connectors → Add custom connector → paste
https://<name>.fastmcp.app/mcp.
Connectors are account-level, so it appears on your phone with no separate
mobile setup. Pushes to main redeploy automatically.
The data model, briefly
Three ideas do most of the work:
Ownership and progress are separate. Ownership belongs to the object
(owned, wishlist, lent, borrowed, sold, gone); progress belongs to
you (unstarted, in_progress, finished, abandoned). You can finish a book
and lend it out, and both facts survive.
Progress is a history. One row per read-through, watch-through or
playthrough, each with its own dates and rating. Rereading appends rather than
overwriting, so your 2019 opinion is still there. A partial unique index allows
only one in_progress record per item.
Copies are separate from items. One canonical set of metadata, many things you own. The paperback and the audiobook of the same book are one item with two copies.
Kinds and statuses are text with CHECK constraints rather than Postgres
enums, so adding boardgame or podcast later is a constraint swap instead of
an ALTER TYPE dance.
Enrichment coverage
Books resolve well. Movies, TV and games do not resolve at all — TMDB and IGDB
both require credentials, and wiring them in would cost this server its
"free, no signup" property. Add them in shelf/enrich/ behind an optional key
when you want them; nothing else has to change.
Backups
Neon's free plan keeps a 6-hour restore window and has no scheduled backups. This is your canonical data, so dump it somewhere periodically:
pg_dump "$DATABASE_URL" --no-owner --no-acl -Fc -f "shelf-$(date +%F).dump"
Not done yet
- Movies, TV and games work as data but have no enrichment.
- No REST API yet; the service layer is shaped for one.
- Covers are stored as URLs pointing at Open Library and Google, not copied.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.