Shop Analytics MCP Server
Provides read-only analytical access to an online store's SQLite database, including tools for customer and country statistics, top spenders, top-selling products, top revenue categories, and period revenue.
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 Analytics MCP Serverhow much revenue did we generate in 2025?"
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 Analytics MCP Server
A read-only MCP server, over stdio, that lets an AI
agent answer analytical questions about an online store's SQLite database
(customers, products, orders, order_items) — without ever being able to
modify it.
See SPEC.md for the full design rationale (decisions log, schema, security model, testing strategy).
Requirements
Node.js >= 24.10.0 (needed for
node:sqlite'ssetAuthorizer, used by the read-only guarantee below). Check withnode --version.No other runtime dependencies beyond what
npm ciinstalls.
Related MCP server: db-mcp
Install → configure → run → connect
npm ci
npm run build
SHOP_DB_PATH=./shop.db npm startshop.dbships in this repository, ready to use. If you ever need to regenerate it deterministically from the schema, runnpm run seed(see Database below).SHOP_DB_PATHis optional; it defaults toshop.dbin the current working directory. No absolute path is hard-coded anywhere in the source.The server speaks MCP over stdio only — there is no HTTP server and nothing else to run.
Connect an AI agent
Config examples for two clients are in config/:
config/claude-code.mcp.json— copy into a project's.mcp.json, or runclaude mcp add-jsonwith itsshop-analyticsentry. Fill in absolute paths forargs/envfirst.config/codex.mcp.toml— copy the[mcp_servers.shop-analytics]table into~/.codex/config.toml(or a project-scoped.codex/config.toml), or use thecodex mcp addcommand in the file's header comment.
To poke at the server manually without any specific agent, use the tool-agnostic MCP Inspector:
SHOP_DB_PATH=$(pwd)/shop.db npx @modelcontextprotocol/inspector node dist/src/index.jsTools
The server exposes exactly 8 specialized, read-only tools — no tool accepts or
executes arbitrary SQL. Every successful response is { "data": [...], "meta": {...} };
every error is a plain, safe, human-readable message (no SQL, file paths, or
stack traces), flagged with isError: true.
Tool | Answers | Key parameters |
| "Show me all tables and what they contain." | (none) |
| "How many customers are from Germany?" |
|
| "Which country has the most customers?" |
|
| "Who spent the most money?" |
|
| "What are the top 5 best-selling products?" |
|
| "What are the top 3 categories by revenue?" |
|
| "How much revenue did we generate in 2025?" |
|
| "Which customer placed the most orders?" |
|
from/to are YYYY-MM-DD and define a half-open UTC interval [from, to);
from must be strictly earlier than to. All financial and count metrics
exclude orders with status cancelled. Full per-tool contracts (exact response
shapes, tie-break rules) are in SPEC.md §4.
Safety
Three independent, defense-in-depth layers guarantee the database is never modified, even by an adversarial prompt like "Delete all cancelled orders":
The SQLite connection is opened with
readOnly: true.PRAGMA query_only = ONis set immediately after opening.A SQLite
authorizerexplicitly denies every write/DDL action (INSERT,UPDATE,DELETE,DROP,ALTER,CREATE,ATTACH,DETACH, transactions, ...).
On top of that, no tool accepts raw SQL, table names, or column names — every
query is a fixed prepared statement, and every input is validated with zod
and passed as a bound parameter, never string-interpolated.
Database
shop.db is generated from database/schema.sql by a
deterministic seed script — re-running it produces byte-identical data
every time (fixed PRNG seed, no wall-clock dependency):
npm run seed # builds, then (re)writes ./shop.db from schema.sql + the seed scriptThe seed script also asserts, at generation time, that the dataset has no ambiguous leaderboards (e.g. a unique top country, a unique top spender) and non-zero 2025 revenue — see SPEC.md §3.
Development
npm run build # tsc + copy database/schema.sql into dist/
npm run test:unit # business logic, in isolation, against fixture databases
npm run test:integration # spawns the built server over stdio via the MCP SDK client
npm test # bothThis project was built with TDD: for every module, a failing test was written first, then the implementation, tool by tool. The integration suite covers all 8 acceptance scenarios end-to-end, SQL-injection-shaped inputs, invalid parameter combinations, and asserts the database file's SHA-256 hash is unchanged after every run.
Project structure
database/ schema.sql + the deterministic seed generator
src/
db.ts read-only SQLite connection (see Safety above)
errors.ts error taxonomy, safe error formatting
validation.ts zod schemas shared across tools (dates, limits, periods)
period.ts half-open period SQL clause builder
tools/ one module per tool: pure query function + types
server.ts registers all 8 tools on the MCP server
index.ts stdio entrypoint
test/
unit/ one file per module/tool, fixture-based
integration/ spawns dist/src/index.js over stdio via the MCP SDK client
config/ example client configuration (Claude Code, Codex CLI)Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityCmaintenanceEnables secure analytics on an SQLite database of an online store via six specialized tools covering schema, customer metrics, product sales, category revenue, period revenue, and order leaders.6
- 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
- AlicenseAqualityBmaintenanceA read-only MCP server that lets AI agents run safe, specialized analytics over an internet shop's SQLite database, covering customers, products, orders, and revenue. It exposes no generic SQL or write tools, so agents can answer questions without modifying data.8MIT
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Read-only bank access for your AI agent. Connects Claude, ChatGPT, Cursor, Gemini, Codex.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
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/bogdaamn/database-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server