Skip to content

feat(mcp-adapters): preserve tool fidelity and isolate connection catalogs - #11612

Open
Baihao Wang (byhow) wants to merge 54 commits into
codex/mcp-api-schemafrom
codex/mcp-fidelity
Open

Baihao Wang (byhow) wants to merge 54 commits into
codex/mcp-api-schemafrom
codex/mcp-fidelity

Conversation

@byhow

@byhow Baihao Wang (byhow) commented Sep 11, 2026

Copy link
Copy Markdown

What changes?

Preserve structured output, resource provenance, and protocol metadata in tool artifacts. Native ToolMessage, Command, and graph-interrupt behavior survive hooks and conversion. Resource links are not fetched implicitly.

Add listToolsets() for executable tools grouped by server; retain initializeConnections() as a deprecated wrapper. listTools([], { cacheMode: "use" | "refresh" | "bypass" }) delegates freshness and pagination to the SDK. Unchanged descriptors reuse adapted tools, and previously returned tools remain unchanged.

Isolate connections and catalogs by effective headers and OAuth provider identity. Deduplicate concurrent connections, release connections after failed setup, and attempt every close during shutdown. Remove tool-level debug logging while preserving errors and MCP server logging APIs.

Keep runnable examples with the package. Detailed discovery, reference, and migration material belongs in langchain-ai/docs; remove the package guides and leave the README unchanged from #11605.

How was it tested?

  • 314 tests passed, with two existing skips, including real SDK 1.30 stdio alongside SDK 2 HTTP/SSE servers, artifacts, graph controls, connection isolation, cache behavior, and lifecycle races.
  • Source, examples, and modified test files typechecked.
  • ESM/CommonJS builds, attw, publint, lint, formatting, and whitespace checks passed.

@modelcontextprotocol/sdk ^1.30.0 is a development dependency used only by the legacy server fixture. This verifies compatibility with an actual SDK 1 server implementation; the shipped adapter uses the SDK 2 client/core packages.

Scope

Stacked on #11605, which owns configuration schemas, tool argument validation, standard content defaults, and branded errors. Protocol negotiation and server interactions follow in #11614; invocation and checkpointed elicitation follow in #11642#11645. OAuth workflow enhancements are outside this stack. No CI changes.

@changeset-bot

changeset-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0d51db7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@langchain/mcp-adapters Major

Not sure what this means? Click here to learn what changesets are.

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

Baihao Wang (byhow) added a commit that referenced this pull request Sep 14, 2026
Selectively backport the schema-preservation and error-boundary fixes from the fidelity branch so PR #11605 addresses its own review without depending on #11612. Keep discovery, caching and content-fidelity changes in the latter.

Source commits: 4ae23b6, 6e84405, b921bb4, d83b6bf.
import type { ToolHooks } from "./hooks.js";
import type { Client } from "./connection.js";
import { getDebugLog } from "./logging.js";
import debug from "debug";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need debug logging?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

this is for parity but can remove / removed

"@langchain/openai": "workspace:*",
"@langchain/tsconfig": "workspace:*",
"@modelcontextprotocol/node": "^2.0.0",
"@modelcontextprotocol/sdk": "^1.30.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

integration test on regression and can remove if a bit too much

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

this is only for dev dep

Comment thread libs/langchain-mcp-adapters/README.md Outdated
and invocation open connections as needed. Use `listTools("serverName")` to
select tools and always await `close()` when finished.

Use `listToolsets()` for a map of server names to tools. Both discovery methods

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

docs should live in langchain-ai/docs I imagine

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants