Skip to content

fix(mcp): fix a batch of MCP OAuth, connection and prompt issues - #66636

Merged
neriousy merged 2 commits into
devfrom
mcp-fixes
Nov 27, 2026
Merged

neriousy merged 2 commits into
devfrom
mcp-fixes

Conversation

@neriousy

@neriousy neriousy commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Issue for this PR

Closes #66175
Closes #58319
Closes #50036
Closes #62331
Closes #53942
Closes #60583
Closes #55181
Closes #52446
Closes #61887
Closes #55335
Closes #53401

Fixes the Google half of #59820

Type of change

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

What does this PR do?

batch of mcp robustness fixes, mostly packages/core/src/mcp

oauth

connection

prompts

other

skipped the ones with an open contributor PR so we don't duplicate: #66073 (#66139), #66072 (#66170), #64837 (#64838), #63463 (#63469), #63092 (#63166), #64846 (#65818), #66577 (claimed), #64941/#65522 (#65233)

no flag, these are fixes

How did you verify your code works?

  • new tests for each issue in mcp-oauth.test.ts, mcp.test.ts, plugin/command.test.ts, plugin/websearch.test.ts, config/normalization.test.ts and server/test/mcp-route.test.ts. checked they fail on dev and pass here
  • full packages/core suite: 7969 pass, 2 fail. the 2 are shell parity tests that fail the same way on dev with local macOS bash
  • bun typecheck in core + server, oxlint

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: #59820, #64854

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sound. Each new test fails on dev and passes here; related core and server tests pass apart from one MCP descendant-process test that fails the same way on dev. typecheck:tsc is clean in core and server. I couldn't run it against real OAuth providers, so this is checked through the tests' simulated servers.

Public API: nothing added or removed. Flat v1 mcp.<name>.oauth entries now also accept the snake_case keys (client_id, client_secret, callback_port, redirect_uri; camelCase wins), and the server router accepts path params up to 512 characters instead of 100. Both are backwards compatible.

No blocking concerns. The needs_auth transition after a refused call takes the lock the same way session-expiry recovery does, and a 401 on a tool call now gets the same needs_auth status a refused connect already gets. The issuer retry still holds the issuer to the value the failed check reported.

Related: #59820, #64854

A 403 insufficient_scope on one tool call no longer ends the connection in needs_auth, since a new login asks for the first challenge's scope and the other tools went down with it. A refusal on the retry after a reconnect now ends the new connection instead of being ignored.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commit looks sound. A 403 asking for more scope now fails only that tool call and the connection stays up. A refused retry after a reconnect now ends the new connection in needs_auth; before, it targeted the replaced connection and did nothing. Both new tests fail with the previous commit's source and pass here. MCP tests pass apart from one process-cleanup test that also fails on dev, and typecheck:tsc is clean in core. Public API is unchanged by this commit. No new concerns.

@neriousy
neriousy merged commit 0081ffa into dev Nov 27, 2026
11 checks passed
@neriousy
neriousy deleted the mcp-fixes branch November 27, 2026 12:03
@amrkmn amrkmn mentioned this pull request Nov 30, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment