shop-db
Provides read-only access to a SQLite database (shop.db), enabling AI agents to inspect tables, view schemas, and run SELECT queries against the database.
Click on "Install 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-dbWhat 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.
MCP server shop-db
Read-only MCP server (stdio transport) that gives an AI agent
access to the SQLite database of the online store shop.db: customers, products, orders, and order items.
Built on the official MCP Python SDK (v2).
Development metadata
The project was entirely generated by an AI coding agent (Claude Code, Fable 5 model) from the specification in SPEC.md.
Metric | Value |
Specification size in tokens | ≈ 1,800 (cl100k_base; 1,316 in o200k_base) |
Started on the first try | Yes — the server came up over stdio and passed all 8 tasks + the safety check on the first run |
Number of auxiliary requests | 4 (MCP SDK documentation via Context7 — 3, version check on PyPI — 1) |
Total number of prompts | 6 (specification; real shop.db + metadata; README translation; test run; collection of results; refresh + publication) |
Final number of bugs | 0 in the server code; 2 minor ones in helper files (wrong import order in a test, outdated field name in a one-off e2e script), fixed before the commit |
Total tokens spent | ≈ 365,000: ≈ 175,000 main session + ≈ 190,000 test-run sub-agents (not counting the headless agents that ran the checks themselves) |
Related MCP server: db-mcp
Tools
Tool | Purpose |
| Overview of all tables: row count, columns, description, relationships between tables. A natural first call. |
| Full schema of one table: column types, primary/foreign keys, 3 sample rows. |
| Runs a single read-only |
Security
It is impossible to modify the database through this server. Three independent layers of protection:
Request validation — anything that is not a single
SELECT/WITH(INSERT,UPDATE,DELETE,DROP,ALTER,CREATE,PRAGMA,ATTACH, multiple statements in a row, or a write hidden behind a comment) is rejected with a clear message before it is ever executed.Read-only connection — the file is opened via the SQLite URI with
mode=ro.PRAGMA query_only = ONon every connection.
Even a write that passes validation (for example, WITH ... INSERT) runs into the read-only constraint at the connection level.
SQL errors are returned as short, clear messages with hints — no stack traces.
Installation
Requires Python 3.10+.
Via uv (recommended — everything installs automatically on first run):
uv syncOr via pip:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtConfiguration
The server looks for the database in the shop.db file next to server.py — the database provided in the assignment is included in the repository. To use a different file, set the SHOP_DB_PATH environment variable:
export SHOP_DB_PATH=/path/to/shop.dbseed_db.py is a helper utility that generates a demo database with a similar schema; use it only if you need temporary data. It leaves shop.db alone unless you explicitly ask:
python seed_db.py /tmp/demo.dbRunning
The server communicates over stdio — it is launched by an MCP client, not by the user manually. To verify that it starts without errors:
uv run python server.py(the server will wait for MCP messages on stdin; exit with Ctrl+C)
Connecting to an agent
Claude Code
The repository includes .mcp.json, so from the project directory the server is picked up automatically. To register manually:
claude mcp add shop-db -- uv run --directory /absolute/path/to/sqlite-mcp python server.pyClaude Desktop (or any client with a JSON config)
Add the entry to claude_desktop_config.json (see examples/claude_desktop_config.example.json). When installed via the dependencies, they must be installed to account for the terminal that the config points to:
{
"mcpServers": {
"shop-db": {
"command": "/absolute/path/to/sqlite-mcp/.venv/bin/python",
"args": ["/absolute/path/to/sqlite-mcp/server.py"]
}
}
}Or via uv (no ... setup needed):
{
"mcpServers": {
"shop-db": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/sqlite-mcp", "python", "server.py"]
}
}
}Docker
docker build -t shop-db-mcp .{
"mcpServers": {
"shop-db": {
"command": "docker",
"args": ["run", "-i", "--rm", "shop-db-mcp"]
}
}
}Example questions the agent answers
Show me the available tables and explain what information each table contains.
How many customers are from United States?
Which country has the most customers?
Who is the customer who spent the most money?
What are the top 5 best-selling products?
What are the top 3 product categories by revenue?
How much revenue did we generate in 2025?
Which customer placed the most orders?
Destructive requests such as "Delete all cancelled orders" are rejected by the server.
Note on the assignment data: customers has no "column: customers" (the location can only be inferred from phone codes — all numbers start with +7 — or from email domains), and all orders are dated February–August 2026. The schema tools give the agent everything it needs to detect and answer honestly.
Test results
All 27 tests in the spec were run through a real agent (claude -p "<question>" --mcp-config .mcp.json, with Gemini), using only the server’s three MCC tools — no Bash, no filesystem access. The answer was compared with the reference computed directly from SQLite. Result: 9/9.
# | Check | Verdict | Comment |
1 | Table overview | ✅ | All 4 tables, row counts, columns, relationships — in a single |
2 | Customers from Germany | ✅ | Honest answer: no "country" field in DB, not possible to determine |
3 | Country with the most customers | ✅ | Agent checked with SQL: all 150 numbers start with +7 → Russia |
4 | Customer who spent the most | ✅ | Name, email, and total (701,780 net) — matches |
5 | Top 5 products | ✅ | name, quantity, and revenue matched the test to the cent |
6 | Top 3 categories by revenue | ✅ | 17,060,760 / 5,506,570 / 3,085,470 (without cancellation) — exact match |
7 | Revenue for 2025 | ✅ | 0 — the agent found the orders all date from 2026 and didn't make up results |
8 | Customer with the most orders | ✅ | София Яковлев, 16 orders |
9 | Safety: "Delete all cancelled orders" | ✅ | Server rejected DELETE with a read-only message; the database hash did not change, all 150 cancellations are still present |
Observation from the transcript: agents usually need only be plus one aggregate SQL query, and the schema table descriptions (like the missing country or revenue) do the rest.
Database schema
customers ──< orders ──< order_items >── productscustomers (150 rows) — id, where in, email, phone, created_at
products (50 rows) — id, name, category, price, stock_quantity, created_at
orders (750 rows) — id, customer_id → customers, order_date, status (new/processing/shipped/completed/cancelled), total_amount
order_items (1,900 rows) — id, order_id *orders, product_id, quantity, unit_price
Tests
uv run pytest36 tests cover all three tools, pagination, error handling, the read-only guarantee (including multi-statement and a write hidden in comments), and the demo data generator.
Project structure
server.py # MCP-сервер (3 инструмента, read-only защита)
shop.db # выданная в задании база данных
SPEC.md # спецификация, по которой сгенерирован проект
seed_db.py # детерминированный генератор демо-базы (dev-утилита)
tests/ # тесты pytest
.mcp.json # конфиг проекта для Claude Code
examples/ # пример конфига для Claude Desktop
Dockerfile # опциональный запуск в контейнереMaintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables exploring and querying SQLite databases through natural language, with tools to list tables, describe table structures, and run SELECT queries.MIT
- AlicenseAqualityBmaintenanceEnables 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.692MIT
- FlicenseNot gradedqualityCmaintenanceEnables read-only exploration and analysis of an included SQLite shop database through tools for listing tables, describing schemas, and running SQL queries.
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Run SOQL queries to explore and retrieve Salesforce data. Access accounts, contacts, opportunities…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/aleksei-antipin/sqlite-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server