Shop Analytics MCP
Shop Analytics MCP
基于 TypeScript 的 MCP 服务器,用于安全分析在线商店的 SQLite 数据库。仅通过 stdio 工作,并提供六个专用工具;不接受任意 SQL。
要求
Node.js 24.10+;
npm;
sqlite3CLI 仅用于重新应用迁移。
Related MCP server: mcp-analytics-server
安装与运行
npm ci
npm run build
SHOP_DB_PATH=./shop.db npm startSHOP_DB_PATH 具有优先级。如果未设置该变量,服务器将在当前工作目录中查找 shop.db。数据库路径未硬编码在源代码中。
数据
仓库中包含已迁移的现成 shop.db。它包含客户国家和 2025 年的数据。货币值视为 EUR,不进行转换。
要一次性将迁移应用到原始数据库:
npm run migrate原始模式位于 database/schema.sql,确定性迁移位于 database/001-add-analytics-data.sql。
连接到客户端
现成的配置模板位于 config/:
claude-code.mcp.json;codex.mcp.json;cursor.mcp.json.
将所选模板中的 /absolute/path/to/mcp-server 替换为此项目的路径。所有配置都通过 stdio 运行 dist/src/index.js,并通过 SHOP_DB_PATH 传递 shop.db 的路径。
工具
工具 | 用途 |
| 表、列、键和关系。 |
| 某个国家/地区的客户数量或客户最多的国家/地区。 |
| 按已售数量和收入排名的商品排行榜。 |
| 按收入排名的类别排行榜。 |
| UTC 期间 |
| 消费最多或订单数最多的客户。 |
财务和商品指标以及订单数量均排除 cancelled。金额在带有 Eur 后缀的字段中返回。排行榜接受从 1 到 100 的 limit;期间使用 YYYY-MM-DD 日期。
使用示例
下面展示了 MCP 客户端如何调用 get_database_schema 来描述表,然后调用 get_customer_metrics 来统计来自德国的客户。

安全性
SQLite 以
readOnly: true和PRAGMA query_only = ON打开。SQLite authorizer 禁止写入、DDL、
ATTACH、DETACH和事务。所有值都作为 SQL 参数绑定。
工具不接受 SQL,因此代理无法传递破坏性语句。
验证错误不会泄露 SQL、绝对路径或堆栈跟踪。
测试
npm test测试覆盖八个验收问题的参考答案、国家/地区参数中的 SQL 注入、对 DELETE 的禁止、数据库临时副本的 SHA-256 不变性,以及通过 stdio 的 MCP 交互。
验收问题
显示所有可用的表,并解释每个表包含哪些信息。
有多少客户来自德国?
哪个国家的客户最多?
哪位客户消费最多?
销量前 5 的产品有哪些?
按收入排名的前 3 个产品类别是什么?
我们在 2025 年产生了多少收入?
哪个客户下的订单最多?
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
- FlicenseNot gradedqualityCmaintenanceEnables AI to query a business database for customers, orders, and revenue using natural language through safe, well-defined tools.
- AlicenseNot gradedqualityBmaintenanceEnables LLMs to interact with a SQLite e-commerce database via safe, typed MCP tools with read-only guards and auth-gated mutations, plus a Claude agent for answering business questions.1MIT
- AlicenseAqualityCmaintenanceEnables safe exploration and analysis of SQLite databases through guarded read-only queries, schema inspection, aggregations, and CSV imports.5MIT
- FlicenseNot gradedqualityCmaintenanceProvides read-only tools for querying a synthetic e-commerce dataset, including product categories, products, sales data, customer history, and order details.
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.
Privacy-first web analytics. Query pageviews, referrers, trends, and AI insights.
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/Myrhoiazov/mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server