ecommerce-sql-mcp
Provides tools for exploring and querying an e-commerce SQLite database, including schema inspection, read-only SELECT queries, and explicitly confirmed inserts, updates, and deletes.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ecommerce-sql-mcpWhich product category sold the most units?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ecommerce-sql-mcp
A Model Context Protocol (MCP) server that exposes a small e-commerce SQLite database as tools, plus an agent that answers natural-language questions by driving those tools over the real MCP wire protocol (streamable HTTP, mcp 2.x).
An agent asks "which product category sold the most units?", the MCP server
discoverable tools let it inspect the schema, write a SELECT, and read the
result — all through the standard MCP tool-call round-trip.
┌────────────┐ MCP streamable HTTP ┌──────────────┐ ┌──────────┐
│ DeepSeek │ ◀──── tools / result ───▶ │ MCP server │ ──▶ │ SQLite │
│ (agent) │ │ (mcp 2.x) │ │ ecommerce│
└────────────┘ └──────────────┘ └──────────┘Tools
Tool | Read/write | What it does |
| read | Enumerate tables with row counts |
| read | Columns, foreign keys, and up to 3 sample rows |
| read | Run a single |
| write |
|
Related MCP server: shop
Design decisions
Read-only at the storage layer.
run_queryopens SQLite withfile:...?mode=ro, so even a slipped keyword can't write. A token guard rejects non-SELECTand every write keyword, plus multi-statement (;) and trailing-semicolon inputs.Writes are explicitly gated.
run_mutationrefuses unlessconfirm=True; the agent must state the change before a side effect happens. This is a small but real "permissioned write" boundary, the same shape as OAuth-2.1-tool designs meant for production.Errors feed the model, not the user. SQL errors are returned with a hint ("table X doesn't exist → list_tables(); no such column → get_schema()"), the MCP-idiomatic way to let the agent self-correct instead of returning a bare stack message.
Reproducible data. The seed writes a fixed-RNG dataset, so the same question yields the same rows run over run.
Running
python -m venv .venv && .venv/Scripts/python -m pip install -r requirements.txt
# 1. Build the sample DB
.venv/Scripts/python scripts/seed_db.py
# 2. Smoke-test the MCP protocol end to end (no LLM needed)
.venv/Scripts/python scripts/test_mcp.py
# 3. Ask the agent a question (needs an OpenAI-compatible LLM endpoint)
set MCP_LLM_BASE=https://api.deepseek.com
set MCP_LLM_MODEL=deepseek-v4-flash
set MCP_LLM_KEY=sk-...
.venv/Scripts/python scripts/demo.py "销量最高的商品类别是哪个?卖了多少件?"Layout
server/ MCP server: db.py (safety + introspection), main.py (MCPServer + tools)
client/ agent: llm.py (thin OpenAI-compatible client), agent.py (tool-call loop)
scripts/ seed_db.py, test_mcp.py, demo.py
data/ generated ecommerce.db (gitignored)Limitations
Single SQLite file, local-only; no persistence layer beyond the seed.
The agent talks to exactly one MCP server endpoint.
max_rows/statement-length caps and the token guard are the current safety boundary; a production version would add a DB role withSELECT-only on a separate connection and per-request auth.DeepSeek's
reasoning_contentmust be echoed back in the assistant message on follow-up turns (handled inclient/agent.py); providers without that field simply omit it.
This server cannot be deployed
Maintenance
Related MCP Connectors
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Hosted MCP for e-commerce: live product catalog, stock, and pricing for AI agents.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Agentic commerce with 58 MCP tools for product search, checkout, A2A negotiation, C-Suite analytics.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables 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.1MIT
- FlicenseAqualityCmaintenanceEnables read-only interaction with an online store's SQLite database over MCP stdio, including table listing, schema inspection, safe read-only SQL execution, and sales analytics. It rejects mutating SQL operations to keep data intact.4-
- FlicenseAqualityCmaintenanceEnables AI agents to safely inspect and query an SQLite e-commerce database with tools for listing tables, describing schemas, and running read-only SQL queries while blocking destructive operations.4-
- FlicenseAqualityBmaintenanceGives AI agents read-only analytical access to an e-commerce SQLite database (customers, orders, order_items, products) via SQL queries, table listing, and schema inspection.3-