Bug description mcp-server connection closed by server, sse transport
Environment spring ai version: 1.0.1 java version: 17
Steps to reproduce
use npx -y @modelcontextprotocol/inspector
connect to mcp-server, after a while, the error appeared.
here is full info:
Error from MCP server: SseError: SSE error: TypeError: terminated: other side closed
at _eventSource.onerror (file:///Users/yeshimin/.npm/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js:82:31)
at EventSource.scheduleReconnect_fn (file:///Users/yeshimin/.npm/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:248:53)
at file:///Users/yeshimin/.npm/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:98:174
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: undefined,
event: {
type: 'error',
message: 'TypeError: terminated: other side closed',
code: undefined,
defaultPrevented: false,
cancelable: false,
timeStamp: 216473083.699792
}
}
Is there any configuration that can resolve this, or is it a bug ?
Thank you !
Comment From: yeshimin
I add proxy_read_timeout 3600
and proxy_send_timeout 3600
in nginx config, a new error info occured:
Error from MCP server: SseError: SSE error: TypeError: terminated: Body Timeout Error
at _eventSource.onerror (file:///Users/yeshimin/.npm/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js:82:31)
at EventSource.scheduleReconnect_fn (file:///Users/yeshimin/.npm/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:248:53)
at file:///Users/yeshimin/.npm/_npx/5a9d879542beca3a/node_modules/eventsource/dist/index.js:98:174
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: undefined,
event: {
type: 'error',
message: 'TypeError: terminated: Body Timeout Error',
code: undefined,
defaultPrevented: false,
cancelable: false,
timeStamp: 320434.630833
}
}
Is there a best-practice Nginx configuration for Spring AI MCP Server ?