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)
| 178 | // WithMCPTokenIdentity, or ("", "") if none was set. The audit |
| 179 | // middleware uses this to populate token_kind + token_ref columns. |
| 180 | func 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 |
no outgoing calls
no test coverage detected