shop-db MCP Server
shop-db MCP Server
Сервер Model Context Protocol только для чтения,
который предоставляет AI-агентам аналитический доступ к базе данных SQLite
электронной коммерции (customers, orders, order_items, products) — без какой-либо
возможности изменять данные.
Создан для Node.js v24.19+, запускает исходные файлы TypeScript напрямую
(без этапа сборки) с использованием нативных node:sqlite и node:test.
Установка
npm installРепозиторий уже содержит заполненную базу ./shop.db в корне
проекта — этап заполнения не требуется. Ни npm start, ни npm test
не записывают в неё: сервер открывает её только для чтения, а набор тестов
создаёт собственные временные базы в tests/ из tests/fixtures/seed.sql.
Related MCP server: Read-Only SQLite Shop Database MCP Server
Запуск сервера
npm startСервер взаимодействует через stdio (StdioServerTransport) — он предназначен
для запуска MCP-клиентом (Claude Code, Claude Desktop и т. д.), а не
для интерактивной работы.
Тесты
npm testЗапускает node --test для tests/, покрывая крайние случаи проверки SQL
(ключевые слова мутации, обход через комментарии, многооператорные инъекции, CTE,
EXPLAIN) и все три MCP-инструмента сквозным тестированием на изолированных
тестовых базах, созданных из tests/fixtures/seed.sql. Зафиксированная база ./shop.db
не читается и не записывается набором тестов.
Настройка пути к базе данных
По умолчанию сервер читает ./shop.db (относительно рабочего
каталога, из которого он запущен). Переопределите с помощью переменной
окружения DB_PATH:
DB_PATH=/absolute/path/to/shop.db npm startИнструменты
list_tables— выводит список 4 таблиц с кратким описанием каждой.describe_table— определения столбцов, типы, первичные ключи и до 3 примеров строк для одной таблицы (tableName) или всех таблиц (если опустить).read_query— выполняет запрос только для чтенияSELECT/WITH/EXPLAIN/PRAGMA(query, обязательный) и возвращает доlimitстрок (необязательно, по умолчанию 100, максимум 1000). Любая попытка мутации (INSERT,UPDATE,DELETE,DROP, ...) отклоняется с понятной ошибкой, даже если она замаскирована SQL-комментариями или обёрнута в CTE.
Конфигурация AI-агента
{
"mcpServers": {
"shop-db": {
"command": "node",
"args": ["/absolute/path/to/src/index.ts"],
"env": {
"DB_PATH": "/absolute/path/to/shop.db"
}
}
}
}Документация проекта
AGENTS.md— инструкции для AI-агентов, работающих с кодом в этом репозитории (также загружается какCLAUDE.mdчерез символическую ссылку).CONTEXT.md— доменная модель и архитектура безопасности.
Available Tools
3 toolsdescribe_tableA
Get column definitions, data types, primary keys, and sample rows for one or all tables in the database.
| Name | Required | Description | Default |
|---|---|---|---|
| tableName | No | Table name to inspect. Omit to describe all tables. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It does reveal what the tool returns (columns, types, PKs, sample rows) and the 'all tables' option, but it does not state read-only semantics, potential performance implications of sample rows, or any limitations. This is adequate but not rich in behavioral detail.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single, tightly worded sentence that leads with the action and resource, then lists the specific details returned. No filler or redundancy — every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with one optional parameter, no output schema, and clear siblings, the description covers the essential information: what it does, what it returns, and the 'one or all' scope. It could mention read-only nature or output format, but given the simplicity, it is nearly complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% and the schema already documents tableName with the exact 'Omit to describe all tables' guidance. The tool description adds no new parameter insight beyond restating this behavior, so it meets the baseline for full schema coverage without adding value.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Get') and lists concrete resources: column definitions, data types, primary keys, and sample rows. It clearly distinguishes from siblings: list_tables (just table names) and read_query (arbitrary SQL). An agent immediately understands this is for schema introspection.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It states when to use the tool (when you need table structure and sample data) and covers both single and all-table cases via the 'one or all tables' phrasing. It does not explicitly say 'use list_tables for just names' or 'read_query for custom queries', but the purpose is clear enough that an agent can infer the right context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_tablesA
List all available tables in the e-commerce database.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the action (listing tables) without mentioning side effects, permissions, read-only guarantees, or any operational constraints. The read-only nature is implicit in 'list' but not explicitly disclosed, and no additional context (e.g., authentication, response format) is given.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence with no extraneous words. It efficiently conveys the tool's purpose without redundancy, earning the highest score for conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple list tool with no parameters and no output schema, the description is mostly complete. It states the scope ('e-commerce database') and the action. However, it does not explicitly describe the return format (e.g., a list of table names, metadata, or schema), which an agent might need to know. Since no output schema exists, the description could have mentioned this, but it is a minor gap for such a straightforward operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, and schema coverage is 100% (vacuously). Per the rubric, the baseline is 4 for zero-parameter tools. The description adds no parameter semantics, which is acceptable because there are no parameters to document.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('List') and resource ('all available tables in the e-commerce database'), clearly distinguishing the tool's purpose from siblings like describe_table (schema details) and read_query (data queries). It states exactly what the tool does with no ambiguity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies that the tool is for discovering available tables but provides no explicit guidance on when to use it versus the sibling tools. No exclusions or alternatives are mentioned, leaving the agent to infer from the action verb. This is adequate but not explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_queryA
Execute a read-only SQL query against the database. Use this tool for analytical aggregations, joins, filtering, CTEs, and reporting.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum rows to return (default 100, max 1000). | |
| query | Yes | The SQL SELECT or WITH query to execute. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It explicitly states 'read-only', which is a key behavioral trait indicating the tool will not modify data. This is a strong statement about side effects. It does not mention error handling, transaction behavior, or performance, but for a read-only query tool, the core behavior is well covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences with no fluff. The primary purpose is stated first, followed by specific use cases. Every word contributes to clarifying the tool's role. It is appropriately sized for the tool's simplicity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (2 params, no output schema, no nested objects) and no annotations, the description provides the essential information: what it does and when to use it. The schema covers parameter details. While it could mention output format or restrictions, these are either implicit (SQL query returns rows) or already in the schema (SELECT/WITH). It is complete enough for correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, as both parameters (query and limit) have descriptive text in the schema. The tool description adds no additional parameter-level meaning beyond reinforcing the 'read-only' nature and usage cases. Since the schema already documents the parameters, a baseline of 3 is appropriate; the description does not need to compensate further.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a clear verb-resource pair ('Execute a read-only SQL query against the database') and explicitly lists use cases (analytical aggregations, joins, filtering, CTEs, reporting). It distinguishes itself from siblings list_tables and describe_table, which are clearly metadata-focused, so an agent can readily differentiate it.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit usage context by stating 'Use this tool for analytical aggregations, joins, filtering, CTEs, and reporting.' This tells the agent when to apply it. However, it does not explicitly mention alternatives or state 'when not to use' it, though the sibling tool names imply the distinction. This is clear but lacks explicit exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v1.0.0- First observed
describe_table - First observed
list_tables - First observed
read_query
TDQS
Scored across 3 tools
The three tools have clearly distinct purposes: listing tables, describing schema, and running queries. There is no overlap or ambiguity, so an agent can easily select the right tool for each operation.
All tool names follow a consistent snake_case verb_noun pattern (list_tables, describe_table, read_query). The naming is predictable and adheres to a single convention throughout.
With only 3 tools, the set is slightly minimal but well-scoped for a read-only database introspection server. Each tool serves a necessary function, and the count is reasonable for the apparent purpose.
The tool surface fully covers the core operations needed for read-only database access: enumerating tables, inspecting schemas, and executing arbitrary queries. No critical gaps are evident for the intended domain.
Maintenance
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
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.6145 npmMIT
- 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-
- 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.-