langchain-mcp-tools 0.1.7__py3-none-any.whl → 0.1.9__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.
@@ -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.7
3
+ Version: 0.1.9
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
@@ -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 800 functional components available as MCP servers:
38
+ Over 1500 functional components available as MCP servers:
39
39
 
40
40
  - [Glama’s list of Open-Source MCP servers](https://glama.ai/mcp/servers)
41
41
  - [Smithery: MCP Server Registry](https://smithery.ai/)
42
42
  - [awesome-mcp-servers](https://github.com/hideya/awesome-mcp-servers#Server-Implementations)
43
43
  - [MCP Get Started/Example Servers](https://modelcontextprotocol.io/examples)
44
44
 
45
- The goal of this utility is to make these 800+ MCP servers readily accessible from LangChain.
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 800+ MCP with ReAct"](https://medium.com/@h1deya/supercharging-langchain-integrating-800-mcp-with-react-d4e467cbf41a)
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-5-sonnet-latest',
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 800+ MCP with ReAct"](https://medium.com/@h1deya/supercharging-langchain-integrating-800-mcp-with-react-d4e467cbf41a)
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=0uKhEeaMLPTHvsLVMrs18MuVz1SxSQZmTE0y8NYbs5o,12221
3
+ langchain_mcp_tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ langchain_mcp_tools-0.1.9.dist-info/LICENSE,sha256=CRC91e8v116gCpnp7h49oIa6_zjhxqnHFTREeoZFJwA,1072
5
+ langchain_mcp_tools-0.1.9.dist-info/METADATA,sha256=7-GqU1Lt_iTfkY0Jn-OmKhcBTMseNx_DlRwTlZNmhbY,5150
6
+ langchain_mcp_tools-0.1.9.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
7
+ langchain_mcp_tools-0.1.9.dist-info/top_level.txt,sha256=aR_9V2A1Yt-Bca60KmndmGLUWb2wiM5IOG-Gkaf1dxY,20
8
+ langchain_mcp_tools-0.1.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (76.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -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.7.dist-info/LICENSE,sha256=CRC91e8v116gCpnp7h49oIa6_zjhxqnHFTREeoZFJwA,1072
5
- langchain_mcp_tools-0.1.7.dist-info/METADATA,sha256=eGSPp9YQFZ9XWjssxhBqlVgw4gXyOmHvs3B-6dB1Lwc,5035
6
- langchain_mcp_tools-0.1.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
- langchain_mcp_tools-0.1.7.dist-info/top_level.txt,sha256=aR_9V2A1Yt-Bca60KmndmGLUWb2wiM5IOG-Gkaf1dxY,20
8
- langchain_mcp_tools-0.1.7.dist-info/RECORD,,