Skip to main content
Glama

CentralMind/Gateway

headers.go1.05 kB
package xcontext import ( "context" "strings" ) type contextKey string const ( headersKey contextKey = "headers" sessionKey contextKey = "session" ) func WithSession(ctx context.Context, sessionID string) context.Context { if _, ok := ctx.Value(sessionKey).(bool); !ok { return context.WithValue(ctx, sessionKey, sessionID) } return ctx } func Session(ctx context.Context) string { session, ok := ctx.Value(sessionKey).(string) if !ok { return "" } return session } func WithHeader(ctx context.Context, headers map[string][]string) context.Context { return context.WithValue(ctx, headersKey, headers) } func Header(ctx context.Context, key string) string { headers, ok := ctx.Value(headersKey).(map[string][]string) if !ok { return "" } for k := range headers { if strings.EqualFold(k, key) { return headers[k][0] } } return "" } func Headers(ctx context.Context) map[string][]string { headers, ok := ctx.Value(headersKey).(map[string][]string) if !ok { return map[string][]string{} } return headers }

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/centralmind/gateway'

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