Shop Database MCP Server
Provides read-only tools for inspecting and querying a SQLite database, including schema inspection and parameterized SELECT queries with pagination.
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., "@Shop Database MCP Server Show me the top 5 products by total revenue."
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.
Shop Database MCP Server
This local stdio MCP server lets an AI agent inspect and analyze shop.db. It is read-only: SQLite is opened read-only, query_only is enabled, and the server rejects anything except one SELECT or WITH ... SELECT query.
Prerequisites
Node.js 20 or newer and the supplied SQLite database.
Related MCP server: shop-database-mcp
Install
npm installConfigure
SHOP_DB_PATH is optional. If set, a relative value is resolved from the process working directory; an absolute value is used directly. Otherwise the server finds shop.db relative to its compiled module, including when launched outside the project directory. See .env.example; it is not loaded automatically.
Build
npm run buildRun manually
npm startA stdio server normally appears idle because it waits for MCP messages.
Connect to Codex IDE extension and CLI
In the IDE extension: Gear menu → MCP servers → Add server → STDIO. Set command, arguments, and environment from config/codex.config.toml.example, save, and restart the extension.
For a project-scoped setup, copy that example to .codex/config.toml and replace every /ABSOLUTE/PATH/TO/PROJECT placeholder. Codex CLI and the IDE extension share Codex MCP configuration. Do not commit the active configuration file.
Available tools
inspect_database takes no parameters. Use it before querying or when uncertain; it returns tables, columns, primary/foreign keys, relationships, and row counts.
query_database accepts sql (required), params (positional string, finite number, boolean, or null values), limit (1–200; default 100), and offset (default 0). Use ? placeholders; joins and aggregates work. It accepts exactly one read-only SELECT or WITH ... SELECT. Inspect schema before assuming columns, date formats, prices, or statuses. Results contain columns, rows, rowCount, limit, offset, and hasMore; request another page with a new offset.
{"sql":"SELECT country, COUNT(*) AS customer_count FROM customers GROUP BY country ORDER BY customer_count DESC","params":[],"limit":100,"offset":0}Test
npm testTests create temporary fixture databases and never modify shop.db.
Safety design and troubleshooting
Safety layers are read-only file access, SQLite query_only, conservative token-aware validation that ignores comments/strings/quoted identifiers, a single-statement rule, and server-side pagination. Tool errors are concise and do not expose stack traces or local paths.
If startup fails, verify SHOP_DB_PATH names an existing regular SQLite file. If a query fails, call inspect_database, use ? parameters, and verify names and relationships.
Available Tools
2 toolsinspect_databaseARead-only
Use before your first query or whenever the schema is uncertain. Returns tables, columns, keys, relationships, and row counts.
Inputs: no named parameters. Returns: tables
query_databaseARead-only
Execute one parameterized read-only SELECT or WITH ... SELECT statement. Use ? placeholders and params for dynamic values. Joins and aggregate queries are supported; schema and data changes are forbidden. Results are paginated: use offset for the next page when hasMore is true. Inspect the schema instead of guessing column names, date formats, price fields, or order status semantics.
Inputs: sql (required), limit, offset, params. Returns: rows, limit, offset, columns, +2 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
inspect_database handles schema metadata while query_database executes read-only SQL queries. There is no functional overlap or ambiguity between the two tools.
Both tools follow the same lower_snake_case verb_noun pattern: inspect_database and query_database. The naming is consistent, predictable, and clearly reflects each tool's purpose.
Two tools is lean but well-suited to the server's read-only database purpose: inspect the schema, then query the data. Each tool is essential, and the narrow scope justifies the small count.
For a read-only database server, inspect_database plus query_database covers the complete workflow of schema discovery and arbitrary SELECT queries with pagination. Write operations are explicitly out of scope, so their absence is not a gap.
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query, explore, and manage your databases through natural conversation.
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.6236 npmMIT
- FlicenseNot gradedqualityCmaintenanceEnables read-only exploration and analysis of an included SQLite shop database through tools for listing tables, describing schemas, and running SQL queries.-
- 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-
- FlicenseAqualityCmaintenanceGives 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-