mcp-langchain-ts-client

MCP.Pizza Chef: isaacwasserman

mcp-langchain-ts-client is a TypeScript client library that integrates LangChain.js with the Model Context Protocol (MCP). It enables developers to easily connect LangChain-based applications to MCP servers, facilitating real-time context sharing and tool orchestration. This client is a port of the original rectalogic/langchain-mcp to JavaScript/TypeScript, supporting modern MCP APIs and workflows. It simplifies initializing MCP toolkits, extracting LangChain-compatible tools, and building advanced AI agents with frameworks like LangGraph and LLMs such as Anthropic's Claude. Ideal for developers building AI copilots, agents, and workflows that require dynamic context and multi-tool interaction.

Use This MCP client To

Integrate LangChain.js apps with MCP servers for context sharing Build AI agents using LangChain tools and MCP context Orchestrate multi-tool workflows in TypeScript environments Create real-time context-aware AI copilots Use MCP tools with LangGraph React agents Connect Anthropic Claude LLMs with MCP toolkits

README

mcp-langchain-ts-client

A LangChain.js client for Model Context Protocol.

This is a port of rectalogic/langchain-mcp to the JS/TS LangChain and MCP APIs.

Installation

npm install mcp-langchain-ts-client

Usage

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 });

mcp-langchain-ts-client FAQ

How do I install mcp-langchain-ts-client?
Install it via npm using `npm install mcp-langchain-ts-client`.
Can I use mcp-langchain-ts-client with TypeScript?
Yes, it is designed as a TypeScript client for LangChain.js and MCP integration.
How do I initialize the MCP toolkit in this client?
You create an MCPToolkit instance with server parameters and call `initialize()` to set up the client.
Does mcp-langchain-ts-client support multiple LLM providers?
Yes, it works with LLMs like Anthropic Claude, OpenAI GPT, and others compatible with LangChain.
Can I extract LangChain-compatible tools from the MCP toolkit?
Yes, the client provides a `tools` property to access LangChain.js compatible tools.
Is this client compatible with React-based LangGraph agents?
Yes, you can use the extracted tools with React agents created via LangGraph.
Where can I find the source code for mcp-langchain-ts-client?
The source is available on GitHub at https://github.com/rectalogic/langchain-mcp (JS/TS port).
What MCP server does this client connect to?
It connects to any MCP server, commonly started with `@modelcontextprotocol/server-everything`.