# LangChain 1.4.0a2 - Product: LangChain (https://whatsnew.fyi/product/langchain) - Vendor: LangChain - Date: 2026-08-28 - Version: 1.4.0a2 - Original notes: https://github.com/langchain-ai/langchain/releases/tag/langchain%3D%3D1.4.0a2 - Permalink: https://whatsnew.fyi/product/langchain/releases/1.4.0a2 - Labels: Pre-release What's New is an index, not a publisher: every entry below links to the vendor's own release notes, which are the authoritative source. Entries are labelled where they are hand-curated sample data, pre-releases, or drawn from a secondary source such as a developer blog. Reuse: the summaries, labels and curation here are © What's New. Quote freely with attribution and a link back; wholesale republication of the corpus is not permitted — terms: https://whatsnew.fyi/terms. The vendors' own release notes remain their publishers'. --- - **added** — Add langchain.mcp module, a first-party adapter that turns any MCP server into LangChain tools compatible with create_agent - **added** — Add MCPAdapter class that accepts any target fastmcp.Client supports, with transport automatically inferred - **added** — Add support for multiple MCP servers through a single config, with tools namespaced by server name to prevent collisions - **added** — Add support for both legacy MCP handshake-era and modern server/discover protocol servers, with automatic protocol negotiation - **added** — Add optional response caching via fastmcp.Client cache parameter, honoring server's ttlMs and cacheScope hints - **added** — Add support for authentication including OAuth flow, bearer tokens, and custom httpx.Auth instances - **added** — Add MCPToolArtifact for accessing structured output on tool messages - **added** — Add adapter.client property to access the underlying fastmcp.Client for prompts, resources, and other adapter-unwrapped functionality Alpha preview of `langchain.mcp` — a first-party adapter that turns any MCP server into LangChain tools you can hand straight to `create_agent`. Connection handling is [FastMCP](https://gofastmcp.com/clients/client)'s, so its client features are available as-is rather than re-implemented behind a narrower interface. ```bash pip install "langchain[mcp]==1.4.0a2" ``` ##### Connect `MCPAdapter` takes any target `fastmcp.Client` accepts — transport is inferred, so there is one entry point rather than one per protocol. ```python from langchain.agents import create_agent from langchain.mcp import MCPAdapter async with MCPAdapter("https://example.com/mcp") as adapter: agent = create_agent("anthropic:claude-sonnet-5", await adapter.get_tools()) result = await agent.ainvoke({"messages": [{"role": "user", "content": "..."}]}) ``` Valid targets: a URL, a local script path (launched over stdio), an in-process `FastMCP` server, a config naming several servers at once, or a `fastmcp.Client` you built yourself. Tools returned by `get_tools()` hold the adapter's client, so they stay callable after the context exits — the `async with` block scopes discovery, not tool lifetime. ##### Auth, caching, timeouts — build the client `MCPAdapter` takes two arguments: the target and `elicitation`. Everything else FastMCP supports is configured on a `fastmcp.Client` that you build and hand over as the target. This is the pattern to reach for whenever you need more than a bare connection: ```python from fastmcp.client import Client from langchain.mcp import MCPAdapter client = Client( "https://example.com/mcp", auth="oauth", # or a bearer token string, or any httpx auth cache=True, # opt-in response caching timeout=30, ) async with MCPAdapter(client) as adapter: tools = await adapter.get_tools() ``` **Auth** accepts `"oauth"` to run the OAuth flow, a token string for bearer auth, or an `httpx.Auth` instance for anything custom — see [FastMCP's auth docs](https://gofastmcp.com/clients/auth). Per-server headers and auth can also be set in a multi-server config (below). **Caching** is opt-in and off by default: `cache=True` enables it with defaults, honoring the server's own `ttlMs` and `cacheScope` hints; a `CacheConfig` customizes it. The cache is per-client and in-memory. **Everything else** on [`fastmcp.Client`](https://gofastmcp.com/clients/client) — `timeout`, `log_handler`, `progress_handler`, `message_handler`, `roots`, `sampling_handler` — works the same way. The adapter passes your client through untouched, so FastMCP behavior is not re-implemented or restricted. One caveat: with `elicitation="interrupt"`, the adapter clones your client so it does not overwrite a callback you set. Configuration (auth, cache settings, handlers) carries over to the clone; cached *entries* do not, since the clone gets its own store. `adapter.client` exposes the underlying client for prompts, resources, and anything else the adapter does not wrap. ##### Multiple servers Point the adapter at a config and it fans out to every server through one connection, presenting a single tool list to your agent. ```python config = { "mcpServers": { "weather": {"url": "https://weather.example.com/mcp"}, "calendar": { "url": "https://calendar.example.com/mcp", "headers": {"Authorization": "Bearer ..."}, }, } } async with MCPAdapter(config) as adapter: agent = create_agent("anthropic:claude-sonnet-5", await adapter.get_tools()) ``` With more than one server, tools are namespaced by server name — `weather_get_forecast`, `calendar_create_event` — so collisions between servers are impossible. With exactly one server, the adapter connects directly and names are unprefixed. Each entry takes its own `headers`, `auth`, `transport`, and `timeout`, so servers with different credentials compose in one agent. A local server uses `command`/`args` instead of `url` and is laun _[Truncated at 4000 characters — full notes: https://github.com/langchain-ai/langchain/releases/tag/langchain%3D%3D1.4.0a2]_