Skip to main content
Glama
oaslananka

MCP Health Monitor

mcp-health-monitor

MCP 服务器健康监控、正常运行时间跟踪、Azure DevOps 流水线状态,以及通过自然语言工具进行警报评估。

npm version npm downloads License: MIT Node.js

功能概述

mcp-health-monitor 会维护一份您关心的 MCP 服务器注册表,对它们执行真实的 MCP 握手,将健康历史记录在 SQLite 中,并通过 MCP 工具报告正常运行时间、延迟和警报阈值。它还跟踪 Azure DevOps 流水线,以便可以在同一位置检查应用程序健康状况和交付健康状况。

快速入门

通过 stdio 运行监控器:

npx -y mcp-health-monitor

Claude Desktop 或 VS Code MCP 配置示例:

{
  "name": "mcp-health-monitor",
  "version": "1.0.2",
  "mcpName": "io.github.oaslananka/mcp-health-monitor",
  "description": "Monitor MCP server health, uptime, response times, and Azure DevOps pipelines",
  "transport": "stdio",
  "command": "npx",
  "args": ["-y", "mcp-health-monitor"]
}

工具参考

工具

用途

典型提示词

register_server

保存要监控的 MCP 服务器

Register https://example.com/mcp as prod-gateway

check_server

对一台服务器进行实时健康检查

Check prod-gateway now

check_all

检查所有已注册的服务器

Check all my MCP servers

get_uptime

返回正常运行时间和延迟统计信息

Show 24h uptime for prod-gateway

get_dashboard

返回 JSON 仪表板数据

Give me a 24h dashboard

get_report

返回 Markdown 报告

Generate a Markdown health report for 24h

list_servers

显示已注册的服务器

List all monitored servers

unregister_server

移除服务器

Stop monitoring local-debugger

set_alert

配置阈值

Alert if prod-gateway exceeds 500ms or drops below 99% uptime

get_monitor_stats

显示监控器级别的统计信息

How many checks has the monitor recorded?

register_azure_pipelines

注册 Azure 流水线组

Track CI and Publish pipelines for my repo

check_pipeline_status

读取最新的 Azure 流水线运行情况

Check pipeline status for my release group

get_pipeline_logs

获取 Azure 构建日志

Show the failed logs for the latest Publish build

check_all_projects

结合 MCP 和 Azure 健康状况

Check all projects

Azure DevOps 集成

使用组织、项目、流水线名称和 PAT 注册流水线组:

register_azure_pipelines name="mcp-health-monitor" organization="oaslananka" project="open-source" pipeline_names=["mcp-health-monitor CI","mcp-health-monitor Publish"] pat_token="..."

在 v1.0 版本中,PAT 令牌以 base64 格式存储在本地 SQLite 数据库中。这只是编码,而非加密。请参阅 凭据存储说明

警报配置

使用 set_alert 配置单台服务器:

字段

含义

max_response_time_ms

当检查超过此延迟时发出警报

min_uptime_percent

当选定时间窗口内的正常运行时间低于此值时发出警报

consecutive_failures_before_alert

在连续出现此次数的非正常结果后发出警报

警报由 check_servercheck_allget_dashboard 内联评估。Webhook 交付计划在 v1.1 中实现,v1.0.x 版本中不提供 Webhook MCP 工具。

数据存储

  • 默认数据库路径:~/.mcp-health-monitor/health.db

  • 覆盖路径:HEALTH_MONITOR_DB=/custom/path/health.db

  • 可选后台调度程序:HEALTH_MONITOR_AUTO_CHECK=1

  • HTTP 服务器健康端点:GET /health

  • 配置示例:.env.example

数据库在基于文件的数据库上使用 WAL 模式,并在启动时自动应用模式迁移。

Docker

构建并运行:

docker build -t mcp-health-monitor .
docker run --rm -p 3000:3000 -e HEALTH_MONITOR_AUTO_CHECK=1 mcp-health-monitor

然后检查:

curl http://localhost:3000/health

开发

npm install
npm run build
npm test
npm run test:integration
npm run lint
npm run lint:test
npm run format:check

在默认 Node 运行时版本高于项目目标版本的开发机上,请使用 npx --yes -p node@20.19.0 -p npm@10.8.2 npm <command>

架构

高级模块图:

  • src/app.ts: MCP 工具注册和响应格式化

  • src/checker.ts: 带有重试/退避机制的实时 MCP 连接探测

  • src/registry.ts: 用于服务器、检查和流水线记录的 SQLite 读/写路径

  • src/db.ts + src/migrations.ts: 连接设置和模式升级

  • src/server-http.ts + src/mcp.ts: HTTP 和 stdio 入口点

  • src/scheduler.ts: 可选的后台自动检查循环

更多详细信息请参阅 architecture.md

路线图

详细的里程碑规划请参阅 ROADMAP.md

  • [x] v1.0: 核心监控、正常运行时间、警报、Azure 流水线、Markdown 报告

  • [ ] v1.1: Slack、Discord 和自定义端点的 Webhook 通知

  • [ ] v1.2: 多提供商流水线和通用 HTTP 监控

  • [ ] v2.0: 加密 PAT 存储和多用户支持

安全性

请阅读 SECURITY.md 以了解漏洞报告,并阅读 docs/security.md 以了解特定于实现的存储详细信息。

贡献

请参阅 contributing.md 以了解设置、标准和 PR 期望。

许可证

MIT

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/oaslananka/mcp-health-monitor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server