Skip to main content
Glama
Viyozc

demo-mcps

by Viyozc
README.md
# demo-mcps

独立 Express 实现的制造业演示数据 MCP 服务。从 senti-flow 项目 `services/demo-mcp` 迁移而来,去除了对原 monorepo 的依赖。

## 功能

- **Mock API**:19 个制造业演示数据集(采购 / 生产 / 质量 / 仓储 / 财务)
- **MCP Server**:通过 Streamable HTTP 暴露 `list_data_types` 工具,告诉 LLM 如何拉取数据
- **健康检查**:`GET /healthz`

## 端点

| 方法 | 路径 | 说明 |
|---|---|---|
| GET | `/healthz` | 健康检查 |
| GET | `/v1/mock?method=xxx` | 获取某个数据集 |
| GET | `/v1/mock/methods[?category=xxx]` | 列出所有方法(可按类目过滤) |
| GET | `/mcp` | MCP 服务自描述 |
| POST | `/mcp` | MCP 协议入口(Streamable HTTP transport) |
| OPTIONS | `/mcp` | CORS 预检 |

## 快速开始

```bash
pnpm install
pnpm dev              # 热重载开发模式,监听 :4011
# 或
pnpm build && pnpm start
```

## 环境变量

| 变量 | 默认 | 说明 |
|---|---|---|
| `PORT` | `4011` | HTTP 监听端口 |
| `LOG_LEVEL` | `info` | pino 日志级别 |

## 在 MCP 客户端配置

```json
{
  "mcpServers": {
    "demo-mcps": {
      "url": "http://localhost:4011/mcp",
      "transport": "streamable-http"
    }
  }
}
```

## 数据集

19 个,按 5 大类组织,全部存于 `resources/<category>/*.json`:

| 类目 | 数量 | 示例方法 |
|---|---|---|
| procurement 采购 | 3 | `procurement_suppliers`、`procurement_purchase_orders`、`procurement_material_requisition` |
| production 生产 | 4 | `production_work_orders`、`production_bom`、`production_lines`、`production_equipment_maintenance` |
| quality 质量 | 3 | `quality_inspections`、`quality_non_conformances`、`quality_spc_metrics` |
| warehouse 仓储 | 4 | `warehouse_warehouses`、`warehouse_inventory`、`warehouse_stock_movements`、`warehouse_inbound_receipts` |
| finance 财务 | 5 | `finance_invoices`、`finance_accounts_payable`、`finance_accounts_receivable`、`finance_cost_centers`、`finance_budget_vs_actual` |

调用示例:

```bash
curl http://localhost:4011/v1/mock?method=procurement_suppliers
```

Maintenance

ActivityStale
ResponsivenessNo issues