GeezerVison is showing github.com — feat(mcp): add OpenWork-managed local OAuth gateway by reachjalil · Pull Request #3652 · different-ai/openwork
Conversation
reachjalil
commented
Aug 10, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
- add an opt-in OpenWork-managed OAuth path for custom remote MCPs in local desktop workspaces
- reuse the provider-neutral enterprise MCP client for discovery, DCR or pre-registered clients, PKCE, token exchange, refresh, and authenticated tool verification
- expose provider tools to the bundled OpenCode engine through a scoped loopback MCP gateway with
oauth: false, so OpenCode never receives provider OAuth credentials
- persist OAuth state in an AES-256-GCM encrypted local vault whose key is held by desktop OS secure storage or an explicitly configured standalone-server secret
- handle reconnect, logout, enable/disable, and removal through the existing MCP settings surface
- guard managed-provider egress with public-HTTPS checks, private/reserved and unsafe IANA special-use address blocking, DNS answers bound to the socket connection, and redirect revalidation
- restrict Electron external navigation to HTTP(S) URLs before opening provider authorization pages
Why
Some MCP providers can complete OAuth through OpenWork's enterprise MCP client but still fail when the bundled OpenCode client owns the direct connection. This adds a compatibility path entirely on the OpenWork side: OpenWork owns OAuth and token lifecycle, while OpenCode continues to consume a normal MCP tool surface.
The path is opt-in per connection and desktop-local only. Existing direct remote MCPs and local command MCPs are unchanged.
Security boundary
Provider access tokens, refresh tokens, OAuth client secrets, registrations, discovery state, and PKCE transactions stay in the encrypted OpenWork vault. OpenWork Desktop lazily protects the random vault key with the operating system's secure-storage service and persists only the protected key blob, separately from the vault. The standalone server requires OPENWORK_ENCRYPTION_KEY and has no plaintext key-file fallback; that server-only value is removed from the managed OpenCode child environment.
The runtime OpenCode config contains only the loopback gateway URL and a connection-scoped bearer derived from a process-only secret. That bearer rotates on restart.
Outside explicit local development, provider URLs must use HTTPS and resolve only to public addresses; private, reserved, documentation, and other unsafe special-use blocks are rejected. DNS validation runs inside the outbound socket connector, and the exact validated answer is passed to TCP/TLS so a hostname cannot rebind between validation and connection. Redirects use the same protected transport, HTTPS downgrade is blocked, credential-bearing request bodies cannot cross origins, and provider authorization pages cannot invoke custom external protocols.
Verification
pnpm -C apps/server test src/local-managed-mcp-url-guard.test.ts src/local-managed-mcp.e2e.test.ts src/embedded-lifecycle.test.ts — 16 tests passed, 96 assertions
pnpm -C apps/desktop test — 185 passed, 1 skipped
pnpm -C apps/app exec bun test tests/desktop-web-url.test.ts — 2 tests passed, 5 assertions
pnpm -C apps/server typecheck
pnpm -C apps/desktop typecheck:electron
pnpm -C apps/app typecheck
pnpm -C apps/server build
pnpm install --frozen-lockfile
- compiled embedded server import verified with the desktop production dependency links
The focused end-to-end test covers discovery/DCR, PKCE callback, encrypted persistence without a colocated plaintext key, OS-protected desktop key restoration, fail-closed secure-storage behavior, OpenCode runtime registration, unauthorized gateway rejection, tool listing and calls, provider tool errors without false reauthentication, silent token refresh, terminal revocation, restart reconciliation with bearer rotation, disconnect, and reconnect.
An opt-in testkit tape and voiceover were added. The repository-wide eval TypeScript check is currently blocked by the pre-existing connectors-quick-add.slow.test.ts MockMcpHandle.handshakes type error.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
vercel
Bot
commented
Aug 10, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (712ef8ddbe1818a39a6c705834d52ed2183c7932). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 10, 2026
This branch was successfully deployed
5 active
deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|