refactor(core): use keyed MCP credential reads (#45708)

This commit is contained in:
Kit Langton 2026-08-27 19:39:12 -04:00 committed by GitHub
parent 74f5317489
commit 35231b408e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -273,14 +273,12 @@ export const layer = (options?: Options) =>
return McpOAuth.provider({ ...base, store: McpOAuth.memoryStore() })
const credentialID = found.id
const methodID = found.value.methodID
const integrationID = entry.integrationID
// Tracks the refresh token this provider last presented, so invalidate can tell whether the SDK
// rejected the currently-stored credential or a snapshot another connection has already rotated past.
let presented = found.value.refresh
const readOAuthCredential = async () => {
const stored = await Effect.runPromise(credentials.list(integrationID))
const match = stored.find((credential) => credential.id === credentialID)
return match && match.value.type === "oauth" ? match.value : undefined
const stored = await Effect.runPromise(credentials.get(credentialID))
return stored?.value.type === "oauth" ? stored.value : undefined
}
return McpOAuth.provider({
...base,