MCPAdapter, which discovers a server’s tools and adapts them into LangChain tools you can pass straight to create_agent.
MCPAdapter is built on FastMCP, which handles transport inference, protocol negotiation, connection management, and authentication. This section covers the LangChain-specific layer and links out to the FastMCP client documentation for the connection details underneath.
The
langchain.mcp namespace requires langchain[mcp]>=1.4.0 and is in beta. Importing from it raises a LangChainBetaWarning once per process. The API may change.If you used MCP before v1.4.0, see Migrate from langchain-mcp-adapters.Install
Install LangChain with themcp extra, which pulls in FastMCP:
Quickstart
Open anMCPAdapter, discover the server’s tools with list_tools(), and build the agent inside the context. The tools hold the client, so the agent stays usable after the context exits:
Example: Query LangChain docs
Example: Query LangChain docs
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.
Transports
MCPAdapter infers the transport from the target you hand it, so the only thing that changes between an in-process server, a local script over stdio, and a remote URL is the target itself:
- An
http/httpsURL (str): reached over streamable HTTP. - A script path (
Path): launched as a subprocess over stdio. - A transport object (
StreamableTransport): a pre-configured transport object. See Client Transports. - An in-process
FastMCPserver: connected in-memory, with no subprocess or socket. - An
MCPConfigdict ({"mcpServers": {...}}): several servers behind one adapter. See Connections. - A prebuilt
fastmcp.Client: for full control over transport, caching, and protocol negotiation.
Next steps
Connections
Connection lifecycle, multiple servers, protocol eras, and caching.
Authentication
Bearer tokens, OAuth 2.1, and per-user server auth.
Tools
Load MCP tools into agents, control their execution, and handle their outputs.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

