feat(mcp): add resource subscription API with autoprompt#29355
Open
sjawhar wants to merge 1 commit into
Open
Conversation
…e read Adds MCP client subscribeResource/unsubscribeResource support on top of upstream's existing readResource API: - New BusEvents: mcp.resource.updated, mcp.resource.list.changed - New MCP.Service methods: subscribe(client, uri), unsubscribe(client, uri), subscriptions() - New State.subscriptions tracking (Map<server, Set<uri>>) - New supportsSubscriptions helper (gates on getServerCapabilities) - New notification handlers: ResourceUpdatedNotificationSchema and ResourceListChangedNotificationSchema - readResource now auto-subscribes after a successful read - New config.mcp[name].subscriptions and config.mcp[name].autoprompt fields - TUI app.tsx surfaces resource.updated/resource.list.changed events as toasts, optionally triggering an AI prompt when autoprompt is enabled - Lifecycle test covering subscribe/unsubscribe round-trip - Stub fields added to all MCP.Service mock layers Used by Oh My Open Agents skill-loaded MCPs (WhatsApp, Envoy plugin, etc.) to react to push notifications from MCP servers.
6 tasks
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.
Issue for this PR
Refs #28567 (partial — this PR delivers the resource-subscription slice of "full MCP client capabilities")
Re-submission of #20672 (closed by automated cleanup) and #14569 (earlier version), rebased onto current dev. The previous PR could not be reopened because the branch has been force-pushed since closure.
Type of change
What does this PR do?
Adds MCP resource subscription support on top of the upstream MCP client:
subscriptionsandautopromptfields in MCP server configmcp.resource.updatedandmcp.resource.list.changedeventsHow did you verify your code works?
test/mcp/lifecycle.test.tscovers the subscription lifecycle.bun typecheckpasses. Manual smoke test against a sample MCP server.Checklist