Skip to main content
Glama
srgsanky

Personal Library MCP Server

by srgsanky

Personal Library MCP Server Demo

What is this?

This is a functional Model Context Protocol (MCP) server built with the FastMCP framework. It provides a structured interface for an AI model to interact with a local SQLite database that tracks a personal reading list.

Related MCP server: MCP Test Server

Why use it?

This project is a very simple demo designed to see the Model Context Protocol (MCP) in action. It serves as a minimal, "Hello World" style example to help you nail the basics of:

  • Resources: Exposing data (like a list of books) as readable URI-based resources.

  • Tools: Providing actionable functions (like adding or searching books) that an AI can call.

  • Client-Server Communication: Demonstrating how a client and server interact using the standard stdio transport.

Getting Started

Prerequisites

  • uv installed on your system.

  • Python 3.10 or later.

Setup and Running the Demo

  1. Initialize the Database: Create the SQLite database and populate it with sample data:

    uv run python init_db.py
  2. Run the Smoke Test: This script acts as a smoke test for your MCP server. It starts the server in the background and simulates how an AI model would interact with it (reading resources, calling tools) without needing an actual AI model connected:

    uv run python main.py

Project Structure

  • server.py: The MCP server implementation using FastMCP.

  • main.py: A smoke test script that demonstrates how to interact with the server.

  • init_db.py: A setup script to create the local books.db SQLite database.

  • pyproject.toml: Project configuration and dependencies (managed by uv).

  • books.db: The local SQLite database (created after running init_db.py).

Using as a Tool with AI Assistants

You can connect this server to any MCP-compatible client. Replace /absolute/path/to/mcp-demo with /Users/sanka/Documents/workspace/mcp-demo in the examples below.

1. Gemini CLI

You can add the server automatically using the Gemini CLI:

gemini mcp add --scope project personal-library uv --directory $(pwd) run python server.py

Or manually add this to .gemini/settings.json:

{
  "mcpServers": {
    "personal-library": {
      "command": "uv",
      "args": ["--directory", "/Users/sanka/Documents/workspace/mcp-demo", "run", "python", "server.py"],
      "trust": true
    }
  }
}

2. Claude Desktop

Add this to your claude_desktop_config.json (typically in ~/Library/Application Support/Claude/ on macOS):

{
  "mcpServers": {
    "personal-library": {
      "command": "uv",
      "args": ["--directory", "/Users/sanka/Documents/workspace/mcp-demo", "run", "python", "server.py"]
    }
  }
}

3. Cline (VS Code Extension)

Open the MCP Settings in Cline or edit cline_mcp_settings.json:

{
  "mcpServers": {
    "personal-library": {
      "command": "uv",
      "args": ["--directory", "/Users/sanka/Documents/workspace/mcp-demo", "run", "python", "server.py"]
    }
  }
}

Sample Prompts for AI Agents

Once you've connected the server to your favorite AI assistant, try these prompts:

  • List Resources: "What books are currently in my reading list?"

  • Search: "Find 'The Martian' in my library." or "Do I have any books by Frank Herbert?"

  • Add a Book: "Add 'Project Hail Mary' by Andy Weir to my library. It's a Sci-Fi book from 2021."

  • Update Status: "I just finished reading 'Dune', can you mark it as read?" or "I just bought 'The Road', mark it as owned."

  • Check Details: "Show me the full metadata for 'The Lord of the Rings'."

  • Combined Task: "Look at my library and tell me which Sci-Fi books I haven't read yet."

