Skip to content

Conversation

@YunKuiLu
Copy link
Contributor

@YunKuiLu YunKuiLu commented Sep 15, 2025

  • Fix StatelessServerSpecificationFactoryAutoConfiguration.toolSpecs method signature to use McpStatelessServerFeatures.SyncToolSpecification
  • Add StatelessServerSpecificationFactoryAutoConfiguration to spring imports
  • Update McpStatelessServerAutoConfigurationIT and McpServerAutoConfigurationIT

This PR fixes Stateless mcp server registration tools failed.

Steps to reproduce

  1. clone https://github.com/YunKuiLu/spring-ai-issue-4396
  2. run SpringAiIssue4396Application.java
  3. execute
curl --location --request POST 'http://127.0.0.1:8080/mcp' \ 
--header 'Accept: application/json,text/event-stream' \
--header 'Content-Type: application/json' \
--data-raw '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list",
  "params": {
  }
}'

Then you will get:

{"jsonrpc":"2.0","id":1,"result":{"tools":[]}}

The expected output is

{"jsonrpc":"2.0","id":1,"result":{"tools":[{"name":"getCurrentTime","title":"getCurrentTime","description":"","inputSchema":{"type":"object","properties":{},"required":[]},"annotations":{"title":"","readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":true}}]}}

@YunKuiLu YunKuiLu changed the title fix: stateless mcp server registration tools failed fix: mcp server registration tools failed Sep 15, 2025
@ilayaperumalg ilayaperumalg added this to the 1.1.0.M2 milestone Sep 16, 2025
@YunKuiLu YunKuiLu changed the title fix: mcp server registration tools failed fix: Stateless mcp server registration tools failed Sep 17, 2025
@YunKuiLu YunKuiLu marked this pull request as draft September 17, 2025 04:32
@YunKuiLu
Copy link
Contributor Author

I want to add more unit tests

- Fix StatelessServerSpecificationFactoryAutoConfiguration.toolSpecs method signature to use McpStatelessServerFeatures.SyncToolSpecification
- Add StatelessServerSpecificationFactoryAutoConfiguration to spring imports
- update McpStatelessServerAutoConfigurationIT and McpServerAutoConfigurationIT.java

Signed-off-by: YunKui Lu <luyunkui95@gmail.com>
@YunKuiLu YunKuiLu marked this pull request as ready for review September 17, 2025 06:32
tzolov pushed a commit that referenced this pull request Sep 17, 2025
- Fix StatelessServerSpecificationFactoryAutoConfiguration.toolSpecs method signature to use McpStatelessServerFeatures.SyncToolSpecification
- Add StatelessServerSpecificationFactoryAutoConfiguration to spring imports
- update McpStatelessServerAutoConfigurationIT and McpServerAutoConfigurationIT.java

Signed-off-by: YunKui Lu <luyunkui95@gmail.com>

- Ensure the McpServerSpecificationFactoryAutoConfiguration is initialized before McpServerAutoConfiguration
- Ensure the StatelessServerSpecificationFactoryAutoConfiguration is initialized before McpServerStatelessAutoConfiguration

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov tzolov added the bug Something isn't working label Sep 17, 2025
@tzolov
Copy link
Contributor

tzolov commented Sep 17, 2025

Nice catch @YunKuiLu Thanks you!

Rebased, additional changes applied, squashed and merged at 1b3705f

@tzolov tzolov closed this Sep 17, 2025
@YunKuiLu YunKuiLu deleted the mcp-stateless-tool branch September 17, 2025 17:39
@AnirudhaDesai
Copy link

Do we have an ETA on when this commit will be released? I am in need of this fix asap for a project.

Willam2004 pushed a commit to Willam2004/spring-ai that referenced this pull request Oct 11, 2025
- Fix StatelessServerSpecificationFactoryAutoConfiguration.toolSpecs method signature to use McpStatelessServerFeatures.SyncToolSpecification
- Add StatelessServerSpecificationFactoryAutoConfiguration to spring imports
- update McpStatelessServerAutoConfigurationIT and McpServerAutoConfigurationIT.java

Signed-off-by: YunKui Lu <luyunkui95@gmail.com>

- Ensure the McpServerSpecificationFactoryAutoConfiguration is initialized before McpServerAutoConfiguration
- Ensure the StatelessServerSpecificationFactoryAutoConfiguration is initialized before McpServerStatelessAutoConfiguration

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
Signed-off-by: 家娃 <guanjing.pangj@alibaba-inc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working MCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants