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

ops-automation-mcp-ts

v2.12.31

Published

TypeScript MCP server for Docker, K3s, Systemd service management and Jenkins builds

Downloads

547

Readme

ops-automation-mcp-ts

ops-automation-mcp-ts 是一套面向 Codex / Claude 的运维自动化 MCP,支持:

  • 服务器状态查询
  • Docker / K3s / Systemd 服务管理
  • Jenkins 直接构建
  • 前端自动部署
  • 后端自动部署
  • 前后端一体项目构建
  • 受控命令执行

这个包主要用于“通过 AI 对话做运维操作”。


1. 在 Codex 里接入

最常见的方式是在 Codex 配置里加入这个 MCP。

方式 A:使用 npm 最新版

[mcp_servers.ops_automation]
type = "stdio"
command = "npx"
args = ["-y", "[email protected]"]

方式 B:使用本地源码构建产物

[mcp_servers.ops_automation]
type = "stdio"
command = "node"
args = ["/绝对路径/ops-automation-mcp-ts/dist/index.js"]

Codex 配置文件常见位置:

  • macOS / Linux:~/.codex/config.toml
  • Windows:C:\\Users\\<用户名>\\.codex\\config.toml

配置完成后,重启 Codex 或重开会话即可。


2. 直接运行

npx ops-automation-mcp-ts

或者:

npm install -g ops-automation-mcp-ts
ops-automation-mcp-ts

3. 配置文件

配置目录:

~/.ops-automation/

常见文件:

  • hosts.yaml
  • jenkins.yaml
  • services.yaml

说明:

  • hosts.yaml:服务器 SSH 与环境信息,必须有
  • jenkins.yaml:Jenkins 配置,做构建或自动部署时必须有
  • services.yaml:可选,用于补充常见服务查找规则

4. 推荐初始化方式

推荐直接通过 Codex 对话初始化,而不是手工创建。

例如:

  • “帮我初始化 ops automation 配置”
  • “帮我初始化服务器配置”
  • “帮我初始化 Jenkins 配置”
  • “给我看 Jenkins 配置模板”

对应能力:

  • config_init
  • config_template

初始化后,推荐先验证:

  • “列出所有服务器”
  • “看看测试服务器状态”
  • “列出 Jenkins 所有视图”

5. 通过 Codex 怎么用

最推荐的说法是:

动作 + 目标 + 范围 + 补充条件

例如:

  • “看看测试服务器负载”
  • “重启 87 上的 microfront-main”
  • “Jenkins 构建 microfront-main 的 prev 分支”
  • “部署前端:http://git.xxx/project.git”
  • “部署后端:http://git.xxx/project.git,jdk17”
  • “在测试机执行 df -h”

Codex 通常会:

  1. 识别你的意图
  2. 优先调用高层工具
  3. 在需要时返回选项或配置草稿
  4. 帮你继续执行并返回结果

6. 功能模块

6.1 配置与帮助

用于:

  • 初始化配置文件
  • 查看模板
  • 查看 MCP 功能清单

6.2 服务器管理

用于:

  • 列服务器
  • 查资源状态
  • 查服务器分组

6.3 服务管理

用于:

  • 查 Docker / K3s / Systemd 服务
  • 看状态
  • 看日志
  • 启动 / 重启 / 停止

6.4 Jenkins 直接构建

适合:

  • Jenkins 里已经有项目
  • 你只想触发某个分支的构建

6.5 前端自动部署

适合:

  • 从 Git 地址开始部署前端
  • 首次部署时自动 review nginx 配置

6.6 后端自动部署

适合:

  • 从 Git 地址开始部署后端
  • 首次部署时自动确认端口和健康监测
  • 已迁移项目从仓库内 deploy/helm/values*.yaml 读取固定 Helm 配置

推荐把这些固定项收敛到项目仓库:

  • ports
  • useHealthCheck
  • replicaCount
  • resources

image.tag 这类每次发布都会变化的参数,继续由 Jenkins 动态传入。

详细约定和迁移方式见:

6.7 前后端一体项目

适合:

  • Jenkinsfile-All
  • frontend / backend / all 模式项目

6.8 受控命令执行

适合:

  • 在指定服务器执行命令
  • 需要风险控制和确认机制

7. 文档入口

完整用户手册:

功能清单与测试覆盖: