Documentation
¶
Index ¶
- func EncodeStringSlice(ss []string) string
- func EnsureRunning(ctx context.Context, serverName string, command string, args []string, ...) (string, error)
- func IsRunning(serverName string) bool
- func LogPath(serverName string) string
- func NewDaemonManageCommand(serverNames []string) *cobra.Command
- func NewDaemonRunCommand() *cobra.Command
- func PIDPath(serverName string) string
- func SocketPath(serverName string) string
- func Start(serverName string, command string, args []string, env []string, ...) error
- func Stop(serverName string) error
- type Daemon
- type SocketTransport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeStringSlice ¶
EncodeStringSlice encodes a string slice as base64 JSON for passing to __daemon.
func EnsureRunning ¶
func EnsureRunning(ctx context.Context, serverName string, command string, args []string, env []string, startupTimeout time.Duration) (string, error)
EnsureRunning makes sure a daemon is running for the server. If not already running, it spawns one as a detached process. Returns the socket path to connect to.
func IsRunning ¶
IsRunning checks if a daemon is alive for the given server. It verifies both the PID file and socket connectivity.
func NewDaemonManageCommand ¶
NewDaemonManageCommand creates the user-facing "daemon" command with status/stop subcommands.
func NewDaemonRunCommand ¶
NewDaemonRunCommand creates the hidden __daemon command that runs the daemon process. This is invoked by EnsureRunning as a detached subprocess.
func SocketPath ¶
SocketPath returns the unix socket path for a server's daemon.
func Start ¶
func Start(serverName string, command string, args []string, env []string, idleTimeout time.Duration) error
Start launches the daemon: starts the MCP server, performs the MCP handshake, listens on a unix socket, and serves client requests until shutdown. This function blocks until the daemon exits.
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon holds a single MCP server alive and accepts client connections over a unix socket. It proxies JSON-RPC requests to the server and routes responses back to the correct client.
type SocketTransport ¶
type SocketTransport struct {
// contains filtered or unexported fields
}
SocketTransport implements mcp.Transport over a unix socket connection to a running mcpx daemon. Closing it only closes the socket — the daemon stays alive.
func NewSocketTransport ¶
func NewSocketTransport(socketPath string) (*SocketTransport, error)
NewSocketTransport connects to a daemon's unix socket and returns a transport.
func (*SocketTransport) Close ¶
func (t *SocketTransport) Close() error
Close closes the socket connection. The daemon stays alive.
func (*SocketTransport) SendNotification ¶
SendNotification sends a notification (no response expected).