Simple TypeScript MCP server for sales operations with a SQLite backend, plus a local minimalist ecommerce storefront.
- users tool: fetch and add users
- items tool: fetch and add items (supports image URLs)
- purchases tool: fetch and add purchases
- simple payment authorization service (local stub)
- local Express + EJS store UI with cart and checkout
- server.ts
- web-server.ts
- tools/users.ts
- tools/items.ts
- tools/purchases.ts
- services/payments.ts
- db/index.ts
- db/repositories.ts
- views/*.ejs
- public/styles.css
-
Install dependencies:
npm install
-
Run MCP server in development mode:
npm run dev
-
Run local web store:
npm run web-dev
-
Build:
npm run build
- Open http://localhost:3000/store for the local storefront.
- Add items with quantity to cart, then checkout using name and email.
- Keep MCP server and web store running in separate terminals to demo both AI and user storefront access against the same SQLite database.
-
Fetch users:
{ "action": "fetch" }
-
Add user:
{ "action": "add", "name": "Ada Lovelace", "email": "ada@example.com" }
-
Fetch items:
{ "action": "fetch" }
-
Add item:
{ "action": "add", "name": "Keyboard", "price": 99.99, "imageUrl": "https://example.com/keyboard.jpg" }
-
Fetch purchases:
{ "action": "fetch" }
-
Add purchase:
{ "action": "add", "userId": 1, "itemId": 1, "quantity": 2 }
- SQLite database file is created at db/sales.sqlite.
- Purchase creation validates user and item, then authorizes payment before insert.
- On first run, sample items are seeded with image URLs if the items table is empty.