Skip to main content
Glama
Myrhoiazov

Shop Analytics MCP

by Myrhoiazov

Shop Analytics MCP

TypeScript製のMCPサーバーで、オンラインストアのSQLiteデータベースを安全に分析します。stdioのみで動作し、6つの専門ツールを提供します。任意のSQLは受け付けません。

要件

  • Node.js 24.10以上

  • npm

  • sqlite3 CLI(マイグレーションを再適用する場合のみ)

Related MCP server: mcp-analytics-server

インストールと起動

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: truePRAGMA query_only = ONで開かれます。

  • SQLiteオーソライザーは、書き込み、DDL、ATTACHDETACH、トランザクションを禁止します。

  • すべての値はSQLパラメータとしてバインドされます。

  • ツールはSQLを受け付けないため、エージェントは破壊的なステートメントを渡すことができません。

  • バリデーションエラーは、SQL、絶対パス、スタックトレースを公開しません。

テスト

npm test

テストは、8つの受け入れ質問の基準応答、国のパラメータへのSQLインジェクション、DELETEの禁止、一時データベースコピーのSHA-256不変性、stdioを介したMCPインタラクションをカバーしています。

受け入れ質問

  1. 利用可能なすべてのテーブルを表示し、各テーブルに含まれる情報を説明してください。

  2. ドイツからの顧客は何人ですか?

  3. 最も多くの顧客がいる国はどこですか?

  4. 最も多くお金を使った顧客は誰ですか?

  5. ベストセラー商品トップ5は何ですか?

  6. 売上上位3つの商品カテゴリは何ですか?

  7. 2025年に生み出した売上はいくらですか?

  8. 最も多くの注文をした顧客は誰ですか?

Install Server
F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI to query a business database for customers, orders, and revenue using natural language through safe, well-defined tools.
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables 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.
    1
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables safe exploration and analysis of SQLite databases through guarded read-only queries, schema inspection, aggregations, and CSV imports.
    5
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Provides read-only tools for querying a synthetic e-commerce dataset, including product categories, products, sales data, customer history, and order details.

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

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