LangChain MCP Tools

v1.0.0Coding Agentsstable

MCP Tools Usage From LangChain ReAct Agent / Example in TypeScript

langchainlangchain-typescriptmcpmcp-clientmodelcontextprotocol
Share:
12
Stars
0
Downloads
0
Weekly
0/5

What is LangChain MCP Tools?

LangChain MCP Tools is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp tools usage from langchain react agent / example in typescript

MCP Tools Usage From LangChain ReAct Agent / Example in TypeScript

This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • MCP Tools Usage From LangChain ReAct Agent / Example in Type

Use Cases

Use MCP tools with LangChain ReAct agents in TypeScript.
Build AI agents with tool-calling capabilities.
hideya

Maintainer

LicenseMIT
Languagetypescript
Versionv1.0.0
UpdatedMar 31, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx langchain-mcp-tools-ts-usage

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use LangChain MCP Tools

LangChain MCP Tools is a TypeScript example project that demonstrates how to use MCP server tools from within a LangChain ReAct agent. It uses the convertMcpToLangchainTools() utility to initialize multiple MCP servers in parallel and convert their exposed tools into LangChain StructuredTool objects that a ReAct agent can call. Developers building AI agents in TypeScript who want to combine LangChain's reasoning capabilities with the rich MCP tool ecosystem can use this as a working reference implementation.

Prerequisites

  • Node.js 18 or higher and npm 8 or higher installed
  • An OpenAI API key (the default LLM is gpt-4.5-mini) or another supported provider key
  • Optionally uv or uvx for running Python-based MCP servers
  • The MCP servers you want to integrate must be installed and accessible
  • Basic familiarity with LangChain and the ReAct agent pattern
1

Clone the repository

Clone the langchain-mcp-tools-ts-usage repository to your local machine.

git clone https://github.com/hideya/langchain-mcp-tools-ts-usage.git
cd langchain-mcp-tools-ts-usage
2

Install dependencies

Install the npm packages required by the project including LangChain, the MCP tools adapter, and provider SDKs.

npm install
3

Create and configure the .env file

Copy the provided template and add your LLM provider API key. The default setup uses OpenAI, but Anthropic, Google GenAI, and xAI are also supported.

cp .env.template .env
# Then edit .env and set:
# OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx
4

Review and customize the MCP server configuration

Edit the MCP server definitions in the configuration to point to the servers you want the ReAct agent to use. Each server entry specifies the command, args, and any required environment variables.

5

Run the example agent

Start the application. The ReAct agent will initialize the configured MCP servers, convert their tools, and begin accepting task requests.

npm start

LangChain MCP Tools Examples

Client configuration

This project is itself an MCP client. The following shows how to configure it as an MCP server entry if you want to expose it through another client.

{
  "mcpServers": {
    "langchain-react-agent": {
      "command": "node",
      "args": ["/path/to/langchain-mcp-tools-ts-usage/dist/index.js"],
      "env": {
        "OPENAI_API_KEY": "sk-xxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

Prompts to try

Example tasks you can give to the LangChain ReAct agent once it is running with MCP tools connected.

- "Search the web for recent TypeScript MCP server releases and summarize the top results."
- "Read the file README.md from the filesystem MCP server and list its main sections."
- "Use the available tools to answer: what is the current Node.js LTS version?"
- "Combine results from multiple tools to compile a report on MCP adoption trends."

Troubleshooting LangChain MCP Tools

ReAct agent fails with tool schema validation errors

The convertMcpToLangchainTools() utility applies provider-specific schema transformations. If you switch LLM providers, update the provider configuration in the source so the correct transformation is applied for that model's tool-calling format.

MCP server fails to initialize during startup

Check that the command and args for each MCP server in your configuration are correct and that the server binary or script is accessible. Run the server command manually in a terminal to see startup errors directly.

OPENAI_API_KEY not found or authentication rejected

Ensure the .env file exists in the project root and contains a valid OPENAI_API_KEY value. The dotenv package loads this file at startup; if you renamed it or placed it elsewhere, the key will not be found.

Frequently Asked Questions about LangChain MCP Tools

What is LangChain MCP Tools?

LangChain MCP Tools is a Model Context Protocol (MCP) server that mcp tools usage from langchain react agent / example in typescript It connects AI assistants to external tools and data sources through a standardized interface.

How do I install LangChain MCP Tools?

Follow the installation instructions on the LangChain MCP Tools GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with LangChain MCP Tools?

LangChain MCP Tools works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is LangChain MCP Tools free to use?

Yes, LangChain MCP Tools is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Coding Agents MCP Servers

Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "langchain-mcp-tools-ts-usage": { "command": "npx", "args": ["-y", "langchain-mcp-tools-ts-usage"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use LangChain MCP Tools?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides