langchain-mcp-tools 0.1.6__py3-none-any.whl → 0.1.8__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 +12 -1
- {langchain_mcp_tools-0.1.6.dist-info → langchain_mcp_tools-0.1.8.dist-info}/METADATA +10 -9
- langchain_mcp_tools-0.1.8.dist-info/RECORD +8 -0
- {langchain_mcp_tools-0.1.6.dist-info → langchain_mcp_tools-0.1.8.dist-info}/WHEEL +1 -1
- langchain_mcp_tools-0.1.6.dist-info/RECORD +0 -8
- {langchain_mcp_tools-0.1.6.dist-info → langchain_mcp_tools-0.1.8.dist-info}/LICENSE +0 -0
- {langchain_mcp_tools-0.1.6.dist-info → langchain_mcp_tools-0.1.8.dist-info}/top_level.txt +0 -0
@@ -35,6 +35,17 @@ except ImportError as e:
|
|
35
35
|
sys.exit(1)
|
36
36
|
|
37
37
|
|
38
|
+
def fix_schema(schema: dict) -> dict:
|
39
|
+
"""Converts JSON Schema 'type': ['string', 'null'] to 'anyOf' format"""
|
40
|
+
if isinstance(schema, dict):
|
41
|
+
if 'type' in schema and isinstance(schema['type'], list):
|
42
|
+
schema['anyOf'] = [{'type': t} for t in schema['type']]
|
43
|
+
del schema['type'] # Remove 'type' and standardize to 'anyOf'
|
44
|
+
for key, value in schema.items():
|
45
|
+
schema[key] = fix_schema(value) # Apply recursively
|
46
|
+
return schema
|
47
|
+
|
48
|
+
|
38
49
|
# Type alias for the bidirectional communication channels with the MCP server
|
39
50
|
# FIXME: not defined in mcp.types, really?
|
40
51
|
StdioTransport: TypeAlias = tuple[
|
@@ -151,7 +162,7 @@ async def get_mcp_server_tools(
|
|
151
162
|
description: str = tool.description or ''
|
152
163
|
# Convert JSON schema to Pydantic model for argument validation
|
153
164
|
args_schema: Type[BaseModel] = jsonschema_to_pydantic(
|
154
|
-
tool.inputSchema
|
165
|
+
fix_schema(tool.inputSchema) # Apply schema conversion
|
155
166
|
)
|
156
167
|
session: Optional[ClientSession] = None
|
157
168
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: langchain-mcp-tools
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.8
|
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
|
@@ -10,14 +10,15 @@ Description-Content-Type: text/markdown
|
|
10
10
|
License-File: LICENSE
|
11
11
|
Requires-Dist: jsonschema-pydantic>=0.6
|
12
12
|
Requires-Dist: langchain>=0.3.14
|
13
|
-
Requires-Dist: langchain-anthropic>=0.3.1
|
14
|
-
Requires-Dist: langchain-groq>=0.2.3
|
15
|
-
Requires-Dist: langchain-openai>=0.3.0
|
16
|
-
Requires-Dist: langgraph>=0.2.62
|
17
13
|
Requires-Dist: mcp>=1.2.0
|
18
14
|
Requires-Dist: pyjson5>=1.6.8
|
19
15
|
Requires-Dist: python-dotenv>=1.0.1
|
20
16
|
Provides-Extra: dev
|
17
|
+
Requires-Dist: dotenv>=0.9.9; extra == "dev"
|
18
|
+
Requires-Dist: langchain-anthropic>=0.3.1; extra == "dev"
|
19
|
+
Requires-Dist: langchain-groq>=0.2.3; extra == "dev"
|
20
|
+
Requires-Dist: langchain-openai>=0.3.0; extra == "dev"
|
21
|
+
Requires-Dist: langgraph>=0.2.62; extra == "dev"
|
21
22
|
Requires-Dist: pytest>=8.3.4; extra == "dev"
|
22
23
|
Requires-Dist: pytest-asyncio>=0.25.2; extra == "dev"
|
23
24
|
|
@@ -34,21 +35,21 @@ dramatically expands LLM’s scope
|
|
34
35
|
by enabling external tool and resource integration, including
|
35
36
|
Google Drive, Slack, Notion, Spotify, Docker, PostgreSQL, and more…
|
36
37
|
|
37
|
-
Over
|
38
|
+
Over 800 functional components available as MCP servers:
|
38
39
|
|
39
40
|
- [Glama’s list of Open-Source MCP servers](https://glama.ai/mcp/servers)
|
40
41
|
- [Smithery: MCP Server Registry](https://smithery.ai/)
|
41
42
|
- [awesome-mcp-servers](https://github.com/hideya/awesome-mcp-servers#Server-Implementations)
|
42
43
|
- [MCP Get Started/Example Servers](https://modelcontextprotocol.io/examples)
|
43
44
|
|
44
|
-
The goal of this utility is to make these
|
45
|
+
The goal of this utility is to make these 800+ MCP servers readily accessible from LangChain.
|
45
46
|
|
46
47
|
It contains a utility function `convert_mcp_to_langchain_tools()`.
|
47
48
|
This async function handles parallel initialization of specified multiple MCP servers
|
48
49
|
and converts their available tools into a list of LangChain-compatible tools.
|
49
50
|
|
50
51
|
For detailed information on how to use this library, please refer to the following document:
|
51
|
-
- ["Supercharging LangChain: Integrating
|
52
|
+
- ["Supercharging LangChain: Integrating 800+ MCP with ReAct"](https://medium.com/@h1deya/supercharging-langchain-integrating-800-mcp-with-react-d4e467cbf41a)
|
52
53
|
|
53
54
|
A typescript equivalent of this utility is available
|
54
55
|
[here](https://www.npmjs.com/package/@h1deya/langchain-mcp-tools)
|
@@ -119,7 +120,7 @@ For hands-on experimentation with MCP server integration,
|
|
119
120
|
try [this LangChain application built with the utility](https://github.com/hideya/mcp-client-langchain-py)
|
120
121
|
|
121
122
|
For detailed information on how to use this library, please refer to the following document:
|
122
|
-
["Supercharging LangChain: Integrating
|
123
|
+
["Supercharging LangChain: Integrating 800+ MCP with ReAct"](https://medium.com/@h1deya/supercharging-langchain-integrating-800-mcp-with-react-d4e467cbf41a)
|
123
124
|
|
124
125
|
## Limitations
|
125
126
|
|
@@ -0,0 +1,8 @@
|
|
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,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
langchain_mcp_tools/__init__.py,sha256=Xtv2VphhrWB_KlxTIofHZqtCIGtNEl0MxugnrNXTERA,94
|
2
|
-
langchain_mcp_tools/langchain_mcp_tools.py,sha256=WY1ckLyIMbRIVhsECEFdAY6DnZB2Q3BLH-Nrb727M-o,11699
|
3
|
-
langchain_mcp_tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
langchain_mcp_tools-0.1.6.dist-info/LICENSE,sha256=CRC91e8v116gCpnp7h49oIa6_zjhxqnHFTREeoZFJwA,1072
|
5
|
-
langchain_mcp_tools-0.1.6.dist-info/METADATA,sha256=yUpYI9tc-JYxN15UzHGTpe9KeQbVT9NhRhUy6MJIqaY,4926
|
6
|
-
langchain_mcp_tools-0.1.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
7
|
-
langchain_mcp_tools-0.1.6.dist-info/top_level.txt,sha256=aR_9V2A1Yt-Bca60KmndmGLUWb2wiM5IOG-Gkaf1dxY,20
|
8
|
-
langchain_mcp_tools-0.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|