Skip to main content
Glama
Shop Analytics MCP

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.

Inputs: no named parameters.

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.

Inputs: no named parameters.

get_database_schemaA

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

Inputs: no named parameters.

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.

Inputs: no named parameters.

get_product_salesA

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

Inputs: no named parameters.

get_revenue_by_periodA

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

Inputs: no named parameters.

Tool Schema Changelog

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

Loading tool schema changelog…

    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.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      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
      D
      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.
      -
    • F
      license
      A
      quality
      D
      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
      -
    • F
      license
      A
      quality
      D
      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
      -