Skip to content

chore(mcp-adapters): hold the adapter out of releases until 2.0 is ready - #11715

Merged
Baihao Wang (byhow) merged 1 commit into
mainfrom
chore/mcp-adapters-release-guard
Sep 23, 2026
Merged

Baihao Wang (byhow) merged 1 commit into
mainfrom
chore/mcp-adapters-release-guard

Conversation

@byhow

Copy link
Copy Markdown
Member

Summary

This adds @langchain/mcp-adapters to the changesets ignore list. The release PR (#11683) can then ship every other package while MCP adapter 2.0 is still being verified.

The merged SDK 2 stack (#11597 … #11700) left a pending major changeset (mcp-adapters-sdk-2.md), so #11683 currently lists @langchain/[email protected]. We don't want 2.0 to ship until the OAuth work lands and has been checked against managed-deepagents and the docs. Holding #11683 would also hold back every other package.

What changes

  • The release PR drops the adapter. Once this merges, the changesets action regenerates chore: version packages #11683 without it. The other 13 packages release as usual.
  • The adapter stays at 1.1.4 on npm. mcp-adapters-sdk-2.md remains pending, and so will later adapter changesets (OAuth), until this entry is removed.
  • Removing this entry is the 2.0.0 release. After it's removed, the next release PR includes @langchain/[email protected].

While this is in place

  • Keep adapter changesets separate. A changeset for @langchain/mcp-adapters must not list any other package. Changesets rejects mixed ignored/non-ignored changesets.
  • No 1.x adapter patches from main. main already carries the 2.0 code.
  • Prereleases for testing are branch snapshots (the dev-release workflow) from a throwaway branch that removes this entry and prunes other packages' changesets, published under a dedicated mcp-rc npm tag. Nothing on main changes.

Testing

  • changeset status --verbose with this config: the adapter is not in the release plan.
  • changeset version dry run on this commit, with changelog generation disabled in a throwaway worktree: 13 packages bump, @langchain/mcp-adapters stays at 1.1.4, and mcp-adapters-sdk-2.md is the only changeset left.
  • oxfmt --check .changeset/config.json passes.

🤖 Generated with Claude Code

…0 is ready

Add the adapter to the changesets ignore list so the release PR can ship
every other package while MCP adapter 2.0 (SDK 2 migration + OAuth) is
still being verified. The pending major changeset stays in place and is
released when this entry is removed.
@changeset-bot

changeset-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: aef6666

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@byhow Baihao Wang (byhow) changed the title chore(release): hold @langchain/mcp-adapters out of releases until 2.0 is ready chore(mcp-adapters): hold the adapter out of releases until 2.0 is ready Sep 23, 2026

@robin-agent robin-agent 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.

✅ Open SWE Review: No issues found

Open SWE reviewed this PR and found no potential bugs to report.

Open in Web • View Open SWE trace

@github-actions github-actions Bot added the ready label Sep 23, 2026
@byhow
Baihao Wang (byhow) merged commit 485d030 into main Sep 23, 2026
15 of 16 checks passed
@byhow
Baihao Wang (byhow) deleted the chore/mcp-adapters-release-guard branch September 23, 2026 21:19
Hunter Lovell (hntrl) added a commit that referenced this pull request Sep 25, 2026
…leases (#11728)

## Summary

Unblocks the stuck main-branch release by deleting the pending
`@langchain/mcp-adapters` major changeset.

### What's stuck

- #11683 merged yesterday and versioned 13 packages on main —
`[email protected]`, `@langchain/[email protected]`,
`@langchain/[email protected]`, etc. — but none have published: npm `latest`
is still `[email protected]` and `[email protected]` 404s.
- The [📦 Publish
workflow](https://github.com/langchain-ai/langchainjs/actions/runs/36011751239)
exits green without publishing. `.changeset/mcp-adapters-sdk-2.md`
(major, targeting *only* the adapter) is still pending, and since #11715
the adapter is on the changesets `ignore` list. This hits a known
upstream bug
([changesets/action#541](changesets/action#541)):
a changeset referencing only ignored packages still counts as pending,
so the action always takes the "update version PR" branch and never runs
`changeset publish`.
- The version PR it maintains, #11725, is literally empty (the bot's
commit tree is identical to main), so each main push force-pushes a
fresh no-op commit onto it.

### The fix

Delete `mcp-adapters-sdk-2.md` from main. With zero pending changesets,
the next push to main reaches `changeset publish` and ships all 13
already-bumped packages immediately. Then close #11725 and delete
`changeset-release/main` so the action can recreate a real one later.

### Deliberately not changed

- The adapter's SDK 2 **code** stays merged on main — the ignore list
already keeps it unpublished, and reverting it is unnecessary (and would
conflict with the interleaved OpenAI Responses merge).
- The `ignore` entry stays: it correctly holds the adapter until 2.0
ships. **Restoring this changeset (plus removing the ignore entry) is
the 2.0.0 release trigger** — the original text is recoverable with `git
show 34edee1:.changeset/mcp-adapters-sdk-2.md` (also at 1edf83a).

### Verification

`pnpm exec changeset status` on this branch now shows only the two new
patch changesets from today (langchain, classic, textsplitters, neo4j) —
the ignored-pending major is gone.

Fixes the release block discussed in #hunters-botcave.

Made by [Open SWE](https://github.com/langchain-ai/open-swe) · [view
thread](https://openswe.vercel.app/agents/25ebdfb3-0bc9-5a2c-aa83-0f0d720c6042)
· fireworks:accounts/fireworks/models/glm-5p3-flash (max)

Co-authored-by: Hunter Lovell <[email protected]>
Co-authored-by: open-swe[bot] <[email protected]>
Hunter Lovell (hntrl) added a commit that referenced this pull request Sep 27, 2026
… retryable (#11720)

This is the first of two stacked PRs adding OAuth to
`@langchain/mcp-adapters` 2.0. It does four things:

- moves the adapter to MCP SDK 2.1;
- accepts the SDK's token-based `AuthProvider`;
- labels authentication failures correctly;
- lets servers that failed on authentication be retried.

It also documents these changes in the README. The follow-up PR, stacked
on this one, adds `finishAuth` to complete an OAuth redirect.

Merging this releases nothing. `@langchain/mcp-adapters` is still in the
changesets `ignore` list (#11715).

**966 changed lines:** implementation 143, tests 738 (of which the OAuth
server fixture is 320), README 18, lockfile 67.

## MCP SDK 2.1 replaces the header workaround

In SDK 2.0, a configured `Authorization` header and the provider's token
were sent joined into one value, `Bearer <provider>, Bearer
<configured>`. #11663 worked around this with `getSdkHeaderCase`. SDK
2.1.0 (modelcontextprotocol/typescript-sdk#2475) fixes it upstream by
matching the transport's own `Authorization` case-insensitively, so the
workaround is deleted rather than kept alongside.

The SDK's fix also decides which value wins, and it picks the opposite
of what #11663 did:

- once the provider has a token, that token replaces a configured
`Authorization`;
- until then, the configured header is sent.

We follow the SDK instead of patching over it. This order is also the
useful one: a static API key works until an OAuth login completes, then
the OAuth token takes over. The header tests now pin both cases.

`@modelcontextprotocol/client` and `core` now require `^2.1.0`. The
dev-only server packages move to `^2.1.0` with them.

## Token providers

`authProvider` now accepts the SDK's minimal `AuthProvider`, `{ token(),
onUnauthorized?() }`, as well as an `OAuthClientProvider`. The adapter
hands it to the transport unchanged:

- the SDK calls `token()` before each request;
- on a 401, it calls `onUnauthorized()` once, then retries.

This covers tokens the application already manages, without implementing
the whole OAuth client interface. `AuthProvider` is exported as a type.

## Authentication failures

When a provider-driven flow fails, the SDK throws `UnauthorizedError`.
That error carries no HTTP status, so the old `code === 401` check
missed it. The new `isAuthenticationError` recognizes either
`UnauthorizedError` or a 401, on the error itself or up to three levels
down its `cause` chain. The depth matters because the legacy HTTP→SSE
fallback wraps the SSE 401 twice. Both the HTTP and SSE paths now use
it.

As a result, a provider auth failure:

- gets the authentication error message;
- keeps the SDK error as `cause`;
- in legacy mode, does not fall back to SSE.

Tests pin this on both transports. `UnauthorizedError` is exported so
callers can check the cause.

## Auth failures stay retryable

Discovery used to add every server that failed to connect to
`#failedServers`, which skips that server for the rest of the adapter's
lifetime. After a 401, completing the login couldn't bring the server
back without creating a new adapter.

Now:

- auth failures stay out of `#failedServers`, so the next discovery
retries them;
- unreachable servers and a throwing `token()` still stay blocked;
- `onConnectionError` still runs for every failure.

## Docs

- The README's Authentication section covers both provider shapes, which
`Authorization` value wins, implementing `invalidateCredentials()`
(without it, a refresh the server rejects fails instead of restarting
the login), and `UnauthorizedError` as the `cause`.
- No changeset: since #11728, `main` can't carry a changeset for the
ignored adapter without blocking every release (changesets/action#541).
The release PR restores the 2.0 changeset, including this PR's notes.

## Testing

- `pnpm --filter @langchain/mcp-adapters test`: 463 passed, 2 skipped,
no type errors. oxlint and oxfmt report no issues.
- The OAuth tests run the real SDK client transport against a real
in-process authorization server (`src/tests/fixtures/oauth-server.ts`).
The SDK is not mocked. The server is built from the SDK's own
`mcpAuthRouter` and `requireBearerAuth` and supports:
  - dynamic client registration;
  - PKCE;
  - RFC 9207 `iss`, which can be sent, omitted or unsupported;
  - token refresh;
  - RFC 9728 resource metadata for both `/mcp` and `/sse`.
- A test reproduces the double-wrapped legacy HTTP→SSE fallback and
checks the server is retried. It fails when `isAuthenticationError`
checks only one `cause` level.
- In the stack's mutation run, deliberately reverting the
token-provider, auth-labeling or retry change each made its tests fail.

---------

Signed-off-by: Hunter Lovell <[email protected]>
Co-authored-by: Hunter Lovell <[email protected]>
Hunter Lovell (hntrl) pushed a commit that referenced this pull request Sep 29, 2026
…t, and reject collisions (#11759)

`MCPAdapter` now prefixes every tool with its server's name by default
(`{server}__{tool}`), even with a single server, so adding a server
never renames the tools already in use. This matches Python's
`ClientGroup`, whose one-connection-per-server design is the closest
analog to `MCPAdapter`. An explicit `prefixToolNameWithServerName` still
wins, and `loadMcpTools` keeps its default of `false`, since it wraps a
single client the caller built.

This is a breaking change from 1.x, which defaulted the option to
`false`. `listTools()` also now throws an `MCPClientError` when a tool
name appears more than once in the flattened list; before, the
duplicates were returned and `ToolNode` sent every call for that name to
whichever tool came first. With the new default this can only happen
with `prefixToolNameWithServerName: false`, and the error names the tool
and both servers.

When one server lists a name twice, prefixing can't separate them, so
the error points at that server or at picking tools from
`listToolsets()`. `listToolsets()` stays grouped by server, and
selecting the same server twice doesn't throw. The PR also restores two
1.x behaviors that 2.0 had dropped. `listResourceTemplates()` lists a
server that answers MethodNotFound (-32601) as `[]` instead of failing
every server, since templates are optional even for a server with
resources; any other error still throws. And `getTools()` is back as a
deprecated alias of `listTools()`, for the docs that still call it.
There's no changeset, because the adapter is still in the changesets
`ignore` list (#11715).
Hunter Lovell (hntrl) added a commit that referenced this pull request Oct 1, 2026
This PR releases `@langchain/mcp-adapters` 2.0.0. It removes the adapter
from the changesets `ignore` list (#11715) and restores the major
changeset that #11728 removed from `main`; both have to land together,
because changesets/action#541 blocks a release that has a changeset for
an ignored package. It also raises `@modelcontextprotocol/client` and
`@modelcontextprotocol/core` to `^2.2.0`, which fixes `listTools`
pagination and the CommonJS `.d.cts` types. The changeset is the 2.0.0
release note and covers everything now on `main`: tool errors returned
as error `ToolMessage`s (#11758); tool names prefixed with the server
name by default, duplicate names throwing, the `getTools` alias and 1.x
resource-template listing (#11759); config guards trimmed to the ones
that change behavior (#11768); `close()` stopping a discovery in
progress (#11744); plus strict config keys, `mode: "legacy"` for HTTP
`reconnect`, the `resource_link` and structured-content changes and the
probe fallback. Once this merges, the version-packages PR (#11749) picks
up the changeset and publishes 2.0.0 alongside `langchain` 1.5.15, which
elicitation under `toolRetryMiddleware` needs. The lockfile churn comes
from the SDK bump.

---------

Co-authored-by: Hunter Lovell <[email protected]>
Co-authored-by: Hunter Lovell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants