Skip to content

share token refresh between mcp integrations in token-session - #78

Merged
hkonsti merged 2 commits into
mainfrom
hkonsti/google-1-token-session
Oct 15, 2026
Merged

hkonsti merged 2 commits into
mainfrom
hkonsti/google-1-token-session

Conversation

@hkonsti

@hkonsti hkonsti commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Moves the generic half of mcp/mcp-session.ts (reading the encrypted credential, refreshing it as it runs out, one refresh at a time per connection, the compare-and-swap save and the one retry on credentials_rejected) into connections/token-session.ts, which knows nothing of MCP: a TokenRefresher<C> gives it the provider's name, credential schema, expiry check and refresh. callMcpToolFor is now a thin wrapper over callWithToken, so the Google Workspace connector can reuse the same refresh logic. No behavior change; the existing mcp-session tests pass unchanged and token-session.test.ts covers the shared module. The in-flight refresh map now holds the new credential as stored, and each request sharing it decrypts it for itself, so the module-level map stays typed without a cast across providers.

Stack: 1 of 3 for the Google Workspace connector; next: Google OAuth and the Drive files collection.


Open workspace in Conductor

@hkonsti
hkonsti added this pull request to stack #88 October 13, 2026 21:06
@hkonsti
hkonsti force-pushed the hkonsti/google-1-token-session branch 2 times, most recently from 201de1b to 11516a1 Compare October 14, 2026 17:29
@hkonsti
hkonsti force-pushed the hkonsti/google-1-token-session branch from 11516a1 to c4f09ca Compare October 15, 2026 00:12
@hkonsti
hkonsti merged commit 03dff04 into main Oct 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant