Skip to main content
Glama
Myrhoiazov

Shop Analytics MCP

by Myrhoiazov

Shop MCP Server

SQLite 데이터베이스의 안전한 분석을 위한 TypeScript 기반 MCP 서버입니다. stdio로만 작동하며, 6개의 전용 도구를 제공합니다. 임의 SQL은 허용되지 않습니다.

요구 사항

  • Node.js 24.10 이상;

  • npm;

  • sqlite3 CLI는 마이그레이션 재적용에만 사용됩니다.

Related MCP server: Shop SQLite MCP

설치 및 실행

npm ci
npm run build
SHOP_DB_PATH=./shop.db npm start

SHOP_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 경로를 전달합니다.

도구

도구

설명

get_database_schema

테이블, 컬럼, 키 및 관계.

get_customer_metrics

국가별 고객 수 또는 최다 고객 국가.

get_product_sales

판매 수량 및 매출 기준 상품 순위.

get_category_revenue

카테고리별 매출 순위.

get_revenue_by_period

UTC 기간 [from, to)의 매출.

get_order_leaders

최다 지출 또는 최다 주문 고객.

재무 및 상품 지표와 주문 수는 cancelled를 제외합니다. 금액은 Eur 접미사가 있는 필드로 반환됩니다. 순위는 limit을 1에서 100까지 허용하며, 기간은 YYYY-MM-DD 날짜를 사용합니다.

사용 예시

아래는 MCP 클라이언트가 get_database_schema를 호출하여 테이블을 설명한 다음, get_customer_metrics를 호출하여 독일 고객 수를 집계하는 방법을 보여줍니다.

MCP 도구 호출 예시

보안

  • SQLite는 readOnly: true 및 PRAGMA query_only = ON으로 열립니다.

  • authorizer는 쓰기, DDL, ATTACH, DETACH 및 트랜잭션을 금지합니다.

  • 모든 값은 SQL 매개변수로 바인딩됩니다.

  • 도구는 SQL을 허용하지 않으므로 에이전트가 파괴적인 명령문을 전달할 수 없습니다.

  • 검증 오류는 SQL, 절대 경로 또는 스택 추적을 노출하지 않습니다.

테스트

npm test

테스트는 8가지 승인 질문에 대한 참조 응답, 국가 매개변수의 SQL 주입, DELETE 금지, 임시 데이터베이스 사본의 SHA-256 불변성 및 stdio를 통한 MCP 상호 작용을 다룹니다.

승인 질문

  1. 사용 가능한 모든 테이블을 보여주고 각 테이블에 포함된 정보를 설명하세요.

  2. 독일에서 온 고객은 몇 명인가요?

  3. 고객이 가장 많은 국가는 어디인가요?

  4. 가장 많은 돈을 지출한 고객은 누구인가요?

  5. 베스트셀러 상품 상위 5개는 무엇인가요?

  6. 매출 기준 상위 3개 상품 카테고리는 무엇인가요?

  7. 2025년에 발생한 매출은 얼마인가요?

  8. 가장 많은 주문을 한 고객은 누구인가요?

Available Tools

6 tools
get_category_revenueA

Rank non-cancelled categories by EUR revenue. Optional YYYY-MM-DD from/to and integer limit 1-100.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It discloses the non-cancelled filter, revenue-based ranking, and the limit constraint of 1-100, which adds useful behavior. However, it does not describe the output format, the ranking direction explicitly, or default behavior when date ranges are omitted.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with the purpose front-loaded ahead of parameter notes. Zero wasted words, and every phrase earns its place - scope, filter, metric, and input constraints are all covered efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for invocation - purpose, filter, and parameter constraints are all present. But with no output schema and no annotations, the return format and the meaning of 'ranked' (list of categories with revenue values, directional order, handling of omitted dates) are left to inference, which is a real gap for a short tool description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema is effectively empty (0 properties, additionalProperties: true), so the description is the only documentation of parameters. It names from/to date parameters with YYYY-MM-DD format and the limit with a 1-100 integer range, fully compensating for the bare schema. It could clarify that limit caps the number of returned categories, but it noticeably exceeds the schema's contribution.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Rank non-cancelled categories by EUR revenue'), which makes it distinguishable from siblings like get_revenue_by_period (time-based) and get_product_sales (product-based). The purpose is unambiguous, though it doesn't explicitly name those siblings to differentiate itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage context is implied rather than explicit: an agent can infer this is for revenue ranking by category, but there is no guidance on when to prefer it over get_revenue_by_period or get_product_sales, nor any exclusion criteria. The scope ('non-cancelled', 'EUR') gives some context but no alternative routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_customer_metricsB

