npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

baihua-mes-mcp

v1.0.0

Published

百华智造MES WorkBuddy连接器 MCP Server(只读查询MES业务数据,stdio传输)

Readme

百华智造MES WorkBuddy 连接器(baihua-mes-mcp)

将百华智造MES业务数据以只读方式开放给腾讯 WorkBuddy(桌面 AI Agent),用户安装连接器后可用自然语言查询销售订单、工单、库存等 27 类数据。

目录结构

mcp-server/
├── src/index.js               # MCP Server(stdio),3个工具:list_mes_domains / query_mes_data / aggregate_mes_data
├── connector/                 # WorkBuddy 连接器提交目录(打包此目录提交审核)
│   ├── connector-meta.json    # 连接器元信息(source: baihua-mes, auth_mode: token)
│   ├── mcp.json               # MCP 启动配置(npx 方式,需包发布到 npm 后生效)
│   ├── token-schema.json      # 用户自填凭证表单(服务器地址/账号/密码,仅存本机)
│   ├── icon.svg
│   └── skills/mes-query/SKILL.md  # 教 AI 如何调用工具
├── test/smoke.test.js         # JSON-RPC stdio 联调自测脚本
└── package.json

依赖的 MES 后端接口

  • POST /api/auth/login — 登录换 JWT(支持在线冲突检测,见下方"专用账号")
  • GET /api/mcp/domains — 数据域目录
  • POST /api/mcp/query — 按域查询(白名单+数据权限+敏感域门控)
  • POST /api/mcp/aggregate — 分组统计

安全模型完全复用百小助 services/aiTools.js 的 DOMAINS 注册表:只读、字段/过滤白名单、dataScope 数据权限、成本需 cost:view、工资仅本人。

本地联调(无需发布 npm)

  1. 启动 MES 后端(默认 3000 端口)
  2. 安装依赖并跑冒烟测试:
cd mcp-server
npm install
MES_BASE_URL=http://localhost:3000 MES_USERNAME=admin MES_PASSWORD='你的密码' node test/smoke.test.js
  1. 在 WorkBuddy 客户端本地调试:新建连接器选择"本地目录",mcp.json 临时把 command 改为 node、args 改为 ["/绝对路径/mcp-server/src/index.js"],env 三个变量照填。

专用账号(重要)

MES 登录有在线冲突检测:同一账号已在网页端登录时,连接器登录会被拒(报"该账号已在其他位置登录")。给客户部署时应在 MES 中创建一个专用查询账号(如 workbuddy),按其数据范围授权,既避免互踢,也符合最小权限原则。

发布上架流程

  1. 将 baihua-mes-mcp 包发布到 npm(去掉 package.json 的 private: true),connector/mcp.json 的 npx 启动方式即可生效
  2. 打包 connector/ 目录提交 WorkBuddy 团队审核(官方文档:https://open.workbuddy.cn/docs/connector)
  3. 审核通过后上架连接器市场;后续更新递增 version 重新提交(约 10~15 分钟生效)

提交前自检清单(对照官方要求)

  • [x] source 全局唯一 kebab-case(baihua-mes)
  • [x] 仅一个 MCP Server,stdio 本地模式(私有化部署无需公网暴露)
  • [x] auth_mode: token + token-schema.json,密码字段 password 类型
  • [x] ${VAR} 占位符与表单字段 key 一一对应(MES_BASE_URL/MES_USERNAME/MES_PASSWORD)
  • [x] minWorkbuddyVersion: 4.23.0(token 模式最低版本)
  • [x] 未硬编码任何真实凭证
  • [x] 工具超时 25s < 官方建议 30s,错误信息可读
  • [x] SKILL.md 覆盖全部工具用法、错误场景与安全约束