mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2025-08-23 14:23:05 +00:00
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:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user