MCPAdapter, which discovers a server’s tools and adapts them into LangChain tools you can pass straight to createAgent.
This guide requires
@langchain/mcp-adapters 2.0 or later. If you use 1.x, see the 1.x docs or the migration guide.Install
Install the@langchain/mcp-adapters package and its peer dependencies:
@modelcontextprotocol/client too if you import SDK types or transports.
Quickstart
Connect an agent to the LangChain docs MCP server to search the documentation. This example requireslangchain, @langchain/anthropic, and an Anthropic API key. See the LangChain quickstart for setup.
Keep the adapter open while the agent runs, then close it in finally:
LangChain docs MCP server
LangChain docs MCP server
The LangChain docs MCP server is a public HTTP endpoint at The server exposes these tools:
https://docs.langchain.com/mcp.Connect an agent to it to search and read documentation without writing custom tools:The docs MCP server is public and does not require an API key. For IDE and coding-agent setup (Claude Code, Cursor, and others), see Use docs programmatically.
MCPAdapter exposes these tools with the server-name prefix, for example docs__search_docs_by_lang_chain.Transports
MCPAdapter accepts a map of named server definitions. It selects the transport from each definition, so one adapter can connect to local stdio servers and remote HTTP servers at the same time:
- stdio: Provide
commandandargs. The adapter starts the command as a child process and communicates over standard input and output. - Streamable HTTP: Provide
url. This is the default transport for URL-based servers, sotransport: "http"is optional. - SSE: Provide
urland settransport: "sse". Use this transport only for legacy servers that expose an SSE endpoint.
mode setting controls which MCP protocol era the client accepts. See Protocol eras.
For new remote servers, omit both
transport and mode. The adapter uses Streamable HTTP with automatic protocol negotiation. Specify these settings only when connecting to a server with known legacy requirements.Next steps
Tools
Load MCP tools into agents, control their execution, and handle their outputs.
Connections
Connection lifecycle, multiple servers, protocol eras, and caching.
Authentication
Bearer tokens, OAuth 2.1, and per-user server auth.
Connect these docs to your agent of choice via MCP for real-time answers.

