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

Method ServiceHandleSSE

controller/mcp/iml.go:219–239  ·  view source on GitHub ↗
(ctx *gin.Context)

Source from the content-addressed store, hash-verified

217}
218
219func (i *imlMcpController) ServiceHandleSSE(ctx *gin.Context) {
220 apikey := ctx.Request.URL.Query().Get("apikey")
221 serviceId := ctx.Param("serviceId")
222 if serviceId == "" {
223 ctx.AbortWithStatusJSON(403, gin.H{"code": -1, "msg": "invalid service id", "success": "fail"})
224 return
225 }
226 ok, err := i.authorizationModule.CheckAPIKeyAuthorizationByService(ctx, serviceId, apikey)
227 if err != nil {
228 ctx.AbortWithStatusJSON(403, gin.H{"code": -1, "msg": err.Error(), "success": "fail"})
229 return
230 }
231 if !ok {
232 ctx.AbortWithStatusJSON(403, gin.H{"code": -1, "msg": "invalid apikey", "success": "fail"})
233 return
234 }
235
236 i.handleSSE(ctx, mcp_server.DefaultMCPServer(), SessionInfo{
237 Apikey: apikey,
238 })
239}
240
241func (i *imlMcpController) ServiceHandleMessage(ctx *gin.Context) {
242 i.handleMessage(ctx, mcp_server.DefaultMCPServer())

Callers

nothing calls this directly

Calls 3

handleSSEMethod · 0.95
GetMethod · 0.65

Tested by

no test coverage detected