1// SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
2//
3// SPDX-License-Identifier: AGPL-3.0-or-later
4
5// Package cmd provides the CLI commands for lunatask-mcp-server.
6package cmd
7
8import (
9 "context"
10 "os"
11
12 "github.com/charmbracelet/fang"
13 "github.com/spf13/cobra"
14
15 configcmd "git.secluded.site/lunatask-mcp-server/cmd/config"
16)
17
18// version is set by Execute and used by serve command for MCP server info.
19var version = "dev"
20
21// rootCmd is the base command when called without subcommands.
22//
23//nolint:exhaustruct // cobra only requires a subset of fields
24var rootCmd = &cobra.Command{
25 Use: "lunatask-mcp-server",
26 Short: "MCP server for Lunatask",
27 Long: `lunatask-mcp-server exposes Lunatask to LLMs via the Model Context Protocol.
28
29Use 'lunatask-mcp-server serve' to start the MCP server.
30Use 'lunatask-mcp-server config' to configure the server interactively.`,
31}
32
33func init() {
34 rootCmd.AddCommand(configcmd.Cmd)
35 rootCmd.AddCommand(serveCmd)
36}
37
38// Execute runs the root command.
39func Execute(v string) {
40 version = v
41 if err := fang.Execute(context.Background(), rootCmd, fang.WithVersion(version)); err != nil {
42 os.Exit(1)
43 }
44}