| 11 | ) |
| 12 | |
| 13 | func (p *plugin) mcpAPIs() []pm3.Api { |
| 14 | globalSSEPath := fmt.Sprintf("/openapi/v1/%s/sse", strings.Trim(mcp_server.GlobalBasePath, "/")) |
| 15 | globalMessagePath := fmt.Sprintf("/openapi/v1/%s/message", strings.Trim(mcp_server.GlobalBasePath, "/")) |
| 16 | |
| 17 | appSSEPath := fmt.Sprintf("/openapi/v1/%s/:app/sse", strings.Trim(mcp_server.AppBasePath, "/")) |
| 18 | appMessagePath := fmt.Sprintf("/openapi/v1/%s/:app/message", strings.Trim(mcp_server.AppBasePath, "/")) |
| 19 | |
| 20 | serviceSSEPath := fmt.Sprintf("/openapi/v1/%s/:serviceId/sse", strings.Trim(mcp_server.ServiceBasePath, "/")) |
| 21 | serviceMessagePath := fmt.Sprintf("/openapi/v1/%s/:serviceId/message", strings.Trim(mcp_server.ServiceBasePath, "/")) |
| 22 | //serviceStreamablePath := fmt.Sprintf("/openapi/v1/%s/:serviceId/mcp", strings.Trim(mcp_server.ServiceBasePath, "/")) |
| 23 | |
| 24 | ignore.IgnorePath("openapi", http.MethodPost, globalMessagePath) |
| 25 | //ignore.IgnorePath("openapi", http.MethodGet, globalSSEPath) |
| 26 | ignore.IgnorePath("openapi", http.MethodPost, appMessagePath) |
| 27 | ignore.IgnorePath("openapi", http.MethodGet, appSSEPath) |
| 28 | ignore.IgnorePath("openapi", http.MethodGet, serviceSSEPath) |
| 29 | ignore.IgnorePath("openapi", http.MethodPost, serviceMessagePath) |
| 30 | |
| 31 | ignore.IgnorePath("openapi", http.MethodGet, mcp_server.OpenAppMCPPath) |
| 32 | ignore.IgnorePath("openapi", http.MethodPost, mcp_server.OpenAppMCPPath) |
| 33 | ignore.IgnorePath("openapi", http.MethodDelete, mcp_server.OpenAppMCPPath) |
| 34 | |
| 35 | ignore.IgnorePath("openapi", http.MethodGet, mcp_server.OpenServiceMCPPath) |
| 36 | ignore.IgnorePath("openapi", http.MethodPost, mcp_server.OpenServiceMCPPath) |
| 37 | ignore.IgnorePath("openapi", http.MethodDelete, mcp_server.OpenServiceMCPPath) |
| 38 | |
| 39 | return []pm3.Api{ |
| 40 | pm3.CreateApiSimple(http.MethodGet, globalSSEPath, p.mcpController.GlobalHandleSSE), |
| 41 | pm3.CreateApiSimple(http.MethodPost, globalMessagePath, p.mcpController.GlobalHandleMessage), |
| 42 | |
| 43 | pm3.CreateApiSimple(http.MethodGet, appSSEPath, p.mcpController.AppHandleSSE), |
| 44 | pm3.CreateApiSimple(http.MethodPost, appMessagePath, p.mcpController.AppHandleMessage), |
| 45 | |
| 46 | pm3.CreateApiSimple(http.MethodGet, serviceSSEPath, p.mcpController.ServiceHandleSSE), |
| 47 | pm3.CreateApiSimple(http.MethodPost, serviceMessagePath, p.mcpController.ServiceHandleMessage), |
| 48 | |
| 49 | pm3.CreateApiSimple(http.MethodGet, mcp_server.OpenGlobalMCPPath, p.mcpController.GlobalHandleStreamHTTP), |
| 50 | pm3.CreateApiSimple(http.MethodPost, mcp_server.OpenGlobalMCPPath, p.mcpController.GlobalHandleStreamHTTP), |
| 51 | pm3.CreateApiSimple(http.MethodDelete, mcp_server.OpenGlobalMCPPath, p.mcpController.GlobalHandleStreamHTTP), |
| 52 | |
| 53 | pm3.CreateApiSimple(http.MethodGet, mcp_server.OpenAppMCPPath, p.mcpController.AppHandleStreamHTTP), |
| 54 | pm3.CreateApiSimple(http.MethodPost, mcp_server.OpenAppMCPPath, p.mcpController.AppHandleStreamHTTP), |
| 55 | pm3.CreateApiSimple(http.MethodDelete, mcp_server.OpenAppMCPPath, p.mcpController.AppHandleStreamHTTP), |
| 56 | |
| 57 | pm3.CreateApiSimple(http.MethodPost, mcp_server.OpenServiceMCPPath, p.mcpController.ServiceHandleStreamHTTP), |
| 58 | pm3.CreateApiSimple(http.MethodDelete, mcp_server.OpenServiceMCPPath, p.mcpController.ServiceHandleStreamHTTP), |
| 59 | pm3.CreateApiSimple(http.MethodGet, mcp_server.OpenServiceMCPPath, p.mcpController.ServiceHandleStreamHTTP), |
| 60 | } |
| 61 | |
| 62 | } |