()
| 144 | } |
| 145 | |
| 146 | func (i *imlMcpController) OnComplete() { |
| 147 | i.sseServers = make(map[string]http.Handler) |
| 148 | for language, tools := range mcpToolsByLanguage { |
| 149 | s := server.NewMCPServer("APIPark MCP Server", "1.0.0", server.WithLogging()) |
| 150 | s.AddTool(tools[ToolServiceList], i.mcpModule.Services) |
| 151 | s.AddTool(tools[ToolOpenAPIDocument], i.mcpModule.APIs) |
| 152 | s.AddTool(tools[ToolInvokeAPI], i.mcpModule.Invoke) |
| 153 | i.sseServers[language] = server.NewSSEServer(s, server.WithStaticBasePath(fmt.Sprintf("/api/v1/%s", mcp_server.GlobalBasePath))) |
| 154 | if language == languageEnUs { |
| 155 | i.openSseServer = server.NewSSEServer(s, server.WithStaticBasePath(fmt.Sprintf("/openapi/v1/%s", strings.Trim(mcp_server.GlobalBasePath, "/")))) |
| 156 | i.openStreamableServer = server.NewStreamableHTTPServer(s, server.WithEndpointPath(mcp_server.OpenGlobalMCPPath)) |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | func (i *imlMcpController) GlobalMCPHandle(ctx *gin.Context) { |
| 162 | cfg := i.settingModule.Get(ctx) |
nothing calls this directly
no outgoing calls
no test coverage detected