feat(mcp): integrate MCP Server into backend service as built-in endpoint
Build and Deploy / build-and-push (push) Successful in 54s

- Add MCP Controller and register /mcp route
- MCP Server now uses OpenAPI Token for authentication
- Update frontend settings to show built-in MCP endpoint config
- Update docs to reflect integrated MCP endpoint
This commit is contained in:
2026-07-27 02:38:09 +08:00
parent f004cfc937
commit 066383de83
8 changed files with 870 additions and 31 deletions
+20
View File
@@ -0,0 +1,20 @@
package router
import (
"github.com/engigu/taskpool/internal/middleware"
"github.com/gin-gonic/gin"
)
// initMCPRoutes 初始化 MCP Server 路由
// 使用 OpenAPI Token 进行鉴权
func initMCPRoutes(root *gin.RouterGroup, c *Controllers) {
// MCP 路由组 (使用 Bearer Token 鉴权,复用 OpenAPI 中间件)
mcp := root.Group("/mcp")
mcp.Use(middleware.OpenapiRequired())
{
// 所有 MCP 请求都通过同一个 handler 处理
// StreamableHTTP 协议支持 POST 和 GET
mcp.POST("/*action", c.MCP.HandleMCP)
mcp.GET("/*action", c.MCP.HandleMCP)
}
}