MCP.so
Sign In

MCP Tools Usage From LangChain / Example in TypeScript

@hideya

About MCP Tools Usage From LangChain / Example in TypeScript

MCP Tools Usage From LangChain ReAct Agent / Example in TypeScript

Overview

What is MCP Tools Usage From LangChain / Example in TypeScript?

This is a command-line Model Context Protocol (MCP) client built with TypeScript that demonstrates how to use MCP server tools via LangChain’s ReAct Agent. It runs on Node.js 16+ and is intended for developers integrating MCP with LangChain.

How to use MCP Tools Usage From LangChain / Example in TypeScript?

Clone the repository, install dependencies with npm install, copy .env.template to .env and add your Anthropic (or OpenAI) API key, then run npm start. Optionally install uv to support Python-based MCP servers.

Key features of MCP Tools Usage From LangChain / Example in TypeScript

  • Demonstrates MCP tool usage with LangChain ReAct Agent
  • Parallel initialization of multiple MCP servers
  • Converts MCP tools to LangChain‑compatible StructuredTool[]
  • Uses Anthropic Claude 3.5 Sonnet by default
  • Includes commented‑out support for OpenAI GPT‑4o
  • Provides sample OAuth authentication for SSE connections

Use cases of MCP Tools Usage From LangChain / Example in TypeScript

  • Learn how to integrate MCP servers into LangChain‑based agents
  • Prototype and test combinations of MCP tools in a TypeScript environment
  • Explore OAuth authentication for MCP servers over SSE
  • Serve as a foundation for building production MCP clients using LangChain

FAQ from MCP Tools Usage From LangChain / Example in TypeScript

What LLMs does it support?

It uses Anthropic’s claude-3-5-sonnet-latest by default. Code for OpenAI’s gpt-4o is included but commented out.

How do I add my own MCP servers?

You modify the server configuration in the source code; the convertMcpToLangchainTools utility handles parallel initialization and tool conversion.

Does it support Python‑based MCP servers?

Yes, if you have uv (or uvx) installed, you can run Python‑based MCP servers alongside Node‑based ones.

What license is it under?

This project is released under the MIT License.

Do I need a paid API key to run it?

Yes, you need an API key from either Anthropic or OpenAI. Usage of those APIs may incur costs depending on your plan.

Comments

More Agent Frameworks MCP clients