Skip to content

Commit 239af8b

Browse files
mudlermajiayu000
authored andcommitted
Address feedback from review
Signed-off-by: Ettore Di Giacinto <[email protected]>
1 parent dcf7125 commit 239af8b

File tree

4 files changed

+4
-155
lines changed

4 files changed

+4
-155
lines changed

core/http/endpoints/localai/mcp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ type MCPErrorEvent struct {
5353
Message string `json:"message"`
5454
}
5555

56-
// MCPStreamEndpoint is the SSE streaming endpoint for MCP chat completions
56+
// MCPEndpoint is the endpoint for MCP chat completions. Supports SSE mode, but it is not compatible with the OpenAI apis.
5757
// @Summary Stream MCP chat completions with reasoning, tool calls, and results
5858
// @Param request body schema.OpenAIRequest true "query params"
5959
// @Success 200 {object} schema.OpenAIResponse "Response"
6060
// @Router /v1/mcp/chat/completions [post]
61-
func MCPStreamEndpoint(cl *config.ModelConfigLoader, ml *model.ModelLoader, evaluator *templates.Evaluator, appConfig *config.ApplicationConfig) echo.HandlerFunc {
61+
func MCPEndpoint(cl *config.ModelConfigLoader, ml *model.ModelLoader, evaluator *templates.Evaluator, appConfig *config.ApplicationConfig) echo.HandlerFunc {
6262
return func(c echo.Context) error {
6363
ctx := c.Request().Context()
6464
created := int(time.Now().Unix())

core/http/endpoints/openai/mcp.go

Lines changed: 0 additions & 148 deletions
This file was deleted.

core/http/routes/localai.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ func RegisterLocalAIRoutes(router *echo.Echo,
138138
requestExtractor.SetModelAndConfig(func() schema.LocalAIRequest { return new(schema.TokenizeRequest) }))
139139

140140
// MCP endpoint - supports both streaming and non-streaming modes
141-
// Note: These are the canonical MCP routes (not duplicated in openai.go)
141+
// Note: streaming mode is NOT compatible with the OpenAI apis. We have a set which streams more states.
142142
if evaluator != nil {
143-
mcpStreamHandler := localai.MCPStreamEndpoint(cl, ml, evaluator, appConfig)
143+
mcpStreamHandler := localai.MCPEndpoint(cl, ml, evaluator, appConfig)
144144
mcpStreamMiddleware := []echo.MiddlewareFunc{
145145
requestExtractor.BuildFilteredFirstAvailableDefaultModel(config.BuildUsecaseFilterFn(config.FLAG_CHAT)),
146146
requestExtractor.SetModelAndConfig(func() schema.LocalAIRequest { return new(schema.OpenAIRequest) }),

core/http/routes/openai.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ func RegisterOpenAIRoutes(app *echo.Echo,
7979
app.POST("/completions", completionHandler, completionMiddleware...)
8080
app.POST("/v1/engines/:model/completions", completionHandler, completionMiddleware...)
8181

82-
// Note: MCP endpoints are registered in localai.go to avoid route conflicts
83-
// The localai.MCPStreamEndpoint handler supports both streaming and non-streaming modes
84-
8582
// embeddings
8683
embeddingHandler := openai.EmbeddingsEndpoint(application.ModelConfigLoader(), application.ModelLoader(), application.ApplicationConfig())
8784
embeddingMiddleware := []echo.MiddlewareFunc{

0 commit comments

Comments
 (0)