Get the FREE Ultimate OpenClaw Setup Guide →

langchainjs -adapters

** THIS REPO HAS MOVED TO https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-mcp-adapters ** Adapters for integrating Model Context Protocol (MCP) tools with LangChain.js applications, supporting both stdio and SSE transports.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio langchain-ai-langchainjs-mcp-adapters node path/to/server.js \
  --env LANGCHAIN_MCP_ADAPTERS_CONFIG="default"

How to use

LangChain.js MCP Adapters provide a lightweight bridge that allows MCP (Model Context Protocol) services to be consumed by LangChain.js workflows. With these adapters, you can expose external model contexts as native LangChain.js tools, enabling you to integrate diverse MCP-based services into your prompt workflows, agents, or memory layers. The adapters handle translation between MCP requests and LangChain.js compatible interactions, so you can leverage MCP endpoints as if they were part of your LangChain.js environment. This is especially useful when you want to plug in external reasoning or tooling services that adhere to MCP without rewriting your existing LangChain.js code.

To use the adapters, install the package in your project and instantiate the MCP client via the provided interface. From there, you can query or invoke MCP services, exchange context, and route results back into your LangChain.js pipelines just like you would with any other LangChain.js tool or chain.

How to install

Prerequisites:\n- Node.js (preferred) or a compatible runtime for your environment.\n- npm or pnpm to install dependencies.\n\nStep-by-step installation:\n1) Initialize your project (if you haven’t already):\nbash\nmkdir my-langchain-app && cd my-langchain-app\nnpm init -y\n\n2) Install the MCP Adapters package:\nbash\nnpm install @langchain/mcp-adapters\n\n3) Verify installation by listing node_modules or running a quick script that imports the adapter.\n4) Integrate into your LangChain.js workflow by configuring the MCP adapter as described in your project’s docs.\n

Additional notes

Notes:\n- This MCP adapters package has been migrated to the LangChainJS monorepo. Check the up-to-date repository for the latest usage patterns and integration guidelines.\n- If you upgrade, ensure your code references the new monorepo paths or import surfaces as required by the current release.\n- Environment variables in the mcp_config can be used to customize endpoints, timeouts, and authentication as supported by the adapter.\n- Some MCP endpoints may require network access or credentials; ensure those are provisioned in your deployment environment.

Related MCP Servers

Sponsor this space

Reach thousands of developers