Pacemaker MCP

Pacemaker MCP

MCP server that enables safe, SSH-based interaction with a Pacemaker cluster, offering guarded pcs commands for status queries and controlled operations via MCP clients.

Category
访问服务器

README

Pacemaker MCP

Model Context Protocol (MCP) server that exposes Pacemaker pcs commands as safe, guardrailed tools over stdio. It connects to a target cluster node via SSH using your OpenSSH config (Host alias; optional sudo) and runs read-only status queries and controlled operations. Ideal for using Pacemaker safely from MCP-aware clients like Cursor or Claude.

Features

  • Pacemaker tools: pcs_cluster_status, pcs_node_status, pcs_resource_list.
  • Logs access: pcs_logs_common, pcs_logs_tail, pcs_logs_journalctl for Pacemaker/Corosync troubleshooting.
  • Key-based auth via OpenSSH config: uses your ~/.ssh/config Host alias; optional sudo.
  • Configurable: JSON/YAML config file or environment variables for alias and options.

Requirements

  • Node.js >= 18
  • Access to a Pacemaker cluster node over SSH

Setup (from scratch)

# 1) Install dependencies
npm install

# 2) Build the server (emits dist/index.js)
npm run build

# 3) (Optional) Verify locally with MCP Inspector
npx @modelcontextprotocol/inspector@latest node $(pwd)/dist/index.js

You can also run directly with Node:

node dist/index.js

Configure connection (single method)

Use your OpenSSH config (e.g., ~/.ssh/config) with a Host alias, and reference that alias. This is the only connection method used by the server.

  • Set a Host entry in your OpenSSH config file:
Host my-cluster
  HostName cluster-node.example.com
  User ec2-user
  IdentityFile ~/.ssh/id_rsa
  Port 22
  • If you use a bastion, either define it with ProxyJump or a ProxyCommand (both are supported):
Host my-cluster
  HostName 10.1.30.239
  User root
  IdentityFile ~/.ssh/aws-instance_rsa
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  # Option A (preferred): use a Host alias for the bastion
  # ProxyJump bastion
  # Option B: ProxyCommand (will be auto-translated)
  ProxyCommand ssh -W %h:%p bastion -i ~/.ssh/aws-bastion_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null

Host bastion
  HostName bastion.example.com
  User ec2-user
  IdentityFile ~/.ssh/aws-bastion_rsa
  • Then either:
    • Provide alias per-call as args: sshConfigHost: "my-cluster" (and optionally sshConfigPath if not ~/.ssh/config)
    • Or put it in your Pacemaker MCP config file (JSON/YAML) via PACEMAKER_MCP_CONFIG:
default:
  sshConfigHost: my-cluster
  # sshConfigPath: /absolute/path/to/ssh_config   # optional, defaults to ~/.ssh/config
  sudo: true

Notes:

  • This server reads connection parameters exclusively from the OpenSSH alias (HostName, User, Port, IdentityFile).
  • If your ssh config has StrictHostKeyChecking no for the alias, unknown host keys will be accepted unless overridden.
  • ProxyCommand lines like ssh -W %h:%p <jump> -i <key> ... are supported; they are treated as a single-hop ProxyJump automatically.
  • If IdentityFile is not set, the SSH agent (SSH_AUTH_SOCK) is used if available.
  • If User is not set, your local username is used by default.

Configuration sources (last-wins per field):

  • Config file from PACEMAKER_MCP_CONFIG (or default search paths)
  • Environment variables (e.g., PACEMAKER_SSH_CONFIG_HOST, PACEMAKER_USE_SUDO)
  • Per-tool arguments (sshConfigHost, sshConfigPath, sudo)

Use with MCP clients

Cursor

  1. Build so dist/index.js exists: npm run build

  2. Add the server to your global Cursor MCP config (macOS: ~/.cursor/mcp.json). Use absolute paths.

{
  "mcpServers": {
    "pacemaker-mcp-server": {
      "command": "node",
      "args": ["/absolute/path/to/pcs_mcp/dist/index.js"],
      "env": {
        "PACEMAKER_SSH_CONFIG_HOST": "my-cluster",
        "PACEMAKER_USE_SUDO": "true"
      }
    }
  }
}

Restart Cursor after saving.

Claude Desktop

  1. Build dist/index.js: npm run build

  2. Add the server to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS), then restart Claude. Use absolute paths.

{
  "mcpServers": {
    "pacemaker-mcp-server": {
      "command": "node",
      "args": ["/absolute/path/to/pcs_mcp/dist/index.js"],
      "env": {
        "PACEMAKER_MCP_CONFIG": "/absolute/path/to/pacemaker.yaml",
        "PACEMAKER_SSH_CONFIG_HOST": "my-cluster",
        "PACEMAKER_USE_SUDO": "false",
        "PACEMAKER_SSH_READY_TIMEOUT_MS": "30000"
      }
    }
  }
}

Notes:

  • Prefer absolute paths in args and file-based env like PACEMAKER_MCP_CONFIG.
  • Configure connection via OpenSSH Host alias; set the alias through env or your MCP config file.
  • For production, prefer key-based SSH and passwordless sudo if sudo is required.

Troubleshooting

  • Handshake timeout:
    • Set PACEMAKER_SSH_DEBUG=true and retry; inspect logs for where it stalls (jump vs target vs auth).
    • Increase PACEMAKER_SSH_READY_TIMEOUT_MS (e.g., 30000).
    • Verify your alias works in a terminal: ssh my-cluster 'echo ok'.
    • If using a bastion, ensure ProxyJump or a correct ProxyCommand is defined and keys are accessible.
    • If host key checks block you in dev/test, set StrictHostKeyChecking no and UserKnownHostsFile /dev/null in your SSH config or set PACEMAKER_INSECURE_ACCEPT_UNKNOWN_HOST_KEYS=true.

Available tools (examples)

  • pcs_cluster_status: returns pcs cluster status
  • pcs_node_status: returns pcs status nodes
  • pcs_resource_list: returns pcs resource config
  • pcs_logs_common: tail common log files and optionally journal; e.g., last 200 lines of Pacemaker/Corosync logs
    • args: { "lines": 200, "includeJournal": true }
  • pcs_logs_tail: tail specific log files
    • args: { "paths": ["/var/log/pacemaker/pacemaker.log", "/var/log/cluster/corosync.log"], "lines": 500 }
  • pcs_logs_journalctl: read journal for units (defaults to pacemaker and corosync)
    • args: { "units": ["pacemaker", "corosync"], "lines": 300, "since": "2 hours ago", "priority": "warning", "grep": "fail|error" }

Each tool accepts a cluster name from config or sshConfigHost/sshConfigPath, and sudo.

Security considerations

  • Prefer key-based SSH; avoid passwords when possible.
  • Set PACEMAKER_INSECURE_ACCEPT_UNKNOWN_HOST_KEYS=false in production.
  • Only use sudo if required by your environment.

Development

npm run typecheck
npm run build
# Run from TS directly (dev):
npm run dev

Open with MCP Inspector (from dist output):

npx @modelcontextprotocol/inspector@latest node $(pwd)/dist/index.js

See CONTRIBUTING.md for PR guidelines.

License

MIT. See LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选