| 108 | } |
| 109 | |
| 110 | func (i *imlMcpController) AppMCPConfig(ctx *gin.Context, appId string) (string, error) { |
| 111 | cfg := i.settingModule.Get(ctx) |
| 112 | if cfg.SitePrefix == "" { |
| 113 | return "", fmt.Errorf("site prefix is empty") |
| 114 | } |
| 115 | appInfo, err := i.appModule.GetApp(ctx, appId) |
| 116 | if err != nil { |
| 117 | return "", fmt.Errorf("get app info error: %v", err) |
| 118 | } |
| 119 | |
| 120 | return mcp_server.NewMCPConfig( |
| 121 | mcp_server.TransportTypeStreamableHTTP, |
| 122 | fmt.Sprintf("%s%s", strings.TrimSuffix(cfg.SitePrefix, "/"), mcp_server.OpenAppMCPPath), |
| 123 | map[string]string{ |
| 124 | "Authorization": "Bearer {your_api_key}", |
| 125 | "X-Application-Id": appId, |
| 126 | }, |
| 127 | nil, |
| 128 | ).ToString(appInfo.Name), nil |
| 129 | } |
| 130 | |
| 131 | func (i *imlMcpController) GlobalMCPConfig(ctx *gin.Context) (string, error) { |
| 132 | cfg := i.settingModule.Get(ctx) |