Skip to content

CAMEL-27241: camel-mcp-server-starter - the MCP Java SDK notifies the removal of a resource template - #2115

Merged
Croway merged 1 commit into
apache:mainfrom
Croway:CAMEL-27241-spring-ai-2.1
Nov 19, 2026
Merged

Croway merged 1 commit into
apache:mainfrom
Croway:CAMEL-27241-spring-ai-2.1

Conversation

@Croway

@Croway Croway commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

CAMEL-27241

Needs apache/camel#30444 (Spring AI 2.1.0). Until a Camel snapshot with that change is deployed, this build still resolves Spring AI 2.0.2 and MCP Java SDK 2.1.0 from the Camel parent, and testResourceAndPromptChangeNotificationsAreDelivered fails (one notification instead of two).

Description

Spring AI 2.1.0 brings MCP Java SDK 2.2.0, which sends notifications/resources/list_changed itself when it removes a resource template and the server advertises listChanged. SDK 2.1.0 did not, so SpringAiMcpServerEngine.resourceTemplateRemoved sent the notification after the removal. With SDK 2.2.0 clients would get it twice, so the engine no longer sends it. camel-mcp-server did the same for its own engines in CAMEL-27145.

  • SpringAiMcpServerEngine: removes only a registered template, and leaves the notification to the SDK.
  • SpringAiMcpServerEngineTest: the engine never sends the notification itself.
  • SpringBootMcpServerTest.testResourceAndPromptChangeNotificationsAreDelivered: after the template removal and a later prompt change, the client has received exactly two resource notifications. The notifications of a session arrive in order, so a duplicate would arrive before the prompt notification.

Tests

mvn test -pl components-starter/camel-mcp-server-starter with -Dspring-ai-version=2.1.0 -Dspring-boot-version=4.2.0 -Dspring-version=7.1.0 (MCP Java SDK 2.2.0): 55 tests pass. With the previous engine code on the same versions, the notification test fails with three resource notifications instead of two.

Claude Code on behalf of Croway

… removal of a resource template

Spring AI 2.1.0 brings MCP Java SDK 2.2.0, which sends notifications/resources/list_changed when it removes a resource
template, so the engine no longer sends a second one.
@Croway
Croway requested review from gzurowski and oscerd November 19, 2026 19:17
@Croway
Croway merged commit 976b398 into apache:main Nov 19, 2026
2 of 4 checks passed
@Croway
Croway deleted the CAMEL-27241-spring-ai-2.1 branch November 19, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant