Skip to content

mcp: allow saving OAuth2 source before sign-in#364

Merged
RhysSullivan merged 1 commit intomainfrom
rs/mcp-defer-oauth-signin
Apr 22, 2026
Merged

mcp: allow saving OAuth2 source before sign-in#364
RhysSullivan merged 1 commit intomainfrom
rs/mcp-defer-oauth-signin

Conversation

@RhysSullivan
Copy link
Copy Markdown
Owner

Summary

  • Adding an MCP source with OAuth2 auth no longer requires completing sign-in first. Save the source, then individual users sign in per-user via McpSignInButton.
  • AddMcpSource.tsx: emit {kind: "oauth2", connectionId} using the stable mcp-oauth2-${namespace} id even when tokens haven't been collected; authReady drops the tokens !== null gate so Save is enabled.
  • plugin.ts: addSource now wraps resolveConnectorInput in Effect.either for remote transports — a missing oauth2 connection or unresolvable header secret no longer short-circuits the save. The source lands in the catalog (same pattern as the existing "0 tools when discovery fails" behavior) and the underlying error still surfaces. Stdio resolver failures remain hard-failures.
  • McpSignInButton already did the right thing — the missing piece was ensuring the saved source had a non-trivial {kind: "oauth2", connectionId} to drive it.

Test plan

  • Manual: add an MCP server with OAuth2, Save without signing in, confirm Sign in renders
  • Manual: sign in, tools populate, second user still sees Sign in
  • `bun run --filter=@executor/plugin-mcp test` — 25/25 (22 prior + 3 new)

Selecting the OAuth auth method when adding an MCP source no longer
forces the admin to complete the authorization flow before Save. The
source is persisted with `{kind: "oauth2", connectionId}` pointing at
the stable `mcp-oauth2-${namespace}` id, and each user later mints
their own backing connection via McpSignInButton on the source detail
page (per-scope shadowing resolves tokens per-user at invoke time).

On the plugin side, remote addSource now captures resolver failures
(e.g. no connection minted yet, missing header secret) the same way it
already handles discovery failures: the source row still lands in the
catalog so it shows up in the list and exposes a Sign-in affordance,
while the underlying error still surfaces to the caller for logging.
Stdio behaviour is unchanged — a stdio resolver failure is a config
error the admin must fix first.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
🔵 In progress
View logs
executor-cloud 5dc4aa8 Apr 22 2026, 03:46 AM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 22, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud 5dc4aa8 Apr 22 2026, 03:47 AM

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 22, 2026

Open in StackBlitz

@executor/sdk

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/sdk@364

@executor/plugin-file-secrets

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-file-secrets@364

@executor/plugin-google-discovery

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-google-discovery@364

@executor/plugin-graphql

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-graphql@364

@executor/plugin-keychain

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-keychain@364

@executor/plugin-mcp

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-mcp@364

@executor/plugin-oauth2

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-oauth2@364

@executor/plugin-onepassword

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-onepassword@364

@executor/plugin-openapi

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-openapi@364

@executor/plugin-workos-vault

npm i https://pkg.pr.new/RhysSullivan/executor/@executor/plugin-workos-vault@364

executor

npm i https://pkg.pr.new/RhysSullivan/executor@364

commit: 5dc4aa8

@RhysSullivan RhysSullivan merged commit 68907a1 into main Apr 22, 2026
9 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