mcp-shop-server
mcp-shop-server
MCPサーバー。AIエージェントにオンラインストアのSQLiteデータベース(customers、products、orders、order_items)への読み取り専用アクセスを提供する。エージェントはこれを介してデータに関する分析的な質問(データベース構造、顧客・商品・カテゴリ別の集計、売上)に回答する。トランスポートはstdio。
データベースへの書き込みはby design不可能。3つの独立した保護レイヤー(mode=ro接続、実行前のクエリ検証(SELECT / WITH ... SELECTのみ)、sqlite3-authorizer)による。
計測結果、エビデンス、仕様からの逸脱は REPORT.md を参照。
使用方法
1. クローン
git clone https://github.com/andreykutsenko/mcp-shop-server.git
cd mcp-shop-serverリポジトリには既に shop.db(顧客150件、商品50件、注文750件、注文明細1900件)が含まれている。
2. 依存関係のインストール
uv venv .venv
uv pip install --python .venv/bin/python -r requirements.txtuvを使わない場合も、標準的な手段で同じことを行う:
python3 -m venv .venv
.venv/bin/pip install -r requirements.txtPython 3.11+が必要。依存関係: mcp(公式MCP SDK)とテスト用のpytest。データベース操作は標準ライブラリのsqlite3を使用。
3. エージェントの設定に記述
最小構成:
{
"command": "python",
"args": ["/absolute/path/to/mcp-shop-server/server.py"]
}mcpServersブロックを持つクライアント(Claude Desktop、Cursor、および互換クライアント)向けの実用的な例:
{
"mcpServers": {
"shop-db": {
"command": "/absolute/path/to/mcp-shop-server/.venv/bin/python",
"args": ["/absolute/path/to/mcp-shop-server/server.py"],
"env": {
"MCP_SHOP_DB": "/absolute/path/to/mcp-shop-server/shop.db"
}
}
}
}Claude Codeの場合は1コマンドで十分:
claude mcp add shop-db -- /absolute/path/to/mcp-shop-server/.venv/bin/python /absolute/path/to/mcp-shop-server/server.pyMCP_SHOP_DBは任意: 環境変数が設定されていない場合、サーバーはserver.pyと同じディレクトリのshop.dbを使用する。データベースが別の場所にある場合は指定すること。インタープリタは.venv内のものを指定するのが望ましい。そうしないと、システムのpythonがmcpパッケージを見つけられない可能性がある。
4. 起動
サーバーはエージェントが起動する。手動で行うことは稀:
.venv/bin/python server.pyプロセスはstdinでJSON-RPCを静かに待機する。診断情報はstderrに出力され、stdoutはMCPプロトコルで占有される。
5. 確認とエージェントへの質問
.venv/bin/python -m pytest -q接続後、エージェントは3つのツールを認識する。質問は自然言語で行う。
宿題のテキストにある8つのタスク — 確認のためにはこれらを実行するのが良い:
1. Show me all available tables and explain what information each table contains.
2. How many customers are from Germany?
3. Which country has the most customers?
4. Who is the customer who spent the most money?
5. What are the top 5 best-selling products?
6. What are the top 3 product categories by revenue?
7. How much revenue did we generate in 2025?
8. Which customer placed the most orders?⚠️ タスク2、3、7は提供されたデータベースでは解がなく、これは想定どおりである。
customersには国を示すカラムがなく、150人の顧客全員がロシアの電話番号を持つ。 750件の注文はすべて2026年の日付で、2025年のデータは存在しない。この場合、サーバーはデータを捏造しない: そのようなフィールドがスキーマに存在しないことを報告し、既存のカラムを列挙する。コードには何もハードコードされておらず、スキーマはデータベースから読み取られるため、
countryが存在する別のデータベースでは、同じ質問は正常に機能する。
さらに、データベースが完全にカバーする質問も確認される: 注文金額上位5顧客、カテゴリ別売上、ステータス別注文分布、平均注文額、商品在庫。
書き込み保護の確認。 「Delete all cancelled orders」に対して、エージェントはエラーではなく明確な拒否を受け取る: サーバーは読み取り専用で動作し、102件のキャンセル済み注文はそのまま残る。
ツール
ツール | 用途 |
| 全テーブルの用途、行数、カラム、リレーション、注文ステータス一覧、日付形式。 |
| 実際のカラムと型、双方向の外部キー、サンプル行。 |
| 単一の |
出力は制限される: デフォルトで100行、最大1000行。切り詰め時には、返された行数、見つかった総行数、次の読み取りに使用するoffsetが応答に含まれる。
要求されたフィールドがデータベースに存在しない場合(例: 顧客の国)、サーバーは正直にその旨を伝え、既存のカラムを列挙する。存在しないフィールドを推測することはない。
Related MCP server: Shop Analytics MCP Server
実装方法
プロジェクトは単一のプロンプトで生成された — ファイル SPEC-mcp-shop.md がエージェントに全体として送信され、その後の修正はなかった。
内部では、エージェントはスキル
repo-task-proof-loop
(Denis Shiryaev、Apache-2.0)に従ってループで作業した: スペックの凍結 → ビルド → エビデンスのパッケージ化 → 新しいセッションでの検証 → 最小限の修正 → 再検証、PASS判定が出るまで。
実行のエビデンスはリポジトリの .agent/tasks/mcp-shop-server/ にある:
spec.md— 受け入れ基準AC1…AC17付きの凍結済みスペック;evidence.md/evidence.json— 各基準に対する判定と具体的なエビデンス;verdict.json— 新しいセッションによる独立検証の結果;problems.md— 検証者が見つけた相違点;raw/— 実行の生ログ: テスト、実MCPセッション、stdoutのクリーン性チェック。
検証されるのはソースコードではなく、実エージェントを使ったサーバーの動作である: harness
raw/mcp_session_check.py は、実際のMCPクライアントでstdio経由でserver.pyを起動し、全ツールを呼び出し、8つの分析タスクを実行し、削除要求に対する拒否を確認し、stdoutにJSON-RPCフレームのみが含まれることを照合する。
開発スキル自体はローカルの .claude/skills/ にあり、リポジトリにはコミットされない — これは他人のコードである。
仕様の曖昧さに対する決定事項
# | 曖昧さ | 決定 |
1 | 「エージェントは仕様の8つのタスクすべてに回答する」 — 8つのタスクのリスト自体は仕様にない。 | 8つの分析質問は |
2 | MCP SDKのバージョンが固定されていない。 | 現在のメジャーライン |
3 | 「最大1000行」 — エラーなのか切り詰めなのかが不明。 |
|
4 | 無制限の選択時の「見つかった総数」。 | カーソルの結果は完全にカウントされるが、最大100,000行まで。クエリがそれを超える場合、 |
5 | Authorizerは読み取り以外をすべて禁止するが、 | Authorizerは3つの読み取り専用PRAGMA( |
6 | ツールの応答形式が指定されていない。 | すべてのツールは |
7 | ツール名とその構成(「セットは自分で設計する」)。 | 推奨される最小限の3ツールを |
8 | クエリ末尾のセミコロン。 | 末尾の |
9 | テストとharnessの配置。 | テストは |
This server cannot be installed
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 Connectors
Ask questions across Shopify, Klaviyo, GA4 and 20+ e-commerce sources in plain English.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Read-only zobrx e-commerce data: P&L, orders, inventory, marketplace, tax & shelf insights.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Related MCP Servers
- 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.683MIT
- FlicenseAqualityCmaintenanceEnables 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
- FlicenseAqualityCmaintenanceEnables AI agents to read-only query an online store's SQLite database, listing tables, inspecting schemas, and running SELECT queries over customers, products, orders, and order items.3
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to read-only analyze a SQLite e-commerce database, exploring schema and running analytical SQL queries over stdio.
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/andreykutsenko/mcp-shop-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server