feat(prompts): react to upstream prompts/list_changed (F13) - #1007
Merged
Conversation
Follow-up to the PR #973 prompt-aggregation work. When aggregation is enabled, an upstream that adds/removes a prompt at runtime now refreshes the aggregated prompt set reactively instead of waiting for an unrelated servers.changed event. Mirrors the existing tools/list_changed plumbing: core client dispatches the notification by method to a new onPromptsChanged callback (connection_lifecycle refactored to a method switch), managed + manager forward it, and the runtime debounces a burst (1s trailing-edge) into a single EventTypeUpstreamPromptsChanged that listenForRoutingModeRefresh turns into one RefreshPrompts — on the same goroutine servers.changed/config.reloaded already use, so no new reentrancy. The runtime callback short-circuits (live config read) when aggregation is off, so an opted-out proxy pays nothing. Tests: debouncer coalesces a burst to one fire; core prompts/list_changed handler fires the callback (+ nil-safe). End-to-end server->client push is covered by manual QA (the test transport does not reliably push notifications). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H7J8Yv5zr4tMQZaY3ot3Za
Deploying mcpproxy-docs with
|
| Latest commit: |
9f24ad6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://cabbe293.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://feat-prompts-list-changed.mcpproxy-docs.pages.dev |
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 32246888728 --repo smart-mcp-proxy/mcpproxy-go
|
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Follow-up to the PR #973 prompt-aggregation work (one of the deferred items). When
aggregate_upstream_promptsis enabled, an upstream that adds/removes a prompt at runtime now refreshes mcpproxy's aggregated prompt set reactively, instead of staying stale until an unrelatedservers.changedevent.How
Mirrors the existing
tools/list_changedplumbing exactly:OnNotificationclosure became a method switch) to a newonPromptsChangedcallback;EventTypeUpstreamPromptsChanged, whichlistenForRoutingModeRefreshturns into oneRefreshPrompts— on the same goroutineservers.changed/config.reloadedalready use, so there's no new reentrancy. The runtime callback short-circuits on a live config read when aggregation is off, so an opted-out proxy pays nothing.Tests
prompts/list_changedhandler fires the callback (+ nil-safe).End-to-end server→client push is covered by manual QA — the in-process test transport (
NewTestStreamableHTTPServer) does not reliably deliver server-initiated notifications, so the automated tests assert the deterministic wiring instead.🤖 Generated with Claude Code