X
xiaotonng/lc2mcp
Convert LangChain tools to FastMCP tools
在 GitHub 查看 ↗链接已于 2026-11-12 核查 · HTTP 200 · 打开的是厂商自己的官网
安装与配置
取自该仓库的安装命令
pip install lc2mcp
解析自我们于 2026-11-05 抓取的该仓库 README;我们未执行过。
这条是仓库自己写的安装方式,不是 MCP 客户端配置,所以不生成 JSON。
配置项的键名以你的客户端为准:客户端与 CLI
- 来源明细
- 收录自 abordage/awesome-mcp 榜单(我们从中收集的条目之一) · 条目类型:MCP 服务
- 收录与活跃
- 收录于 2026-11-05 · 最近见到 2026-11-14 · 共见到 10 次 · 被 10 个来源列出
- 评分构成
- 综合分 1,003 · 10 个来源 · mcp
- 安装
pip install lc2mcp
常见问题(答案都来自我们的记录)
怎么安装?
该仓库给出的安装命令是
pip install lc2mcp。我们的记录里它是仓库自己提供的;不保证在你的客户端上直接可用。它适合谁 / 用来做什么?
我们把它归在这些标签下: MCP 服务。标签来自条目自身,不是我们强加的分类。
谁维护它、还在更新吗?
我们收录于 2026-11-05;最近见到 2026-11-14。这里没有"官方认证"或"质量评级"——我们只记录来源与时间。
# lc2mcp
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
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
bash
pip install lc2mcp
### 3 Lines to MCP
python
from langchaincore.tools import tool
from fastmcp import FastMCP
from lc2mcp import registertools
@tool
def getweather(city: str) -> str:
"""Get current weather for a city."""
return f"Sunny, 25°C in {city}"
mcp = FastMCP("weather-server")
registertools(mcp, [getweather]) # ← 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 parsedocstring=True (Recommended for simplicity)
python
@tool(parsedocstring=True)
def getweather(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 argsschema (Recommended for complex types)
python
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(argsschema=WeatherInput)
def getweather(city: str, unit: str = "celsius") -> str:
"""Get current weather for a city."""
return f"Sunny, 25°C in {city}"
> Note: Without parsedocstring=True or argsschema, parameter descriptions from docstrings will not be extracted.
## 🔌 How It Works
┌─────────────────┐ ┌─────────────┐ ┌─────────────────┐
│ LangChain Tool │ ───▶ │ lc2mcp │ ───▶ │ FastMCP Tool │
│ (@tool, etc.) │ │ (adapter) │ │ │
└─────────────────┘ └─────────────┘ └────────┬────────┘
┌─────────────────┐
│ FastMCP Server │
└────────┬────────┘
┌───────────────────────┐
│ MCP Clients │
│ (Claude, Cursor, ...) │
└───────────────────────┘
## 🔄 lc2mcp vs langchain-mcp-adapters
LangChain and MCP ecosystems can be connected in both directions:
| Direction | Tool | Description |
| LangChain → MCP | lc2mcp ✅ | Convert LangChain tools to MCP tools (this project) |
| MCP → LangChain | langchain-mcp-adapters | Convert MCP tools to LangChain tools (official) |
When to use lc2mcp:
You have existing LangChain tools and want to expose them via MCP
You want to build an MCP server using LangChain's rich tool ecosystem
You need to serve tools to Claude, Cursor, or other MCP clients
When to use langchain-mcp-adapters:
> 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
bash
pip install lc2mcp
### 3 Lines to MCP
python
from langchaincore.tools import tool
from fastmcp import FastMCP
from lc2mcp import registertools
@tool
def getweather(city: str) -> str:
"""Get current weather for a city."""
return f"Sunny, 25°C in {city}"
mcp = FastMCP("weather-server")
registertools(mcp, [getweather]) # ← 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 parsedocstring=True (Recommended for simplicity)
python
@tool(parsedocstring=True)
def getweather(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 argsschema (Recommended for complex types)
python
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(argsschema=WeatherInput)
def getweather(city: str, unit: str = "celsius") -> str:
"""Get current weather for a city."""
return f"Sunny, 25°C in {city}"
> Note: Without parsedocstring=True or argsschema, parameter descriptions from docstrings will not be extracted.
## 🔌 How It Works
┌─────────────────┐ ┌─────────────┐ ┌─────────────────┐
│ LangChain Tool │ ───▶ │ lc2mcp │ ───▶ │ FastMCP Tool │
│ (@tool, etc.) │ │ (adapter) │ │ │
└─────────────────┘ └─────────────┘ └────────┬────────┘
┌─────────────────┐
│ FastMCP Server │
└────────┬────────┘
┌───────────────────────┐
│ MCP Clients │
│ (Claude, Cursor, ...) │
└───────────────────────┘
## 🔄 lc2mcp vs langchain-mcp-adapters
LangChain and MCP ecosystems can be connected in both directions:
| Direction | Tool | Description |
| LangChain → MCP | lc2mcp ✅ | Convert LangChain tools to MCP tools (this project) |
| MCP → LangChain | langchain-mcp-adapters | Convert MCP tools to LangChain tools (official) |
When to use lc2mcp:
You have existing LangChain tools and want to expose them via MCP
You want to build an MCP server using LangChain's rich tool ecosystem
You need to serve tools to Claude, Cursor, or other MCP clients
When to use langchain-mcp-adapters:
收录徽章(可选)
想把收录标记放进 README 就复制这行,可选,不影响收录。
[](https://anclum.com/zh/s/xiaotonng-lc2mcp/)
- 来源
- awesome · https://github.com/xiaotonng/lc2mcp
- 按领域浏览
- MCP 服务
- 收录来源
- 10 个独立来源
- 收录于
- 今天
同类推荐
所属领域与标签
每个标签都能点进去看同类的全部条目。数字是当前库里的真实条数。