Skip to content

Conversation

@sazap10
Copy link
Contributor

@sazap10 sazap10 commented Oct 21, 2025

Goal

Adds common cache service at the top level, allowing it to be configured for the whole server and used by all clients.

Design

In order to allow configuring cache service for the whole mcp server. For a hosted install this will be disabled.

Changeset

Moving cache from bugsnag client to the server level

Testing

Makes no changes to client functionality

@sazap10 sazap10 requested review from a team as code owners October 21, 2025 18:44
@sazap10 sazap10 requested a review from Copilot October 21, 2025 18:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a common cache service at the server level to enable centralized cache configuration across all clients. The cache service can be disabled for hosted installations via the CACHE_ENABLED environment variable and supports configurable TTL through CACHE_TTL.

Key changes:

  • Created a new CacheService class that wraps NodeCache with environment-based configuration
  • Updated the Client interface to accept an optional cache parameter in the configure method
  • Migrated Bugsnag client from managing its own cache instance to using the shared cache service

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/common/cache.ts New cache service implementation with environment-based configuration
src/common/types.ts Updated Client interface to accept optional cache parameter
src/common/server.ts Added cache service instantiation and accessor method
src/common/client-registry.ts Updated to pass cache service to client configure methods
src/bugsnag/client.ts Refactored to use shared cache service instead of local instance
src/tests/unit/bugsnag/client.test.ts Updated tests to pass cache parameter and verify cache integration
src/zephyr/client.ts Added cache parameter to configure signature
src/reflect/client.ts Added cache parameter to configure signature
src/qmetry/client.ts Added cache parameter to configure signature
src/pactflow/client.ts Added cache parameter to configure signature and reformatted error messages
src/api-hub/client.ts Added cache parameter to configure signature
src/common/transport-http.ts Fixed comment describing POST message handling
src/index.ts Removed empty line

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <[email protected]>
}
}
if (await entry.configure(server, config)) {
if (await entry.configure(server, config, server.getCache())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given it's in the server, shall we just let clients get the cache from there rather than pass it explicitly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeh that makes sense

@sazap10 sazap10 merged commit 8bff82a into http_support Oct 22, 2025
@sazap10 sazap10 deleted the common_cache_service branch October 22, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants