Skip to content

feat(mcp): add resource subscription API with autoprompt#29355

Open
sjawhar wants to merge 1 commit into
anomalyco:devfrom
sjawhar:feat/mcp-resource-subscriptions
Open

feat(mcp): add resource subscription API with autoprompt#29355
sjawhar wants to merge 1 commit into
anomalyco:devfrom
sjawhar:feat/mcp-resource-subscriptions

Conversation

@sjawhar
Copy link
Copy Markdown

@sjawhar sjawhar commented May 26, 2026

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

  • Bug fix
  • New feature

What does this PR do?

Adds MCP resource subscription support on top of the upstream MCP client:

  • New subscriptions and autoprompt fields in MCP server config
  • TUI toasts on mcp.resource.updated and mcp.resource.list.changed events
  • Optional auto-prompt: when a subscribed resource updates and the session is idle, automatically prompt the AI to react to the change

How did you verify your code works?

test/mcp/lifecycle.test.ts covers the subscription lifecycle. bun typecheck passes. Manual smoke test against a sample MCP server.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…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.
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.

1 participant