Skip to main content
Glama
preetash88

E-commerce MCP Server

by preetash88

MCP E-commerce Server

A comprehensive Model Context Protocol (MCP) server for e-commerce product management with CRUD operations, AI-powered descriptions, and database integration.

Features

  • 🛍️ Complete CRUD Operations - Create, read, update, delete products

  • 🤖 AI-Powered Descriptions - Automatic product description generation using MCP sampling

  • 📊 Database Integration - MySQL database with proper schema

  • 🔍 Smart Search - Search products by name with pagination

  • 📦 Low Stock Monitoring - Resource for tracking inventory levels

  • 🌐 Dual Transport Support - Both stdio and HTTP/SSE transports

  • 🔧 TypeScript - Fully typed with Zod validation

  • 📋 MCP Resources - Product catalog and low-stock resources

  • 🎯 MCP Prompts - Pre-built prompt templates

Related MCP server: MCP E-commerce Server

Quick start

# 1) Install deps
npm i

# 2) Prepare env
cp .env.example .env

# 3) Create schema (optional, run in your MySQL)
# See sql/schema.sql

# 4) Run demo (non-MCP) usage
npm run dev:demo

# 5) Run MCP server (stdio transport)
npm run dev:mcp

The MCP server prints nothing special; it waits on stdio for a client like Claude Desktop / MCP Inspector / Apps SDK to connect.

Notes

  • This is intentionally minimal and tutorial‑friendly.

  • All database params come from environment variables.

  • You can extend with transactions, pagination, auth, etc.

#package.json npm link

npm login npm publish --access public

Available Tools

5 tools
add_productAdd ProductC

Create a new product with sku, name, description(optional but better to have), price, and quantity.

ParametersJSON Schema
NameRequiredDescriptionDefault
skuYes
nameYes
priceYes
quantityYes
descriptionNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
idNo
skuYes
nameYes
priceYes
quantityYes
created_atNo
updated_atNo
descriptionNo

TDQS

C2.9/5.0
Behavior2/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 communicates a write operation ('Create') and notes that description is optional, but it does not disclose duplicate-SKU behavior, persistence semantics, permissions, or what happens on invalid input.

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 filler. It states the action first and compacts the parameter list, including an optionality note, without wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Although an output schema exists and can cover return values, this is still a mutation tool with no annotations and no guidance on how it differs from add_product_smartly. It omits duplicate handling, failure behavior, and selection context, leaving an agent under-informed 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 0%, so the description must compensate. It lists all five parameter names and marks description as optional but better to have, which is useful. However, it does not explain semantics such as SKU uniqueness, currency, or quantity constraints, so the compensation is only partial.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with 'Create a new product', a specific verb and resource, and enumerates the key fields. It clearly says what the tool does, but it does not differentiate itself from the sibling add_product_smartly, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance about when to use this tool versus its siblings, especially add_product_smartly, which appears to be an alternate creation path. The description is purely declarative and provides no exclusions, prerequisites, or selection criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

add_product_smartlyAdd Product SmartlyC

Create a new product with sku, name, description(optional), price, and quantity. Since description is optional, is description is missing, use smart AI generated description if missing. This tool also checks for existing products with the same SKU to prevent duplicates.

ParametersJSON Schema
NameRequiredDescriptionDefault
skuYes
nameYes
priceYes
quantityYes
descriptionNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
idNo
skuYes
nameYes
priceYes
quantityYes
created_atNo
updated_atNo
descriptionNo

TDQS

C2.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden, and it does disclose two important behaviors: generating a smart description when none is supplied and checking for existing products with the same SKU. However, it stops short of explaining what happens on a duplicate (error, no-op, update?) or whether AI generation is automatic, so the disclosure is incomplete.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short, front-loaded with the primary action, and contains no filler. The second sentence has a typo and redundant phrasing ('is description is missing... if missing'), which slightly reduces polish but does not obscure the meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The definition is too thin for a mutation tool with a same-purpose sibling and no annotations: it neither explains how to choose between add_product and add_product_smartly nor states the behavior when a duplicate SKU is encountered. The agent is left without the edge-case knowledge needed to call it correctly and interpret the outcome.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description is the only source of parameter meaning. Yet it merely lists the parameter names and notes that description is optional; it adds no detail on formats, units, constraints, or subtle semantics beyond what a reader would infer from the names. The schema itself also lacks property descriptions, so nothing compensates.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a new product') and enumerates the accepted fields, which is specific and unambiguous. It also hints at its distinguishing behaviors—AI-generated description and duplicate-SKU prevention—which set it apart from the sibling add_product, though it never names that sibling explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit statement of when to use this tool versus add_product or any other sibling. The duplicate-check and AI-description behaviors imply use cases, but the description does not say 'use this when...' or describe an exclusion criterion, leaving the agent to guess which creation tool is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

delete_productDelete a Product by IDB

Delete a product using its unique ID(number). Returns true if deletion was successful, false otherwise.

ParametersJSON Schema
NameRequiredDescriptionDefault
idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
successYes

TDQS

