Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to control and test resource subscription in MCP Inspector #166

Open
olaservo opened this issue Mar 7, 2025 · 3 comments · May be fixed by #170
Open

Add ability to control and test resource subscription in MCP Inspector #166

olaservo opened this issue Mar 7, 2025 · 3 comments · May be fixed by #170
Labels
enhancement New feature or request

Comments

@olaservo
Copy link
Collaborator

olaservo commented Mar 7, 2025

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.

Image

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.

Image

@olaservo olaservo added the enhancement New feature or request label Mar 7, 2025
@cliffhall
Copy link
Contributor

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?

@cliffhall
Copy link
Contributor

STATUS UPDATE

Subscribe is working!

  • 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.
Image

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

@cliffhall
Copy link
Contributor

This has now been addressed with #170

@cliffhall cliffhall linked a pull request Mar 8, 2025 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants