home / mcp / bookstore mcp server
Provides an MCP server to manage bookstore inventory and search, checkout, and stock operations.
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.
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.
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 syncIf 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 .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 8000When 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.
Retrieve the complete list of books available in the bookstore, including titles, authors, and IDs.
Fetch detailed information for a specific book by its ID.
Find books whose titles match a given string or pattern.
Find books written by a specified author.
List all books that currently have stock greater than zero.
Purchase a specified quantity of a book by its ID.
Check how many copies of a book are currently available for a requested quantity.
Increase the stock count for a specific book by its ID.