Skip to main content
Glama
mcp_cors.go835 B
package cmd import ( "net/http" ) // corsMiddleware adds CORS headers required by Smithery.ai func corsMiddleware(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // Set CORS headers as required by Smithery w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Credentials", "true") w.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS") w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization, mcp-session-id, mcp-protocol-version, *") w.Header().Set("Access-Control-Expose-Headers", "mcp-session-id, mcp-protocol-version") // Handle preflight requests if r.Method == "OPTIONS" { w.WriteHeader(http.StatusOK) return } // Pass to the next handler next.ServeHTTP(w, r) }) }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/samihalawa/whatsapp-go-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server