Shop MCP Server
Provides read-only access to a SQLite database of shop data, with tools for retrieving customers, products, orders, and order items, as well as analytical reports like top customers, best-selling products, and revenue by period.
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., "@Shop MCP Server What are the top 5 best-selling products?"
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.
Shop MCP Server
A read-only MCP server that exposes the
shop.db SQLite database to AI consumers as domain entities and
analytic answers — not as raw tables and SQL.
Exposes
customers,products,orders,order_itemsas first-class read tools.Answers reporting questions (top customers by spend, best-selling products, top categories by revenue, revenue by period, customers by order count).
Read-only by design and by engine: no tool accepts arbitrary SQL, every prepared statement is asserted to be a
SELECT, and the database is opened withreadOnly: true.
Requirements
Node.js >= 22.5 (uses the built-in
node:sqlitemodule — no native dependencies).npmfor building.
Related MCP server: db-mcp
Setup
npm install
npm run build # compiles TypeScript to dist/
npm test # runs the read-only unit testsThe compiled server entry point is dist/index.js. Re-run npm run build
after any change to src/.
Configuration
By default the server reads ./shop.db in the working directory. Set the
DB_PATH environment variable to point at a different database file:
DB_PATH=/abs/path/to/shop.db node dist/index.jsThe server speaks MCP over stdio and is intended to be launched by an MCP client, e.g.:
{
"mcpServers": {
"shop": {
"command": "node",
"args": ["/abs/path/to/shop-mcp/dist/index.js"],
"env": { "DB_PATH": "/abs/path/to/shop.db" }
}
}
}Claude Code (.mcp.json), ChatGPT, and Antigravity all accept this shape.
Tools
Entity tools
Tool | Params |
|
|
|
|
|
|
|
|
get_orders with include_items: true attaches each order's line items.
Analytic tools
All take optional from/to date filters and a limit (default 10), except
revenue_by_period which takes group_by: "year" | "month".
Tool | Answers |
| Who spent the most? |
| Best-selling products? |
| Top categories by revenue? |
| Revenue in 2025 / by month? |
| Which customer placed the most orders? |
Cancelled-order semantics
Orders with status = 'cancelled' are excluded from all analytic
aggregates (spend / revenue / quantity), but remain visible via get_orders
(filterable by status).
Read-only model
Read-only is enforced in three independent layers:
No raw SQL — each tool is a fixed
SELECTtemplate with validated, whitelisted identifiers and value parameters bound via?placeholders.Runtime assertion — every built statement is asserted to match
/^\s*SELECT\b/ibefore it is prepared.Engine guarantee — the database is opened with
readOnly: true, so SQLite itself refuses any write regardless of tool input.
Data model
Table | Purpose |
| Customer profiles (name, email, phone, created_at) |
| Products (name, category, price, stock_quantity) |
| Orders (customer, order_date, status, total_amount) |
| Order line items (product, quantity, unit_price) |
orders.total_amount equals the sum of its order_items
(unit_price * quantity); revenue is derived from orders.total_amount.
Project layout
shop.db the SQLite database
docs/implementation-plan.md the design and tool plan
src/db.ts DB open (readOnly) + identifier/SELECT guards
src/index.ts MCP server setup + tool registration
test/db.test.ts read-only unit tests (node:test)
dist/ tsc build outputAvailable Tools
9 toolscustomers_by_order_countA
Top customers by number of orders placed. NOTE: unlike the other analytic tools, this counts ALL orders (cancelled orders are NOT excluded). Optionally filter by date range on order_date. Each row: { customer_id, name, orders }. Default limit 10.
Inputs: to, from, limit.
get_customersA
List customers. Optional search matches first_name, last_name, or email (case-insensitive substring). Returns rows with pagination metadata (data, total ignoring limit, limit, offset).
Inputs: limit, offset, search.
get_order_itemsA
List order line items. Filter by order_id and/or product_id. Each row includes the product name via a LEFT JOIN to products. Sorted by id by default.
Inputs: limit, offset, order_id, product_id.
get_ordersA
List orders. Filter by exact status (validated against the DB), customer_id, and/or a date range on order_date (from_date, to_date — ISO date or datetime strings). When include_items is true, attach an items array to each order. Sorted by id by default. Cancelled orders are shown here but excluded from analytic tools.
Inputs: limit, offset, status, to_date, +3 more.
get_productsA
List products. category must be an existing product category (validated against the DB). inStock filters to stock_quantity > 0. minPrice/maxPrice filter by price. Sorted by id by default.
Inputs: limit, offset, inStock, category, +2 more.
revenue_by_periodA
Revenue (sum of orders.total_amount) EXCLUDING cancelled orders, grouped by period. group_by = "year" (default) or "month" (-> YYYY-MM). Returns rows sorted by period ascending; a period with no data simply yields no row. Each row: { period, revenue }.
Inputs: to, from, group_by.
top_categories_by_revenueA
Top product categories by revenue (sum of order_items.quantity * unit_price), EXCLUDING cancelled orders. Each row: { category, revenue }. Default limit 10.
Inputs: to, from, limit.
top_customers_by_spendA
Top customers by total spend (sum of orders.total_amount), EXCLUDING cancelled orders. Optionally filter by a date range on order_date. Each row: { customer_id, name, orders, total_spent }. Default limit 10.
Inputs: to, from, limit.
top_products_by_quantityA
Top products by units sold (sum of order_items.quantity), EXCLUDING cancelled orders (JOINs orders to filter status and date). Each row: { product_id, name, category, units_sold }. Default limit 10.
Inputs: to, from, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct resource or metric, and the descriptions clearly separate raw entity queries from analytics. The only mild ambiguity is between top_customers_by_spend and customers_by_order_count, both returning top customer lists, though their ordering metrics differ.
Entity lookups consistently use get_* (get_customers, get_products, get_orders, get_order_items), while analytics mostly follow a noun_by_dimension pattern. customers_by_order_count breaks the top_* prefix used by other analytics tools, but the pattern remains predictable overall.
Nine tools is a well-scoped size for a shop-focused read/analytics server. Each tool covers a meaningful query surface without redundancy or excessive narrowness.
The server covers core shop data retrieval and key analytics dimensions: customers, products, orders, line items, revenue, and top lists. Minor gaps exist, such as no single-record detail endpoint or no direct product-to-category drill-down, but the surface is workable for typical reporting workflows.
Related MCP Connectors
Read-only answers from your business database, with the SQL and conditions behind each number.
Read-only Recharge store analytics: metrics, dimensions, and governed queries in plain language.
Ask about a Lightspeed Retail (R-Series) shop's sales, stock, customers, and work orders.
Query your own databases and Data Sets with read-only SQL, and build hosted dashboards.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables safe, read-only analysis of an online store's SQLite database, providing schema introspection, restricted SELECT queries, and specialized analytics tools through MCP.-
- FlicenseAqualityDmaintenanceEnables AI agents to safely interact with a SQLite shop database through schema discovery, read-only SQL queries, and pre-built analytics reports like top customers, top products, and revenue summaries.6-
- FlicenseNot gradedqualityDmaintenanceEnables read-only exploration and analysis of an included SQLite shop database through tools for listing tables, describing schemas, and running SQL queries.-
- FlicenseAqualityDmaintenanceEnables AI agents to answer analytical questions about an online store's SQLite database through specialized read-only tools, without any risk of modifying the underlying data.8-