mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-05-28 09:01:22 +02:00
feat(api): implement API key generation and management functionality
Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
7
mcp.go
7
mcp.go
@@ -26,9 +26,12 @@ func StartMCP(port int, stdio bool) {
|
||||
// SSE mode
|
||||
addr := fmt.Sprintf(":%d", port)
|
||||
sseServer := server.NewSSEServer(s)
|
||||
handler := sseServer.SSEHandler()
|
||||
|
||||
// Add auth for non-localhost
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("/sse", sseServer.SSEHandler())
|
||||
mux.Handle("/message", sseServer.MessageHandler())
|
||||
|
||||
var handler http.Handler = mux
|
||||
if config.APIKey != "" {
|
||||
handler = withAPIKeyAuth(handler, config.APIKey)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user