Andon SOP 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., "@Andon SOP MCP Server 查询最近一周的异常报表"
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.
Andon SOP MCP Server
这是一个面向 WorkBuddy 的本地 MCP Server,用于连接 MES 系统,提供 SOP 上传辅助工具和异常报表查询工具。
当前项目通过 MCP stdio 协议与 WorkBuddy 通信,通过 HTTP REST 接口访问 MES 后端。
架构
WorkBuddy
|
| MCP Protocol (stdio)
v
本地 MCP Server(本项目)
|
| HTTP REST / 登录鉴权
v
MES 系统Related MCP server: Industrial MCP Agent Platform
环境要求
Node.js >= 18
npm
WorkBuddy
可访问的 MES 后端服务
MES 登录账号和密码,或可用的 MES 鉴权配置
快速开始
1. 安装依赖
进入项目根目录:
cd D:\svn-workspace\andon_sop-mcp安装依赖:
npm install2. 配置 MES 连接
配置文件位于:
config\mes-config.json示例:
{
"mes": {
"baseUrl": "http://localhost:9998",
"auth": {
"type": "login",
"username": "superadmin",
"password": "1234554321",
"loginUrl": "/main/login",
"contentType": "application/x-www-form-urlencoded"
},
"timeout": 300000,
"queryTimeoutMs": 25000,
"retry": 3,
"writeIntervalMs": 2400
},
"tools": {
"likeSelectMaterielList": true,
"selectCategoryTreeList": true,
"uploadSop": true
}
}字段说明:
字段 | 说明 |
| MES 后端地址。如果 MES 不在本机,不要使用 |
| 当前使用 |
| MES 用户名。 |
| MES 密码。 |
| MES 登录接口路径。 |
| 普通请求超时时间,单位毫秒。 |
| 查询类请求超时时间,单位毫秒。 |
| 网络失败后的重试次数。 |
| 写入类接口调用间隔,用于避开 MES 防重复提交限制。 |
| 控制 MCP 工具是否启用, |
3. 编译
npm run build编译后入口文件是:
dist\src\index.js4. 本地手动启动测试
$env:MES_CONFIG_PATH="D:\svn-workspace\andon_sop-mcp\config\mes-config.json"
node D:\svn-workspace\andon_sop-mcp\dist\src\index.js如果看到类似日志,说明 MCP Server 已启动:
MES TaskReport MCP Server starting...
Config loaded from: D:\svn-workspace\andon_sop-mcp\config\mes-config.json
Registered 3 tools: likeSelectMaterielList, selectCategoryTreeList, uploadSop
MES TaskReport MCP Server is ready. Waiting for requests...这是 stdio MCP,启动后会等待客户端连接,终端没有继续输出是正常的。测试结束后按 Ctrl + C 退出。
WorkBuddy 配置
在 WorkBuddy 的自定义 MCP 配置中填写:
{
"mcpServers": {
"andon-sop-mcp": {
"type": "stdio",
"command": "node",
"args": [
"D:\\svn-workspace\\andon_sop-mcp\\dist\\src\\index.js"
],
"cwd": "D:\\svn-workspace\\andon_sop-mcp",
"env": {
"MES_CONFIG_PATH": "D:\\svn-workspace\\andon_sop-mcp\\config\\mes-config.json"
}
}
}
}说明:
字段 | 说明 |
| 固定使用 |
| 启动命令,这里是 |
| MCP 编译后的入口文件。 |
| 项目根目录,即 |
| 指定 |
Windows 路径写到 JSON 中时,\ 要写成 \\。
可用工具
Tool | 用途 |
| 按物料名称模糊分页查询物料,返回物料 ID、名称、编码。 |
| 查询 SOP 分类列表,返回分类 ID 和分类名称。 |
| 上传 SOP 文件到 MES。 |
典型使用流程
上传 SOP
准备或生成 SOP 文件,并拿到本地文件路径
file_path。如果只有物料名称,调用
likeSelectMaterielList查询物料,让用户选择正确物料,使用表格中的物料 ID 作为materielId。如果没有 SOP 分类 ID,调用
selectCategoryTreeList查询分类,让用户选择正确分类,使用表格中的分类 ID 作为esopCategoryId。确认
version、procedureId。参数齐全后调用
uploadSop。
uploadSop 必需参数:
参数 | 说明 |
| 本地 SOP 文件路径,MCP Server 所在机器必须能读取。 |
| SOP 版本号。 |
| 物料 ID。 |
| 工序 ID。 |
| SOP 分类 ID。 |
不要猜测 materielId、procedureId、esopCategoryId。如果用户没有明确提供,应先查询或追问。
Skills
项目内置了 WorkBuddy 使用流程说明:
skills\mes-sop-abnormal-workflows\SKILL.md该技能重点说明:
上传 SOP 应按什么流程调用 MCP 工具
哪些 ID 不能猜,必须查询或询问用户
自包含打包
项目提供 scripts\bundle.mjs,用于把 MCP Server 打包成单个 JS 文件:
npm run bundle输出文件:
andon_sop-mcp.js这种方式适合分发给其他电脑使用。对方仍需要:
Node.js >= 18
config\mes-config.jsonWorkBuddy MCP 配置指向打包后的 JS 文件
如果执行 npm run bundle 报找不到 esbuild,先执行:
npm install项目结构
andon_sop-mcp/
├─ config/
│ ├─ mes-config.json # MES 实际连接配置
│ ├─ mes-config.example.json # MES 配置示例
│ └─ 说明.txt # WorkBuddy 配置简要说明
├─ docs/
│ └─ workbuddy配置教程.md # WorkBuddy 详细配置教程
├─ scripts/
│ └─ bundle.mjs # esbuild 打包脚本
├─ skills/
│ └─ mes-sop-abnormal-workflows/
│ └─ SKILL.md # WorkBuddy 业务流程技能说明
├─ src/
│ ├─ index.ts # MCP Server 入口
│ ├─ tools/
│ │ ├─ index.ts # 工具注册
│ │ ├─ like_select_materiel_list.ts
│ │ ├─ select_category_tree_list.ts
│ │ ├─ upload_sop.ts
│ │ └─ query_abnormal_report_page.ts
│ ├─ services/
│ │ ├─ mesClient.ts # MES HTTP 客户端
│ │ ├─ authService.ts # 登录和 token 管理
│ │ └─ entityResolverService.ts
│ ├─ types/
│ │ ├─ api.ts
│ │ └─ toolContent.ts
│ └─ utils/
│ └─ logger.ts # 日志输出到 stderr,避免干扰 MCP stdio
├─ test/
├─ package.json
└─ tsconfig.json常见问题
MCP error -32000: Connection closed
通常表示 WorkBuddy 启动了本地 MCP 进程,但 MCP 进程马上退出。
优先检查:
是否执行过
npm run build。dist\src\index.js是否存在。WorkBuddy 配置里的
cwd是否是项目根目录。MES_CONFIG_PATH是否指向真实存在的config\mes-config.json。mes-config.json是否是合法 JSON。node命令是否可用。
MES 接口连不上
检查 config\mes-config.json:
"baseUrl": "http://localhost:9998"如果 MES 后端不在本机,必须改成真实 MES 地址。
工具没有出现
检查 config\mes-config.json 的 tools 配置。设置为 false 的工具不会注册。
开发命令
# 编译 TypeScript
npm run build
# 运行测试
npm test
# 启动 MCP Server
npm start
# 打包成单个 JS 文件
npm run bundle扩展工具
新增 MCP 工具时:
在
src\tools下新增工具文件。导出
name、description、inputSchema、handler。在
src\tools\index.ts中注册。在
config\mes-config.json的tools中增加开关。添加对应测试。
Available Tools
12 toolsauditProductionTaskA
批量下达生产任务,调用 /productionTask/audit。调用本工具前必须先调用 queryProductionTaskList 查询生产任务并让用户选择要下达的任务。只有 checkStatus 为 0(未下达)的生产任务允许下达;其他状态不能下达。本工具会在下达前校验每个生产任务的 checkStatus。
Inputs: tasks (required).
dispatchToStationA
将一个或多个 SOP 派发到工位机。调用本工具前必须先调用 querySopList 查询并选择 SOP,ids 来自 SOP 记录 id;还必须先调用 queryWorkstationList 查询并选择工位机,stationId 和 stationName 必须来自同一条工位机记录。本工具支持批量派发,会把多个 SOP id 用英文逗号拼接为 ids。
Inputs: sops (required), stationId (required), stationName (required).
likeSelectMaterielListA
按 MES 表单配置动态分页查询物料列表。会先读取 Materiel 表单字段配置,构建查询参数,查询 /materiel/queryPageMap,并使用数据字典翻译展示值。调用 uploadSop 前可先用本工具查询物料,并从返回的 Work Buddy 查询上下文中读取记录 id 作为 materielId。
Inputs: page, limit, contain, exclude, +1 more.
previewSopFileA
预览 SOP 文件异常标注点图片。调用本工具前应先调用 queryAbnormalDrawingList 查询 SOP 异常图纸/异常标注点列表,并让用户选择要查看的记录 id。本工具会访问 /attachment/getMapById,根据返回实体中的文件路径字段拼接前端可访问的图片 URL。
Inputs: id (required).
queryAbnormalDrawingListA
分页查询SOP异常图纸列表。会先调用 /form/initFieldData 读取 AbnormalDrawing 表单字段配置,再调用 /attachment/queryPageMap 查询分页数据;分页查询 className 固定为 Attachment,并固定传入 fileType=abnormalDrawing。返回的 Work Buddy 查询上下文会包含每条记录的 id,方便后续选择异常图纸记录继续操作。
Inputs: page, limit, contain, exclude, +1 more.
queryProductionTaskListA
分页查询生产任务列表。会先调用 /form/initFieldData 读取 ProductionTask 表单字段配置,再调用 /productionTask/queryPageMap 查询分页数据,并使用数据字典翻译展示值。返回的 Work Buddy 查询上下文会包含每条记录的 id,方便后续按生产任务记录继续操作。
Inputs: page, limit, contain, exclude, +1 more.
querySopListA
分页查询 SOP 列表。会先调用 /form/initFieldData 读取 ESOPAttachment 表单字段配置,再调用 /esopAttachment/queryPageMap 查询分页数据,并使用数据字典翻译展示值。返回的 Work Buddy 查询上下文会包含每条记录的 id,方便后续按 SOP 记录继续操作。
Inputs: page, limit, contain, exclude, +1 more.
queryWorkstationListA
查询工位机列表。会读取 AndonSysUser 表单配置,查询 /user/queryPageMap,并固定带上 accountType=1。返回的 Work Buddy 查询上下文会包含每条工位机记录的 id,方便后续选择工位机。
Inputs: page, limit, contain, exclude, +1 more.
reverseAuditProductionTaskA
批量反下达生产任务,调用 /productionTask/reverseAudit。调用本工具前必须先调用 queryProductionTaskList 查询生产任务并让用户选择要反下达的任务。只有 checkStatus 为 1(已下达)的生产任务允许反下达;其他状态不能反下达。本工具会在反下达前校验每个生产任务的 checkStatus。
Inputs: tasks (required).
saveCategoryA
新增 SOP 分类。调用前应先使用 selectCategoryTreeList 查询分类树,让用户选择父分类;将选择数据中的 id 作为 parentId。未传 parentId 时默认创建到 ROOT。
Inputs: title (required), parentId.
selectCategoryTreeListB
查询 SOP 分类树并扁平化展示。展示给用户时只显示层级和分类名称;Work Buddy 可从结果中的选择数据读取 id 作为 esopCategoryId。
Inputs: no named parameters.
uploadSopB
上传 SOP 文件到 MES 系统。只有在所有参数齐全后才能调用。
Inputs: version (required), file_path (required), materielId (required), esopCategoryId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool has a clearly distinct purpose targeting different entities or actions. Query tools are differentiated by entity type (production task, SOP, workstation, etc.) and action tools are uniquely named (audit, dispatch, upload). There is no ambiguity or overlap.
Tool names follow a consistent verb_noun pattern in camelCase (e.g., queryProductionTaskList, auditProductionTask). Some names like 'likeSelectMaterielList' and 'dispatchToStation' deviate slightly but remain understandable. Overall predictable.
With 12 tools covering production task management, SOP file operations, workstation dispatch, material queries, and category management, the count is well-scoped for the server's purpose. Each tool earns its place without redundancy.
Core workflows are covered: querying, creating (category, SOP), approving tasks, and dispatching. However, missing update and delete operations for several entities (e.g., no update for production tasks or categories) leave notable gaps that may require agents to work around.
Related MCP Connectors
MCP server for Support & Service Management
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
MCP server for Product Management
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server enabling CAD interaction with Creo Parametric and knowledge base retrieval from Volcengine.24 PyPI9MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for integrating manufacturing systems (MES/ERP/quality/maintenance) with LLM agents, enabling event ingestion, incident triage, approval workflows, and RAG-based knowledge retrieval.MIT
- AlicenseAqualityNot gradedmaintenanceMCP server that unifies real-time telemetry from industrial systems into a single queryable interface, enabling production visibility, anomaly detection, and operational insights.56 npmMIT
- AlicenseNot gradedqualityCmaintenanceMCP server for HolmesGPT that provides runbook search, gap detection, AI-assisted drafting, and root cause analysis by integrating with Confluence and Git providers.Apache 2.0