Files
mcpctl/.taskmaster/tasks/task_035.md

65 lines
2.0 KiB
Markdown
Raw Permalink Normal View History

# Task ID: 35
**Title:** Implement health monitoring across all tiers
**Status:** done
**Dependencies:** 33 ✓, 34 ✓
**Priority:** medium
**Description:** Extend health monitoring to track connectivity and status across mcplocal, mcpd, and individual MCP server instances.
**Details:**
1. Update mcplocal health monitor in `src/mcplocal/src/health.ts`:
```typescript
export class TieredHealthMonitor {
async checkHealth(): Promise<TieredHealthStatus> {
return {
mcplocal: {
status: 'healthy',
llmProvider: await this.checkLlmProvider(),
uptime: process.uptime()
},
mcpd: await this.checkMcpdHealth(),
instances: await this.checkInstancesHealth()
};
}
private async checkMcpdHealth(): Promise<McpdHealth> {
try {
const health = await this.mcpdClient.get('/api/v1/health');
return { status: 'connected', ...health };
} catch {
return { status: 'disconnected' };
}
}
private async checkInstancesHealth(): Promise<InstanceHealth[]> {
const instances = await this.mcpdClient.get('/api/v1/instances');
return instances.map(i => ({
name: i.name,
status: i.status,
lastHealthCheck: i.lastHealthCheck
}));
}
}
```
2. Add health endpoint to mcplocal HTTP server: `GET /health`
3. Update mcpctl status command to display tiered health
4. Add degraded state detection:
- LLM provider unavailable but mcpd reachable
- Some instances down but others healthy
5. Add health event notifications for state transitions
6. Add configurable health check intervals
**Test Strategy:**
1. Unit test: Health check correctly identifies all states
2. Unit test: Degraded state is detected correctly
3. Integration test: Full health check across all tiers
4. Test health endpoint returns correct format
5. Test mcpctl status displays health correctly
6. Test state transition events are emitted