configurable auto refresh for automatic tools/prompts/resources sync during health checks#1950
Merged
crivetimihai merged 1 commit intomainfrom Jan 9, 2026
Merged
Conversation
This was referenced Jan 8, 2026
Member
|
Thanks for the PR — it covers health-check auto-refresh. For REQ-002 we still need manual refresh API, per-gateway intervals, list_changed event handling, and full tool spec sync (annotations/outputSchema). Tracking those gaps in #1984. |
91499e8 to
eca342c
Compare
…sync Add configurable feature to automatically sync gateway tools, resources, and prompts with the database during health checks. When enabled: - Fetches latest tools/resources/prompts from MCP servers - Compares against database state - Performs add/update/delete operations only when changes detected - Tracks updates per-type (tools/resources/prompts) for precise cache invalidation - Only deletes MCP-discovered items (health_check, oauth, federation, update, MCP) - Preserves user-created entries (api, ui, None/legacy) during cleanup - Allows empty server responses to clear stale items (except for auth_code OAuth) - Passes pre-authenticated headers from health check to avoid duplicate OAuth token fetch - Invalidates relevant caches per-gateway for efficiency - Uses fresh_db_session() to avoid holding DB connections during HTTP calls Configuration: - AUTO_REFRESH_SERVERS=false (disabled by default) - Reduces load on MCP servers when disabled Closes #1910, #172 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
eca342c to
5b0ba9b
Compare
Member
Code Review ChangesRebased onto main, squashed 7 commits into 1, and addressed the following issues: Fixes Applied
Key Implementation Details
Files Changed
All tests pass. |
crivetimihai
approved these changes
Jan 9, 2026
Member
crivetimihai
left a comment
There was a problem hiding this comment.
Approved - created [FEATURE REQUEST]: Full tool list/spec refresh (polling + API + list_changed) #1984 for remaining features
65 tasks
kcostell06
pushed a commit
to kcostell06/mcp-context-forge
that referenced
this pull request
Feb 24, 2026
…sync (IBM#1950) Add configurable feature to automatically sync gateway tools, resources, and prompts with the database during health checks. When enabled: - Fetches latest tools/resources/prompts from MCP servers - Compares against database state - Performs add/update/delete operations only when changes detected - Tracks updates per-type (tools/resources/prompts) for precise cache invalidation - Only deletes MCP-discovered items (health_check, oauth, federation, update, MCP) - Preserves user-created entries (api, ui, None/legacy) during cleanup - Allows empty server responses to clear stale items (except for auth_code OAuth) - Passes pre-authenticated headers from health check to avoid duplicate OAuth token fetch - Invalidates relevant caches per-gateway for efficiency - Uses fresh_db_session() to avoid holding DB connections during HTTP calls Configuration: - AUTO_REFRESH_SERVERS=false (disabled by default) - Reduces load on MCP servers when disabled Closes IBM#1910, IBM#172 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ Feature / Enhancement PR
🔗 Epic / Issue
Closes #1910, #172
🚀 Summary (1-2 sentences)
Added configurable
AUTO_REFRESH_SERVERSfeature that automatically syncs gateway tools, resources, and prompts with the database during health checks. When enabled, the system detects changes from MCP servers and performs add/update/delete operations only when necessary.The tools, prompts, and resources are compared against those stored in the database, and any required add, update, or delete operations are performed.
🔧 Usage
Enable via environment variable:
🧪 Checks
make lintpassesmake testpasses📓 Notes (optional)
flowchart TD A[Health Check Loop] -->|Every HEALTH_CHECK_INTERVAL| B{Gateway Healthy?} B -->|No| C[Handle Failure] B -->|Yes| D{AUTO_REFRESH_SERVERS?} D -->|No| E[Update last_seen] D -->|Yes| F[Fetch tools from MCP Server] F --> G{Any Changes?} G -->|No| E G -->|Yes| H[Sync DB: Add/Update/Delete] H --> I[Invalidate Caches] I --> E