Count customers in a country or find the top country. Parameters: mode=count_by_country with country, or mode=top_country without country.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations are absent, so the description carries the full burden. The description only states the two modes and parameter combinations. It doesn't disclose anything about the return format, whether the tool is read-only, performance implications, or any side effects. For a query tool that presumably reads data, this is a minimal disclosure. Given zero annotations, a score of 2 is warranted because the description doesn't clarify error behavior or output structure beyond the mode.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded: 'Count customers in a country or find the top country.' That is followed by parameter instructions. Two sentences, no fluff. It loses a point because it could be more structured, e.g., listing parameters explicitly, but it is efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that the schema provides no property definitions and there is no output schema, the description must explain both input and output. It explains modes but does not describe the return format or any caveats (e.g., does top_country return just the country name or also a count? Does count_by_country return a single number?). For an agent to call this correctly, it needs to know what output to expect, which is missing. The tool complexity is low, but with such sparse schema, the description is incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema is empty (no properties defined) and has additionalProperties true, but the description mentions parameters 'mode' and 'country'. Schema coverage is 100% because the schema is essentially empty, so the description provides the only meaning for parameters. It says 'mode=count_by_country with country' and 'mode=top_country without country', which clarifies the parameters. However, it doesn't specify the data types, allowed values for mode beyond two examples, or required status. Since the description does add essential meaning that the schema lacks, but it is not exhaustive, a 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states two modes: 'count customers in a country' and 'find the top country'. This is specific enough to distinguish from siblings like get_product_sales or get_revenue_by_period. However, it doesn't name any sibling tool, so it gets a 4 rather than a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear context for when to use each mode: 'mode=count_by_country with country' or 'mode=top_country without country'. It implies that if you want counts by country you use count mode, and if you want the top country you use top_country mode. No explicit exclusions or alternatives are named, but the conditions for each mode are clear. This is good but not fully explicit about when not to use this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_database_schemaA

Inspect tables, columns, keys, and relationships. Parameters: none.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must carry the burden, and 'Inspect' implies a read-only operation. It does not go further to state side effects, authorization needs, or that object types like indexes/constraints may be included, but the simple no-parameter introspection scope makes this acceptable.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two short sentences with no filler. The core behavior is front-loaded and every word contributes to understanding the tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter introspection tool, the description captures the essential return scope: tables, columns, keys, and relationships. It does not describe output formatting or exact return structure, but no invocation decisions are required.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the description explicitly states 'Parameters: none,' matching the empty input schema. With no parameters to define, the description provides all necessary semantic context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly specifies the resource (database schema) and the action (Inspect), and enumerates the concrete objects involved: tables, columns, keys, and relationships. This separates it from the sibling metric-focused tools without needing to open their definitions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not mention when to use this tool versus alternatives, nor does it explicitly say it is for structural introspection rather than data queries. However, the sibling list and the term 'schema' make the intended use contextually clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_order_leadersA

Find a customer with highest spend or most non-cancelled orders. mode=highest_spend accepts optional YYYY-MM-DD from/to; mode=most_orders accepts no dates.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of disclosing behavior. It explains mode semantics (date acceptance per mode) but doesn't disclose return format, edge cases (e.g., ties, no customers found), or any filtering/scoping behavior beyond the two modes. This is adequate but lacks rich behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One compact sentence that front-loads the core purpose and immediately adds functional details. It would earn a 5 with slightly clearer separation of mode semantics, but the density of information per word is high.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with zero parameters in the schema, the description covers the main functional dimensions (what modes exist, date handling). However, it lacks details on output shape, potential error conditions, or ordering behavior, which an agent might need. Given the tool's simplicity, it's reasonably complete but not fully comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema is empty (no properties defined), so the description fully compensates by documenting 'mode' parameter with its two values and date parameters in terms of format and applicability. Since schema coverage is listed as 100% but the schema literally has no properties, the description is the only source of parameter meaning and does it well.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool finds a customer with highest spend or most non-cancelled orders, which is a specific purpose distinguishing it from revenue/product-focused siblings. However, it doesn't explicitly name sibling tools for contrast, so it loses a point for not differentiating from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage through mode-based guidance (highest_spend vs most_orders) and date handling, but doesn't explicitly state when to prefer this over sibling tools like get_customer_metrics. The mode distinction provides some usage context, but no exclusion criteria or alternative routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_product_salesA

