- Explore MCP Servers
- langchain-mcp-tools-ts-usage
Langchain Mcp Tools Ts Usage
What is Langchain Mcp Tools Ts Usage
langchain-mcp-tools-ts-usage is a simple implementation of a Model Context Protocol (MCP) client using LangChain and TypeScript. It demonstrates how to utilize MCP server tools through the LangChain ReAct Agent.
Use cases
Use cases include building conversational agents, integrating multiple AI tools for enhanced functionality, and developing applications that require real-time interaction with various MCP servers.
How to use
To use langchain-mcp-tools-ts-usage, install the dependencies using ‘npm install’, set up your API key by copying the .env.template to .env and updating it, then run the application with ‘npm start’.
Key features
Key features include the ability to initialize multiple MCP servers in parallel, convert their tools into LangChain-compatible tools, and support for both Anthropic’s Claude and OpenAI’s GPT models.
Where to use
langchain-mcp-tools-ts-usage can be used in fields such as AI development, natural language processing, and any application requiring integration with MCP servers for enhanced conversational capabilities.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Langchain Mcp Tools Ts Usage
langchain-mcp-tools-ts-usage is a simple implementation of a Model Context Protocol (MCP) client using LangChain and TypeScript. It demonstrates how to utilize MCP server tools through the LangChain ReAct Agent.
Use cases
Use cases include building conversational agents, integrating multiple AI tools for enhanced functionality, and developing applications that require real-time interaction with various MCP servers.
How to use
To use langchain-mcp-tools-ts-usage, install the dependencies using ‘npm install’, set up your API key by copying the .env.template to .env and updating it, then run the application with ‘npm start’.
Key features
Key features include the ability to initialize multiple MCP servers in parallel, convert their tools into LangChain-compatible tools, and support for both Anthropic’s Claude and OpenAI’s GPT models.
Where to use
langchain-mcp-tools-ts-usage can be used in fields such as AI development, natural language processing, and any application requiring integration with MCP servers for enhanced conversational capabilities.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP Tools Usage From LangChain / Example in TypeScript 
This simple Model Context Protocol (MCP)
client demonstrates the use of MCP server tools by LangChain ReAct Agent.
It leverages a utility function convertMcpToLangchainTools() from
@h1deya/langchain-mcp-tools.
This function handles parallel initialization of specified multiple MCP servers
and converts their available tools into an array of LangChain-compatible tools
(StructuredTool[]).
Anthropic’s claude-3-5-haiku-latest is used as the LLM.
For convenience, code for OpenAI’s and Google’s LLMs are also included and commented out.
A bit more realistic (conversational) MCP Client is available
here
A python equivalent of this app is available
here
Prerequisites
- Node.js 16+
- npm 7+ (
npx) to run Node.js-based MCP servers - [optional]
uv(uvx)
installed to run Python-based MCP servers - API key from Anthropic
(or OpenAI)
Usage
-
Install dependencies:
npm install -
Setup API key:
cp .env.template .env- Update
.envas needed. .gitignoreis configured to ignore.env
to prevent accidental commits of the credentials.
- Update
-
Run the app:
npm start
Sample Code for Streamable HTTP Authentiocation
A simple example of showing how to implement an OAuth client provider and
use it with the langchain-mcp-tools library can be found
in src/streamable-http-auth-test-client.ts.
For testing purposes, a sample MCP server with OAuth authentication support
that works with the above client is provided
in src/streamable-http-auth-test-server.ts.
You can run the server with npm run test:streamable:server
and the client with npm run test:streamable:client.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










