spring-projects / spring-projects/spring-ai

Spring AI MCP server exposes resource templates but does not support resource subscriptions in streamable sync WebMVC setup

Open
#6,196 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Bug description
When using Spring AI MCP server with:

  • Spring AI 2.0.0-M5
  • protocol STREAMABLE
  • server type SYNC
  • transport WEBMVC

the server correctly exposes MCP resources/resource templates, but does not support resources/subscribe.

This makes notifyResourcesUpdated(...) effectively unusable for standard MCP clients expecting resource subscriptions.

Environment

spring.ai.mcp.server.annotation-scanner.enabled=true
spring.ai.mcp.server.enabled=true
spring.ai.mcp.server.protocol=STREAMABLE
spring.ai.mcp.server.streamable-http.mcp-endpoint=/mcp
spring.ai.mcp.server.type=SYNC
spring.ai.mcp.server.transport=WEBMVC

Observed behavior
The server starts correctly and answers initialize.

Returned capabilities are:

{
  "completions": {},
  "logging": {},
  "prompts": { "listChanged": true },
  "resources": { "subscribe": false, "listChanged": true },
  "tools": { "listChanged": true }
}

The server exposes resource templates correctly after manual registration, and resources/read works.

However, calling:

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "resources/subscribe",
  "params": {
    "uri": "user-info://users/TBE/infos"
  }
}

returns:

{
  "jsonrpc":"2.0",
  "id":3,
  "error":{
    "code":-32601,
    "message":"Method not found: resources/subscribe"
  }
}

Additional observation
On the server side, calling:

mcpSyncServer.notifyResourcesUpdated(new McpSchema.ResourcesUpdatedNotification(uri));

produces logs such as:
No sessions subscribed to resource URI: user-info://users/TBE/infos

but there is no standard way for clients to subscribe because resources.subscribe=false and resources/subscribe is not available.

Expected behavior
One of the following should be clarified or fixed:

1- If sync streamable WebMVC servers are supposed to support resource subscriptions, then resources/subscribe should be available and initialize.capabilities.resources.subscribe should be true.

2- If resource subscriptions are intentionally unsupported in this setup, then:

  • this should be documented
  • notifyResourcesUpdated(...) should probably not suggest a usable subscription flow for standard MCP clients in this mode

Notes
I first tried with @McpResource(uri = "user-info://users/{username}/infos"), but resource templates were not published in my setup. I worked around that by manually registering a SyncResourceTemplateSpecification, and then resources/templates/list and resources/read worked correctly.

So this issue is specifically about resource subscription support/capability, not about basic MCP connectivity.

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 with the SYNC + STREAMABLE + WEBMVC server's initialization capability reporting and request dispatch for resources/subscribe, then trace mcpSyncServer.notifyResourcesUpdated(...). Done means the chosen behavior is consistent: supported mode advertises and accepts subscriptions, or unsupported mode is documented and does not present notification as a usable client flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.