Skip to content

a simple MCP client implementation using LangChain / TypeScript

License

Notifications You must be signed in to change notification settings

hideya/langchain-mcp-tools-ts-usage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple MCP Client Using LangChain / TypeScript License: MIT

This simple Model Context Protocol (MCP) client demonstrates MCP server invocations 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 a list of LangChain-compatible tools.

Anthropic's claude-3-5-haiku-latest is used as the LLM.
For convenience, code for OpenAI's gpt-4o-mini is also included and commented out.

Requirements

Usage

  1. Install dependencies:

    npm install
  2. Setup API key:

    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:

    npm start