Naming Conventions

  • Server Name (Configuration): The key used in settings.json (e.g., "personal-library") is a unique identifier for your AI client to manage multiple servers.

  • Display Name (Code): The name passed to FastMCP("Personal Library Manager") in server.py is what appears in the UI of apps like Claude Desktop.

  • Tool/Resource Names: These (e.g., add_book, library://...) must match exactly between server.py and main.py.

You don't need to use these names in your prompts! The AI assistant automatically discovers all available tools and resources once the server is connected.

Available Tools

5 tools
add_bookC

Adds a new book to the library.

ParametersJSON Schema
NameRequiredDescriptionDefault
isbnYes
nameYes
authorYes
genreYes
yearYes
ownedNo
readNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Adds' implies a mutation/write operation, but the description doesn't cover critical aspects like permissions needed, whether duplicates are allowed, error handling, or what the output contains. It lacks details on side effects, rate limits, or authentication requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly. No extraneous information or redundancy is present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (7 parameters, mutation operation) and the presence of an output schema (which covers return values), the description is minimally adequate but incomplete. It states the basic purpose but lacks usage guidelines, parameter explanations, and behavioral details needed for a mutation tool with no annotations. The output schema helps, but the description should do more to guide the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 7 parameters (5 required), the description adds no meaning beyond the schema. It doesn't explain what 'isbn', 'genre', 'owned', or other parameters represent, their formats, or constraints. The description fails to compensate for the schema's lack of parameter explanations.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Adds') and resource ('a new book to the library'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'update_book_status' or 'delete_book', which would require mentioning it's for creation rather than modification or removal.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'update_book_status' or 'delete_book'. It doesn't mention prerequisites (e.g., required fields), exclusions, or contextual cues for selection, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

delete_bookB

Removes a book from the library.

ParametersJSON Schema
NameRequiredDescriptionDefault
isbnYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action is destructive ('Removes'), but lacks details on permissions needed, whether deletion is permanent or reversible, error handling, or rate limits. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core action, making it easy to scan and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a destructive operation with no annotations) and the presence of an output schema (which reduces the need to describe return values), the description is minimally adequate. However, it lacks critical details like behavioral traits and parameter context, making it incomplete for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It doesn't mention the 'isbn' parameter at all, failing to add meaning beyond the schema. However, with only one parameter, the baseline is higher, but the description doesn't explain what the ISBN is or how it's used, leaving a gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Removes') and resource ('a book from the library'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'update_book_status' which might also affect book availability, missing full sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention prerequisites (e.g., the book must exist), when not to use it (e.g., for temporary removal), or refer to siblings like 'update_book_status' for non-destructive changes.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_booksB

Lists books in the library. Set unread_only=True to see only the books you haven't read yet.

ParametersJSON Schema
NameRequiredDescriptionDefault
unread_onlyNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists books but doesn't mention whether this is a read-only operation, if it requires authentication, how results are paginated or sorted, or what the output format entails. This is a significant gap for a tool with potential behavioral nuances.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with two sentences that directly address the tool's function and key parameter usage. It's front-loaded with the core purpose and wastes no words, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter) and the presence of an output schema (which handles return values), the description is minimally adequate. However, it lacks context on behavioral traits like authentication needs or result limitations, and doesn't differentiate from siblings, leaving gaps in overall completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context for the 'unread_only' parameter by explaining its effect ('to see only the books you haven't read yet'), which goes beyond the schema's basic title and type. Since schema description coverage is 0% and there's only one parameter, this compensation is effective, though it could specify default behavior more explicitly.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Lists') and resource ('books in the library'), making it immediately understandable. However, it doesn't explicitly distinguish this from sibling tools like 'search_books' or 'update_book_status', which would require mentioning that this is a basic listing operation without filtering beyond unread status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'search_books' or 'add_book'. It mentions the 'unread_only' parameter but doesn't explain broader usage contexts, prerequisites, or exclusions, leaving the agent to infer when this tool is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_booksB

Searches for books by name or ISBN.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the search functionality but omits critical details such as whether this is a read-only operation, how results are returned (e.g., pagination, sorting), error handling, or performance characteristics. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It front-loads the core functionality ('Searches for books') and adds necessary detail ('by name or ISBN') without redundancy, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (a search function with one parameter) and the presence of an output schema (which likely covers return values), the description is minimally adequate. However, with no annotations and incomplete parameter guidance, it lacks sufficient context for optimal agent use, such as error conditions or search scope limitations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, but the description adds meaning by specifying that the 'query' parameter searches 'by name or ISBN'. This clarifies the parameter's purpose beyond the schema's basic type definition. However, it doesn't detail syntax, format constraints, or examples, so it only partially compensates for the schema gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Searches for') and resource ('books'), and specifies the search criteria ('by name or ISBN'). It distinguishes from siblings like 'list_books' by implying a query-based search rather than listing all books. However, it doesn't explicitly contrast with 'add_book' or 'delete_book', keeping it at a 4 rather than a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_books' (for browsing all books) or other siblings. It lacks explicit instructions on use cases, prerequisites, or exclusions, leaving the agent to infer usage from the tool name and context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

update_book_statusB

Updates the owned and/or read status of a book by ISBN.

ParametersJSON Schema
NameRequiredDescriptionDefault
isbnYes
ownedNo
readNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it's an update operation, implying mutation, but doesn't cover critical aspects like required permissions, whether changes are reversible, error handling, or rate limits. This leaves significant gaps for an agent to understand the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's front-loaded and appropriately sized for the task, earning a high score for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, mutation operation) and the presence of an output schema (which reduces the need to describe return values), the description is minimally adequate. However, with no annotations and low schema coverage, it lacks details on behavioral traits and parameter nuances, making it incomplete for optimal agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions updating 'owned and/or read status,' which aligns with the 'owned' and 'read' parameters in the schema, adding some semantic context. However, with 0% schema description coverage, it doesn't fully compensate by explaining parameter formats, defaults, or the 'isbn' requirement beyond what's implied. The baseline is 3 due to the partial alignment.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Updates') and the target resource ('owned and/or read status of a book by ISBN'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'add_book' or 'delete_book' beyond the 'update' verb, which is why it doesn't reach a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'add_book' for new books or 'delete_book' for removal. It lacks context about prerequisites, such as whether the book must already exist in the system, or any exclusions for its use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.1.0
    • First observedadd_book
    • First observeddelete_book
    • First observedlist_books
    • First observedsearch_books
    • First observedupdate_book_status

TDQS

A3.5/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no ambiguity: add_book, delete_book, list_books, search_books, and update_book_status each target specific operations in the library domain. The descriptions reinforce this clarity, such as list_books filtering unread books and update_book_status handling status changes, preventing misselection.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern using snake_case (e.g., add_book, delete_book, list_books). There are no deviations in style or convention, making the set predictable and easy to understand for an agent.

Tool Count5/5

With 5 tools, this server is well-scoped for a personal library domain. Each tool earns its place by covering core operations like adding, deleting, listing, searching, and updating books, without being overly sparse or bloated.

Completeness4/5

The tool set provides strong coverage for basic CRUD operations in a library context, including create (add_book), read (list_books, search_books), update (update_book_status), and delete (delete_book). A minor gap is the lack of a tool for editing book details beyond status (e.g., title or author), but agents can work around this with the existing tools.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    C
    quality
    D
    maintenance
    A testing server that demonstrates Model Context Protocol features, providing access to user data, todos, and system information through resources, tools for user management and calculations, and prompt templates for various analyses.
    4
    -
  • F
    license
    C
    quality
    D
    maintenance
    A reference implementation of a Model Context Protocol server that demonstrates core primitives including tools, resources, and prompts. It enables users to perform basic arithmetic operations and manage notes through a simple storage system.
    4
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that exposes tools for querying a bookstore inventory, allowing AI agents to search and retrieve book information via the Model Context Protocol.
    205 npm
    1
    MIT