Read-Only SQLite Shop Database MCP Server
MCP-сервер для SQLite-базы данных интернет-магазина (только для чтения)
Официальный Model Context Protocol (MCP)-сервер, обеспечивающий безопасный доступ только для чтения к SQLite-базе данных интернет-магазина (shop.db) для AI-агентов.
🌟 Ключевые особенности
Стандартный транспорт
stdio: Бесшовно работает с любым MCP-клиентом (Claude Desktop, Cursor, Gemini CLI, Antigravity и т. д.).Многоуровневая защита только для чтения:
Режим только для чтения через SQLite URI (
?mode=ro).Строгий
PRAGMA query_only = ON;во время выполнения.Предварительный SQL-парсер, отклоняющий все мутирующие DDL/DML-запросы (
INSERT,UPDATE,DELETE,DROP,ALTER,CREATEи т. д.).Блокирует цепочки SQL-инъекций и выполнение нескольких операторов.
Инструменты, оптимизированные для LLM: Понятные описания, надёжная обработка ошибок без сырых трассировок стека и автоматическая пагинация (
limit/offset).Гибкое разрешение путей: Работает из коробки с относительными путями, переменной окружения
DB_PATHили флагом CLI--db-path.
Related MCP server: node-sqlite-mcp
🗄️ Схема базы данных
База данных SQLite (shop.db) содержит следующие сущности:
customers
│
└──< orders
│
└──< order_items >── productscustomers:id,first_name,last_name,email,phone,created_atproducts:id,name,category,price,stock_quantity,created_atorders:id,customer_id,order_date,status(new,processing,shipped,completed,cancelled),total_amountorder_items:id,order_id,product_id,quantity,unit_price
🛠️ Инструменты MCP
Инструмент | Параметры | Описание |
| Нет | Перечисляет все пользовательские таблицы с количеством колонок и строк. |
|
| Возвращает определения колонок, типы данных, первичные ключи, внешние ключи, количество строк и примеры строк. |
| Нет | Возвращает полную схему и граф связей всех таблиц за один вызов. |
|
| Выполняет запросы только для чтения ( |
🚀 Начало работы
1. Установка
Создайте виртуальное окружение и установите необходимые зависимости:
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt2. Локальный запуск
Запустите MCP-сервер через стандартный ввод/вывод:
python server.pyИли укажите пользовательский путь к базе данных:
# Using CLI argument
python server.py --db-path /path/to/shop.db
# Or using Environment Variable
DB_PATH=/path/to/shop.db python server.py3. Запуск тестов
Запустите тестовый набор для проверки функциональности инструментов и ограничений безопасности:
python -m unittest discover -s tests -v🔌 Подключение к AI-агентам
Claude Desktop
Добавьте этот сервер в ваш claude_desktop_config.json (~/Library/Application Support/Claude/claude_desktop_config.json на macOS или %APPDATA%\Claude\claude_desktop_config.json на Windows):
{
"mcpServers": {
"shop-database": {
"command": "/absolute/path/to/.venv/bin/python",
"args": ["/absolute/path/to/server.py"],
"env": {
"DB_PATH": "/absolute/path/to/shop.db"
}
}
}
}Cursor IDE
В Cursor Settings → Features → MCP:
Тип:
commandКоманда:
/absolute/path/to/.venv/bin/python /absolute/path/to/server.py
Antigravity / Gemini CLI
Добавьте в файл конфигурации MCP:
{
"mcpServers": {
"shop-database": {
"command": "python",
"args": ["server.py"]
}
}
}🔒 Примеры безопасности и валидации
Если AI-агент или подсказка попытается выполнить деструктивную операцию, сервер немедленно корректно отклоняет запрос:
Запрос: «Удалить все отменённые заказы.»
Ответ сервера:
{ "error": "Operation rejected: Statement type 'DELETE' is not allowed. Only read-only queries (SELECT, WITH ... SELECT, EXPLAIN) are permitted." }
📊 Проверочные запросы
Сервер позволяет AI-агентам решать аналитические запросы, например:
Обнаружение таблиц:
list_tables()иdescribe_table(table_name="customers")Демография клиентов:
SELECT count(*) FROM customers WHERE phone LIKE '+7%';Клиент, потративший больше всего денег:
SELECT c.first_name, c.last_name, c.email, SUM(o.total_amount) AS total_spent FROM customers c JOIN orders o ON c.id = o.customer_id WHERE o.status != 'cancelled' GROUP BY c.id ORDER BY total_spent DESC LIMIT 1;Топ-5 самых продаваемых товаров:
SELECT p.name, SUM(oi.quantity) AS units_sold, SUM(oi.quantity * oi.unit_price) AS revenue FROM products p JOIN order_items oi ON p.id = oi.product_id JOIN orders o ON oi.order_id = o.id WHERE o.status != 'cancelled' GROUP BY p.id ORDER BY units_sold DESC LIMIT 5;Топ-3 категории товаров по выручке:
SELECT p.category, SUM(oi.quantity * oi.unit_price) AS revenue FROM products p JOIN order_items oi ON p.id = oi.product_id JOIN orders o ON oi.order_id = o.id WHERE o.status != 'cancelled' GROUP BY p.category ORDER BY revenue DESC LIMIT 3;Клиент с наибольшим количеством заказов:
SELECT c.first_name, c.last_name, COUNT(o.id) AS order_count FROM customers c JOIN orders o ON c.id = o.customer_id GROUP BY c.id ORDER BY order_count DESC LIMIT 1;
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
- FlicenseNot gradedqualityDmaintenanceExposes a SQLite database to AI assistants with structured, read-safe access. Includes five tools for schema exploration, querying, and sampling data.
- AlicenseAqualityBmaintenanceLets AI agents query local SQLite database files read-only using Node's built-in sqlite module, providing tools for listing tables, describing schemas, and running SQL queries.315MIT
- AlicenseNot gradedqualityCmaintenanceEnables exploring and querying SQLite databases through natural language, with tools to list tables, describe table structures, and run SELECT queries.MIT
- 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.692MIT
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Explore your Messages SQLite database to browse tables and inspect schemas with ease. Run flexible…
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/alimbux/mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server