compu-ai-mcp
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., "@compu-ai-mcp What laptops are in stock under 5000 quetzales?"
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.
compu-ai-mcp
MCP server for a computer and electronics store. It exposes the store's commercial truth — catalogue, real stock, prices, promotions, instalment plans, quotes, reservations and orders — as MCP tools backed by PostgreSQL.
The Model Context Protocol is implemented directly over JSON-RPC 2.0: no MCP SDK is used, only the message exchange defined by the specification.
Built for CC3067 Redes, Universidad del Valle de Guatemala. Free to reuse.
Why it is not a trivial server
Every answer is a real SQL query against PostgreSQL; nothing is hard-coded.
Prices are computed by applying the best active promotion at query time.
Instalments are computed in integer cents, with the last payment absorbing the rounding remainder so the payments always add up exactly to the total.
Reservations run inside a transaction with
SELECT ... FOR UPDATE, so two concurrent callers cannot both take the last unit, and they are idempotent: repeating the same key returns the existing reservation instead of double booking.Turning a reservation into an order moves stock in both counters atomically.
Related MCP server: MCP Orquestacion de Agentes
Requirements
Node.js 20.6+
Docker (for the bundled PostgreSQL) or any reachable PostgreSQL 14+
Installation
git clone https://github.com/<user>/compu-ai-mcp
cd compu-ai-mcp
npm install
cp .env.example .env
npm run db:up # PostgreSQL 17 in Docker, host port 5434
npm run db:setup # creates the schema and loads the demo catalogue
npm run buildVerify it works, end to end, without any host or LLM:
npm run selftestThe self test walks the three business use cases (recommend, offer an
alternative when out of stock, quote → reserve → order) and checks the guard
rails. It prints ALL CHECKS PASSED when everything is fine.
Check that the server obeys the protocol:
npm run conformanceThis one drives dist/index.js over real stdio pipes with a throwaway client —
deliberately not the project's own MCP client, so a bug present on both sides of
the connection cannot hide. It covers 28 checks: the handshake, version
negotiation and fallback, notifications going unanswered, correlation of
concurrent requests by id, string ids, the JSON-RPC error codes (-32700,
-32601, -32602), recovery from malformed input, business failures reported
as isError instead of protocol errors, and stdout carrying nothing but
protocol frames.
Using it from an MCP host
The server speaks stdio: one JSON-RPC message per line on stdin/stdout.
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"compu-ai": {
"command": "node",
"args": ["/absolute/path/to/compu-ai-mcp/dist/index.js"],
"env": {
"DATABASE_URL": "postgres://compu_ai:compu_ai_local_only@localhost:5434/compu_ai"
}
}
}
}Any other host
{
"name": "compu-ai",
"command": "node",
"args": ["dist/index.js"],
"cwd": "/absolute/path/to/compu-ai-mcp"
}By hand, to see the protocol
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"demo","version":"1.0"}}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
'{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"check_availability","arguments":{"sku":"LAP-ACR-A515"}}}' \
| node dist/index.jsTools
Tool | Reads / writes | Purpose |
| read | Search the catalogue by text, category, brand, budget and stock |
| read | Specs, price, promotion, warranty and stock of one SKU |
| read | Units really available (on hand − reserved) |
| read | List price, active promotion, final cash price, card price |
| read | Compare 2–4 SKUs side by side |
| read | Available substitutes in the same category and price range |
| read | Instalment plans that apply to an amount |
| read | Exact monthly payment for a SKU under a plan |
| write | Persist a quote and return its code |
| write | Hold units for a customer (idempotent, concurrency safe) |
| write | Return held units to stock |
| write | Turn a reservation into a confirmed order |
| read | Look up an order by code |
| read | Hours, location, warranty, returns, shipping |
Full parameter-by-parameter specification with examples:
docs/specification.md.
Demo data
14 products across laptops, desktops, monitors, components and peripherals, with
prices in Guatemalan quetzales. Two products are deliberately out of stock
(LAP-ASU-VB15, PER-HP-LJ107) so a host can be shown offering alternatives,
and two carry an active promotion (LAP-ACR-A515, MON-SAM-24F).
Re-running npm run db:setup always rebuilds the same dataset.
Configuration
Variable | Default | Meaning |
|
| PostgreSQL connection |
|
| Symbol used when formatting money |
Layout
db/schema.sql tables (money stored in integer cents)
db/seed.sql reproducible demo catalogue
src/index.ts stdio loop: one JSON-RPC message per line
src/protocol.ts initialize / tools/list / tools/call dispatch
src/tools.ts the 14 tools and their SQL
src/money.ts instalment maths in integer cents
src/db.ts connection pool and transaction helper
src/selftest.ts end-to-end check through the JSON-RPC layerLicence
MIT.
Available Tools
14 toolscalculate_installmentsARead-only
Calculate the exact monthly payment for a SKU under one instalment plan. Applies the active promotion, the plan surcharge, the fee and the interest. Never quote instalments without calling this.
Inputs: sku (required), plan_id (required), quantity.
check_availabilityARead-only
Check how many units of a SKU are really available right now (on hand minus reserved). Use this before promising anything to a customer.
Inputs: sku (required).
compare_productsARead-only
Compare two to four SKUs side by side: price, key specifications, warranty and availability.
Inputs: skus (required).
create_orderADestructive
Turn an active reservation into a confirmed order, discounting the units from stock. This writes to the database; confirm with the salesperson before calling it.
Inputs: payment_method (required), reservation_code (required), plan_id.
create_quoteA
Create a formal quote for a customer, optionally under an instalment plan. Returns a quote code that can be given to the customer. This writes to the database.
Inputs: sku (required), customer (required), plan_id, quantity.
get_current_priceARead-only
Current price of a SKU: list price, active promotion, final cash price and card price. This is the only valid source of prices.
Inputs: sku (required).
get_order_statusARead-only
Look up an order by its code and return its current status.
Inputs: order_code (required).
get_product_detailsARead-only
Full detail of one product by SKU: specifications, price, promotion, warranty and stock by condition and location.
Inputs: sku (required).
get_store_policiesARead-only
Current store policies: business hours, location, warranty, returns and shipping. Use this instead of answering from memory.
Inputs: key.
list_installment_plansARead-only
List the instalment plans currently offered, optionally filtered by the amount the customer wants to finance.
Inputs: amount.
recommend_alternativesARead-only
Given a SKU that the customer wanted, propose available products from the same category in a similar price range. Use this when the requested product is out of stock or over budget.
Inputs: sku (required), limit, max_price.
release_reservationAIdempotent
Release an active reservation and return the units to available stock. This writes to the database.
Inputs: reservation_code (required).
reserve_itemAIdempotent
Hold units of a SKU for a customer for a limited time. Fails if there is not enough available stock. This writes to the database; confirm with the salesperson first.
Inputs: sku (required), customer (required), idempotency_key (required), quantity, +1 more.
search_productsARead-only
Search the store catalogue by free text, category, brand and/or maximum budget. Returns SKU, price with any active promotion applied, and real stock. Use this before answering anything about what the store sells.
Inputs: text, brand, limit, category, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Each tool has a clearly distinct purpose: searching, retrieving details, checking availability, getting price, comparing, recommending, listing plans, calculating installments, reserving, releasing, creating order, checking order status, getting policies, and creating quotes. No overlapping functionality is evident.
All tool names follow a consistent verb_noun pattern in snake_case (e.g., search_products, get_product_details, reserve_item, create_order). The naming style is uniform and predictable.
With 14 tools, the set is well-scoped for a store operation domain. It covers a broad range of customer and sales workflows without being excessive or sparse.
The tool surface covers the full lifecycle from product discovery (search, details, compare) to transactional actions (reserve, order, quote) and support (policies, installment plans). No critical gaps are apparent.
Maintenance
Related MCP Connectors
Managed Postgres MCP: projects, SQL, docs search, and storage buckets via OAuth.
Unified MCP server for 70+ eCommerce platforms: products, orders, customers, and more.
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
Sample shop MCP server: paginated search, idempotent orders, guarded cancellation. Four languages.
Related MCP Servers
- AlicenseAqualityCmaintenanceFull-featured MCP server that exposes 36 tools for interacting with PostgreSQL databases, covering schema introspection, query execution, data exploration, performance monitoring, security auditing, and maintenance.365 npmMIT
- AlicenseNot gradedqualityDmaintenanceMCP server that exposes tools to query an e-commerce database (customers, sales, products) using natural language, orchestrated by a LangChain agent with Groq's LLM.MIT
- AlicenseAqualityCmaintenanceA comprehensive PostgreSQL MCP server providing 27 tools for database management and administration, including connection management, query execution, schema introspection, CRUD operations, and server monitoring.2738 npmAGPL 3.0
- FlicenseNot gradedqualityDmaintenanceHTTP MCP server that reads from and writes to a PostgreSQL database (bankdb). Provides tools for querying and managing customer, account, and transaction data.-