Applicability
When to Use
✓When you need a single view of system health
✓When monitoring multiple microservices
✓When SLA reporting requires uptime tracking
Overview
How It Works
This pattern periodically checks the health of every connected MCP server and aggregates the results into a unified health status. Each MCP server is pinged with a lightweight health check, and the results are stored for dashboarding and alerting.
The aggregated health status can be exposed as an API endpoint, pushed to Grafana for visualization, or used to trigger PagerDuty alerts when critical services are unhealthy.
Implementation
Code Example
typescript
async function checkAllHealth() {
const checks = [
{ name: "PostgreSQL", check: () => postgres.query("SELECT 1") },
{ name: "Redis", check: () => redis.ping() },
{ name: "Elasticsearch", check: () => elasticsearch.cluster.health() },
{ name: "Stripe", check: () => stripe.listBalanceTransactions({ limit: 1 }) },
];
const results = await Promise.allSettled(checks.map(async c => {
const start = Date.now();
await c.check();
return { name: c.name, status: "healthy", latency: Date.now() - start };
}));
const health = results.map((r, i) =>
r.status === "fulfilled" ? r.value : { name: checks[i].name, status: "unhealthy", error: r.reason.message }
);
const unhealthy = health.filter(h => h.status === "unhealthy");
if (unhealthy.length > 0) {
await slack.sendMessage({ channel: "#ops", text: `Health check: ${unhealthy.map(h => h.name).join(", ")} DOWN` });
}
return health;
}Quick Info
Categorymonitoring
ComplexityEasy