Files
Memoh/cmd/mcp/main.go
T
BBQ ca5c6a1866 refactor(core): restructure conversation, channel and message domains
- 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
2026-02-12 15:34:40 +08:00

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)
}