Skip to content

Hide Subscribe/Unsubscribe button and Subscriptions section when server doesn't support resource subscriptions #1478

Description

@cliffhall

Summary

On the Resources screen, the Subscribe/Unsubscribe button (SubscribeButton in ResourcePreviewPanel) and the Subscriptions accordion section (in ResourceControls) are always rendered, even when the connected server does not advertise the resource subscription capability. These controls should be hidden when the server doesn't support subscriptions, since they can't do anything useful.

Expected behavior

When the server's capabilities do not include resources.subscribe === true:

  • Do not render the Subscribe/Unsubscribe button in ResourcePreviewPanel.
  • Do not render the "Subscriptions" accordion section in ResourceControls.

When the server does advertise resources.subscribe, both should render as they do today.

Relevant code

  • Capability source: ServerCapabilities.resources.subscribe, exposed to the UI via useInspectorClient (core/react/useInspectorClient.ts) and already used in core/mcp/inspectorClient.ts (e.g. this.capabilities?.resources?.subscribe === true).
  • Subscribe button: clients/web/src/components/groups/ResourcePreviewPanel/ResourcePreviewPanel.tsx (renders SubscribeButton).
  • Subscriptions accordion section: clients/web/src/components/groups/ResourceControls/ResourceControls.tsx (the value="subscriptions" Accordion.Item).
  • Both flow through ResourcesScreenInspectorView, which already receives capabilities from useInspectorClient.

Implementation notes

  • Thread a boolean prop (e.g. supportsSubscriptions) down from InspectorViewResourcesScreenResourceControls / ResourcePreviewPanel, derived from capabilities?.resources?.subscribe === true. Keep the components "dumb" (data + callbacks as props) per the v2 architecture.
  • Remember to update/add tests and Storybook stories for the hidden vs. shown states (ResourceControls, ResourcePreviewPanel, SubscribeButton).

Metadata

Metadata

Assignees

Labels

v2Issues and PRs for v2

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions