mcp-client-langchain-ts

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.

10
0

MCP Client Using LangChain / TypeScript

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:

  1. Install dependencies using npm install.
  2. Configure API keys in .env (copied from .env.template).
  3. Customize LLM and MCP server settings in 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.

Repository

HI
hideya

hideya/mcp-client-langchain-ts

Created

December 31, 2024

Updated

March 28, 2025

Language

TypeScript

Category

AI