Skip to content

我用spring ai实现一个mcp server.服务起来后,一直无法访问/sse端点 #2732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shirehappy opened this issue Apr 14, 2025 · 10 comments

Comments

@shirehappy
Copy link

Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description
我用spring ai 实现 mcp server ,如果采用stdio的方式
打成jar包,然后用charry studio 配置,能够正常访问

但是通过spring ai 实现mcp server ,采用sse方式
服务正常启动,但是浏览器死活访问不到sse节点
localhost:8080/sse
通过postman也无法访问(控制台没有任何报错信息)

问题的原因是什么?

Environment
pom.xml:

<dependency>
  <groupId>org.springframework.ai</groupId>
  <artifactId>spring-ai-mcp-server-webmvc-spring-boot-starter</artifactId>
  <version>1.0.0-M6</version>
</dependency>

<dependency>
  <groupId>org.springframework.ai</groupId>
  <artifactId>spring-ai-starter-mcp-server-webmvc</artifactId>
  <version>1.0.0-M7</version>
</dependency>

Steps to reproduce
项目结构非常简单,服务也是正常启动
Image
但是页面上就是一直无法访问:
localhost:8080/sse
通过postman也无法访问

Expected behavior
A clear and concise description of what you expected to happen.

Minimal Complete Reproducible example
Please provide a failing test or a minimal complete verifiable example that reproduces the issue.
Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.

@shirehappy
Copy link
Author

Image
配置也很简单

就是页面请求不到

Image

@hymmyh
Copy link

hymmyh commented Apr 15, 2025

为什么 1.0.0-M6 和 1.0.0-M7 混用,只用1.0.0-M7不就可以?yml 的配置也没有对齐。

@shirehappy
Copy link
Author

为什么 1.0.0-M6 和 1.0.0-M7 混用,只用1.0.0-M7不就可以?yml 的配置也没有对齐。

你好,谢谢答复!
1.版本统一用M6或者M7 ,不混用,还是存在这个问题
2.yml里面,ai.mcp.server不管是从头开始的,还是在spring下面的,也还是存在这个问题。

现在就是服务正常启动,但是启动的日志里面没有类似于tools register success这种,然后页面请求:http://localhost:8080/sse 无法请求到资源

@fireman-ace
Copy link

sse use this
org.springframework.ai
spring-ai-starter-mcp-server-webflux

@kkxrrh
Copy link

kkxrrh commented Apr 16, 2025

服务端用这个

org.springframework.ai
spring-ai-starter-mcp-server-webmvc

我试了好几遍 webflux 是会 404 没招

@suxuanning
Copy link

+1

@xizihong
Copy link

I also encountered this issue, for a while I could successfully access /sse, but after that, I could no longer access it during startup, and it reported an error 404

@rong-zhi-yi
Copy link

服务端必须用这个,否则会报404,这是个bug

org.springframework.ai
spring-ai-starter-mcp-server-webmvc

@xizihong
Copy link

I found the cause of the problem, adding the following dependency will not have this issue

      <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-starter-mcp-server-webmvc</artifactId>
        </dependency>

If this dependency is introduced, this error will occur.

        <dependency>
            <groupId>org.springframework.ai</groupId>
            <artifactId>spring-ai-starter-mcp-server-webflux</artifactId>
        </dependency>

Although the official documentation recommends using spring-ai-starter-mcp-server-webflux for sse

@shirehappy
Copy link
Author

问题已解决,就是用kkxrrh的方法,pom.xml删除webflux依赖就可以了。

这应该是官方的问题,也不清楚为啥有这个问题,官方还要推荐webflux

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

No branches or pull requests

7 participants