Context
The MCP Gateway Specification is being updated to v1.13.0 in github/gh-aw#25135. The headers field in the opentelemetry configuration is changing from object | string to string-only. The compiler will now emit "headers": "${OTEL_EXPORTER_OTLP_HEADERS}" as a raw string value instead of converting it to a JSON object.
What Needs to Change
1. Stdin config: accept headers as a string
StdinOpenTelemetryConfig.Headers in internal/config/config_stdin.go is currently map[string]string. It needs to become a string:
// Before
Headers map[string]string `json:"headers,omitempty"`
// After
Headers string `json:"headers,omitempty"`
2. TOML config: align if needed
Check TracingConfig / OpenTelemetryConfig in internal/config/config_tracing.go — if it also has Headers map[string]string, update to string.
3. Tracing provider: parse the string at export time
internal/tracing/provider.go currently passes headers as map[string]string to otlptracehttp.WithHeaders(). It will need to parse the key=value,key=value string format into a map before passing to the OTLP exporter:
func parseOTLPHeaders(raw string) map[string]string {
headers := make(map[string]string)
for _, pair := range strings.Split(raw, ",") {
k, v, ok := strings.Cut(strings.TrimSpace(pair), "=")
if ok {
headers[strings.TrimSpace(k)] = strings.TrimSpace(v)
}
}
return headers
}
4. JSON schema: update to string type
Update internal/config/schema/mcp-gateway-config.schema.json — change opentelemetry.headers from object with additionalProperties: string to type: string.
5. Update tests
- Config parsing tests for string headers
- Tracing provider tests for header string parsing
- Validation tests if any check header types
References
Context
The MCP Gateway Specification is being updated to v1.13.0 in github/gh-aw#25135. The
headersfield in theopentelemetryconfiguration is changing fromobject | stringto string-only. The compiler will now emit"headers": "${OTEL_EXPORTER_OTLP_HEADERS}"as a raw string value instead of converting it to a JSON object.What Needs to Change
1. Stdin config: accept
headersas a stringStdinOpenTelemetryConfig.Headersininternal/config/config_stdin.gois currentlymap[string]string. It needs to become astring:2. TOML config: align if needed
Check
TracingConfig/OpenTelemetryConfigininternal/config/config_tracing.go— if it also hasHeaders map[string]string, update tostring.3. Tracing provider: parse the string at export time
internal/tracing/provider.gocurrently passes headers asmap[string]stringtootlptracehttp.WithHeaders(). It will need to parse thekey=value,key=valuestring format into a map before passing to the OTLP exporter:4. JSON schema: update to string type
Update
internal/config/schema/mcp-gateway-config.schema.json— changeopentelemetry.headersfrom object withadditionalProperties: stringtotype: string.5. Update tests
References