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 — fix(mcp): generate OAuth state on-the-fly during initial connection by jonahsnider · Pull Request #16248 · anomalyco/opencode

Conversation

@jonahsnider

@jonahsnider jonahsnider commented Mar 6, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #16247

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When connecting to a remote MCP server requiring OAuth, the SDK's auth flow calls provider.state() to get the state parameter.
This method was throwing when no state had been pre-generated, causing a non-UnauthorizedError that prevented the server from being recognized as needing auth.
The error fell through to the SSE transport fallback, which also failed, resulting in a generic "Non-200 status code" status instead of needs_auth.

How did you verify your code works?

Following the reproduction steps in #16247, you'll see that the TUI properly marks the server as needing authentication, rather than having an SSE transport error:

Screenshot of /status in OpenCode TUI

Screenshots / recordings

N/A - not a UI change

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jonahsnider
fix(mcp): generate OAuth state on-the-fly during initial connection
d8618ef
@github-actions

github-actions Bot commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on the search results, I found a potentially related PR:

Related PR:

  • fix(mcp): fix OAuth auto-connect failing on first connection #15547 - fix(mcp): fix OAuth auto-connect failing on first connection
    • fix(mcp): fix OAuth auto-connect failing on first connection #15547
    • This PR also addresses MCP OAuth connection issues on initial connection, which is closely related to PR fix(mcp): generate OAuth state on-the-fly during initial connection #16248's fix for generating OAuth state on-the-fly during initial connection. These may be complementary fixes or addressing similar root causes.

The search also returned several other OAuth-related PRs (#11477, #11925, #13085, #9034) but these appear to be feature additions rather than duplicate fixes for the same issue.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Mar 6, 2026
fix(mcp): show auth-required status for streamable HTTP 401 #16315
Closed
2 of 6 tasks
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this May 5, 2026
@jonahsnider

jonahsnider commented May 5, 2026

Copy link
Copy Markdown
Author

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

I'm still waiting for a review. The bug this PR addresses is an actual issue and this fixes it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Unauthenticated streamable HTTP MCP servers are reported as SSE errors instead of missing auth

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@jonahsnider
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.
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.