Class: Gmeet::MCPServer

Inherits:
Object
  • Object
show all
Defined in:
lib/utilities/gmeet/mcp.rb

Instance Method Summary collapse

Constructor Details

#initializeMCPServer

Returns a new instance of MCPServer.



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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/utilities/gmeet/mcp.rb', line 10

def initialize
  # Defer Service initialization until actually needed
  @gmeet_tool = nil
  @tools = {
    "test_connection" => {
      name: "test_connection",
      description: "Test the Google Calendar API connection",
      inputSchema: {
        type: "object",
        properties: {},
        required: []
      }
    },
    "list_meetings" => {
      name: "list_meetings",
      description: "List Google Meet meetings with optional date filtering",
      inputSchema: {
        type: "object",
        properties: {
          start_date: {
            type: "string",
            description: "Start date in YYYY-MM-DD format (default: today)"
          },
          end_date: {
            type: "string",
            description: "End date in YYYY-MM-DD format (default: 7 days from start)"
          },
          max_results: {
            type: "number",
            description: "Maximum number of meetings to return (default: 20)"
          },
          calendar_id: {
            type: "string",
            description: "Calendar ID to list meetings from (default: primary calendar)"
          }
        },
        required: []
      }
    },
    "upcoming_meetings" => {
      name: "upcoming_meetings",
      description: "List upcoming Google Meet meetings in the next 24 hours",
      inputSchema: {
        type: "object",
        properties: {
          max_results: {
            type: "number",
            description: "Maximum number of meetings to return (default: 10)"
          },
          calendar_id: {
            type: "string",
            description: "Calendar ID to list meetings from (default: primary calendar)"
          }
        },
        required: []
      }
    },
    "search_meetings" => {
      name: "search_meetings",
      description: "Search for Google Meet meetings by text content",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Search query to find meetings"
          },
          start_date: {
            type: "string",
            description: "Start date in YYYY-MM-DD format (default: today)"
          },
          end_date: {
            type: "string",
            description: "End date in YYYY-MM-DD format (default: 30 days from start)"
          },
          max_results: {
            type: "number",
            description: "Maximum number of meetings to return (default: 10)"
          }
        },
        required: ["query"]
      }
    },
    "get_meeting_url" => {
      name: "get_meeting_url",
      description: "Get the Google Meet URL for a specific event",
      inputSchema: {
        type: "object",
        properties: {
          event_id: {
            type: "string",
            description: "Calendar event ID"
          },
          calendar_id: {
            type: "string",
            description: "Calendar ID (default: primary calendar)"
          }
        },
        required: ["event_id"]
      }
    }
  }
end

Instance Method Details

#runObject



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/utilities/gmeet/mcp.rb', line 114

def run
  # Disable stdout buffering for immediate response
  $stdout.sync = true

  # Log startup to file instead of stdout to avoid protocol interference
  Mcpeasy::Config.ensure_config_dirs
  File.write(Mcpeasy::Config.log_file_path("gmeet", "startup"), "#{Time.now}: Google Meet MCP Server starting on stdio\n", mode: "a")
  while (line = $stdin.gets)
    handle_request(line.strip)
  end
rescue Interrupt
  # Silent shutdown
rescue => e
  # Log to a file instead of stderr to avoid protocol interference
  File.write(Mcpeasy::Config.log_file_path("gmeet", "error"), "#{Time.now}: #{e.message}\n#{e.backtrace.join("\n")}\n", mode: "a")
end