Skip to content

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

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

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

Conversation

@sjawhar

@sjawhar sjawhar commented Jul 3, 2026

Copy link
Copy Markdown

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

Refs #28567

Supersedes #29355 (closed by the inactivity bot). Rebased onto latest dev with all merge conflicts resolved; typecheck and targeted tests pass on the fork branch.

…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.
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate PRs Found

Based on the search results, there are related PRs addressing similar MCP resource functionality:

  1. feat(mcp): support resource subscriptions #32936 - feat(mcp): support resource subscriptions

    • Directly related to resource subscription support
  2. feat(mcp): publish resource list change events #32478 - feat(mcp): publish resource list change events

    • Addresses the mcp.resource.list.changed event aspect of this PR
  3. feat(mcp): support resource update notifications #31398 - feat(mcp): support resource update notifications

    • Related to handling mcp.resource.updated events

These PRs overlap with the functionality described in PR #35197. Review the status and content of these existing PRs to determine if they should be consolidated or if #35197 represents a comprehensive rewrite/update that supersedes them.

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