Implements the daemon mode feature for running core as a background service with MCP server capabilities. New features: - `core daemon` command with configurable MCP transport - Support for stdio, TCP, and Unix socket transports - Environment variable configuration (CORE_MCP_TRANSPORT, CORE_MCP_ADDR) - CLI flags for runtime configuration - Integration with existing daemon infrastructure (PID file, health checks) Files added: - internal/cmd/daemon/cmd.go - daemon command implementation - pkg/mcp/transport_stdio.go - stdio transport wrapper - pkg/mcp/transport_unix.go - Unix domain socket transport Files modified: - pkg/mcp/mcp.go - added log import - pkg/mcp/transport_tcp.go - added log import - pkg/mcp/transport_tcp_test.go - fixed port binding test Usage: core daemon # TCP on 127.0.0.1:9100 core daemon --mcp-transport=socket --mcp-addr=/tmp/core.sock CORE_MCP_TRANSPORT=stdio core daemon # for Claude Code integration Fixes #119 Co-authored-by: Claude <developers@lethean.io> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Snider <snider@host.uk.com>
15 lines
405 B
Go
15 lines
405 B
Go
package mcp
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/host-uk/core/pkg/log"
|
|
"github.com/modelcontextprotocol/go-sdk/mcp"
|
|
)
|
|
|
|
// ServeStdio starts the MCP server over stdin/stdout.
|
|
// This is the default transport for CLI integrations.
|
|
func (s *Service) ServeStdio(ctx context.Context) error {
|
|
s.logger.Info("MCP Stdio server starting", "user", log.Username())
|
|
return s.server.Run(ctx, &mcp.StdioTransport{})
|
|
}
|