Files
kandev/apps/backend/internal/mcp/origin/context.go
T
nova28 c82668c789 feat(mcp): expose agent clarification questions and permission requests externally (#2875)
Co-authored-by: Vojtěch Biberle <vojtech.biberle@gmail.com>
Co-authored-by: nova28 <17953305+nova28@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
2026-08-22 15:39:40 +00:00

21 lines
692 B
Go

// Package origin carries trusted, process-local MCP transport attestations.
// Wire payloads cannot create these markers.
package origin
import "context"
type externalTransportKey struct{}
// WithTrustedExternalTransport marks a context after it enters through the
// backend's external MCP transport boundary.
func WithTrustedExternalTransport(ctx context.Context) context.Context {
return context.WithValue(ctx, externalTransportKey{}, true)
}
// IsTrustedExternalTransport reports whether the external MCP boundary marked
// the context in-process.
func IsTrustedExternalTransport(ctx context.Context) bool {
trusted, _ := ctx.Value(externalTransportKey{}).(bool)
return trusted
}