langchain-mcp-tools-ts-usage
Categories
Language:
TypeScript
Stars:
12
Forks:
2
Simple MCP Client Using LangChain / 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-sonnet-latest is used as the LLM.
For convenience, code for OpenAI's gpt-4o is 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.envto prevent accidental commits of the credentials.
- Update
-
Run the app:
npm start
Publisher info
More MCP servers built with TypeScript
Build modern, production-ready UI blocks, components, and landing pages in minutes.
A comprehensive and efficient MCP server for task management with multi-format support (Markdown, JSON, YAML)
Turn YouTube, TikTok, X videos and websites into structured data. Skip the hassle of video transcription and data scraping. Our APIs help you build better software and AI products faster.