Skip to content

OAuth 2.1 (PKCE) + public reachability for the MCP endpoint, so hosted agents can connect #1541

Closed

Description

@currentbits

Split from #1530 (part 3). Parts 1-2 of that issue shipped as device scopes for Solenta Web, plus a capability declared on each external MCP tool.

Blocker: the orch MCP server listens only on 127.0.0.1 (electron/orchServer.js, server.listen(config.port, "127.0.0.1")). Hosted agents such as ChatGPT connectors, claude.ai and cloud bots cannot reach it, whatever the auth. OAuth on its own would only help local clients that can already paste a bearer token.

Scope:

  1. Public reachability: pick a path that is opt-in and off by default. Candidates are Tailscale Funnel (reusing the Serve helper in electron/webAccess.js) or a relay. The UI must state the exposure as clearly as the existing Tailscale Serve note does.
  2. OAuth 2.1 with PKCE on /mcp, following the MCP authorization spec:
    • protected-resource metadata
    • an authorization server with consent in the desktop app
    • dynamic client registration
    • short-lived access tokens and refresh tokens
  3. Grants: each OAuth grant maps to a pairing row (electron/pairing.js), with capabilities, a project list, expiry and revoke. Every tool already declares its capability in EXTERNAL_TOOLS, and each call re-checks it.
  4. UI: the "Copy MCP URL" button already shipped in Scoped remote access: per-device permissions and OAuth for outside agents #1530. Add a public URL once one exists.

Done when: a hosted agent can sign in through the in-app consent screen, sees only the tools its grant allows, and revoking the grant cuts it off at once.

Activity

  1. added
    plan:todo
    on Oct 9, 2026
  2. added
    plan:doing
    and removed
    plan:todo
    on Oct 11, 2026
  3. currentbits commented on Oct 11, 2026

    @currentbits
    OwnerAuthor

    Path chosen: Tailscale Funnel (opt-in, off by default). No relay in this issue.

    Design:

    1. Reuse the Tailscale helper in electron/webAccess.js to Funnel the orch loopback port. Dedicated HTTPS port so it does not fight Solenta Web Serve on :443.
    2. Public Host never accepts the rotating in-app session token — pairing / OAuth only. Loopback keeps today's session token for in-app MCP.
    3. OAuth 2.1 + PKCE on the orch server: protected-resource metadata, authorization-server metadata, dynamic client registration, in-app consent, short-lived access + refresh. Each grant is a pairing row; revoke already cuts authorizeToken off.
    4. Integrations UI: Funnel switch + exposure note (same clarity as Serve) + Copy public URL once one exists.
  4. currentbits commented on Oct 11, 2026

    @currentbits
    OwnerAuthor

    Implemented on coder/oauth-2-1-pkce-public-reachability-for-t-ce2911 (not committed).

    Public reachability (opt-in Tailscale Funnel)

    • Reuses the existing Serve CLI helper. Dedicated HTTPS port 8443 so it does not fight Web Serve on :443.
    • Off until Settings → Integrations → “Expose /mcp on the public internet”. Exposure note matches the Serve tone. Copy public URL once Funnel is up.
    • Funnel proxies to loopback, so /mcp treats a request as local only when Host is loopback. The rotating in-app session token is rejected on a public Host (401 + WWW-Authenticate resource_metadata).

    OAuth 2.1 + PKCE

    • Protected-resource + AS metadata, DCR (public clients, no secret), in-app consent dialog, S256 required.
    • Each grant is a pairing row (kind: oauth). Short-lived access (1h) + refresh hash. Revoke cuts the token immediately.
    • Auth code is not consumed until the PKCE verifier matches.

    Left for a live check: a hosted agent (ChatGPT connector / claude.ai) signing in through the consent screen. Unit/HTTP/UI tests are green. Residual risks noted on the review itinerary (Host spoof through Funnel, refresh tokens not rotated, Funnel :8443 vs connectors that only allow :443).

  5. currentbits commented on Oct 11, 2026

    @currentbits
    OwnerAuthor

    PR is up: #1603

  6. added
    plan:done
    and removed
    plan:doing
    on Oct 11, 2026
  7. currentbits commented on Oct 11, 2026

    @currentbits
    OwnerAuthor

    Landed from Solenta thread "OAuth 2.1 (PKCE) + public reachability for the MCP endpoint,". Closed on merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions