LangChain MCP Tools

v1.0.0โ€ขAPIsโ€ขstable

MCP to LangChain Tools Conversion Utility / TypeScript

langchainlangchain-typescriptmcpmcp-clientmodelcontextprotocol
Share:
23
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 to langchain tools conversion utility / typescript

MCP to LangChain Tools Conversion Utility / TypeScript

This server falls under the APIs and Developer Tools categories on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • MCP to LangChain Tools Conversion Utility / TypeScript

Use Cases

Convert MCP tools to LangChain tools for seamless agent integration.
Enable tool calling and function invocation in LangChain applications.
hideya

Maintainer

LicenseMIT
Languagetypescript
Versionv1.0.0
UpdatedMar 31, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx langchain-mcp-tools-ts

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-ts (published as @h1deya/langchain-mcp-tools) is a TypeScript utility library that converts MCP server tools into LangChain-compatible tool objects, enabling LangChain agents to call any MCP server's capabilities as native tools. It handles parallel initialization of multiple MCP servers, performs provider-specific schema transformations to prevent compatibility issues with OpenAI, Google Gemini, Anthropic, and xAI, and exposes a simple cleanup lifecycle for resource management. Developers building LangChain agents who want to leverage the growing ecosystem of MCP servers can drop this utility in without writing manual adapter code.

Prerequisites

  • Node.js 18+ with npm or yarn
  • TypeScript project with LangChain (@langchain/core and relevant LLM provider packages) installed
  • One or more MCP servers to integrate (local or remote)
  • API keys for your chosen LLM provider (e.g., ANTHROPIC_API_KEY, OPENAI_API_KEY)
1

Install the package

Add the langchain-mcp-tools package to your TypeScript project.

npm i @h1deya/langchain-mcp-tools
2

Define your MCP server configurations

Create a configuration object for the MCP servers you want to use. The format matches Claude for Desktop's MCP server configuration.

const mcpServers = {
  filesystem: {
    command: "npx",
    args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
  },
  fetch: {
    command: "uvx",
    args: ["mcp-server-fetch"]
  }
};
3

Convert MCP tools to LangChain tools

Call convertMcpToLangchainTools with your server configs and optionally specify the LLM provider for schema compatibility transformations.

import { convertMcpToLangchainTools } from "@h1deya/langchain-mcp-tools";

const { tools, cleanup } = await convertMcpToLangchainTools(
  mcpServers,
  { llmProvider: "anthropic" }
);
4

Create a LangChain agent with the converted tools

Pass the tools array to your LangChain agent or chain as you would any native LangChain tool.

import { createReactAgent } from "@langchain/langgraph/prebuilt";
import Anthropic from "@anthropic-ai/sdk";

const agent = createReactAgent({ model, tools });
const result = await agent.invoke({ messages: [{ role: "user", content: "List files in /tmp" }] });
5

Clean up MCP server connections

Always call cleanup() when done to properly close MCP server connections and free resources.

await cleanup();

LangChain MCP Tools Examples

Client configuration

Example TypeScript code showing the full integration pattern with an Anthropic model.

{
  "dependencies": {
    "@h1deya/langchain-mcp-tools": "latest",
    "@langchain/anthropic": "latest",
    "@langchain/langgraph": "latest"
  }
}

Prompts to try

Examples of what your LangChain agent can do once MCP tools are integrated.

- "List all files in the /tmp directory using the filesystem server"
- "Fetch the content of https://example.com and summarize it"
- "Search my notes vault for mentions of 'project deadline'"
- "What tools are available from the connected MCP servers?"
- "Use the GitHub MCP server to list open pull requests in my repository"

Troubleshooting LangChain MCP Tools

Schema validation errors when using with Google Gemini or OpenAI

Pass the correct llmProvider option to convertMcpToLangchainTools (e.g., `{ llmProvider: "google_gemini" }` or `{ llmProvider: "openai" }`). This triggers provider-specific schema transformations that fix incompatibilities between MCP tool schemas and provider expectations.

MCP server process fails to start

Verify the command and args in your server config are correct and the binary is installed. For npx-based servers, ensure Node.js is in PATH. For uvx-based servers, ensure uv is installed. Check stderr output by adding `stderr: "pipe"` to the server config.

Tools array is empty after conversion

Confirm the MCP server started successfully and actually exposes tools. Test the server independently using the MCP Inspector (`npx @modelcontextprotocol/inspector`) to verify it lists tools before trying to convert them.

Frequently Asked Questions about LangChain MCP Tools

What is LangChain MCP Tools?

LangChain MCP Tools is a Model Context Protocol (MCP) server that mcp to langchain tools conversion utility / 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 APIs MCP Servers

Explore all apis 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": { "command": "npx", "args": ["-y", "langchain-mcp-tools-ts"] } } }

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