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(core): fall back to legacy when the MCP probe gets an HTTP 5xx by neriousy · Pull Request #66588 · anomalyco/opencode

Conversation

@neriousy

@neriousy neriousy commented Nov 26, 2026 •
edited by opencodejr Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Issue for this PR

Closes #66101

Type of change

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

What does this PR do?

since #65282 remote servers default to auto, but the HTTP path only fell back to legacy when the server/discover probe timed out. lots of legacy servers (Spring AI / mcp-java) answer unknown methods with a 500, and the SDK turns that into SdkHttpError(EraNegotiationFailed), so the connect just failed and never tried initialize

  • negotiate in packages/core/src/mcp/client.ts now also falls back on a 5xx answer to the probe, same as the timeout case. network errors still fail (initialize would fail the same way)
  • if the server is really down it now gets probe + initialize per attempt, so the pool "was down" test counts 6 requests instead of 3
  • docs said legacy is the default, fixed to auto

not covered here: the Railway case from the comments (probe succeeds, then tools/list hangs on the modern era) and protocol being dropped in the flat mcp.<name> config form

no flag, it's a fix

How did you verify your code works?

  • new test in packages/core/test/mcp.test.ts: an HTTP server that answers server/discover with 500 and speaks legacy otherwise. fails on dev, passes here (--rerun-each 10)
  • bun run script/test.ts test/mcp*.test.ts test/mcp and bun typecheck in packages/core
  • docs build (bun src/docs/script/build.ts) passes

Screenshots / recordings

n/a

Checklist

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

Added by the opencode bot (AI-generated).

Related: #66577

Sorry, something went wrong.

Uh oh!

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

All reactions
@neriousy
fix(core): fall back to legacy when the MCP probe gets an HTTP 5xx
da4172c
opencodejr[bot]
opencodejr Bot reviewed Nov 26, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

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.

The fix works. I ran the #66101 repro script from source against a local proxy that answers server/discover with HTTP 500 and forwards everything else to the reporter's real Spring AI server. The public server itself now answers the probe with -32601, so it no longer shows the bug. On the base, the default protocol fails with Version negotiation failed: the server answered the probe with HTTP 500. With this PR it connects. The new test and the updated pool test both fail on the base and pass here. tsc passes for packages/core.

In the SDK, an SdkHttpError with the negotiation-failed code only comes from a probe answered with a 5xx. 401/403 keep their auth errors, and other 4xx answers already fell back. So the new condition covers just this case, and OAuth is unaffected.

Public API: unchanged. The docs now correctly say auto is the default, which matches the schema.

No blocking concerns.

Related: #66577

Sorry, something went wrong.

Uh oh!

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

All reactions
@neriousy
neriousy merged commit 70e8a0f into dev Nov 26, 2026
14 checks passed

Uh oh!

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

@neriousy
neriousy deleted the mcp-probe-fallback branch November 26, 2026 13:48
@heunghingwan heunghingwan mentioned this pull request Nov 26, 2026
fix(mcp): fall back to legacy when a slow stdio server refuses initialize #66595
Open
3 of 6 tasks
@ransagy ransagy mentioned this pull request Nov 26, 2026
mcp: tools/list hangs after subscriptions/listen on the 2026-07-28 protocol railwayapp/cli#1376
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

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.

mcp: server/discover probe answered with HTTP 500 hard-fails; no legacy fallback despite docs

Uh oh!

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

1 participant

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