MCP To LangChain Tools Conversion Utility logo

MCP To LangChain Tools Conversion Utility

by hideya

This package simplifies the integration of Model Context Protocol (MCP) server tools with LangChain in TypeScript. It provides a utility function to convert MCP tools into LangChain-compatible tools, enabling access to over 2000 functional components.

View on GitHub

Last updated: N/A

What is MCP To LangChain Tools Conversion Utility?

This utility converts MCP server tools into LangChain-compatible tools. It allows developers to easily use the vast ecosystem of MCP servers (over 2000 components) within LangChain applications.

How to use MCP To LangChain Tools Conversion Utility?

Install the package using npm i @h1deya/langchain-mcp-tools. Then, use the convertMcpToLangchainTools() function with your MCP server configurations (similar to Claude for Desktop's mcpServers property). The function returns an array of LangChain tools and a cleanup function to close MCP server sessions.

Key features of MCP To LangChain Tools Conversion Utility

  • Parallel initialization of MCP servers

  • Conversion of MCP tools to LangChain tools

  • Cleanup function for server sessions

  • Support for remote MCP servers (SSE and Websocket)

  • Working directory configuration for local MCP servers

  • stderr redirection configuration for local MCP servers

Use cases of MCP To LangChain Tools Conversion Utility

  • Integrating Google Drive with LangChain

  • Connecting Slack to LangChain agents

  • Using Notion data within LangChain workflows

  • Controlling Spotify through LangChain

  • Managing Docker containers with LangChain

  • Querying PostgreSQL databases using LangChain

FAQ from MCP To LangChain Tools Conversion Utility

What is MCP?

Model Context Protocol (MCP) is an open-source technology that expands LLM's scope by enabling external tool and resource integration.

How many MCP servers are available?

Over 2000 functional components are available as MCP servers.

What is the main function provided by this utility?

The main function is convertMcpToLangchainTools(), which converts MCP server tools into LangChain-compatible tools.

What prerequisites are required to use this utility?

Node.js 16+ is required.

Are remote MCP servers supported?

Yes, remote MCP servers using SSE and Websocket are supported as experimental features.