There doesn't appear to be a way to autoconfigure the stateless transport provider in spring-AI as of 1.0.1
or 1.1.0-SNAPSHOT
.
proposed type:
options
- SYNC
- SYNC_STATELESS
- STDIO
- ASYNC
- ASYNC_STATELESS
proposed PR 4144
Expected Behavior Given the following configuration, the Stateless Transport should be utilized.
ai:
mcp:
server:
name: "example-mcp"
stateless-message-endpoint: /message // <--- proposed
version: 1.0.0
type: SYNC_STATELESS /// <-- proposed
capabilities:
completion: true
resource: true
prompt: true
tool: true
Current Behavior
There doesn't appear to be a way to configure the Stateless MCP Server out of the box via autoconfiguration.
Context
I discovered that the OpenAI MCP-Client version 1.0.0 is not sending a Session ID in its requests resulting in HTTP Status Code 400 errors. In order to be compatible with other MCP-Server implementations at my org it looks like I need to support the Stateless transport. That transport already exists at WebMvcStatelessServerTransport.java
Sample request payload from OpenAI's MCP-Client:
{
"jsonrpc": "2.0",
"method": "initialize",
"id": 1,
"params": {
"protocolVersion": "2025-03-26",
"capabilities": {},
"clientInfo": {
"name": "openai-mcp",
"version": "1.0.0"
}
}
}
Note that sessionId parameter is missing resulting in a 400 status code
{"cause":null,"stackTrace":[{"classLoaderName":null,"moduleName":null,"moduleVersion":null,"methodName":"handleMessage","fileName":"WebMvcSseServerTransportProvider.java","lineNumber":359,"className":"io.modelcontextprotocol.server.transport.WebMvcSseServerTransportProvider","nativeMethod":false}
....
"localizedMessage":"Session ID missing in message endpoint"}