The mcp-langchain-ts-client repository provides a LangChain.js client for the Model Context Protocol, porting the original Python implementation to JavaScript/TypeScript, enabling the use of MCP tools within LangChain.js applications.
A LangChain.js client designed for seamless integration with the Model Context Protocol (MCP).
This project is a JavaScript/TypeScript adaptation of the original rectalogic/langchain-mcp, aligning it with the LangChain.js and MCP APIs. It enables developers to leverage the power of MCP within their LangChain.js applications.
npm install mcp-langchain-ts-client
const serverParams = {
command: "npx",
args: [
"-y",
"@modelcontextprotocol/server-everything"
]
}
// Initialize the toolkit
const toolkit = new MCPToolkit(serverParams);
await toolkit.initialize();
// Extract LangChain.js compatible tools
const tools = toolkit.tools;
// Use the tools
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { ChatAnthropic } from "@langchain/anthropic";
const llm = new ChatAnthropic({ model: 'claude-3-5-sonnet-20241022' });
const agent = createReactAgent({ llm, tools });
isaacwasserman/mcp-langchain-ts-client
December 16, 2024
March 26, 2025
TypeScript