db-mcp
db-mcp
読み取り専用の MCP サーバーです。AI エージェントに、小規模な SQLite ショップデータベース(shop.db)への安全なアクセスを提供します。スキーマ探索、自由形式の読み取り専用 SQL、あらかじめ用意された分析レポートを備えています。
インストール
npm installRelated MCP server: SQLite Read-Only MCP Server
設定
サーバーは、プロセス環境変数 SHOP_DB_PATH を読み取ってデータベースファイルの場所を特定します。この変数は省略可能です。未設定の場合は、サーバーはプロジェクトルートの shop.db を使用します。.env ファイルは自動的に読み込まれません(dotenv への依存はなく、package.json のスクリプトにも --env-file フラグはありません)。.env.example は、変数名を思い出すためのリマインダーとしてのみ提供されています。SHOP_DB_PATH は、サーバーが実際に実行される環境に設定してください。stdio MCP クライアントの場合は、そのクライアント設定内の env キーに指定します(下記の「クライアントを接続する」を参照)。
ビルド
npm run build実行
npm start
# or directly:
node dist/index.jsサーバーは stdio 上で MCP 通信を行います。つまり、対話的に実行されるのではなく、MCP クライアント/ホストの子プロセスとして起動されることを想定しています。
クライアントを接続する
一般的な stdio MCP クライアント設定:
{
"mcpServers": {
"db-mcp": {
"command": "node",
"args": ["/absolute/path/to/db-mcp/dist/index.js"],
"env": { "SHOP_DB_PATH": "/absolute/path/to/shop.db" }
}
}
}Claude Desktop: claude_desktop_config.json の mcpServers に同じブロックを追加し(OS ごとの設定ファイルの場所は MCP.md を参照)、その後 Claude Desktop を再起動します。
ツール
ツール | 説明 |
| すべてのテーブルを、短い説明と行数付きで一覧表示します。最初に呼び出してください。 |
| 1つのテーブル( |
|
|
| 総支出額または注文数に基づく上位顧客を表示します。キャンセル済みの注文は除外されます。 |
| 販売数量に基づくベストセラー商品と売上高を表示します。キャンセル済みの注文は除外されます。 |
| カテゴリ、年、月ごとにグループ化した売上を表示します。オプションで1年に限定できます。キャンセル済みの注文は除外されます。 |
セキュリティに関する注意
データベース接続は
{ readonly: true, fileMustExist: true }で開かれます。SQLite エンジン自体が、送信される SQL の内容に関係なく、物理的にすべての書き込みを拒否します。queryツールは、入力がデータベースに到達する前に、それが単一のSELECT(またはWITH ... SELECT)ステートメントであることをさらに検証し、INSERT/UPDATE/DELETE/DROP/ALTER/CREATE/PRAGMA/ATTACH/DETACH/REPLACE/VACUUM/REINDEX/TRIGGERおよびマルチステートメントの入力を、わかりやすいエラーメッセージとともに拒否します。エラーは各ツールの境界で捕捉され、
isError: trueと短いメッセージを持つ MCP ツールの結果として返されます。スタックトレースやファイルシステムのパスがクライアントに送信されることは一切ありません。すべてのログは
stderr(console.error)に送信されます。stdoutは JSON-RPC プロトコルストリーム専用に予約されています。
テスト
npm testnode --test(tsx 経由)をすべての *.test.ts ファイルで実行します。実物の shop.db に対する SQL ガード、DB 接続、各ツールのクエリロジックのユニットテストに加え、コンパイル済みサーバーを起動して stdio 上の実際の MCP クライアントで操作するエンドツーエンドテストが含まれます。
Docker
docker build -t db-mcp .
docker run -i db-mcpサーバーをローカルで実行するために必須ではありません(上記のクライアント設定はローカルの node プロセスを想定しています)が、検証や実行のための代替手段として提供されています。
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
- AlicenseBqualityCmaintenanceExposes Shopify store data from SLAM Gadget SQLite databases to AI tools through 60 specialized tools for products, orders, inventory, customers, and reporting. Provides read-only access with automatic schema validation and security protections.6041MIT
- AlicenseAqualityCmaintenanceEnables safe, read-only SQL access to SQLite databases for AI agents, allowing schema exploration and SELECT queries with defense-in-depth protections.3MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to query Shopify analytics with ShopifyQL via the Admin GraphQL endpoint, executing queries and interpreting results like 'show me the products with the highest margins'.
- FlicenseNot gradedqualityCmaintenanceEnables 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.
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Manage your NanoCart store from any AI agent: products, orders, coupons, subscribers, reports.
Manage your Savanto store from your AI: catalog, content, prompts, and analytics, by chat.
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/denezhkinia/shop-db-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server