apikey-mcp-server
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., "@apikey-mcp-server find customer by email john@doe.com"
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.
apikey-mcp-server
A fully-featured Model Context Protocol (MCP) server with API-key authentication, demonstrating realistic e-commerce tools, resources, and prompts. Built on the official @modelcontextprotocol/sdk.
Quick Start
npm install
npm run build
# Start with a custom key:
API_KEY=my-secret-key npm start
# Or start without setting API_KEY — uses default key "mcp-api-key-default":
npm startRelated MCP server: mcp-server-demo
Authentication
This server requires an API key passed via the x-api-key custom header for HTTP transport access. This is the industry-standard header used by Stripe, SendGrid, GitHub REST API, and many others.
If
API_KEYenv var is set: use that value as the key.If
API_KEYenv var is unset: a default keymcp-api-key-defaultis used, so the server is never wide open.stdio transport: No authentication required — stdio is launched as a local subprocess on a trusted machine.
The /health endpoint is not authenticated so load balancers and monitoring tools can probe it.
Transports
Streamable HTTP
# Start the server
API_KEY=my-secret-key npm start
# Health check (no auth required)
curl http://localhost:3000/health
# Initialize an MCP session
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "x-api-key: my-secret-key" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2026-07-28","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}'stdio
npm run start:stdio
# Or: npx @modelcontextprotocol/inspector node dist/stdio.jsMCP Inspector
Transport:
Streamable HTTPURL:
http://localhost:3000/mcpCustom Header:
x-api-key = your-key-here
Configuration
Variable | Default | Description |
|
| API key for HTTP auth. Always falls back to this default if unset. |
|
| HTTP server port |
|
| Bind address (auto-switches to |
|
| Environment name |
|
| Max chars of request/response body to log |
MCP Capabilities
Tools (7)
Tool | Description |
| Search 25 customer records by name, email, or ID |
| Fetch full order details with line items, pricing, and tracking |
| Browse 30 products across 5 categories with text search and category filters |
| Estimate shipping cost by product weight and destination zone |
| Generate business reports: sales, customers, orders, inventory, or summary |
| Validate and standardize postal addresses with confidence scoring |
| Connectivity and health check with uptime info |
Resources (5)
URI | Description |
| Server configuration and feature flags (JSON) |
| Full product catalog — 30 products (JSON) |
| API documentation listing all capabilities (Markdown) |
| Individual customer record with order history (JSON) |
| Individual order record with line items and tracking (JSON) |
Prompts (4)
Prompt | Description |
| Generate a customer summary for support staff |
| Draft an order status email to a customer |
| Generate personalized product recommendations |
| Analyze business metrics and surface actionable insights |
Mock Data
All data is in-memory (no external database required):
25 customers across 4 tiers (bronze / silver / gold / platinum)
30 products across 5 categories (Electronics, Apparel, Home, Books, Sports)
30 orders across 5 statuses (pending, confirmed, shipped, delivered, cancelled)
4 shipping zones with weight-tiered rate tables
MCP Protocol Compatibility
Spec | Transport | Status |
Streamable HTTP | ✅ Primary | |
HTTP + SSE | ✅ Compatible |
Claude Desktop Configuration
Add to claude_desktop_config.json:
{
"mcpServers": {
"apikey-mcp-server": {
"command": "node",
"args": ["C:\\Users\\...\\apikey-mcp-server\\dist\\stdio.js"]
}
}
}Docker
docker build -t apikey-mcp-server .
docker run -p 8080:8080 -e API_KEY=my-secret-key apikey-mcp-serverScripts
Script | Description |
| Compile TypeScript to |
| Start HTTP server |
| Start stdio server |
| Watch mode (TypeScript compilation only) |
| Hot-reload HTTP server with tsx |
| Hot-reload stdio server with tsx |
| Launch MCP Inspector (stdio) |
| Build + run smoke test |
| Remove |
Project Structure
src/
├── server.ts # MCP server factory (createServer)
├── http.ts # Streamable HTTP transport + auth middleware
├── stdio.ts # Stdio transport entry point
├── auth.ts # API key validation (x-api-key header)
├── config.ts # Typed configuration loader (env vars)
├── data.ts # Mock data store (customers, products, orders, shipping)
├── tools.ts # 7 e-commerce tools
├── resources.ts # 5 resources (static + templated)
├── prompts.ts # 4 prompts
├── banner.ts # ANSI startup banner
└── logging.ts # Structured JSON logging with redaction
scripts/
└── smoke.mjs # stdio smoke testLicense
MIT
Available Tools
7 toolscalculate_shippingCalculate ShippingB
Estimate shipping cost for a product based on weight and destination zone.
Inputs: zone (required), product_id (required), quantity.
generate_reportGenerate ReportB
Generate a summary report with key business metrics: customer stats, order volumes, revenue, and product inventory.
Inputs: report_type (required), period.
get_orderGet OrderA
Fetch full order details by order ID, including line items, pricing, status, and tracking information.
Inputs: order_id (required).
list_productsList ProductsA
Browse the product catalog with optional category and text filters.
Inputs: limit, query, category.
pingPingA
Lightweight connectivity and health check. Returns server status, uptime, and version information.
Inputs: no named parameters.
search_customersSearch CustomersA
Search the customer directory by name, email, or customer ID. Returns matching customer profiles with tier, lifetime value, and order counts.
Inputs: query (required), limit.
validate_addressValidate AddressA
Validate and standardize a postal address. Returns a normalized version with a verification confidence score and any corrections.
Inputs: zip (required), city (required), state (required), street (required), +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct resource or action: orders, products, shipping, reports, addresses, health, and customers. There is no overlap or ambiguity between the tools.
Most tools follow a verb_noun pattern (get_order, list_products, calculate_shipping, generate_report, validate_address, search_customers), but 'ping' breaks the pattern by being a bare verb without a noun.
With 7 tools, the set is well-scoped for a data-oriented commerce server. Each tool serves a clear purpose without unnecessary bloat, and the count is within the ideal range.
The set covers read-only operations like fetching orders, listing products, and searching customers, but lacks basic lifecycle operations such as creating, updating, or deleting resources. Also missing is a list_orders or get_product endpoint, leaving notable gaps in the domain surface.
Maintenance
Related MCP Connectors
Hosted MCP for e-commerce: live product catalog, stock, and pricing for AI agents.
A full backend your AI coding agent can set up over MCP
Hosted Shopify MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted MCP server for live public-data APIs and Skills for AI agents.
Related MCP Servers
- FlicenseNot gradedqualityFmaintenanceA Model Context Protocol server that enables AI assistants to interact with a complete e-commerce application, providing authentication, product browsing, and shopping cart management through standardized MCP tools.-
- FlicenseNot gradedqualityDmaintenanceExample MCP server built with FastMCP, demonstrating tools, resources, and prompts for AI integration.14-
- FlicenseNot gradedqualityDmaintenanceA proof of concept MCP server that gives AI agents business context for e-commerce operations including orders, inventory, logistics, returns, claims, and payments.1-
- FlicenseAqualityDmaintenanceA beginner-friendly MCP server demonstrating custom Tools, Resources, and Prompts using FastMCP.10-