Several interests and projects of mine recently aligned with each other: I have a large, disorganized library that I'd like to clean up, I wanted to do a project with AI dev tools to find out how well they really work, and I think AI in general is a pretty neat thing.
The end result was a full-featured MCP server to allow an AI agent to access Calibre libraries. I've seen a few others already written and posted, but they were all fairly simple and focused on read-only access - a useful thing, to be sure, but I wanted to give an AI agent the ability to
manage a library for me.
So here it is:
https://github.com/FaceDeer/calibre_full_mcp_server/
I've tested this pretty thoroughly on my own computer but this is the first time I've flung it out to the wild, so I highly recommend that if anyone else wants to use it they should make sure any libraries they give this access to are backed up just to be on the safe side. You can configure libraries with fine-grained permissions, so you can only give an AI write access to the specific libraries and the specific fields in those libraries that you want it to be able to write to, but the Internet is rife with tales of "I gave an AI agent access to the production servers and it deleted them!" So be aware of the risks. A lot of AI is still early days yet.
A quick bullet point list of features:
* Lets an agent search multiple libraries by metadata or by full text, retrieve book contents, and search book contents by text
* Read/write all metadata types, with fine grained permission control in the server's configuration
* Import/export books from pre-defined folders (the agent can't just read or write files wherever it wants, willy-nilly)
* Convert formats as needed using Calibre's file conversion tools
* Set log level to "info" to track your agent's every move. Or "debug" for a
huge spew of information.
I've been using Jan.ai with this MCP server to run tasks with it entirely offline, I've come up with a standard prompt that essentially tells the AI "search for a book that lacks a 'comment' field, read the first 30000 characters of the first such book you find, and update the 'comment' field with a summary and add tags" And I've been rather happy with the results. But I'm sure if other people use this they'll come up with uses I haven't tried or even thought of, and I'm keen for feedback.