Skip to content

Lc2mcp

Convert LangChain tools to FastMCP tools

Install

$pip install lc2mcp

Install command taken from the project's README or registry entry. Always review code before running it.

lc2mcp

Convert LangChain tools to FastMCP tools — in one line of code.

Stop rewriting your tools. Just adapt them.

lc2mcp is a lightweight adapter that converts existing LangChain tools into FastMCP tools, enabling you to quickly build MCP servers accessible to Claude, Cursor, and any MCP-compatible client.


✨ Features

Feature Description
🔄 Instant Conversion One function call to convert any LangChain tool to FastMCP tool
📦 Ecosystem Access Unlock 1000+ LangChain community tools (Search, Wikipedia, SQL, APIs...)
🎯 Zero Boilerplate Automatic Pydantic → JSON Schema conversion
🔐 Context Injection Pass auth, user info, and request context to tools
📊 Progress & Logging Full support for MCP progress notifications and logging
🏷️ Namespace Support Prefix tool names and handle conflicts automatically

🚀 Quick Start

Installation

pip install lc2mcp

3 Lines to MCP

from langchain_core.tools import tool
from fastmcp import FastMCP
from lc2mcp import register_tools

@tool
def get_weather(city: str) -> str:
    """Get current weather for a city."""
    return f"Sunny, 25°C in {city}"

mcp = FastMCP("weather-server")
register_tools(mcp, [get_weather])  # ← That's it!

if __name__ == "__main__":
    mcp.run()

Your tool is now available to Claude, Cursor, and any MCP client.

Tool Parameter Descriptions

To include parameter descriptions in the MCP tool schema, you have two options:

Option 1: Use parse_docstring=True (Recommended for simplicity)

@tool(parse_docstring=True)
def get_weather(city: str, unit: str = "celsius") -> str:
    """Get current weather for a city.

    Args:
        city: The name of the city to query
        unit: Temperature unit (celsius or fahrenheit)
    """
    return f"Sunny, 25°C in {city}"

Option 2: Use args_schema (Recommended for complex types)

from pydantic import BaseModel, Field

class WeatherInput(BaseModel):
    city: str = Field(description="The name of the city to query")
    unit: str = Field(default="celsius", description="Temperature unit")

@tool(args_schema=WeatherInput)
def get_weather(city: str, unit: str = "celsius") -> str:
    """Get current weather for a city."""
    return f"Sunny, 25°C in {city}"

Note: Without parse_docstring=True or args_schema, parameter descriptions from docstrings will not be extracted.


🔌 How It Works

Similar plugs

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

Java 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype…

Explore related