[Developer] add Codex streamable MCP endpoint
This commit is contained in:
@@ -29,6 +29,20 @@ public class McpSseController {
|
||||
this.mcpSseService = mcpSseService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Streamable HTTP transport for Codex and other current MCP clients.
|
||||
* The legacy SSE endpoints remain available for existing integrations.
|
||||
*/
|
||||
@PostMapping(path = "/mcp", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<ObjectNode> streamableMessage(@RequestBody JsonNode request) {
|
||||
// JSON-RPC notifications never receive a response body. Current MCP
|
||||
// clients send notifications/initialized immediately after initialize.
|
||||
if (request != null && !request.has("id")) {
|
||||
return ResponseEntity.accepted().build();
|
||||
}
|
||||
return ResponseEntity.ok(mcpSseService.handle("default", request));
|
||||
}
|
||||
|
||||
@GetMapping(path = "/mcp/sse", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||
public SseEmitter defaultSse() throws IOException {
|
||||
return openSse("default");
|
||||
|
||||
Reference in New Issue
Block a user