You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add functionality to MCP Inspector for subscribing to a resource.
Exposing a Dynamic Resource
I have an SSE-based MCP that exposes a dynamic resource - finite state machines (called puzzles).
From the MCP Inspector, I can list the resources, and I can use the resource template to enter a puzzleId and get a snapshot of the puzzle. So far so good.
Subscribing to Changes
I want to allow clients to subscribe to to a given puzzle so that they can be updated with a server-sent event when its state changes.
There is no affordance in the the reference client - the MCP Inspector - for subscribing to a resource.
When a resource is selected, there is a refresh button. It seems like an obvious place for a companion toggle button: Subscribe | Unsubscribe. It would send a subscribe or unsubscribe request to the server.
The text was updated successfully, but these errors were encountered:
Since I was the one who complained, I figured I'd have a look at fixing it.
Given that the rest of the inspector seems quite complete, I wonder if there was a reason that subscribing to resources was left out of the initial implementation. Could have something to do with the way the inspector connects with the MCP via a proxy server?
@ashwin-ant and @jspahrsummers : I notice that you guys seem to have done the bulk of the work on the Resources tab, where I expect the subscribe to resource feature should go. Is there anything you remember about why this was left out?
I added the button, sent the subscribe request, handled it on my server.
Below, I use the perform_action_on_puzzle tool to change the state of a puzzle.
Immediately after running the tool, the notification appears in the Server Notifications panel below.
Remaining work
I need to manage a local set of subscribed uris, so that the UI can display a toggle button, being informed by whether the selected resource is in that set.
I copied this from this discussion for more visibility in the repo: https://github.com/orgs/modelcontextprotocol/discussions/187
Feature Request
Add functionality to MCP Inspector for subscribing to a resource.
Exposing a Dynamic Resource
I have an SSE-based MCP that exposes a dynamic resource - finite state machines (called puzzles).
From the MCP Inspector, I can list the resources, and I can use the resource template to enter a puzzleId and get a snapshot of the puzzle. So far so good.
Subscribing to Changes
I want to allow clients to subscribe to to a given puzzle so that they can be updated with a server-sent event when its state changes.
Server-side
Examples are clear.
The
mcp-servers/everything
example shows how to accept subscribe and unsubscribe requests.It simulates changes happening and being reported with a setInterval that sends notifications for all the dummy resources ever so often.
Client-side
There is no affordance in the the reference client - the MCP Inspector - for subscribing to a resource.
When a resource is selected, there is a refresh button. It seems like an obvious place for a companion toggle button:
Subscribe
|Unsubscribe
. It would send a subscribe or unsubscribe request to the server.The text was updated successfully, but these errors were encountered: