LibraryMCP
Click on "Deploy 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., "@LibraryMCP search for books about space and borrow one for member M001"
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.
Library Server
A small MCP server modeling a library, plus a client that drives it with the OpenAI Agents SDK. Uses uv for environment and dependency management.
Files
app.py— the MCP server (4 tools, 2 resources, 1 prompt)client.py— connects toapp.pyover stdio using an Agents SDK agentpyproject.toml— project + dependency definition (uv reads this)uv.lock— locked dependency versions (commit this alongside pyproject.toml)
Related MCP server: MCP Open Library & File Search Server
1. Install uv (if you don't have it yet)
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"Restart your terminal, then confirm it's on PATH:
uv --version2. Set up the project in VS Code
Open this folder in VS Code, open a terminal (Ctrl+` / Cmd+`),
and sync dependencies from the lockfile:
uv syncThis creates a .venv in the project folder and installs exactly what's
pinned in uv.lock. Point VS Code at it: Command Palette
(Ctrl+Shift+P) → Python: Select Interpreter → pick the one at
.venv/bin/python (or .venv\Scripts\python.exe on Windows).
You don't need to manually activate the venv for the commands below —
uv run does that for you automatically.
3. Verify the server structure
This is the check the assignment asks for — it should report 4 tools, 1 prompt, 1 resource, 1 template:
uv run fastmcp inspect app.pyExpected output:
Components
Tools: 4
Prompts: 1
Resources: 1
Templates: 1You can also run the server directly to confirm it starts cleanly
(it just sits there listening on stdio — Ctrl+C to stop):
uv run python app.py4. Run the client
The client normally needs an LLM provider to decide which tools to invoke. This project defaults to using a local LLM (via Ollama) instead of the remote OpenAI API.
Option A — Use the local LLM (default)
Ensure an Ollama daemon is running and the model referenced in
client.pyis available (the client expectshttp://localhost:11434/v1andmodel="gemma4:e4b"by default).Then run:
uv run python client.pyOption B — Use OpenAI instead
Set your OpenAI API key in the environment:
# macOS / Linux
export OPENAI_API_KEY="sk-..."Edit
client.pyto construct an OpenAI-backed model (or replace the local model block) so the client uses your OpenAI credentials, then run:
uv run python client.pyclient.py spawns app.py as a subprocess automatically via MCPServerStdio, using uv run python app.py as the launch command — so it always runs inside this project's own uv-managed environment.
What should happen
The agent receives: "Find me books about space, then borrow one for member M001." It should:
Call
search_books("space")→ finds 2001: A Space Odyssey (the only catalog entry with "space" in the title — matches per the assignment's title/author search spec).Call
borrow_book("9780451457998", "M001")→ decrements its stock and records the borrow in M001's history.Print a final natural-language summary confirming both steps.
If you want to see the raw tool-call trace (not just the final answer),
add print(result.new_items) after result = await Runner.run(...) in
client.py, or inspect result.raw_responses.
Adding more dependencies later
Don't pip install directly into the venv — use uv so pyproject.toml
and uv.lock stay in sync:
uv add some-packageNotes on design choices
All four tools return plain strings for both success and error cases (e.g. no copies left, unknown ISBN) — never exceptions — so a calling LLM always gets something it can read and relay to the user.
search_booksmatches onlytitle/author(per the assignment spec), case-insensitively, substring match.The dynamic resource (
member://{member_id}/history) returns JSON as a string; FastMCP resource functions need to returnstr/bytes/specific content types, not raw Python lists of dicts.The mock catalog is 8 well-known sci-fi/fantasy titles; stock levels are deliberately mixed (some at 0) so you can test both the success and no-copies-left paths in
borrow_book.
Available Tools
4 toolsborrow_bookA
Borrow a copy of a book on behalf on a library member.
Use this tool when the user wants to check out / borrow a specific book and you already know the ISBN and the member's ID. This reduces the book's availability count by one and records the borrow in the member's history. If there are no copies left or the ISBN/member_id is invalid, and error is returned as a string rather than raised an exception - check the return value before telling the user the borrow succeeded.
Inputs: isbn (required), member_id (required). Returns: result
check_availabilityA
Check how many copies of a specific book are available to borrow.
Use this tool when the user (or another tool call) already has an ISBN and wants to know stock levels before attempting to borrow, or just want a quick status check on a book.
Inputs: isbn (required). Returns: result
return_bookA
Return a previously borrowed book on behalf of a library member.
Use this tool when the user wants to return / check in a book they have borrowed. This increases the book's available copy count by one and records the return in the member's history. Errors (unknown ISBN or empty member_id) are returned as strings, never raised.
Inputs: isbn (required), member_id (required). Returns: result
search_booksA
Search the library catalog by title or author (case-insensitive, partial matches allowed).
Use this tool whenever the user wants to find books, browse what's available on a topic, or look up a specific author/title but doesn't already know the ISBN. Return a list of matching book records (title, author, isbn, available_copies), or a plain string message if nothing matches.
Inputs: query (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct operation: search, availability check, borrow, and return. The descriptions clearly delineate when each should be used (search when ISBN unknown, check_availability when ISBN known, borrow/return with ISBN + member). No two tools have overlapping purposes.
Three tools follow a consistent verb_noun pattern (search_books, check_availability, borrow_book, return_book). The pair borrow_book/return_book is perfectly symmetric. Only check_availability deviates slightly by using a gerund-ish structure instead of an imperative verb, though it remains readable and predictable.
Four tools is within a reasonable range for a library catalog server, but it's on the thinner side. The core borrow/return/search/check lifecycle is covered, yet one might expect more tools for a fuller library domain (e.g., catalog a new book, list member history, list popular books). Still, the stated purpose is narrow enough that 4 is defensible.
The core borrowing lifecycle is covered: search to find a book, check availability, borrow, and return. However, there are notable gaps such as no way to list a member's borrowing history, no add_book/register member operations, and no reservation/hold feature. A member could not get a full picture of their loans without an additional tool, creating potential dead ends.
Maintenance
Related MCP Connectors
Read-only MCP server exposing a user ORANO library to their own AI agent.
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- FlicenseAqualityDmaintenanceAn MCP server for managing local Calibre libraries using the calibredb CLI. It allows users to search books, manage metadata, and retrieve EPUB file paths through natural language commands.7-
- AlicenseBqualityDmaintenanceMCP server that enables searching books by author via Open Library API and searching keywords inside local text files.2164 npmMIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that exposes tools for querying a bookstore inventory, allowing AI agents to search and retrieve book information via the Model Context Protocol.547 npm1MIT
- AlicenseAqualityDmaintenanceA library management MCP server supporting book search, member management, and loan operations through natural language commands.134MIT