langchain-mcp-tools 0.0.10__tar.gz → 0.0.12__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: langchain-mcp-tools
3
- Version: 0.0.10
3
+ Version: 0.0.12
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
@@ -18,6 +18,10 @@ Requires-Dist: mcp>=1.2.0
18
18
  Requires-Dist: pyjson5>=1.6.8
19
19
  Requires-Dist: pympler>=1.1
20
20
  Requires-Dist: python-dotenv>=1.0.1
21
+ Requires-Dist: pytest>=8.3.4
22
+ Requires-Dist: pytest-asyncio>=0.25.2
23
+ Provides-Extra: dev
24
+ Requires-Dist: twine>=6.0.1; extra == "dev"
21
25
 
22
26
  # MCP To LangChain Tools Conversion Utility [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/hideya/langchain-mcp-tools-py/blob/main/LICENSE) [![pypi version](https://img.shields.io/pypi/v/langchain-mcp-tools.svg)](https://pypi.org/project/langchain-mcp-tools/)
23
27
 
@@ -25,7 +29,7 @@ This package is intended to simplify the use of
25
29
  [Model Context Protocol (MCP)](https://modelcontextprotocol.io/)
26
30
  server tools with LangChain / Python.
27
31
 
28
- It contains a utility function `convertMcpToLangchainTools()`.
32
+ It contains a utility function `convert_mcp_to_langchain_tools()`.
29
33
  This function handles parallel initialization of specified multiple MCP servers
30
34
  and converts their available tools into a list of
31
35
  [LangChain-compatible tools](https://js.langchain.com/docs/how_to/tool_calling/).
@@ -108,14 +112,17 @@ to work successfully...
108
112
 
109
113
  I'm new to Python, so it is very possible that my ignorance is playing
110
114
  a big role here...
111
- I'll summarize the difficulties I faced below.
115
+ I'll summarize the difficulties I faced below.
116
+ The source code is available
117
+ [here](https://github.com/hideya/langchain-mcp-tools-py/blob/main/langchain_mcp_tools/langchain_mcp_tools.py).
112
118
  Any comments pointing out something I am missing would be greatly appreciated!
113
119
  [(comment here)](https://github.com/hideya/langchain-mcp-tools-ts/issues)
114
120
 
115
121
  1. Core Challenge:
116
122
  - Async resources management for `stdio_client` and `ClientSession` seems
117
- to rely exclusively on `asynccontextmanager` for cleanup with no manual
118
- cleanup options (based on the mcp python-sdk impl as of Jan 14, 2025)
123
+ to require relying exclusively on `asynccontextmanager` for cleanup with
124
+ no manual cleanup options
125
+ (based on [the mcp python-sdk impl as of Jan 14, 2025](https://github.com/modelcontextprotocol/python-sdk/tree/99727a9/src/mcp/client))
119
126
  - Initializing multiple MCP servers in parallel requires a dedicated
120
127
  `asyncio.Task` per server
121
128
  - Necessity of keeping sessions alive for later use after initialization
@@ -4,7 +4,7 @@ This package is intended to simplify the use of
4
4
  [Model Context Protocol (MCP)](https://modelcontextprotocol.io/)
5
5
  server tools with LangChain / Python.
6
6
 
7
- It contains a utility function `convertMcpToLangchainTools()`.
7
+ It contains a utility function `convert_mcp_to_langchain_tools()`.
8
8
  This function handles parallel initialization of specified multiple MCP servers
9
9
  and converts their available tools into a list of
10
10
  [LangChain-compatible tools](https://js.langchain.com/docs/how_to/tool_calling/).
@@ -87,14 +87,17 @@ to work successfully...
87
87
 
88
88
  I'm new to Python, so it is very possible that my ignorance is playing
89
89
  a big role here...
90
- I'll summarize the difficulties I faced below.
90
+ I'll summarize the difficulties I faced below.
91
+ The source code is available
92
+ [here](https://github.com/hideya/langchain-mcp-tools-py/blob/main/langchain_mcp_tools/langchain_mcp_tools.py).
91
93
  Any comments pointing out something I am missing would be greatly appreciated!
92
94
  [(comment here)](https://github.com/hideya/langchain-mcp-tools-ts/issues)
93
95
 
94
96
  1. Core Challenge:
95
97
  - Async resources management for `stdio_client` and `ClientSession` seems
96
- to rely exclusively on `asynccontextmanager` for cleanup with no manual
97
- cleanup options (based on the mcp python-sdk impl as of Jan 14, 2025)
98
+ to require relying exclusively on `asynccontextmanager` for cleanup with
99
+ no manual cleanup options
100
+ (based on [the mcp python-sdk impl as of Jan 14, 2025](https://github.com/modelcontextprotocol/python-sdk/tree/99727a9/src/mcp/client))
98
101
  - Initializing multiple MCP servers in parallel requires a dedicated
99
102
  `asyncio.Task` per server
100
103
  - Necessity of keeping sessions alive for later use after initialization
@@ -38,8 +38,9 @@ The key aspects are:
38
38
 
39
39
  1. Core Challenge:
40
40
  - Async resources management for `stdio_client` and `ClientSession` seems
41
- to rely exclusively on `asynccontextmanager` for cleanup with no manual
42
- cleanup options (based on the mcp python-sdk impl as of Jan 14, 2025)
41
+ to require relying exclusively on `asynccontextmanager` for cleanup with
42
+ no manual cleanup options
43
+ (based on [the mcp python-sdk impl as of Jan 14, 2025](https://github.com/modelcontextprotocol/python-sdk/tree/99727a9/src/mcp/client))
43
44
  - Initializing multiple MCP servers in parallel requires a dedicated
44
45
  `asyncio.Task` per server
45
46
  - Necessity of keeping sessions alive for later use after initialization
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: langchain-mcp-tools
3
- Version: 0.0.10
3
+ Version: 0.0.12
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
@@ -18,6 +18,10 @@ Requires-Dist: mcp>=1.2.0
18
18
  Requires-Dist: pyjson5>=1.6.8
19
19
  Requires-Dist: pympler>=1.1
20
20
  Requires-Dist: python-dotenv>=1.0.1
21
+ Requires-Dist: pytest>=8.3.4
22
+ Requires-Dist: pytest-asyncio>=0.25.2
23
+ Provides-Extra: dev
24
+ Requires-Dist: twine>=6.0.1; extra == "dev"
21
25
 
22
26
  # MCP To LangChain Tools Conversion Utility [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/hideya/langchain-mcp-tools-py/blob/main/LICENSE) [![pypi version](https://img.shields.io/pypi/v/langchain-mcp-tools.svg)](https://pypi.org/project/langchain-mcp-tools/)
23
27
 
@@ -25,7 +29,7 @@ This package is intended to simplify the use of
25
29
  [Model Context Protocol (MCP)](https://modelcontextprotocol.io/)
26
30
  server tools with LangChain / Python.
27
31
 
28
- It contains a utility function `convertMcpToLangchainTools()`.
32
+ It contains a utility function `convert_mcp_to_langchain_tools()`.
29
33
  This function handles parallel initialization of specified multiple MCP servers
30
34
  and converts their available tools into a list of
31
35
  [LangChain-compatible tools](https://js.langchain.com/docs/how_to/tool_calling/).
@@ -108,14 +112,17 @@ to work successfully...
108
112
 
109
113
  I'm new to Python, so it is very possible that my ignorance is playing
110
114
  a big role here...
111
- I'll summarize the difficulties I faced below.
115
+ I'll summarize the difficulties I faced below.
116
+ The source code is available
117
+ [here](https://github.com/hideya/langchain-mcp-tools-py/blob/main/langchain_mcp_tools/langchain_mcp_tools.py).
112
118
  Any comments pointing out something I am missing would be greatly appreciated!
113
119
  [(comment here)](https://github.com/hideya/langchain-mcp-tools-ts/issues)
114
120
 
115
121
  1. Core Challenge:
116
122
  - Async resources management for `stdio_client` and `ClientSession` seems
117
- to rely exclusively on `asynccontextmanager` for cleanup with no manual
118
- cleanup options (based on the mcp python-sdk impl as of Jan 14, 2025)
123
+ to require relying exclusively on `asynccontextmanager` for cleanup with
124
+ no manual cleanup options
125
+ (based on [the mcp python-sdk impl as of Jan 14, 2025](https://github.com/modelcontextprotocol/python-sdk/tree/99727a9/src/mcp/client))
119
126
  - Initializing multiple MCP servers in parallel requires a dedicated
120
127
  `asyncio.Task` per server
121
128
  - Necessity of keeping sessions alive for later use after initialization
@@ -9,3 +9,8 @@ mcp>=1.2.0
9
9
  pyjson5>=1.6.8
10
10
  pympler>=1.1
11
11
  python-dotenv>=1.0.1
12
+ pytest>=8.3.4
13
+ pytest-asyncio>=0.25.2
14
+
15
+ [dev]
16
+ twine>=6.0.1
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "langchain-mcp-tools"
3
- version = "0.0.10"
3
+ version = "0.0.12"
4
4
  description = "Model Context Protocol (MCP) To LangChain Tools Conversion Utility"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -16,12 +16,12 @@ dependencies = [
16
16
  "pyjson5>=1.6.8",
17
17
  "pympler>=1.1",
18
18
  "python-dotenv>=1.0.1",
19
+ "pytest>=8.3.4",
20
+ "pytest-asyncio>=0.25.2",
19
21
  ]
20
22
 
21
- [dependency-groups]
23
+ [project.optional-dependencies]
22
24
  dev = [
23
- "pytest>=8.3.4",
24
- "pytest-asyncio>=0.25.2",
25
25
  "twine>=6.0.1",
26
26
  ]
27
27
 
@@ -1,7 +1,7 @@
1
1
  import pytest
2
2
  from unittest.mock import AsyncMock, MagicMock, patch
3
3
  from langchain_core.tools import BaseTool
4
- from src.langchain_mcp_tools import (
4
+ from langchain_mcp_tools.langchain_mcp_tools import (
5
5
  convert_mcp_to_langchain_tools,
6
6
  )
7
7
 
@@ -11,14 +11,14 @@ pytest_plugins = ('pytest_asyncio',)
11
11
 
12
12
  @pytest.fixture
13
13
  def mock_stdio_client():
14
- with patch('src.langchain_mcp_tools.stdio_client') as mock:
14
+ with patch('langchain_mcp_tools.langchain_mcp_tools.stdio_client') as mock:
15
15
  mock.return_value.__aenter__.return_value = (AsyncMock(), AsyncMock())
16
16
  yield mock
17
17
 
18
18
 
19
19
  @pytest.fixture
20
20
  def mock_client_session():
21
- with patch('src.langchain_mcp_tools.ClientSession') as mock:
21
+ with patch('langchain_mcp_tools.langchain_mcp_tools.ClientSession') as mock:
22
22
  session = AsyncMock()
23
23
  # Mock the list_tools response
24
24
  session.list_tools.return_value = MagicMock(