# langchain-mcp-tools-ts-usage

> MCP Client

This repository showcases a simple Model Context Protocol (MCP) client using LangChain and TypeScript, demonstrating how to convert MCP server tools into LangChain-compatible tools for use with LLMs like Anthropic's Claude.

## Overview

- **Category:** AI
- **Language:** TypeScript
- **Stars:** 12
- **Forks:** 2
- **Owner:** hideya
- **GitHub:** https://github.com/hideya/langchain-mcp-tools-ts-usage
- **Created:** 2025-01-06T05:44:45+00:00
- **Updated:** 2025-03-28T22:25:26+00:00
- **Source:** https://model-context-protocol.com/clients/langchain-typescript-mcp-client-example

## Setup

## Setup

1.  Install dependencies:

    ```bash
    npm install
    ```

2.  Setup API key:
    ```bash
    cp .env.template .env
    ```
    - Update `.env` as needed.
    - `.gitignore` is configured to ignore `.env`
      to prevent accidental commits of the credentials.

3.  Run the app:
    ```bash
    npm start
    ```

## Tools

## Available Tools

1.  `convertMcpToLangchainTools()` (Handles parallel initialization of specified multiple MCP servers and converts their available tools into an array of LangChain-compatible tools).
2.  LangChain ReAct Agent (Demonstrates the use of MCP server tools).
3.  Anthropic's `claude-3-5-sonnet-latest` (Used as the LLM).
4.  OpenAI's `gpt-4o` (Code is included and commented out for potential use).
