mcp open library
A Model Context Protocol (MCP) server for the Open Library API that enables AI assistants to search for book information.
A Model Context Protocol (MCP) server for the Open Library API that enables AI assistants to search for book information.
A Model Context Protocol (MCP) server for the Open Library API that enables AI assistants to search for book information.
This project implements an MCP server that provides a tool for AI assistants to search the Open Library for book information by title. The server returns structured data about the most relevant book match, including title, authors, publication year, and other metadata.
# Clone the repository
git clone https://github.com/your-username/mcp-open-library.git
cd mcp-open-library
# Install dependencies
npm install
# Build the project
npm run build
You can use the MCP Inspector to test the server:
npm run inspector
Access the MCP Inspector and then test the tool e.g.
This server implements the Model Context Protocol, which means it can be used by any MCP-compatible AI assistant or client e.g. Claude Desktop. The server exposes the following tool:
get_book_by_title
: Search for book information by titleExample input:
{
"title": "The Hobbit"
}
Example output:
{
"title": "The Hobbit",
"authors": ["J.R.R. Tolkien"],
"first_publish_year": 1937,
"open_library_work_key": "/works/OL45883W",
"edition_count": 120
}
An example of this tool being used in Claude Desktop can be see here:
src/index.ts
- Main server implementationsrc/types.ts
- TypeScript type definitionssrc/index.test.ts
- Test suitenpm run build
- Build the TypeScript codenpm run watch
- Watch for changes and rebuildnpm test
- Run the test suitenpm run format
- Format code with Prettiernpm run inspector
- Run the MCP Inspector against the servernpm test
Contributions are welcome! Please feel free to submit a Pull Request.
[
{
"description": "Search for a book by its title on Open Library.",
"inputSchema": {
"properties": {
"title": {
"description": "The title of the book to search for.",
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
},
"name": "get_book_by_title"
}
]