Library Book MCP Server
A read-only MCP server that lets you query a library database of books and authors through 5 tools:
search_books: Search for books by partial title match and/or exact genre, with an option to filter for only available copies.get_book: Retrieve full details of a specific book (including author name) by its ID.books_by_author: Find all books by a specific author using a partial name match (e.g., "Borges" matches any author containing that name).list_authors: Get a complete list of all authors in the library along with their book counts.library_stats: Retrieve a summary of the entire library, including totals for titles, authors, and available copies.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Library Book MCP Serversearch for books by Stephen King"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP de ejemplo: Biblioteca de libros 📚
Un servidor MCP (Model Context Protocol) mĂnimo y de solo lectura, hecho en Python, que consulta una base de datos Postgres con libros y autores.
El objetivo es aprender cĂłmo un agente (por ejemplo en Azure AI Foundry) descubre y llama herramientas expuestas por un MCP.
¿Qué hace?
Expone 5 herramientas (tools) que el agente puede llamar:
Tool | Qué hace |
| Busca libros por tĂtulo y/o gĂ©nero, opcionalmente solo disponibles |
| Detalle completo de un libro por id |
| Libros de un autor (bĂşsqueda por nombre) |
| Todos los autores con su nĂşmero de libros |
| Resumen: totales de tĂtulos, autores y copias |
Related MCP server: PostgreSQL MCP Server
Requisitos
Docker (para Postgres)
Python 3.11+ (con
uvno hace falta tenerlo instalado; él descarga uno)uv (recomendado) o pip
Puesta en marcha
1. Levantar Postgres
docker compose up -dEsto levanta Postgres vacĂo. Las tablas y los datos de ejemplo los crea la
propia app al arrancar (init_db en server.py), asĂ que no hay que cargar
nada a mano.
Para reiniciar los datos desde cero:
docker compose down -v && docker compose up -d2. Instalar dependencias
Con uv (recomendado):
uv syncO con pip + venv:
python -m venv .venv && source .venv/bin/activate
pip install -e .3. Probar el servidor
La forma más rápida de ver las tools sin escribir un cliente es el MCP Inspector:
uv run mcp dev server.pySe abre una UI en el navegador donde puedes listar las tools y llamarlas a mano.
Para correrlo directamente (modo stdio, como lo lanzarĂa un agente):
uv run server.pyO usa el cliente de ejemplo incluido, que arranca el server, lista las tools y llama algunas (es la forma más fácil de ver la mecánica del protocolo):
uv run test_client.pyConectarlo a un cliente MCP
Ejemplo de configuraciĂłn para un cliente tipo Claude Desktop / Cursor
(mcpServers):
{
"mcpServers": {
"library": {
"command": "uv",
"args": ["run", "server.py"],
"env": {
"DATABASE_URL": "postgresql://library:library@localhost:5433/library"
}
}
}
}ConfiguraciĂłn
Variables de entorno:
Variable | Default | Para qué |
|
| ConexiĂłn a Postgres |
|
|
|
|
| Puerto HTTP (solo con |
|
| Al arrancar, crea el esquema y carga |
Seed automático: la app ejecuta
seed.sqlal arrancar (verinit_dbenserver.py). Es idempotente, asà que no duplica datos ni depende de mounts ni de tocar el contenedor de Postgres. Ponlo enfalsepara el proyecto real, donde normalmente no querrás sembrar datos desde la app.
Despliegue en Coolify
El server ya soporta transporte HTTP. En modo streamable-http expone:
GET /health→ok(para el health check)POST /mcp→ el endpoint del protocolo MCP (lo consume el agente/cliente)
La app se auto-inicializa: al arrancar crea el esquema y carga los datos de
ejemplo (seed.sql) si faltan. No hay que montar seed.sql ni tocar el
contenedor de Postgres.
Opción A — Docker Compose (recomendada)
Usa docker-compose.coolify.yml: levanta Postgres
MCP juntos.
En Coolify crea un recurso Docker Compose apuntando a tu repo y a
docker-compose.coolify.yml.(Opcional) Define
POSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_DBcomo variables del recurso; si no, usa los defaults (library).Asigna un dominio al servicio
mcp. Para enrutar al puerto interno del contenedor, escrĂbelo en el dominio:https://<tu-dominio>:8000. Coolify lo sirve pĂşblico en 443. No expongas la DB.
El endpoint MCP para el cliente/agente quedará en
https://<tu-dominio>/mcp. Health check: path/health(respondeok).
Opción B — Application (Postgres por separado)
Postgres: provisiona un contenedor Postgres manualmente (vacĂo; la app lo siembra sola al arrancar).
MCP: crea un recurso Application apuntando a tu repo (usa el
Dockerfile).Variables de entorno del MCP:
DATABASE_URL→ hostname interno del Postgres (nolocalhost), p. ej.postgresql://library:library@<servicio-postgres>:5432/library.MCP_TRANSPORT=streamable-http(ya viene en el Dockerfile).PORT=8000.
Health check: path
/health, GET. Puerto: 8000.
Probar la imagen en local (opcional)
docker build -t mcp-library .
docker run --rm -p 8000:8000 \
-e DATABASE_URL="postgresql://library:library@host.docker.internal:5433/library" \
mcp-library
curl http://localhost:8000/health # -> okEstructura
.
├── docker-compose.yml # Postgres 16 para desarrollo local
├── seed.sql # Esquema + datos de ejemplo (carga automática)
├── server.py # El MCP: FastMCP + tools (stdio o streamable-http)
├── test_client.py # Cliente de ejemplo para probar el MCP sin agente (stdio)
├── Dockerfile # Imagen del MCP para desplegar (Coolify, etc.)
├── .dockerignore
├── pyproject.toml # Dependencias
└── README.mdSiguientes pasos (ideas)
Agregar tools de escritura (crear/prestar libros) cuando quieras practicar acciones.
Cambiar el transporte a HTTP/SSE para conectar desde Azure AI Foundry.
Añadir recursos (
resources) además de tools, p. ej. exponer el esquema de la DB.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceA production-ready MCP server that enables safe, read-only SQL SELECT queries against PostgreSQL databases with built-in security validation. It features connection pooling, automatic row limits, and structured logging to ensure secure and reliable database interactions.Last updated53ISC
- Alicense-qualityCmaintenanceAn open-source MCP server for PostgreSQL schema introspection and guarded read-only queries. It enables MCP clients to discover schemas, tables, columns, indexes, relationships, and safe queryable data from a configured PostgreSQL database.Last updated30MIT
- Alicense-qualityCmaintenanceRead-only MCP server for accessing local Kindle library data, exposing tools to query profile, health, and book metadata.Last updatedMIT
- FlicenseAqualityCmaintenanceA read-only MCP server for Goodreads that enables LLMs to search for books, retrieve detailed book info with ratings and reviews, and explore recommendations, series, and author bibliographies using public data sources without requiring authentication.Last updated9
Related MCP Connectors
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
MCP server for managing Prisma Postgres.
MCP server for Project Gutenberg — 75,000+ public-domain ebooks with full plain-text retrieval.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/alianza86/cti-mcp-test'
If you have feedback or need assistance with the MCP directory API, please join our Discord server