| 129 | } |
| 130 | |
| 131 | func (i *imlMcpController) GlobalMCPConfig(ctx *gin.Context) (string, error) { |
| 132 | cfg := i.settingModule.Get(ctx) |
| 133 | if cfg.SitePrefix == "" { |
| 134 | return "", fmt.Errorf("site prefix is empty") |
| 135 | } |
| 136 | return mcp_server.NewMCPConfig( |
| 137 | mcp_server.TransportTypeStreamableHTTP, |
| 138 | fmt.Sprintf("%s%s", strings.TrimSuffix(cfg.SitePrefix, "/"), mcp_server.OpenGlobalMCPPath), |
| 139 | map[string]string{ |
| 140 | "Authorization": "Bearer {your_api_key}", |
| 141 | }, |
| 142 | nil, |
| 143 | ).ToString("APIPark-MCP-Server"), nil |
| 144 | } |
| 145 | |
| 146 | func (i *imlMcpController) OnComplete() { |
| 147 | i.sseServers = make(map[string]http.Handler) |