About mcp-langchain-ts-client
mcp-langchain-ts-client is a LangChain.js client for Model Context Protocol, ported from rectalogic/langchain-mcp to the JS/TS LangChain and MCP APIs. It suits developers who want to connect MCP servers from TypeScript projects.
Key features
- 01LangChain.js-based MCP client
- 02Ported from rectalogic/langchain-mcp
- 03Installable via npm
- 04Server launch configuration using npx
Use cases
- 01Calling MCP server tools from TypeScript applications
- 02Connecting MCP servers within LangChain.js workflows
MCP support
The project acts as an MCP client, launching and connecting to MCP servers through command and args parameters, such as @modelcontextprotocol/server-everything.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEmcp-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 });
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.