No static resource sse.
Bug description
使用cursor 连接 webflux mcp 服务器,在解析 /see 请求时发生了 404 NOT_FOUND.
Environment
Spring AI 1.0.0-M6 Java version 17 MACOS 15.3.2 (24D81)
Steps to reproduce
-
使用
cursor
作为mcp-client
-
使用
spring-ai-mcp-server-webflux-spring-boot-starter
构建mcp-server
-
修复
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "tools"
问题
```java @Bean @ConditionalOnMissingBean public WebFluxSseServerTransport webFluxTransport(McpServerProperties serverProperties) { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return new WebFluxSseServerTransport(objectMapper, serverProperties.getSseMessageEndpoint());
```
- 使用 cursor 与 mcp-server 连接。
当修复了 Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "tools"
后还是无法与 cursor 建立正常通讯。
Comment From: hvne4j
同样问题
Comment From: AthelasWang
Try to use:
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-mcp-server-webmvc</artifactId>
</dependency>
instead of
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-mcp-server-webmvc-spring-boot-starter</artifactId>
</dependency>
Comment From: X-TAN
尝试使用:
<dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-starter-mcp-server-webmvc</artifactId> </dependency>
而不是
<dependency> <groupId>org.springframework.ai</groupId> <artifactId>spring-ai-mcp-server-webmvc-spring-boot-starter</artifactId> </dependency>
我使用的是: spring-ai-mcp-server-webflux-spring-boot-starter
,在文章的开头有提到过。
使用spring-ai-mcp-server-webmvc-spring-boot-starter
时 cursor 是可以正常连接的,但是在 mcp
的使用过程中会出现大量的异常日志,且经常出现客户端重连,因此我必须弃用 WebMvc ,修改为 WebFlux。
当前文章的问题是基于 spring-ai-mcp-server-webflux-spring-boot-starter
-1.0.0-M6
出现的。
Comment From: iuuuuuaena
我目前也是这个情况,cursor 无法使用
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-mcp-server-webflux-spring-boot-starter</artifactId>
</dependency>
的 mcp server
Comment From: X-TAN
@iuuuuuaena 升级到1.0.0-M8 就能解决了,但是还是挺不友好的,现在我已经换成了, 1.0.0-M8 的 spring-ai-starter-mcp-server-webmvc 了
Comment From: JoeBerg8
try adding this bean to your config
@Configuration public class WebConfig implements WebMvcConfigurer { @Override public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); converter.setSupportedMediaTypes(Arrays.asList( MediaType.TEXT_EVENT_STREAM, MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN )); converters.add(converter); } }
worked for me