MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / AppMCPConfig

Method AppMCPConfig

controller/mcp/iml.go:110–129  ·  view source on GitHub ↗
(ctx *gin.Context, appId string)

Source from the content-addressed store, hash-verified

108}
109
110func (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
131func (i *imlMcpController) GlobalMCPConfig(ctx *gin.Context) (string, error) {
132 cfg := i.settingModule.Get(ctx)

Callers

nothing calls this directly

Calls 3

ToStringMethod · 0.80
GetMethod · 0.65
GetAppMethod · 0.65

Tested by

no test coverage detected