This repository provides a TypeScript-based Model Context Protocol (MCP) client that integrates with LangChain ReAct Agent, enabling interaction with LLMs like Anthropic, OpenAI, and Groq through MCP servers.
This project is a Model Context Protocol (MCP) client demonstrating the use of MCP server tools with a LangChain ReAct Agent. It utilizes the convertMcpToLangchainTools()
function from the @h1deya/langchain-mcp-tools
package, which initializes multiple MCP servers in parallel and converts their tools into LangChain-compatible StructuredTool[]
.
The client supports LLMs from Anthropic, OpenAI, and Groq. A Python version is also available.
Setup:
npm install
..env
(copied from .env.template
).llm_mcp_config.json5
. This file uses a similar structure to Claude for Desktop, but with mcp_servers
instead of mcpServers
. It supports JSON5 format and environment variable substitution using ${...}
.Usage:
Run the app with npm start
. Use npm run start:v
for verbose mode or npm run start:h
to see command-line options. Example queries, configurable in llm_mcp_config.json5
, can be executed by pressing Enter at the prompt.
hideya/mcp-client-langchain-ts
December 31, 2024
March 28, 2025
TypeScript