feat: add HTTP server mode with updated docs and localization (#45)

- Update download instructions for clarity and consistency in all README files
- Add example configuration for HTTP mode to all README files
- Expand transport type support to include "http" in command-line flags and documentation
- Implement HTTP server mode in the application entrypoint
- Update log output behavior to include "http" mode alongside "sse" for stdout logging
- Refine Chinese README translations for greater accuracy and localization

Signed-off-by: appleboy <appleboy.tw@gmail.com>

Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/45
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
appleboy
2025-05-27 12:17:37 +00:00
committed by Bo-Yi Wu (吳柏毅)
parent 417ef26da0
commit f25cc0de8c
6 changed files with 95 additions and 55 deletions

View File

@@ -15,9 +15,7 @@ import (
"github.com/mark3labs/mcp-go/server"
)
var (
mcpServer *server.MCPServer
)
var mcpServer *server.MCPServer
func RegisterTool(s *server.MCPServer) {
// User Tool
@@ -55,8 +53,14 @@ func Run() error {
if err := sseServer.Start(fmt.Sprintf(":%d", flag.Port)); err != nil {
return err
}
case "http":
httpServer := server.NewStreamableHTTPServer(mcpServer)
log.Infof("Gitea MCP HTTP server listening on :%d", flag.Port)
if err := httpServer.Start(fmt.Sprintf(":%d", flag.Port)); err != nil {
return err
}
default:
return fmt.Errorf("invalid transport type: %s. Must be 'stdio' or 'sse'", flag.Mode)
return fmt.Errorf("invalid transport type: %s. Must be 'stdio', 'sse' or 'http'", flag.Mode)
}
return nil
}