Shop Analytics MCP Server
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.
전체 설계 근거(의사결정 로그, 스키마, 보안 모델, 테스트 전략)는 SPEC.md를 참조하세요.
요구 사항
Node.js >= 24.10.0 (
node:sqlite의setAuthorizer를 사용하며, 아래의 읽기 전용 보장에 사용됩니다).node --version으로 확인하세요.npm ci가 설치하는 것 외에 다른 런타임 의존성은 없습니다.
Related MCP server: db-mcp
설치 → 구성 → 실행 → 연결
npm ci
npm run build
SHOP_DB_PATH=./shop.db npm startshop.db는 이 저장소에 포함되어 있으며 즉시 사용할 수 있습니다. 스키마로부터 결정적으로 다시 생성해야 한다면npm run seed를 실행하세요(아래 데이터베이스 참조).SHOP_DB_PATH는 선택 사항이며, 기본적으로 현재 작업 디렉터리의shop.db를 사용합니다. 소스 어디에도 절대 경로가 하드코딩되어 있지 않습니다.서버는 stdio 전용으로 MCP를 통신합니다. HTTP 서버를 실행하거나 다른 작업은 없습니다.
AI 에이전트 연결
두 클라이언트의 구성 예시는 config/에 있습니다:
config/claude-code.mcp.json— 프로젝트의.mcp.json에 복사하거나, 해당shop-analytics항목으로claude mcp add-json을 실행하세요. 먼저args/env에 절대 경로로 채워 넣으세요.config/codex.mcp.toml—[mcp_servers.shop-analytics]테이블을~/.codex/config.toml(또는 프로젝트 범위의.codex/config.toml)에 복사하거나, 파일의 헤더 주석에 있는codex mcp add명령을 사용하세요.
특정 에이전트 없이 서버를 직접 다뤄보려면, 도구에 구애받지 않는 MCP Inspector를 사용하세요:
SHOP_DB_PATH=$(pwd)/shop.db npx @modelcontextprotocol/inspector node dist/src/index.js도구
The full per-tool contracts ... but in Korean:
서버는 정확히 8개의 특화된 읽기 전용 도구를 노출합니다. 어떤 도구도 임의의 SQL을 받아들이거나 실행하지 않습니다. 모든 성공 응답은 { "data": [...], "meta": {...} } 형태이며, 모든 오류는 isError: true로 표시된, SQL이나 파일 경로, 스택 트레이스가 없는 안전한 사람이 읽을 수 있는 일반 메시지입니다.
도구 | 답변 | 핵심 매개변수 |
| "모든 테이블과 그 내용을 보여 줘." | (없음) |
| "독일에서 온 고객은 몇 명인가?" |
|
| "어느 나라에 고객이 가장 많나?" |
|
| "누가 가장 많은 돈을 썼나?" |
|
| "가장 많이 팔린 상품 5개는 무엇인가?" |
|
| "매출 기준 상위 3개 카테고리는?" |
|
| "2025년 매출은 얼마인가?" |
|
| "가장 많은 주문을 한 고객은?" |
|
from/to는 YYYY-MM-DD 형식이며 반개방 UTC 구간 [from, to)을 정의합니다. from은 반드시 to보다 이전이어야 합니다. 모든 금액 및 개수 관련 지표는 상태가 cancelled인 주문을 제외합니다. 각 도구의 완전한 계약(관한 정확한 응답 형태, 동점 시 처리 규칙)은 SPEC.md §4에 있습니다.
안전
"모든 취소된 주문을 삭제하세요" 같은 적대적 프롬프트에도 데이터베이스가 절대 수정되지 않도록 보장하는 세 가지 독립적인 심층 방어 계층이 있습니다:
SQLite 연결이
readOnly: true로 열립니다.연결을 연 직후
PRAGMA query_only = ON이 설정됩니다.SQLite의
authorizer가 모든 쓰기/DDL 작업(INSERT,UPDATE,DELETE,DROP,ALTER,CREATE,ATTACH,DETACH, 트랜잭션 등)을 명시적으로 거부합니다.
그 위에 어떤 도구도 원시 SQL, 테이블 이름, 컬럼 이름을 받지 않습니다. 모든 쿼리는 고정된 prepared statement이며, 모든 입력은 zod로 검증되고 문자열을 직접 연결하는 일 없이 바인딩된 매개변수로 전달됩니다.
데이터베이스
shop.db는 결정적 시드 스크립트가 database/schema.sql에서 생성합니다. 다시 실행할 때마다 바이트 단위로 동일한 데이터를 생성합니다(고정된 PRNG 시드, 벽시계에 의존하지 않음):
npm run seed # builds, then (re)writes ./shop.db from schema.sql + the seed script시드 스크립트는 생성 당시 데이터셋에 모호한 리더보드가 없다는 점(예: 유일한 최상위 국가, 유일한 최고 지출 고객)과 2025년 매출이 0이 아닌 것을 검증합니다 — SPEC.md §3 참조.
개발
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 # both이 프로젝트는 TDD 방식으로 개발되었습니다. 각 모듈마다 먼저 실패하는 테스트를 작성하고, 그다음 구현을 도구별로 수행했습니다. 통합 테스트 스위트는 8가지 인수 시나리오를 종단 간(end-to-end)으로, SQL 인젝션 형태의 입력, 잘못된 매개변수 조합을 다루며, 모든 실행 후 데이터베이스 파일의 SHA-256 해시가 변경되지 않았음을 검증합니다.
프로젝트 구조
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