Skip to main content
Glama
bulychauPI

shop-db MCP Server

by bulychauPI

shop-db MCP Server

A read-only Model Context Protocol server that gives AI agents analytical access to an e-commerce SQLite database (customers, orders, order_items, products) — without any ability to modify data.

Built for Node.js v24.19+, running TypeScript source files directly (no build step) using native node:sqlite and node:test.

Setup

npm install

The repository already includes a populated ./shop.db at the project root — no seeding step is needed. Nothing in npm start or npm test writes to it: the server opens it read-only, and the test suite builds its own throwaway databases under tests/ from tests/fixtures/seed.sql.

Related MCP server: Read-Only SQLite Shop Database MCP Server

Run the server

npm start

The server communicates over stdio (StdioServerTransport) — it's meant to be launched by an MCP client (Claude Code, Claude Desktop, etc.), not run interactively.

Tests

npm test

Runs node --test against tests/, covering SQL validation edge cases (mutation keywords, comment-evasion, multi-statement injection, CTEs, EXPLAIN) and the three MCP tools end-to-end against isolated test databases built from tests/fixtures/seed.sql. The committed ./shop.db is never read or written by the test suite.

Configuring the database path

By default the server reads ./shop.db (relative to the working directory it's launched from). Override with the DB_PATH environment variable:

DB_PATH=/absolute/path/to/shop.db npm start

Tools

  • list_tables — lists the 4 tables with a short description of each.

  • describe_table — column definitions, types, primary keys, and up to 3 sample rows, for one table (tableName) or all tables (omit it).

  • read_query — executes a read-only SELECT/WITH/EXPLAIN/PRAGMA query (query, required) and returns up to limit rows (optional, default 100, max 1000). Any mutation attempt (INSERT, UPDATE, DELETE, DROP, ...) is rejected with a clear error, even if disguised with SQL comments or wrapped in a CTE.

AI agent config

{
  "mcpServers": {
    "shop-db": {
      "command": "node",
      "args": ["/absolute/path/to/src/index.ts"],
      "env": {
        "DB_PATH": "/absolute/path/to/shop.db"
      }
    }
  }
}

Project docs

  • AGENTS.md — instructions for AI coding agents working on this repo (also loaded as CLAUDE.md via symlink).

  • CONTEXT.md — domain model and safety architecture.

Available Tools

3 tools
describe_tableA

Get column definitions, data types, primary keys, and sample rows for one or all tables in the database.

ParametersJSON Schema
NameRequiredDescriptionDefault
tableNameNoTable name to inspect. Omit to describe all tables.

TDQS

A4/5.0
Behavior3/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.8/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum rows to return (default 100, max 1000).
queryYesThe SQL SELECT or WITH query to execute.

TDQS

A4.2/5.0
Behavior4/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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.

  1. 3 tool updatesv1.0.0
    • First observeddescribe_table
    • First observedlist_tables
    • First observedread_query

TDQS

A4.2/5.0

Scored across 3 tools

Disambiguation5/5

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.

Naming Consistency5/5

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.

Tool Count4/5

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.

Completeness5/5

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

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Enables 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.
    6
    61
    MIT
  • F
    license
    A
    quality
    C
    maintenance
    Enables 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
    -
  • F
    license
    A
    quality
    C
    maintenance
    Enables 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
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to read-only analyze a SQLite e-commerce database, exploring schema and running analytical SQL queries over stdio.
    -