shop
상점의 읽기 전용 MCP 서버
기존 온라인 쇼핑몰 SQLite 데이터베이스(data/shop.db)를 위한 stdio 기반 Python MCP 서버입니다. 파일은 읽기 전용으로만 열리며, 데이터를 변경하는 SQL은 거부되어 실행되지 않습니다.
설치
Python 3.11+:
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"Related MCP server: Shop SQLite MCP
실행
프로젝트 루트에서 실행합니다 (기본 DB 경로는 ./data/shop.db):
python -m shop_mcp
# или
shop-mcp다른 DB 경로:
SHOP_DB_PATH=~/my/test-mcp-db/data/shop.db python -m shop_mcp프로세스는 MCP를 통해 stdin/stdout으로 통신합니다. MCP 클라이언트가 연결되기 전까지는 이 터미널에 명령을 입력하지 마세요.
Cursor에서 MCP 설정
mcpServers 항목을 추가하세요 (Cursor Settings → MCP 또는 프로젝트의 .cursor/mcp.json). 전송 방식은 stdio입니다.
예시에서 ~/my/test-mcp-db는 이 저장소입니다. SHOP_DB_PATH는 서버가 직접 해석합니다 (~ → 홈 디렉터리). Cursor가 command / cwd에서 ~를 해석하지 않으면 해당 필드에 /Users/<вы>/my/test-mcp-db/...를 지정하세요.
로컬 (venv)
{
"mcpServers": {
"shop": {
"command": "~/my/test-mcp-db/.venv/bin/python",
"args": ["-m", "shop_mcp"],
"cwd": "~/my/test-mcp-db",
"env": {
"SHOP_DB_PATH": "~/my/test-mcp-db/data/shop.db"
}
}
}
}pip install -e . 이후 콘솔 스크립트가 더 편리하다면:
{
"mcpServers": {
"shop": {
"command": "~/my/test-mcp-db/.venv/bin/shop-mcp",
"cwd": "~/my/test-mcp-db",
"env": {
"SHOP_DB_PATH": "~/my/test-mcp-db/data/shop.db"
}
}
}
}Docker
이미지를 한 번 빌드합니다:
docker build -t shop-mcp .{
"mcpServers": {
"shop": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"~/my/test-mcp-db/data/shop.db:/data/shop.db:ro",
"-e",
"SHOP_DB_PATH=/data/shop.db",
"shop-mcp"
]
}
}
}-i 플래그는 stdio 연결을 유지하는 데 필수입니다. shop.db만 마운트하고, 컨테이너가 호스트의 파일을 덮어쓰면 안 됩니다.
도구
도구 | 용도 |
| 사용자 테이블과 역할에 대한 간단한 설명 ( |
| 실제 컬럼, 타입, PK/FK |
| 단일 |
| 수동 SQL 없이 연간 평점과 매출 |
금액, 수량, 매출은 order_items.quantity * order_items.unit_price로 계산됩니다. cancelled 상태의 주문은 제외됩니다. 달력 연도는 strftime('%Y', orders.order_date)에서 가져옵니다.
안전
SQLite URI
file:<abs>?mode=ro주석은 제거되고, 쿼리 체인(
SELECT 1; DELETE ...)은 거부됩니다.INSERT / UPDATE / DELETE / DROP / ALTER / CREATE / ATTACH / PRAGMA / … → '허용되지 않음' 명시적 오류
SQLite 구문 오류와 알 수 없는 컬럼은 구조화된 형태로 반환되며, 프로세스는 종료되지 않습니다.
평가 참고 사항
customers에는country컬럼이 없습니다. 이 내용은describe_table로 확인할 수 있습니다. 지리 정보를 임의로 만들어내면 안 됩니다.SELECT country FROM customers는 SQLite 오류를 반환합니다.현재 덤프의 주문 날짜는 2026년입니다. 2025년 매출은 0일 수 있습니다. 이것은 올바른 결과이지 필터가 고장 난 것이 아닙니다.
테스트
pytest테스트는 data/shop.db를 임시 파일로 복사하고, 거부된 쓰기 작업 후에도 복사본의 해시가 변하지 않는지 확인합니다.
처리된 요청 예시

Available Tools
4 toolsdescribe_tableA
Describe columns, types, primary keys, and foreign keys for one table.
Use before writing joins. Returns actual SQLite metadata only — never fabricates fields such as country. Parameters: table (name from list_tables). Returns {table, columns: [{name, type, primary_key, ...}], foreign_keys}.
Inputs: table (required). Returns: object
execute_readonly_sqlA
Run a single read-only SQL statement against shop.db.
Allowed: one SELECT, WITH (CTE), or EXPLAIN. Writes and DDL (INSERT, UPDATE, DELETE, REPLACE, DROP, ALTER, CREATE, TRUNCATE, ATTACH, VACUUM, REINDEX, PRAGMA) are rejected with an explicit not-allowed error. Stacked statements (semicolons) are rejected. Prefer shop_analytics for rankings and yearly revenue.
Pagination: default limit 100, maximum 1000 (error if exceeded), offset default 0. Returns {columns, rows, truncated, row_count, next_offset} or {error, sqlite_error?}. The database is opened read-only; refused mutations leave the file unchanged.
Inputs: sql (required), limit, offset. Returns: object
list_tablesA
List user tables in shop.db with a one-line purpose for each.
Use this first to discover the real schema. Internal SQLite tables such as sqlite_sequence are omitted. Does not invent columns (customers has no country). Returns {tables: [{name, purpose}, ...]}.
Inputs: no named parameters. Returns: object
shop_analyticsA
Shop aggregations without hand-written SQL.
Operations: top_customers_by_spend (name, email, total_amount; default limit 5), customer_most_orders (name, email, order_count), top_products (product_name, units_sold, revenue; default limit 5), top_categories (category, revenue; default limit 3), revenue_by_year (requires year). Spend/units/revenue use quantity * unit_price and exclude cancelled orders. Year is taken from order_date.
Inputs: operation (required), year, limit. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The schema-discovery tools are clearly separated from the querying/analytics tools. There is some overlap between execute_readonly_sql and shop_analytics, but the descriptions explicitly steer agents toward shop_analytics for rankings and revenue, reducing confusion.
Three tools follow a clear verb-first snake_case pattern: list_tables, describe_table, execute_readonly_sql. shop_analytics breaks that pattern as a nouny resource name, though it is still understandable and not chaotic.
Four tools is a well-scoped set for a read-only shop database. Each tool fills a distinct role: schema discovery, table metadata, raw SQL execution, and prebuilt analytics, with no redundancy.
For a read-only database exploration server, the workflow is complete: list the tables, describe one, run arbitrary safe SQL, and get common analytics. There are no missing mutations or write operations because the server is explicitly read-only.
Maintenance
Related MCP Connectors
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Read databases and usage, run read-only SQL, and create databases and tokens in Turso.
Read authorized Loam tables and supported external databases through a bounded MCP connection.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables natural-language sales queries against a SQLite database, generating and executing read-only SQL through a secure MCP server with table listing, schema description, and query execution.-
- FlicenseNot gradedqualityDmaintenanceEnables safe, read-only analysis of an online store's SQLite database, providing schema introspection, restricted SELECT queries, and specialized analytics tools through MCP.-
- FlicenseNot gradedqualityDmaintenanceThis MCP server lets an AI agent securely connect to a read-only SQLite store database, inspect its tables and schema, and run analytical SQL queries without modifying any data.-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to read-only analyze a SQLite e-commerce database, exploring schema and running analytical SQL queries over stdio.-