Frontmatter
| id | 8104 |
| title | [MCP] Harden HealthServices with Request Deduplication |
| state | Closed |
| labels | enhancementai |
| assignees | tobiu |
| createdAt | Dec 13, 2025, 2:15 PM |
| updatedAt | Dec 13, 2025, 2:25 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8104 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Dec 13, 2025, 2:25 PM |
[MCP] Harden HealthServices with Request Deduplication
tobiu assigned to @tobiu on Dec 13, 2025, 2:24 PM

tobiu
Dec 13, 2025, 2:25 PM
Input from gemini:
✦ I have implemented request deduplication in the
HealthServicefor bothmemory-coreandknowledge-base.Changes:
Memory Core (
ai/mcp/server/memory-core/services/HealthService.mjs):
- Added
#healthCheckPromiseprivate field.- Updated
healthcheck()to returnawait this.#healthCheckPromiseif a check is already in progress, ensuring the existing error handling wrapper is respected.- Ensured the promise is cleared in a
finallyblock.Knowledge Base (
ai/mcp/server/knowledge-base/services/HealthService.mjs):
- Added
#healthCheckPromiseprivate field.- Updated
healthcheck()to returnthis.#healthCheckPromiseif a check is already in progress.- Ensured the promise is cleared in a
finallyblock.This prevents race conditions during startup where multiple services could trigger redundant health checks simultaneously.
tobiu closed this issue on Dec 13, 2025, 2:25 PM
Objective
Implement request deduplication (in-flight promise caching) in the HealthService for both
memory-coreandknowledge-baseMCP servers.Description
To prevent "thundering herd" race conditions where multiple concurrent callers (e.g., Server initialization and Service initialization) trigger parallel, redundant health checks during startup, we need to cache the pending health check promise. This pattern was successfully implemented in the
github-workflowserver and should be standardized across all MCP servers.Implementation Details
For both:
ai/mcp/server/memory-core/services/HealthService.mjsai/mcp/server/knowledge-base/services/HealthService.mjs#healthCheckPromise = null;.healthcheck()method:#healthCheckPromiseexists. If so, return it.this.#performHealthCheck().finally(...)to it.finallyblock.