MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / mcpAPIs

Method mcpAPIs

plugins/core/mcp.go:13–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11)
12
13func (p *plugin) mcpAPIs() []pm3.Api {
14 serviceSSEPath := fmt.Sprintf("/api/v1/%s/:serviceId/sse", mcp_server.ServiceBasePath)
15 serviceMessagePath := fmt.Sprintf("/api/v1/%s/:serviceId/message", mcp_server.ServiceBasePath)
16 globalSSEPath := fmt.Sprintf("/api/v1/%s/sse", mcp_server.GlobalBasePath)
17 globalMessagePath := fmt.Sprintf("/api/v1/%s/message", mcp_server.GlobalBasePath)
18 appSSEPath := fmt.Sprintf("/api/v1/%s/sse", mcp_server.AppBasePath)
19 appMessagePath := fmt.Sprintf("/api/v1/%s/message", mcp_server.AppBasePath)
20 globalMcpPath := fmt.Sprintf("/api/v1/%s/mcp", mcp_server.GlobalBasePath)
21 appMcpPath := fmt.Sprintf("/api/v1/%s/mcp", mcp_server.AppBasePath)
22 ignore.IgnorePath("login", http.MethodGet, serviceSSEPath)
23 ignore.IgnorePath("login", http.MethodPost, serviceMessagePath)
24 ignore.IgnorePath("login", http.MethodGet, globalSSEPath)
25 ignore.IgnorePath("login", http.MethodPost, globalMessagePath)
26 ignore.IgnorePath("login", http.MethodGet, appSSEPath)
27 ignore.IgnorePath("login", http.MethodPost, appMessagePath)
28 ignore.IgnorePath("login", http.MethodGet, globalMcpPath)
29 ignore.IgnorePath("login", http.MethodGet, appMcpPath)
30 return []pm3.Api{
31 pm3.CreateApiSimple(http.MethodGet, serviceSSEPath, p.mcpController.MCPHandle),
32 pm3.CreateApiSimple(http.MethodPost, serviceMessagePath, p.mcpController.MCPHandle),
33 pm3.CreateApiSimple(http.MethodGet, globalSSEPath, p.mcpController.GlobalMCPHandle),
34 pm3.CreateApiSimple(http.MethodPost, globalMessagePath, p.mcpController.GlobalMCPHandle),
35 pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/global/mcp/config", []string{"context"}, []string{"config"}, p.mcpController.GlobalMCPConfig),
36 pm3.CreateApiWidthDoc(http.MethodGet, "/api/v1/app/mcp/config", []string{"context", "query:app"}, []string{"config"}, p.mcpController.AppMCPConfig),
37 pm3.CreateApiSimple(http.MethodGet, fmt.Sprintf("/api/v1/%s/:app/sse", mcp_server.AppBasePath), p.mcpController.AppMCPHandle),
38 pm3.CreateApiSimple(http.MethodPost, fmt.Sprintf("/api/v1/%s/:app/message", mcp_server.AppBasePath), p.mcpController.AppMCPHandle),
39 }
40}

Callers 1

OnCompleteMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected