langchain-mcp-tools 0.1.8__py3-none-any.whl → 0.1.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- langchain_mcp_tools/langchain_mcp_tools.py +19 -2
- {langchain_mcp_tools-0.1.8.dist-info → langchain_mcp_tools-0.1.10.dist-info}/METADATA +14 -10
- langchain_mcp_tools-0.1.10.dist-info/RECORD +8 -0
- {langchain_mcp_tools-0.1.8.dist-info → langchain_mcp_tools-0.1.10.dist-info}/WHEEL +1 -1
- langchain_mcp_tools-0.1.8.dist-info/RECORD +0 -8
- {langchain_mcp_tools-0.1.8.dist-info → langchain_mcp_tools-0.1.10.dist-info/licenses}/LICENSE +0 -0
- {langchain_mcp_tools-0.1.8.dist-info → langchain_mcp_tools-0.1.10.dist-info}/top_level.txt +0 -0
@@ -247,13 +247,22 @@ async def get_mcp_server_tools(
|
|
247
247
|
return langchain_tools
|
248
248
|
|
249
249
|
|
250
|
+
# A very simple pre-implemented logger for fallback
|
251
|
+
def init_logger() -> logging.Logger:
|
252
|
+
logging.basicConfig(
|
253
|
+
level=logging.INFO, # logging.DEBUG,
|
254
|
+
format='\x1b[90m[%(levelname)s]\x1b[0m %(message)s'
|
255
|
+
)
|
256
|
+
return logging.getLogger()
|
257
|
+
|
258
|
+
|
250
259
|
# Type hint for cleanup function
|
251
260
|
McpServerCleanupFn = Callable[[], Awaitable[None]]
|
252
261
|
|
253
262
|
|
254
263
|
async def convert_mcp_to_langchain_tools(
|
255
264
|
server_configs: Dict[str, Dict[str, Any]],
|
256
|
-
logger: logging.Logger =
|
265
|
+
logger: Optional[logging.Logger] = None
|
257
266
|
) -> Tuple[List[BaseTool], McpServerCleanupFn]:
|
258
267
|
"""Initialize multiple MCP servers and convert their tools to
|
259
268
|
LangChain format.
|
@@ -267,7 +276,8 @@ async def convert_mcp_to_langchain_tools(
|
|
267
276
|
configurations, where each configuration contains command, args,
|
268
277
|
and env settings
|
269
278
|
logger: Logger instance to use for logging events and errors.
|
270
|
-
|
279
|
+
If None, uses module logger with fallback to a pre-configured
|
280
|
+
logger when no root handlers exist.
|
271
281
|
|
272
282
|
Returns:
|
273
283
|
A tuple containing:
|
@@ -285,6 +295,13 @@ async def convert_mcp_to_langchain_tools(
|
|
285
295
|
await cleanup()
|
286
296
|
"""
|
287
297
|
|
298
|
+
if logger is None:
|
299
|
+
logger = logging.getLogger(__name__)
|
300
|
+
# Check if the root logger has handlers configured
|
301
|
+
if not logging.root.handlers and not logger.handlers:
|
302
|
+
# No logging configured, use our pre-implemented logger
|
303
|
+
logger = init_logger()
|
304
|
+
|
288
305
|
# Initialize AsyncExitStack for managing multiple server lifecycles
|
289
306
|
stdio_transports: List[StdioTransport] = []
|
290
307
|
async_exit_stack = AsyncExitStack()
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: langchain-mcp-tools
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.10
|
4
4
|
Summary: Model Context Protocol (MCP) To LangChain Tools Conversion Utility
|
5
5
|
Project-URL: Bug Tracker, https://github.com/hideya/langchain-mcp-tools-py/issues
|
6
6
|
Project-URL: Source Code, https://github.com/hideya/langchain-mcp-tools-py
|
@@ -12,7 +12,6 @@ Requires-Dist: jsonschema-pydantic>=0.6
|
|
12
12
|
Requires-Dist: langchain>=0.3.14
|
13
13
|
Requires-Dist: mcp>=1.2.0
|
14
14
|
Requires-Dist: pyjson5>=1.6.8
|
15
|
-
Requires-Dist: python-dotenv>=1.0.1
|
16
15
|
Provides-Extra: dev
|
17
16
|
Requires-Dist: dotenv>=0.9.9; extra == "dev"
|
18
17
|
Requires-Dist: langchain-anthropic>=0.3.1; extra == "dev"
|
@@ -21,6 +20,7 @@ Requires-Dist: langchain-openai>=0.3.0; extra == "dev"
|
|
21
20
|
Requires-Dist: langgraph>=0.2.62; extra == "dev"
|
22
21
|
Requires-Dist: pytest>=8.3.4; extra == "dev"
|
23
22
|
Requires-Dist: pytest-asyncio>=0.25.2; extra == "dev"
|
23
|
+
Dynamic: license-file
|
24
24
|
|
25
25
|
# MCP To LangChain Tools Conversion Utility [](https://github.com/hideya/langchain-mcp-tools-py/blob/main/LICENSE) [](https://pypi.org/project/langchain-mcp-tools/)
|
26
26
|
|
@@ -35,21 +35,21 @@ dramatically expands LLM’s scope
|
|
35
35
|
by enabling external tool and resource integration, including
|
36
36
|
Google Drive, Slack, Notion, Spotify, Docker, PostgreSQL, and more…
|
37
37
|
|
38
|
-
Over
|
38
|
+
Over 1500 functional components available as MCP servers:
|
39
39
|
|
40
|
-
- [
|
40
|
+
- [MCP.so - Find Awesome MCP Servers and Clients](https://mcp.so/)
|
41
41
|
- [Smithery: MCP Server Registry](https://smithery.ai/)
|
42
|
-
- [
|
42
|
+
- [pulse - Browse and discover MCP use cases, servers, clients, and news](https://www.pulsemcp.com/)
|
43
43
|
- [MCP Get Started/Example Servers](https://modelcontextprotocol.io/examples)
|
44
44
|
|
45
|
-
The goal of this utility is to make these
|
45
|
+
The goal of this utility is to make these 1500+ MCP servers readily accessible from LangChain.
|
46
46
|
|
47
47
|
It contains a utility function `convert_mcp_to_langchain_tools()`.
|
48
48
|
This async function handles parallel initialization of specified multiple MCP servers
|
49
49
|
and converts their available tools into a list of LangChain-compatible tools.
|
50
50
|
|
51
51
|
For detailed information on how to use this library, please refer to the following document:
|
52
|
-
- ["Supercharging LangChain: Integrating
|
52
|
+
- ["Supercharging LangChain: Integrating 1500+ MCP with ReAct"](https://medium.com/@h1deya/supercharging-langchain-integrating-1500-mcp-with-react-d4e467cbf41a)
|
53
53
|
|
54
54
|
A typescript equivalent of this utility is available
|
55
55
|
[here](https://www.npmjs.com/package/@h1deya/langchain-mcp-tools)
|
@@ -102,7 +102,7 @@ The returned tools can be used with LangChain, e.g.:
|
|
102
102
|
```python
|
103
103
|
# from langchain.chat_models import init_chat_model
|
104
104
|
llm = init_chat_model(
|
105
|
-
model='claude-3-
|
105
|
+
model='claude-3-7-sonnet-latest',
|
106
106
|
model_provider='anthropic'
|
107
107
|
)
|
108
108
|
|
@@ -120,8 +120,12 @@ For hands-on experimentation with MCP server integration,
|
|
120
120
|
try [this LangChain application built with the utility](https://github.com/hideya/mcp-client-langchain-py)
|
121
121
|
|
122
122
|
For detailed information on how to use this library, please refer to the following document:
|
123
|
-
["Supercharging LangChain: Integrating
|
123
|
+
["Supercharging LangChain: Integrating 1500+ MCP with ReAct"](https://medium.com/@h1deya/supercharging-langchain-integrating-1500-mcp-with-react-d4e467cbf41a)
|
124
124
|
|
125
125
|
## Limitations
|
126
126
|
|
127
127
|
Currently, only text results of tool calls are supported.
|
128
|
+
|
129
|
+
## Change Log
|
130
|
+
|
131
|
+
Can be found [here](https://github.com/hideya/langchain-mcp-tools-py/blob/main/CHANGELOG.md)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
langchain_mcp_tools/__init__.py,sha256=Xtv2VphhrWB_KlxTIofHZqtCIGtNEl0MxugnrNXTERA,94
|
2
|
+
langchain_mcp_tools/langchain_mcp_tools.py,sha256=vIiOB8u62Q-7Mi8U6XI247g-xfxpE2QvoBeo0pbtFX4,12838
|
3
|
+
langchain_mcp_tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
+
langchain_mcp_tools-0.1.10.dist-info/licenses/LICENSE,sha256=CRC91e8v116gCpnp7h49oIa6_zjhxqnHFTREeoZFJwA,1072
|
5
|
+
langchain_mcp_tools-0.1.10.dist-info/METADATA,sha256=kAMCbY0YTAA5aj-SaiGqtAanX30ggpEeZO39zChua0Y,5135
|
6
|
+
langchain_mcp_tools-0.1.10.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
|
7
|
+
langchain_mcp_tools-0.1.10.dist-info/top_level.txt,sha256=aR_9V2A1Yt-Bca60KmndmGLUWb2wiM5IOG-Gkaf1dxY,20
|
8
|
+
langchain_mcp_tools-0.1.10.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
langchain_mcp_tools/__init__.py,sha256=Xtv2VphhrWB_KlxTIofHZqtCIGtNEl0MxugnrNXTERA,94
|
2
|
-
langchain_mcp_tools/langchain_mcp_tools.py,sha256=0uKhEeaMLPTHvsLVMrs18MuVz1SxSQZmTE0y8NYbs5o,12221
|
3
|
-
langchain_mcp_tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
langchain_mcp_tools-0.1.8.dist-info/LICENSE,sha256=CRC91e8v116gCpnp7h49oIa6_zjhxqnHFTREeoZFJwA,1072
|
5
|
-
langchain_mcp_tools-0.1.8.dist-info/METADATA,sha256=vKg5tsJ9L-Awt-MIJOBsLRHeObsXHyQk2AUXskRvS0M,5035
|
6
|
-
langchain_mcp_tools-0.1.8.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
7
|
-
langchain_mcp_tools-0.1.8.dist-info/top_level.txt,sha256=aR_9V2A1Yt-Bca60KmndmGLUWb2wiM5IOG-Gkaf1dxY,20
|
8
|
-
langchain_mcp_tools-0.1.8.dist-info/RECORD,,
|
{langchain_mcp_tools-0.1.8.dist-info → langchain_mcp_tools-0.1.10.dist-info/licenses}/LICENSE
RENAMED
File without changes
|
File without changes
|