B3.2/5.0
Behavior2/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 states the operation and return value, but does not mention potential side effects, irreversibility, error behavior for non-existent IDs, or any authorization requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short and front-loaded, clearly stating the action and the parameter. The return value is mentioned efficiently. No unnecessary filler is present, though the phrasing 'ID(number)' is slightly redundant.

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 one-parameter deletion tool, the description covers the core action, the required input, and the return behavior. However, because there are no annotations, a brief note about the destructive nature or behavior when the ID is not found would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It only restates that 'id' is a unique ID number, adding little beyond the schema's integer type and exclusiveMinimum constraint. It does not clarify where the ID comes from or how it should be obtained.

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 ('Delete') and resource ('a product') and identifies the exact method (by unique ID). It is clearly distinct from sibling tools like add_product, get_product_by_id, and update_product.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to use this tool versus alternatives, nor when not to use it. The intended use is implied by the name and description, but the tool does not explicitly differentiate itself or mention prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_product_by_idGet a Product by IDA

Fetch a product's details using its unique ID(number).

ParametersJSON Schema
NameRequiredDescriptionDefault
idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
idNo
skuYes
nameYes
priceYes
quantityYes
created_atNo
updated_atNo
descriptionNo

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It indicates a read operation ('fetch') but does not mention error handling (e.g., behavior when ID not found), permissions, or response format. For a simple getter this may be acceptable, but it adds no context beyond the operation itself.

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, front-loaded sentence with no filler. Every word earns its place, and the description is appropriately sized for a simple getter tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one required param, output schema present), the description states the core operation. However, it lacks usage context and error behavior, which would be helpful given the absence of annotations. It is minimally complete but not thorough beyond the essential purpose.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already defines the id parameter as an integer greater than zero. The description's 'ID(number)' essentially restates the schema type and adds minimal semantic value. With 0% schema description coverage, the description should compensate by clarifying what the ID refers to (e.g., product SKU or database ID) or any uniqueness constraints, but it does not.

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 clearly states the tool fetches product details by unique numeric ID. It is a specific read operation that is distinct from the sibling tools (add_product, delete_product, update_product, add_product_smartly), which are all write operations. The verb 'fetch' and resource 'product details' are unambiguous.

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?

No explicit guidance is provided on when to use this tool versus the siblings. The intended use is implied by the read-only nature, but the description does not mention alternatives or exclusions, leaving it to the agent to infer based solely on the name and description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

update_productUpdate ProductB

Update an existing product by providing correct id(mandatory) as input along with with sku(optional), name(optional), description(optional but better to have), price(optional), and quantity(optional).

ParametersJSON Schema
NameRequiredDescriptionDefault
idYes
skuNo
nameNo
priceNo
quantityNo
descriptionNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
idNo
skuYes
nameYes
priceYes
quantityYes
created_atNo
updated_atNo
descriptionNo

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavior. It states the operation is an update (implying mutation) but does not mention side effects, required permissions, validation behavior, or partial update semantics. Also, it misleadingly marks description as 'optional but better to have' without explaining why better, which is vague.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is somewhat long and has repetition ('with with' typo). It front-loads the mandatory id and lists optional fields, but could be more concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the parameter count, schema coverage, and output schema, the description covers the basics but lacks critical behavioral context (e.g., what response to expect, validation rules, idempotency). For a mutation tool with 6 params and no annotations, more detail is expected.

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 coverage is 0%, so the description must compensate. It lists all parameters and states optionality, adding some value over the schema (e.g., description 'better to have'). However, it lacks details on format, constraints, or interplay between parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool updates an existing product and lists the fields that can be modified, with the id as mandatory. It distinguishes from sibling 'add_product' and 'delete_product' by focusing on update, but does not explicitly differentiate from 'add_product_smartly' or 'get_product_by_id'.

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?

It implies usage (update when you have an existing product id), but does not explicitly state when to use it over alternatives like add_product_smartly or get_product_by_id. No exclusions or prerequisites are mentioned.

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. 5 tool updatesv1.0.0
    • First observedadd_product
    • First observedadd_product_smartly
    • First observeddelete_product
    • First observedget_product_by_id
    • First observedupdate_product

TDQS

B3.2/5.0

Scored across 5 tools

Disambiguation3/5

add_product and add_product_smartly overlap significantly, both creating products with the same parameters, though add_product_smartly adds AI description generation and duplicate checking. The other tools are distinct CRUD operations, so the main ambiguity is between the two creation tools.

Naming Consistency4/5

Most tools follow a verb_noun pattern (add_product, get_product_by_id, delete_product, update_product), but add_product_smartly breaks the convention with an adverb suffix. The naming is mostly consistent but the smartly variant is a deviation.

Tool Count4/5

Five tools is a reasonable count for a simple product CRUD server. The add_product_smartly tool is somewhat redundant, making the count feel slightly padded, but it's still within an appropriate range.

Completeness4/5

The server covers the core CRUD lifecycle for products: create, read, update, delete. A list/search products tool is missing, which is a notable gap for an e-commerce server, but the essential operations are present.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers