Server Ops MCP
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**English** | 简体中文
A general-purpose server-ops MCP Server. Let AI tools like Claude Code / Cursor / Codex manage multiple projects or servers through .mcp.json — **log troubleshooting, system resource inspection, code read/write, and Nginx / certificate management**.
Supports **local** and **remote (SSH)** modes, with built-in two-step confirmation, command whitelisting, path-traversal protection, and automatic secret redaction.
Features
- 🔍 **Log troubleshooting**: list / read / search project logs, multi-channel logs & system logs
- 📊 **Resource monitoring**: CPU / memory / disk / load / processes / service status at a glance
- 📁 **Code operations**: read, write, patch, delete, and search files — all sandboxed to the project root
- 🌐 **Nginx & certificates**: config test & read, safe reload, certificate install & renewal
- 🔒 **Secure by design**: two-step confirmation for writes, command whitelist, path-traversal protection, auto redaction
Installation
Requires Node.js 18+. No clone or build needed — npx fetches and runs the published npm package on first use (see the config below).
To build from source instead (e.g. for development):
Build output goes to dist/; the entry point is dist/index.js.
Configuration
In each project where you want to use this tool, create (or append to) .mcp.json and declare an MCP Server per environment. Local mode only needs OPS_PROJECT_ROOT; remote mode adds the SSH variables.
If you built from source, point the command at the local build instead: "command": "node", "args": ["/absolute/path/to/server-ops-mcp/dist/index.js"].
Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| OPS_PROJECT_ROOT | Yes | Project root path; all file operations are sandboxed here |
| OPS_SSH_HOST | No | Remote server IP / domain; leave empty to run locally |
| OPS_SSH_PORT | No | SSH port, default 22 |
| OPS_SSH_USER | No | SSH username |
| OPS_SSH_KEY | No | Path to SSH private key (choose either key or password) |
| OPS_SSH_PASSWORD | No | SSH password (choose either key or password) |
| OPS_SSH_PASSPHRASE | No | Private key passphrase |
| OPS_CONFIG_PATH | No | Path to an extra config file — see "Custom Configuration" |
Usage
Once configured, just give ops instructions in natural language in your AI tool. The AI picks and calls the right tool automatically.
Read-only operations (run directly)
Write operations (require confirmation)
For writes, deletes, command execution, Nginx reload, certificate install, and similar, the tool first returns a confirmationId. The AI shows you exactly what will run, and it **only executes after you confirm**:
file_write, file_patch, file_delete, command_exec, and similar all follow the same confirmation flow.
Typical scenarios
- **Production troubleshooting**: "Why is the server memory full?" → memory_analysis + log_search working together
- **Routine inspection**: "Is the disk almost full? Which directory uses the most?" → disk_analysis
- **Security audit**: "Audit the project config for leaked secrets" → config_audit (output is auto-redacted)