@@ -27,7 +27,7 @@ import (
2727 "github.com/modelcontextprotocol/go-sdk/mcp"
2828)
2929
30- var httpAddr = flag .String ("http" , ":3000 " , "HTTP address to listen on for streamable HTTP server" )
30+ var httpAddr = flag .String ("http" , ":9000 " , "HTTP address to listen on for streamable HTTP server" )
3131
3232// StaticTokenCredential implements azcore.TokenCredential
3333type StaticTokenCredential struct {
@@ -131,24 +131,24 @@ const (
131131
132132// Event detail types for GetEventDetails response
133133type DetailedEventInfo struct {
134- ID string `json:"id"`
135- Subject string `json:"subject"`
136- Start string `json:"start"`
137- End string `json:"end"`
138- Location string `json:"location,omitempty"`
139- IsOnline bool `json:"is_online"`
140- Body string `json:"body,omitempty"`
141- BodyPreview string `json:"body_preview,omitempty"`
142- Attendees []DetailedAttendeeInfo `json:"attendees,omitempty"`
143- Organizer * DetailedOrganizerInfo `json:"organizer,omitempty"`
144- IsAllDay bool `json:"is_all_day"`
145- ShowAs string `json:"show_as,omitempty"`
146- Sensitivity string `json:"sensitivity,omitempty"`
147- Importance string `json:"importance,omitempty"`
148- Categories []string `json:"categories,omitempty"`
149- Recurrence map [string ]interface {} `json:"recurrence,omitempty"`
150- Attachments []DetailedAttachmentInfo `json:"attachments,omitempty"`
151- OnlineMeetingUrl string `json:"online_meeting_url,omitempty"`
134+ ID string `json:"id"`
135+ Subject string `json:"subject"`
136+ Start string `json:"start"`
137+ End string `json:"end"`
138+ Location string `json:"location,omitempty"`
139+ IsOnline bool `json:"is_online"`
140+ Body string `json:"body,omitempty"`
141+ BodyPreview string `json:"body_preview,omitempty"`
142+ Attendees []DetailedAttendeeInfo `json:"attendees,omitempty"`
143+ Organizer * DetailedOrganizerInfo `json:"organizer,omitempty"`
144+ IsAllDay bool `json:"is_all_day"`
145+ ShowAs string `json:"show_as,omitempty"`
146+ Sensitivity string `json:"sensitivity,omitempty"`
147+ Importance string `json:"importance,omitempty"`
148+ Categories []string `json:"categories,omitempty"`
149+ Recurrence map [string ]interface {} `json:"recurrence,omitempty"`
150+ Attachments []DetailedAttachmentInfo `json:"attachments,omitempty"`
151+ OnlineMeetingUrl string `json:"online_meeting_url,omitempty"`
152152}
153153
154154type DetailedAttendeeInfo struct {
@@ -275,13 +275,13 @@ func (c *CalendarMCPServer) ListEvents(ctx context.Context, req *mcp.CallToolReq
275275 }
276276
277277 type EventInfo struct {
278- ID string `json:"id"`
279- Subject string `json:"subject"`
280- Start string `json:"start"`
281- End string `json:"end"`
282- Location string `json:"location,omitempty"`
283- IsOnline bool `json:"is_online"`
284- Body string `json:"body,omitempty"`
278+ ID string `json:"id"`
279+ Subject string `json:"subject"`
280+ Start string `json:"start"`
281+ End string `json:"end"`
282+ Location string `json:"location,omitempty"`
283+ IsOnline bool `json:"is_online"`
284+ Body string `json:"body,omitempty"`
285285 Attendees []string `json:"attendees,omitempty"`
286286 }
287287
@@ -1456,12 +1456,25 @@ func main() {
14561456 }
14571457
14581458 if * httpAddr != "" {
1459- handler := mcp .NewStreamableHTTPHandler (serverFactory , nil )
1459+ mcpHandler := mcp .NewStreamableHTTPHandler (serverFactory , nil )
14601460 log .Printf ("Calendar MCP server listening at %s" , * httpAddr )
1461- if err := http .ListenAndServe (* httpAddr , handler ); err != nil {
1461+
1462+ // Create a custom multiplexer
1463+ mux := http .NewServeMux ()
1464+
1465+ // Handle /health with custom handler
1466+ mux .HandleFunc ("/health" , func (w http.ResponseWriter , r * http.Request ) {
1467+ w .WriteHeader (http .StatusOK )
1468+ w .Write ([]byte ("OK" ))
1469+ })
1470+
1471+ // Handle all other paths with MCP handler
1472+ mux .Handle ("/" , mcpHandler )
1473+
1474+ if err := http .ListenAndServe (* httpAddr , mux ); err != nil {
14621475 log .Fatal (err )
14631476 }
14641477 } else {
14651478 log .Fatal ("HTTP address is required" )
14661479 }
1467- }
1480+ }
0 commit comments