forked from casdoor/casdoor
fix: rename mcp package to mcpself (#5302)
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package mcp
|
||||
package mcpself
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package mcp
|
||||
package mcpself
|
||||
|
||||
import (
|
||||
"strings"
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package mcp
|
||||
package mcpself
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package mcp
|
||||
package mcpself
|
||||
|
||||
import (
|
||||
"github.com/casdoor/casdoor/object"
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/beego/beego/v2/server/web/context"
|
||||
"github.com/casdoor/casdoor/mcp"
|
||||
"github.com/casdoor/casdoor/mcpself"
|
||||
"github.com/casdoor/casdoor/object"
|
||||
"github.com/casdoor/casdoor/util"
|
||||
)
|
||||
@@ -31,7 +31,7 @@ func AutoSigninFilter(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
if urlPath == "/api/mcp" {
|
||||
var req mcp.McpRequest
|
||||
var req mcpself.McpRequest
|
||||
if err := json.Unmarshal(ctx.Input.RequestBody, &req); err == nil {
|
||||
if req.Method == "initialize" || req.Method == "notifications/initialized" || req.Method == "ping" || req.Method == "tools/list" {
|
||||
return
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
"github.com/beego/beego/v2/server/web/context"
|
||||
"github.com/casdoor/casdoor/conf"
|
||||
"github.com/casdoor/casdoor/i18n"
|
||||
"github.com/casdoor/casdoor/mcp"
|
||||
"github.com/casdoor/casdoor/mcpself"
|
||||
"github.com/casdoor/casdoor/object"
|
||||
"github.com/casdoor/casdoor/util"
|
||||
)
|
||||
@@ -75,7 +75,7 @@ func denyRequest(ctx *context.Context) {
|
||||
}
|
||||
|
||||
func denyMcpRequest(ctx *context.Context) {
|
||||
req := mcp.McpRequest{}
|
||||
req := mcpself.McpRequest{}
|
||||
err := json.Unmarshal(ctx.Input.RequestBody, &req)
|
||||
if err != nil {
|
||||
ctx.Output.SetStatus(http.StatusBadRequest)
|
||||
@@ -88,7 +88,7 @@ func denyMcpRequest(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resp := mcp.BuildMcpResponse(req.ID, nil, &mcp.McpError{
|
||||
resp := mcpself.BuildMcpResponse(req.ID, nil, &mcpself.McpError{
|
||||
Code: -32001,
|
||||
Message: "Unauthorized",
|
||||
Data: T(ctx, "auth:Unauthorized operation"),
|
||||
|
||||
@@ -26,7 +26,7 @@ package routers
|
||||
import (
|
||||
"github.com/beego/beego/v2/server/web"
|
||||
"github.com/casdoor/casdoor/controllers"
|
||||
"github.com/casdoor/casdoor/mcp"
|
||||
"github.com/casdoor/casdoor/mcpself"
|
||||
)
|
||||
|
||||
func InitAPI() {
|
||||
@@ -372,7 +372,7 @@ func InitAPI() {
|
||||
|
||||
web.Router("/scim/*", &controllers.RootController{}, "*:HandleScim")
|
||||
|
||||
web.Router("/api/mcp", &mcp.McpController{}, "POST:HandleMcp")
|
||||
web.Router("/api/mcp", &mcpself.McpController{}, "POST:HandleMcp")
|
||||
|
||||
web.Router("/api/faceid-signin-begin", &controllers.ApiController{}, "GET:FaceIDSigninBegin")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user