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

mes-fault-code-mcp

v1.1.0

Published

MES Fault Code MCP Server for Trae AI

Readme

MES Fault Code MCP Server

MES错误代码查询服务的MCP服务器,用于为Trae AI提供工具调用能力。

功能特性

  • 查询MES系统错误代码信息
  • 支持按错误代码精确匹配
  • 支持关键词模糊搜索
  • 支持按存储过程名称搜索

技术栈

  • Node.js >= 18.0.0
  • axios

环境变量配置

| 变量名 | 默认值 | 说明 | |--------|--------|------| | MES_API_URL | http://flex.otdmes.com.cn:60064 | MES后端API地址 | | MES_API_KEY | mes-ai-fault-code-2026 | API认证密钥 |

Trae配置

.trae/mcp.json 中添加:

{
  "mcpServers": {
    "mes-fault-code": {
      "command": "npx",
      "args": [
        "-y",
        "mes-fault-code-mcp"
      ],
      "env": {
        "MES_API_URL": "http://flex.otdmes.com.cn:60064",
        "MES_API_KEY": "mes-ai-fault-code-2026"
      }
    }
  }
}

工具调用

query_fault_code

查询MES系统错误代码信息

参数

| 参数名 | 类型 | 必填 | 说明 | |--------|------|------|------| | faultCode | string | 否 | 错误代码,精确匹配 | | keyword | string | 否 | 关键词,模糊搜索 | | sourceProcedure | string | 否 | 存储过程名称,模糊匹配 |

调用示例

query_fault_code(faultCode="SP00008")
query_fault_code(keyword="PCBA")
query_fault_code(sourceProcedure="OTD_API")

响应示例

{
  "result": "OK",
  "resultCode": "0",
  "resultMsg": "查询成功",
  "list": [
    {
      "faultCode": "SP00008",
      "description": "产品序号[[&]]不存在!",
      "triggerCondition": "...",
      "businessMeaning": "...",
      "resolution": "[...]",
      "sourceProcedures": "[...]",
      "occurrenceCount": 6343987
    }
  ]
}

npm发布

1. 登录npm

npm login

2. 更新版本号

修改 package.json 中的 version 字段:

{
  "version": "1.0.1"
}

3. 发布到npm

npm publish

部署指南

使用PM2管理进程(推荐)

# 安装PM2
npm install -g pm2

# 启动服务
pm2 start index.js --name mes-fault-code-mcp --env production

# 查看状态
pm2 status

# 查看日志
pm2 logs mes-fault-code-mcp

# 开机自启
pm2 startup
pm2 save

MCP协议支持

支持的方法

| 方法 | 说明 | |------|------| | initialize | 初始化连接 | | tools/list | 获取工具列表 | | tools/call | 调用工具 |

通知消息

服务器会忽略以下通知消息:

  • notifications/initialized

日志说明

服务器使用 console.error 输出日志,包含:

  • 启动信息
  • API配置
  • 接收到的消息
  • 处理状态
  • 错误信息

项目结构

mcp-server/
├── index.js          # MCP服务器主文件
├── package.json      # 项目配置
├── package-lock.json # 依赖锁定
└── README.md         # 说明文档

版本历史

| 版本 | 日期 | 说明 | |------|------|------| | 1.0.0 | 2026-05-29 | 初始版本,支持query_fault_code工具 |

许可证

ISC