mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
ca5c6a1866
- Rename chat module to conversation with flow-based architecture - Move channelidentities into channel/identities subpackage - Add channel/route for routing logic - Add message service with event hub - Add MCP providers: container, directory, schedule - Refactor Feishu/Telegram adapters with directory and stream support - Add platform management page and channel badges in web UI - Update database schema for conversations, messages and channel routes - Add @memoh/shared package for cross-package type definitions
43 lines
963 B
Go
43 lines
963 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"io"
|
|
"log/slog"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"github.com/memohai/memoh/internal/logger"
|
|
"github.com/memohai/memoh/internal/version"
|
|
gomcp "github.com/modelcontextprotocol/go-sdk/mcp"
|
|
)
|
|
|
|
func main() {
|
|
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
|
defer stop()
|
|
|
|
// File tools (read/write/list/edit) are provided by the agent's MCP tool gateway, not this binary.
|
|
server := gomcp.NewServer(
|
|
&gomcp.Implementation{Name: "memoh-mcp", Version: version.GetInfo()},
|
|
nil,
|
|
)
|
|
err := server.Run(ctx, &gomcp.StdioTransport{})
|
|
if ctx.Err() != nil {
|
|
return
|
|
}
|
|
if err == nil {
|
|
logger.Warn("mcp server exited without error; waiting for shutdown signal")
|
|
<-ctx.Done()
|
|
return
|
|
}
|
|
if errors.Is(err, io.EOF) {
|
|
logger.Warn("mcp stdio closed; waiting for shutdown signal")
|
|
<-ctx.Done()
|
|
return
|
|
}
|
|
logger.Error("mcp server failed", slog.Any("error", err))
|
|
os.Exit(1)
|
|
}
|