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-haiku-latest
is used as the LLM.
For convenience, code for OpenAI's gpt-4o-mini
is also included and commented out.
-
Install dependencies:
npm install
-
Setup API key:
cp .env.template .env
- Update
.env
as needed. .gitignore
is configured to ignore.env
to prevent accidental commits of the credentials.
- Update
-
Run the app:
npm start