retail-mcp

retail-mcp

Connects AI clients to retail customer, inventory, sales, order, and support capabilities through the Model Context Protocol.

Category
访问服务器

README

Retail Enterprise MCP Portfolio

A complete enterprise portfolio that connects AI clients to retail customer, inventory, sales, order, and support capabilities through the Model Context Protocol (MCP). It combines strategic assessment, a working server, and production security/deployment artifacts in one repository.

Portfolio coverage

  1. MCP architecture assessment and design: architecture, MCP evaluation, risk assessment, ROI, and executive summary.
  2. Production MCP server: resources, tools, prompt, PostgreSQL adapter, Redis cache, connection pool, validation, transactions, idempotency, tests, and API documentation.
  3. Enterprise framework: security, Prometheus/Grafana, Docker, Kubernetes, TLS gateway, CI/CD, deployment, and disaster recovery.

Architecture

flowchart LR
  U[Enterprise User] --> H[AI Host / MCP Client]
  H -->|Streamable HTTP + TLS| G[Gateway / WAF]
  G --> M[Stateless MCP Replicas]
  M --> A[Authentication + RBAC]
  A --> R[Resource Manager]
  A --> T[Tool Manager]
  R --> C[(Redis Cache)]
  R --> P[Connection Pool]
  T --> P
  P --> D[(PostgreSQL)]
  D -. adapters .-> E[CRM / ERP / Inventory / Support]
  M --> O[Metrics / Audit / Alerts]

The editable diagram is docs/architecture.mmd.

MCP contract

Resources

URI template Permission Description
retail://customers/{customer_id} customer:read Customer profile with role-based PII filtering
retail://inventory/{sku} inventory:read Quantity, reorder threshold, and price
retail://sales/{sale_id} sales:read Confirmed retail sale

Tools

Tool Permission Safety property
process_order order:write Transaction, row lock, idempotency key, stock validation
update_inventory inventory:write Bounds validation, non-negative invariant, cache invalidation
create_support_ticket ticket:write Length/control-character validation and audit event

The investigate_customer_issue prompt provides workflow guidance but grants no permission.

Quick start

Prerequisites: asdf, uv, and optionally Docker. The repository pins Python in .tool-versions, following the workspace standard.

asdf install
asdf current python
cp .env.example .env
uv sync --python "$(asdf which python)" --extra dev
uv run pytest
uv run retail-mcp --transport http

In another terminal, run the non-destructive protocol smoke test, or let it manage a temporary local server with --start-server:

uv run python scripts/smoke_test.py
uv run python scripts/smoke_test.py --start-server

Connect an MCP client to http://localhost:8000/mcp and send one of these headers:

X-API-Key: dev-admin-key

or:

Authorization: Bearer dev-admin-key

Bundled keys work only in development. Production mode rejects them. For STDIO:

RETAIL_MCP_STDIO_API_KEY=dev-admin-key uv run retail-mcp --transport stdio

Full stack

docker compose up --build -d
docker compose ps
curl http://localhost:8000/health/ready

Services:

  • MCP server: localhost:8000/mcp
  • Prometheus: localhost:9090
  • Grafana: localhost:3000
  • PostgreSQL and Redis: private Compose network only

See deployment.md for production Compose, Kubernetes, TLS, secrets, SLOs, scaling, and rollback.

Configuration

All settings use the RETAIL_MCP_ prefix.

Variable Purpose Production requirement
ENVIRONMENT development, test, or production production
DATA_BACKEND memory or postgres postgres
DATABASE_URL PostgreSQL DSN Secret
REDIS_URL Shared cache URL Secret/private endpoint
API_KEYS JSON key/subject/role records Secret; no dev-* keys
STDIO_API_KEY Credential for local STDIO process Environment secret
RATE_LIMIT_PER_MINUTE Per-principal application limit Tune from load test
REQUEST_TIMEOUT_SECONDS Dependency operation timeout Below gateway timeout

Example API_KEYS value:

[
  {"key": "a-long-random-secret", "subject": "support-agent", "role": "customer_service"}
]

API keys are the scenario's required authentication mechanism. Enterprise evolution should replace them with OAuth 2.1 and audience-bound tokens while retaining the same Principal and RBAC boundary.

Quality and validation

uv run ruff check .
uv run ruff format --check .
uv run pytest
docker compose config
docker build -t retail-mcp:local .

The CI pipeline performs linting, tests with coverage, package build, dependency review, and container build. Before production, add organization-specific SAST, secret scanning, image vulnerability scanning, signing, provenance, and deployment approval.

Repository map

src/retail_mcp/       MCP server and enterprise application layers
tests/                Unit, authorization, resilience, and API tests
migrations/           PostgreSQL schema and seed data
monitoring/           Prometheus alerts and provisioned Grafana dashboard
deploy/               TLS gateway and Kubernetes deployment/HPA
docs/                 Architecture, business, security, operations, and DR
.github/workflows/    CI pipeline

Important limitations

  • The API-key manager is intentionally replaceable; use the corporate IdP for user-delegated production access.
  • The sample is single-tenant. Tenant identity must be enforced in principals, queries, row policies, and cache keys before multi-tenant use.
  • The PostgreSQL projection represents integration with systems of record; real CRM/ERP adapters and synchronization are organization-specific.
  • Performance and ROI figures are hypotheses until validated with production-like load tests and business measurements.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选