diff --git a/README.md b/README.md index beeb6f9..a869551 100644 --- a/README.md +++ b/README.md @@ -133,21 +133,6 @@ To configure the MCP server for Gitea, add the following to your MCP configurati } ``` -- **sse mode** - -```json -{ - "mcpServers": { - "gitea": { - "url": "http://localhost:8080/sse", - "headers": { - "Authorization": "Bearer " - } - } - } -} -``` - - **http mode** ```json @@ -227,10 +212,10 @@ The Gitea MCP Server supports the following tools: ## 🐛 Debugging -To enable debug mode, add the `-d` flag when running the Gitea MCP Server with sse mode: +To enable debug mode, add the `-d` flag when running the Gitea MCP Server with http mode: ```sh -./gitea-mcp -t sse [--port 8080] --token -d +./gitea-mcp -t http [--port 8080] --token -d ``` ## 🛠 Troubleshooting diff --git a/README.zh-cn.md b/README.zh-cn.md index af3d111..a73932e 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -133,21 +133,6 @@ cp gitea-mcp /usr/local/bin/ } ``` -- **sse 模式** - -```json -{ - "mcpServers": { - "gitea": { - "url": "http://localhost:8080/sse", - "headers": { - "Authorization": "Bearer " - } - } - } -} -``` - - **http 模式** ```json @@ -221,10 +206,10 @@ Gitea MCP 服务器支持以下工具: ## 🐛 调试 -要启用调试模式,请在使用 sse 模式运行 Gitea MCP 服务器时添加 `-d` 标志: +要启用调试模式,请在使用 http 模式运行 Gitea MCP 服务器时添加 `-d` 标志: ```sh -./gitea-mcp -t sse [--port 8080] --token -d +./gitea-mcp -t http [--port 8080] --token -d ``` ## 🛠 疑难排解 diff --git a/README.zh-tw.md b/README.zh-tw.md index 8d26b8c..a3b8890 100644 --- a/README.zh-tw.md +++ b/README.zh-tw.md @@ -133,21 +133,6 @@ cp gitea-mcp /usr/local/bin/ } ``` -- **sse 模式** - -```json -{ - "mcpServers": { - "gitea": { - "url": "http://localhost:8080/sse", - "headers": { - "Authorization": "Bearer " - } - } - } -} -``` - - **http 模式** ```json @@ -221,10 +206,10 @@ Gitea MCP 伺服器支持以下工具: ## 🐛 調試 -要啟用調試模式,請在使用 sse 模式運行 Gitea MCP 伺服器時添加 `-d` 旗標: +要啟用調試模式,請在使用 http 模式運行 Gitea MCP 伺服器時添加 `-d` 旗標: ```sh -./gitea-mcp -t sse [--port 8080] --token -d +./gitea-mcp -t http [--port 8080] --token -d ``` ## 🛠 疑難排解 diff --git a/cmd/cmd.go b/cmd/cmd.go index 233bae9..3ec886f 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -21,13 +21,13 @@ func init() { &flagPkg.Mode, "t", "stdio", - "Transport type (stdio, sse or http)", + "Transport type (stdio or http)", ) flag.StringVar( &flagPkg.Mode, "transport", "stdio", - "Transport type (stdio, sse or http)", + "Transport type (stdio or http)", ) flag.StringVar( &host, @@ -39,7 +39,7 @@ func init() { &port, "port", 8080, - "see or http port", + "http port", ) flag.StringVar( &token, diff --git a/operation/operation.go b/operation/operation.go index da0c811..8a2f59c 100644 --- a/operation/operation.go +++ b/operation/operation.go @@ -59,12 +59,12 @@ func parseBearerToken(authHeader string) (string, bool) { if len(authHeader) < len(bearerPrefix) || !strings.HasPrefix(authHeader, bearerPrefix) { return "", false } - + token := strings.TrimSpace(authHeader[len(bearerPrefix):]) if token == "" { return "", false } - + return token, true } @@ -92,15 +92,6 @@ func Run() error { ); err != nil { return err } - case "sse": - sseServer := server.NewSSEServer( - mcpServer, - server.WithSSEContextFunc(getContextWithToken), - ) - log.Infof("Gitea MCP SSE server listening on :%d", flag.Port) - if err := sseServer.Start(fmt.Sprintf(":%d", flag.Port)); err != nil { - return err - } case "http": httpServer := server.NewStreamableHTTPServer( mcpServer, @@ -113,7 +104,7 @@ func Run() error { return err } default: - return fmt.Errorf("invalid transport type: %s. Must be 'stdio', 'sse' or 'http'", flag.Mode) + return fmt.Errorf("invalid transport type: %s. Must be 'stdio' or 'http'", flag.Mode) } return nil } @@ -127,3 +118,4 @@ func newMCPServer(version string) *server.MCPServer { server.WithRecovery(), ) } + diff --git a/pkg/log/log.go b/pkg/log/log.go index e040cf5..f0be5cd 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -48,7 +48,7 @@ func Default() *zap.Logger { MaxAge: 30, })) - if flag.Mode == "http" || flag.Mode == "sse" { + if flag.Mode == "http" { wss = append(wss, zapcore.AddSync(os.Stdout)) }