GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — MCP OAuth cannot use public proxy redirect URLs with a local callback listener · Issue #31014 · anomalyco/opencode

MCP OAuth cannot use public proxy redirect URLs with a local callback listener #31014

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
MCP OAuth cannot use public proxy redirect URLs with a local callback listener#31014
Copy link
Assignees
rekram1-node

Description

@rev-rwasilewski
rev-rwasilewski
opened on Jun 5, 2026
Issue body actions

What happened?

OpenCode MCP OAuth currently uses oauth.redirectUri for two separate things:

  • the provider-facing OAuth redirect_uri
  • the local callback listener port/path

That works for normal localhost flows, but breaks remote or containerized environments where the browser can only reach OpenCode through a public proxy URL that forwards back to the local OpenCode process.

For example, OpenCode may run inside a JupyterHub user server or another proxied container environment. The OAuth provider needs to redirect the browser to a public URL like:

https://example.com/hub/user-redirect/proxy/19876/mcp/oauth/callback

That public URL then forwards to the local callback listener:

http://127.0.0.1:19876/mcp/oauth/callback

With the current behavior, setting the public HTTPS URL as redirectUri also makes OpenCode derive local callback settings from that public URL. This can make OpenCode bind the wrong local port/path instead of listening on the local callback endpoint.

What did you expect to happen?

OpenCode should be able to advertise a public/proxied OAuth redirect_uri while independently listening on a local callback port/path.

For example:

{
  "mcp": {
    "slack": {
      "type": "remote",
      "url": "https://mcp.slack.com/mcp",
      "oauth": {
        "redirectUri": "https://example.com/hub/user-redirect/proxy/19876/mcp/oauth/callback",
        "callbackPort": 19876,
        "callbackPath": "/mcp/oauth/callback"
      }
    }
  }
}

The provider should see the public redirectUri, while OpenCode should listen locally on 127.0.0.1:19876/mcp/oauth/callback.

How can we reproduce it?

  1. Run OpenCode in a remote/containerized environment where the browser reaches it through a public reverse proxy, such as JupyterHub or another per-user proxy.
  2. Configure a remote MCP server using OAuth and set oauth.redirectUri to the public proxy URL.
  3. Start opencode mcp auth <server>.
  4. The OAuth provider redirects to the public URL, but OpenCode also uses that URL to derive local listener settings, so the callback may not reach the local listener correctly.

Additional context

This is related to earlier MCP OAuth redirect URI issues like #7377, #18955, and #23787, but the missing piece is separating the provider-facing redirect URI from the local callback listener configuration.

I have a PR that fixes this by keeping redirectUri as the provider-facing OAuth URI and adding callbackPath so callbackPort/callbackPath can control the local listener for proxied environments.

Reacted by juk-stata

Activity

  1. github-actions
    assigned
    rekram1-node
    on Jun 5, 2026
  2. mertcanvural commented on Jun 5, 2026

    @mertcanvural
    mertcanvural
    on Jun 5, 2026
    More actions

    I hit this exact split-surface OAuth bug once in a proxied dev box. Since your repro already has https://example.com/hub/user-redirect/proxy/19876/mcp/oauth/callback forwarding into http://127.0.0.1:19876/mcp/oauth/callback, I'd stop using one redirectUri field for both provider-facing and listener-facing values and keep the public callback plus local bind config separate. My usual 3 checks are a manual diff of emitted redirect vs listener bind, authproxy.dev if the proxy hop is fuzzy, or OAuth Redirect Doctor when I want public callback, local port, and callback path lined up. ngl this feels like one config field doing two jobs.

  3. github-actions commented on Aug 5, 2026

    @github-actions
    github-actionsBot
    on Aug 5, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  4. github-actions
    closed this as not plannedon Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.