main
1package main
2
3import (
4 "context"
5 "flag"
6 "fmt"
7 "log"
8
9 "github.com/xlgmokha/mcp/pkg/time"
10)
11
12func printHelp() {
13 fmt.Printf(`Time MCP Server
14
15DESCRIPTION:
16 A Model Context Protocol server that provides time and date utilities.
17 Supports time zone conversions, date formatting, and temporal calculations.
18
19USAGE:
20 mcp-time [options]
21
22OPTIONS:
23 --help Show this help message
24
25EXAMPLE USAGE:
26 # Start the time server
27 mcp-time
28
29 # Test with MCP protocol
30 echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "get_current_time", "arguments": {}}}' | mcp-time
31
32MCP CAPABILITIES:
33 - Tools: get_current_time, convert_time
34 - Features: Time zone conversions, date formatting, temporal calculations
35 - Standards: ISO 8601 date formats, multiple time zone support
36 - Protocol: JSON-RPC 2.0 over stdio
37
38For detailed documentation, see: cmd/time/README.md
39`)
40}
41
42func main() {
43 // Parse command line flags
44 var help = flag.Bool("help", false, "Show help message")
45 flag.Parse()
46
47 if *help {
48 printHelp()
49 return
50 }
51
52 server := time.New()
53
54 ctx := context.Background()
55 if err := server.Run(ctx); err != nil {
56 log.Fatalf("Server error: %v", err)
57 }
58}