home / mcp / bookstore mcp server

Bookstore MCP Server

Provides an MCP server to manage bookstore inventory and search, checkout, and stock operations.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "hongfanmeng-bookstore-mcp": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

You run an MCP server that exposes bookstore management and inventory tools over HTTP, so you can connect from clients like Cherry Studio and perform actions such as listing books, searching by title or author, checking stock, and processing purchases. This guide walks you through using the server, installing it, and configuring it for use with MCP clients.

How to use

Connect to the HTTP MCP endpoint to access the bookstore tools. The HTTP endpoint is http://localhost:8000/mcp and you start the server in HTTP mode on port 8000. Once connected, you can browse the catalog, search by title or author, check stock availability, restock items, and place purchases.

How to install

Prerequisites: Python 3.13 or higher and a package manager such as UV or pip.

Option 1 — Use UV (recommended)

Install UV if you do not have it yet, then clone and enter the project directory, and install dependencies which will ensure Python 3.13 and all required packages are available in a local virtual environment.

curl -LsSf https://astral.sh/uv/install.sh | sh
# 或在 Windows 上:
# powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Navigate to the project directory and install dependencies with UV, which will set up the virtual environment and install Python 3.13 and all needed packages into .venv.

cd mcp-bookstore
uv sync

Option 2 — Use pip with a virtual environment

If you prefer pip, set up a virtual environment, activate it, and install the package in editable mode so you can develop against it.

cd mcp-bookstore
python -m venv .venv
source .venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -e .

Start the MCP server in HTTP mode

Run the server in HTTP mode so you can integrate with MCP clients like Cherry Studio. Use UV if you started with UV, or use the active virtual environment if you installed dependencies with pip.

# Using UV
uv run fastmcp run src/bookstore_mcp/server.py -t http --port 8000

# Using an activated virtual environment
fastmcp run src/bookstore_mcp/server.py -t http --port 8000

Server startup message you will see

When the server starts, you will see a log line indicating the MCP server name and its HTTP endpoint, for example: INFO Starting MCP server 'BookStore' with transport 'http' on http://127.0.0.1:8000/mcp.

Available tools

get_all_books

Retrieve the complete list of books available in the bookstore, including titles, authors, and IDs.

get_book_by_id

Fetch detailed information for a specific book by its ID.

search_books_by_title

Find books whose titles match a given string or pattern.

search_books_by_author

Find books written by a specified author.

get_books_in_stock

List all books that currently have stock greater than zero.

buy_book

Purchase a specified quantity of a book by its ID.

check_availability

Check how many copies of a book are currently available for a requested quantity.

restock_book

Increase the stock count for a specific book by its ID.