fix: rename mcp package to mcpself (#5302)

This commit is contained in:
DacongDA
2026-03-23 10:59:10 +08:00
committed by GitHub
parent 4879926977
commit df47f5785c
7 changed files with 11 additions and 11 deletions

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package mcp
package mcpself
import (
"fmt"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package mcp
package mcpself
import (
"strings"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -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"),

View File

@@ -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")
}