modelcontextprotocol / modelcontextprotocol/typescript-sdk

[v2] Server: print warning if `sendResourceUpdated` is used but `subscribe` is not set

Open
#2,545 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

spec-2026-07-28 v1 v2
Dominant language
TypeScript
Stars
13.4k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
4

Description

What happened?

I lost a few hours to realize that if I want to subscribe to a resource, I need to explicitly put in the server:

  const server = new McpServer({ name: 'proofdiag', version: '0.0.1' }, {
    capabilities: {
      tools: {},
      resources: { subscribe: true, listChanged: true }, // <--- this is the important line
    }
  });
  // Later someone calls
  await server.server.sendResourceUpdated({ uri }).catch((e) => {console.log("Error in sendResourceUpdated", e)});

Otherwise, when subscribing the client would just receive an acknowledgment with an empty notifications, which is really hard to debug. As such, I would expect maybe some warning/errors if the declared capabilities do not allow to call a functionality (here when calling sendResourceUpdated or when receiving from the client the subscribe message), or otherwise capabilities should be changed based on what the server defines.

What did you expect?

An error/warning.

Code to reproduce
MWE with resource subscription.
SDK version

2.0.0-beta.4

Area

Server

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the server-side sendResourceUpdated call and the incoming resource subscribe handling described in the reproduction. Check how declared resource capabilities are represented and how failures are currently reported; done means an absent subscribe capability produces a clear warning or error instead of an empty acknowledgment.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.