Rank non-cancelled products by units sold and EUR revenue. Optional YYYY-MM-DD from/to and integer limit 1-100.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations are absent, so the description carries full burden. It discloses operational behavior (excludes cancelled, returns ranking, supports date range and limit), which is above minimal. However, it does not mention edge cases, default responses, or how it handles malformed dates/limits, so it's adequate but not exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, front-loaded sentence with no filler. The core ranking purpose is first, followed by precise optional parameters with formats and ranges. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 0 params and no output schema, the description covers the essential behavior: what ranks, what filters apply, and parameter constraints. It lacks explicit mention of output structure, but since no output schema exists, the description's focus on the ranking result is reasonable. Minor gap: doesn't specify how limit behaves if omitted, but that's a small omission.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema is empty (0 params, 100% coverage), meaning the description is the only source of parameter meaning. It clearly specifies optional YYYY-MM-DD from/to and integer limit 1-100, which is valuable and sufficient for an agent to understand what can be passed even without a schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states a specific verb ('Rank'), resource ('products'), and scope ('non-cancelled'), and includes key dimensions (units sold, EUR revenue, date range, limit). Distinguishes from sibling tools by focusing on product-level ranking, not schema, customer metrics, or broader categories.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description provides context for when to use (ranking products by sales) and implies an alternative exists (e.g., get_category_revenue for category-level), but does not explicitly state when not to use or recommend a sibling. It gives enough for basic selection but lacks explicit exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_revenue_by_periodA

Calculate non-cancelled EUR revenue. Optional YYYY-MM-DD from/to define [from, to).

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It does disclose the half-open interval semantics [from, to) and the revenue filters (non-cancelled, EUR), which are useful behavioral details. However, it omits output format, aggregation method, and default period behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two tight sentences with the purpose stated first and no extraneous words. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple calculation tool with no output schema, the description covers the core purpose and parameters, but lacks behavioral and return-value context (e.g., whether it returns a scalar, a series, or a breakdown), leaving some ambiguity for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero properties and only allows additionalProperties, so the description is the sole source of parameter documentation. It explicitly names 'from' and 'to', specifies the YYYY-MM-DD format, and precisely defines the interval as half-open [from, to).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the verb 'Calculate' and the specific resource 'non-cancelled EUR revenue', with the time period implied by the optional from/to parameters. This differentiates it well from sibling tools like get_category_revenue or get_product_sales.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to choose this tool over siblings such as get_category_revenue or get_product_sales. The optional date range is descriptive, but there is no explicit routing or exclusion criterion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updatesv1.0.0
    • First observedget_category_revenue
    • First observedget_customer_metrics
    • First observedget_database_schema
    • First observedget_order_leaders
    • First observedget_product_sales
    • First observedget_revenue_by_period

TDQS

A3.9/5.0

Scored across 6 tools

Disambiguation5/5

Each tool targets a distinct entity or aggregation level: database schema, customer counts, product sales rankings, category revenue, total revenue, and customer leaders. Even though get_customer_metrics and get_order_leaders both involve customers, their purposes (country-level counts vs. individual customer extremes) are clearly separated. No two tools are likely to cause misselection.

Naming Consistency5/5

All tool names follow the consistent pattern 'get_' followed by a descriptive noun phrase, using snake_case throughout. Examples: get_database_schema, get_product_sales, get_revenue_by_period. This uniform phrasing makes the set predictable and easy to navigate.

Tool Count5/5

With 6 tools, the server is well-scoped for a shop analytics use case. It covers the essential query types without unnecessary proliferation, and each tool earns its place by addressing a distinct analytical question. The count is within the ideal range for a focused server.

Completeness4/5

The tool set covers key analytics workflows: schema inspection, customer metrics, product and category performance, total revenue, and top customer identification. Minor gaps include lack of time-series revenue breakdown (e.g., by day/month) and no list of customers beyond the leader, but the core analytical needs are met. These omissions are workable around.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants like Claude to query, analyze, and summarize local SQLite e-commerce databases using natural language through 11 tools, schema resources, and pre-built analytical prompts.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables safe, read-only analysis of an online store's SQLite database, providing schema introspection, restricted SELECT queries, and specialized analytics tools through MCP.
    -
  • A
    license
    A
    quality
    B
    maintenance
    Enables 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
    145 npm
    MIT
  • F
    license
    A
    quality
    C
    maintenance
    Enables 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
    -