ops MCP server
Commit Oct 29, 2026Enables AI agents to perform zero-downtime deployments, rollbacks, service restarts, and remote log inspection via SSH.
Also known as key086/ops-mcp
- Stars
- 0
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Oct 29, 2026
- License
- MIT
What is ops MCP?
ops enables AI agents to perform zero-downtime deployments, rollbacks, service restarts, and remote log inspection via SSH.
Summary generated from the project's README
About ops MCP server
Managing server deployments and maintenance through natural language is what ops-mcp enables for developers using AI clients like Claude, OpenCode, or Cursor. This server provides a bridge between an AI agent and your remote infrastructure via SSH, allowing for zero-downtime deployments using a timestamped directory and symbolic link switching method. It is designed to run locally on your machine, requiring only a configuration file containing your project details, host addresses, and SSH keys.
Users can perform complex operations such as instant rollbacks, service restarts via systemd or pm2, and remote log inspection using tail commands. The system includes built-in safety features like a dryRun mode to preview deployment plans and automatic rollbacks if a health check fails. It also supports automated notifications to Slack, DingTalk, WeChat, or Feishu. Because it relies on standard SSH, no additional software needs to be installed on your remote servers, making it a lightweight solution for managing multiple cloud instances.
What you can do with it
- 1Automate health monitoringSet up the system to automatically roll back a deployment if the remote health URL returns an error.
Written from the project's README. Every use case is checked against a quote from it.
How to install ops MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall ops MCP in Claude Code
$ claude mcp add ops-mcp -- npx -y ops-mcpInstall ops MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"ops-mcp": {
"command": "npx",
"args": [
"-y",
"ops-mcp"
]
}
}
}Install ops MCP in VS Code
.vscode/mcp.json
{
"servers": {
"ops-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"ops-mcp"
]
}
}
}Install ops MCP in VS Code CLI
$ code --add-mcp '{"name":"ops-mcp","type":"stdio","command":"npx","args":["-y","ops-mcp"]}'Install ops MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"ops-mcp": {
"command": "npx",
"args": [
"-y",
"ops-mcp"
]
}
}
}Install ops MCP in Codex
$ codex mcp add ops-mcp -- npx -y ops-mcpInstall ops MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.ops-mcp] command = "npx" args = ["-y", "ops-mcp"]
Install ops MCP in Gemini CLI
$ gemini mcp add -s user ops-mcp npx -- -y ops-mcpInstall ops MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"ops-mcp": {
"command": "npx",
"args": [
"-y",
"ops-mcp"
]
}
}
}Configuration
OPS_MCP_CONFIG
Automated checks
Ran Nov 14, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachablekey086/ops-mcp is public and reachablegithub.com/key086/ops-mcp ↗Pass
- Package names this repository as its sourceops-mcp names key086/ops-mcp as sourcenpmjs.com/package/ops-mcp ↗Pass
- Build provenance (Sigstore attestation)No build attestation published for this releaseNot checked
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-10-29github.com/key086/ops-mcp ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNo popular package one edit away from ops-mcpPass
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubops-mcp
让 AI Agent 接管你的服务器发布运维。 Zero-downtime deploys, instant rollbacks, log inspection and service restarts — exposed as MCP tools for Claude, OpenCode, Cursor and any MCP client.
源自真实生产环境:一位全栈工程师用 Shell + Expect 维护 7 台云服务器、30+ 发布脚本多年后,把这套「时间戳版本目录 + 软链原子切换」的发布工程重写为标准 MCP Server。现在你可以直接对 AI 说:"把 admin-web 发一下"、"刚才那次发布有问题,回滚"、"看下网关日志最后 200 行"。
特性
- 🚀 零停机发布 — 构建产物上传至
releases/<时间戳>,ln -sfn原子切换current软链,Nginx 无感知 - ⏪ 秒级回滚 — 保留最近 N 个版本,一条指令切回任意历史版本
- 🩺 健康检查 + 自动回滚 — 部署后在远端探测健康 URL(支持内网地址),失败自动切回上一版本,把故障时间压到秒级
- 📣 群机器人通知 — 部署/回滚/健康检查失败自动推送飞书(支持加签)/ 钉钉 / 企业微信 / Slack
- 🔍 日志巡检 — tail 远端日志 / systemd journal,AI 直接读日志定位问题
- 🔁 服务重启 — systemd / pm2 / 自定义命令统一抽象
- 🧾 审计日志 — 每次部署/回滚写入远端
.ops-history.log,谁让 AI 干了什么有据可查 - 🛡️ 凭据不出本机 — 密钥/密码只存在于本地配置文件,任何工具输出与 MCP resource 均自动脱敏;支持
dryRun先看计划再执行 - 📦 零依赖服务端 — 服务器端不需要安装任何东西,只要能 SSH
工作原理
<remoteRoot>/
├── releases/
│ ├── 20261028-101500/ ← 每次部署一个时间戳目录
│ ├── 20261027-183012/
│ └── ...(保留最近 keep 个,自动清理)
├── current -> releases/20261028-101500 ← ln -sfn 原子切换(发布点)
└── .ops-history.log ← 部署/回滚审计日志
Nginx root 指向 current,软链切换是原子的,用户请求无感知;回滚只是把软链指回旧目录。
安装
npm install -g ops-mcp
# 或不安装直接用
npx -y ops-mcp
配置
复制 ops.config.example.json 到 ~/.ops-mcp/config.json:
{
"projects": [
{
"name": "admin-web", // 项目名(AI 调用时的标识)
"description": "运营管理后台(React SPA)",
"host": "203.0.113.10",
"username": "deploy",
"privateKey": "~/.ssh/id_ed25519", // 推荐密钥登录
"remoteRoot": "/data/www/admin-web", // Nginx root 指向 <remoteRoot>/current
"localDist": "./dist", // 默认上传的本地构建目录
"keep": 5, // 保留历史版本数
"logs": ["/var/log/nginx/admin-web.access.log"]
},
{
"name": "api-server",
"description": "Java 服务(systemd 托管)",
"host": "203.0.113.11",
"username": "deploy",
"privateKey": "~/.ssh/id_ed25519",
"remoteRoot": "/data/app/api-server",
"service": { "type": "systemd", "name": "api-server" }, // 部署后自动重启
"healthCheck": { // 部署后健康检查
"url": "http://127.0.0.1:8080/actuator/health",
"expectStatus": 200,
"retries": 3,
"intervalSec": 3
},
"autoRollback": true, // 检查失败自动回滚(默认开启)
"notify": { // 结果推送群机器人
"webhook": "https://open.feishu.cn/open-apis/bot/v2/hook/xxx",
"secret": "飞书加签密钥(可选)"
},
"keep": 3
}
]
}
配置文件查找顺序:$OPS_MCP_CONFIG → ./ops.config.json → ~/.ops-mcp/config.json。
接入 MCP 客户端
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"ops": {
"command": "npx",
"args": ["-y", "ops-mcp"]
}
}
}
OpenCode (opencode.json):
{
"mcp": {
"ops": {
"type": "local",
"command": ["npx", "-y", "ops-mcp"],
"enabled": true
}
}
}
然后直接对 AI 说人话:
"把 admin-web 发一下,先 dryRun 给我看计划" "线上 502 了,看下 api-server 日志最后 200 行,找出原因,需要的话回滚"
工具一览
| 工具 | 说明 |
|---|---|
list_projects |
列出所有已配置项目 |
deploy |
零停机部署(支持 dryRun 预览执行计划) |
rollback |
回滚到前 N 个版本,自动重启服务 |
list_releases |
查看历史版本与当前生效版本 |
health_check |
手动触发健康探测(远端执行,支持内网 URL) |
tail_log |
查看远端日志 / systemd journal |
restart |
重启服务(systemd / pm2 / 自定义命令) |
status |
当前版本、服务活性、磁盘余量、最近操作记录 |
ops://projects(resource) |
脱敏后的项目配置,供 Agent 了解环境 |
安全设计
- 私钥/密码仅存于本地配置,永不出现在任何工具输出、日志与 MCP resource 中(
sanitizeProject强制脱敏) deploy支持dryRun,配合 MCP 客户端的工具审批机制,危险操作先预览后执行- 服务器端零安装、零守护进程,攻击面与普通 SSH 运维一致
- 建议为部署单独建低权限系统账户,只授予发布目录写权限与
systemctl restart <指定服务>的 sudoers 白名单
Roadmap
- 部署后健康检查(HTTP probe 失败自动回滚)
- 飞书(含加签)/ 钉钉 / 企业微信 / Slack 部署通知
- 多主机灰度发布(canary:先切一台观察再全量)
- Docker 镜像发布模式(build → push → 远端 pull & up)
- Web 控制台模式(SSE 实时部署日志,浏览器可看)
欢迎 issue / PR。
开发
git clone https://github.com/key086/ops-mcp && cd ops-mcp
npm install
npm run build
OPS_MCP_CONFIG=./ops.config.example.json npm start # 本地调试
License
MIT © Liu Xinfeng (key086)
ops MCP questions
How do I add ops MCP to Claude Code?
Run claude mcp add ops-mcp -- npx -y ops-mcp in your terminal. Add --scope user to make it available in every project.
How do I add ops MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
Does the remote server need any software installed?
No, the server-side requires zero dependencies; it only needs SSH access.
How does the zero-downtime deployment work?
It builds artifacts in a timestamped directory and uses an atomic symlink switch (ln -sfn) to update the current version, making it transparent to Nginx.
Can the server automatically roll back if a deployment fails?
Yes, it supports health checks after deployment and can automatically switch back to the previous version if the health probe fails.
Is my sensitive information safe?
Yes, private keys and passwords stay in your local configuration and are never exposed in tool outputs or MCP resources.