-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
48 lines (39 loc) · 1.03 KB
/
Copy pathmain.go
File metadata and controls
48 lines (39 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"fmt"
"net/http"
"os"
"github.com/mark3labs/mcp-go/server"
"github.com/spf13/cobra"
)
var version = "dev"
func main() {
rootCmd := &cobra.Command{
Use: "pushover-mcp",
Short: "Pushover MCP server for AI agents",
Long: "pushover-mcp is an MCP server that exposes the Pushover notification service as tools for AI agents.",
}
rootCmd.AddCommand(mcpCmd())
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}
func mcpCmd() *cobra.Command {
return &cobra.Command{
Use: "mcp",
Short: "Start MCP server (stdio)",
RunE: func(cmd *cobra.Command, args []string) error {
token := os.Getenv("PUSHOVER_TOKEN")
if token == "" {
return fmt.Errorf("PUSHOVER_TOKEN environment variable is required")
}
userKey := os.Getenv("PUSHOVER_USER_KEY")
if userKey == "" {
return fmt.Errorf("PUSHOVER_USER_KEY environment variable is required")
}
client := NewPushoverClient(token, userKey, http.DefaultClient)
srv := NewServer(client)
return server.ServeStdio(srv)
},
}
}