Repository navigation
feat(mcp): add OpenWork-managed local OAuth gateway - #3652
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
reachjalil
force-pushed
the
codex/local-mcp-oauth-gateway
branch
from
August 10, 2026 09:57
17431fc to
a106cb6
Compare
reachjalil
force-pushed
the
codex/local-mcp-oauth-gateway
branch
from
August 10, 2026 09:59
a106cb6 to
2dfb6ab
Compare
reachjalil
enabled auto-merge (squash)
August 10, 2026 10:06
reachjalil
force-pushed
the
codex/local-mcp-oauth-gateway
branch
from
August 10, 2026 10:10
2dfb6ab to
47c0668
Compare
Contributor
There was a problem hiding this comment.
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
This was referenced Aug 10, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
oauth: false, so OpenCode never receives provider OAuth credentialsWhy
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_KEYand 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 assertionspnpm -C apps/desktop test— 185 passed, 1 skippedpnpm -C apps/app exec bun test tests/desktop-web-url.test.ts— 2 tests passed, 5 assertionspnpm -C apps/server typecheckpnpm -C apps/desktop typecheck:electronpnpm -C apps/app typecheckpnpm -C apps/server buildpnpm install --frozen-lockfileThe 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.tsMockMcpHandle.handshakestype error.