Skip to content

Commit ff0b4c0

Browse files
committed
provide better error message if missing an api token
1 parent 82a8dfc commit ff0b4c0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cmd/root.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ var rootCmd = &cobra.Command{
5252
Long: `Opslevel MCP Server`,
5353

5454
RunE: func(cmd *cobra.Command, args []string) error {
55+
token := viper.GetString("api-token")
56+
if token == "" {
57+
return fmt.Errorf("no API token was found, use --api-token=XXX or the OPSLEVEL_API_TOKEN environment variable is required")
58+
}
59+
5560
s := server.NewMCPServer(
5661
"OpsLevel",
5762
version,

0 commit comments

Comments
 (0)