feat(mcp-adapters): preserve tool fidelity and isolate connection catalogs - #11612
Open
Baihao Wang (byhow) wants to merge 54 commits into
Open
Baihao Wang (byhow) wants to merge 54 commits into
Baihao Wang (byhow) wants to merge 54 commits into
Conversation
🦋 Changeset detectedLatest commit: 0d51db7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
# Conflicts: # libs/langchain-mcp-adapters/src/tools.ts
# Conflicts: # libs/langchain-mcp-adapters/README.md # libs/langchain-mcp-adapters/docs/sdk-v2-migration.md # libs/langchain-mcp-adapters/src/tools.ts
# Conflicts: # libs/langchain-mcp-adapters/src/tools.ts
Inherit schema and error fixes from #11605 without duplicating their implementation. Keep discovery and content behavior intact and scope release notes to their owning PR.
| import type { ToolHooks } from "./hooks.js"; | ||
| import type { Client } from "./connection.js"; | ||
| import { getDebugLog } from "./logging.js"; | ||
| import debug from "debug"; |
There was a problem hiding this comment.
do we need debug logging?
Author
There was a problem hiding this comment.
this is for parity but can remove / removed
| "@langchain/openai": "workspace:*", | ||
| "@langchain/tsconfig": "workspace:*", | ||
| "@modelcontextprotocol/node": "^2.0.0", | ||
| "@modelcontextprotocol/sdk": "^1.30.0", |
Author
There was a problem hiding this comment.
integration test on regression and can remove if a bit too much
Author
There was a problem hiding this comment.
this is only for dev dep
| 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 |
There was a problem hiding this comment.
docs should live in langchain-ai/docs I imagine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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; retaininitializeConnections()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?
@modelcontextprotocol/sdk ^1.30.0is 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.