MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / MCPTokenIdentityFromContext

Function MCPTokenIdentityFromContext

internal/server/context.go:180–184  ·  view source on GitHub ↗

MCPTokenIdentityFromContext returns (kind, ref) attached by WithMCPTokenIdentity, or ("", "") if none was set. The audit middleware uses this to populate token_kind + token_ref columns.

(ctx context.Context)

Source from the content-addressed store, hash-verified

178// WithMCPTokenIdentity, or ("", "") if none was set. The audit
179// middleware uses this to populate token_kind + token_ref columns.
180func MCPTokenIdentityFromContext(ctx context.Context) (kind, ref string) {
181 k, _ := ctx.Value(ctxMCPTokenKind).(string)
182 r, _ := ctx.Value(ctxMCPTokenRef).(string)
183 return k, r
184}
185
186// TokenAllowedWorkspacesFromContext returns the token's workspace
187// allow-list, or nil if none was attached. Three return shapes

Callers 4

MCPAuditLogMethod · 0.85
recordMCPAuthzDenialMethod · 0.85
handleOAuthClaimMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected