← Back to Pull requests

feat(langchain): langchain.mcp namespace, `MCPAdapter` #39922

Closed
unknown closed this pull request without merging on Aug 26, 2026 21:42 UTC
View on GitHub
unknown unknown commented on Aug 26, 2026 04:41 UTC
Author

adopts a new langchain.mcp namespace that exports MCPAdapter:
a thin wrapper over a FastMCP client that will yield a list of langchain compatible tools for an mcp connection through .get_tools()
these tools will be able to handle elicitation through interrupt semantics (now possible since mcp is stateless!)
intended as a spiritual successor to (langchain-mcp-adapters)
also is an alt implementation to what we're thinking of doing in #39887

async with MCPAdapter(client) as mcp:
    agent = create_agent(
        tools=[*await mcp.get_tools()]
    )

there is a long tail of things that we're intending to support within langchain.mcp -- for right now i'm just hoping to get good understanding on mcp connection handling + lifecycle, and will stack PRs as iterative improvements on top. To name a few still to do:
broader error normalization
content conversion to langchain standard types (notably NOT resources/prompts, moreso has to do with tool I/O)
server metadata and instructions
how we handle multiple server instances (a big benefit of MultiServerMCPClient atm, working with FastMCP to ideate here)
resources and prompts

things we know we're deferring

  • experimental facets like mcp apps, mcp task execution
  • Diff: 162 lines (+121 / -41) across 2 files Reviewer: eyurtsev Review duration: 1020m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.35) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 162 lines diff across 2 files
    0.35
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.305
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #39922"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 34.9% (LOW) · Higher = larger blast radius
    34.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.1% · Safe to merge
    15.1%