XL

xiaotonng/lc2mcp

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

55 stars 16 forks Качество 58 Тренд 0MIT

xiaotonng/lc2mcp - кандидат на сервер MCP, импортированный из https://github.com/xiaotonng/lc2mcp.

Обзор

xiaotonng/lc2mcp - кандидат на сервер MCP, импортированный из https://github.com/xiaotonng/lc2mcp.

Обзор (машинный перевод)

Преобразуйте инструменты LangChain в инструменты FastMCP — в одну строку кода.

Перестаньте переписывать инструменты. Просто адаптируйте их.

lc2mcp — это легкий адаптер, который преобразует существующие инструменты LangChain в FastMCP-инструменты, позволяя быстро создавать MCP-серверы, доступные для Claude, Cursor и любого MCP-совместимого клиента.

Feature Особенности

Описание / Description [скрыто] [скрыто] [скрыто] [скрыто] [скрыто] Мгновенная конверсия Вызов одной функции для преобразования любого инструмента LangChain в инструмент FastMCP ** Экосистемный доступ** | Unlock 1000+ Инструменты сообщества LangChain (поиск, Википедия, SQL, API…) | Zero Boilerplate | Автоматический Pydantic → JSON Schema conversion | | * * Контекстная инъекция * * | Передайте ауту, информацию о пользователе и запросите контекст для инструментов | **Прогресс и регистрация ** Полная поддержка уведомлений о прогрессе и регистрации MCP ️ Namespace Support | Префиксировать имена инструментов и автоматически обрабатывать конфликты

Быстрый старт

###Установка

3 Линии в MCP

Ваш инструмент теперь доступен для Claude, Cursor и любого MCP-клиента.

Параметры инструментов

Чтобы включить описания параметров в схему инструмента MCP, у вас есть два варианта:

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

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

┌─────────────────┐      ┌─────────────┐      ┌─────────────────┐
│  LangChain Tool │ ───▶ │   lc2mcp    │ ───▶ │  FastMCP Tool   │
Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →