langchain-mcp-tools 0.2.1__tar.gz → 0.2.2__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.
- {langchain_mcp_tools-0.2.1/src/langchain_mcp_tools.egg-info → langchain_mcp_tools-0.2.2}/PKG-INFO +31 -11
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/README.md +30 -10
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/pyproject.toml +1 -1
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools/langchain_mcp_tools.py +4 -6
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2/src/langchain_mcp_tools.egg-info}/PKG-INFO +31 -11
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/LICENSE +0 -0
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/setup.cfg +0 -0
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools/__init__.py +0 -0
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools/py.typed +0 -0
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools.egg-info/SOURCES.txt +0 -0
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools.egg-info/dependency_links.txt +0 -0
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools.egg-info/requires.txt +0 -0
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools.egg-info/top_level.txt +0 -0
- {langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/tests/test_langchain_mcp_tools.py +0 -0
{langchain_mcp_tools-0.2.1/src/langchain_mcp_tools.egg-info → langchain_mcp_tools-0.2.2}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: langchain-mcp-tools
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.2
|
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
|
@@ -30,11 +30,14 @@ This package is intended to simplify the use of
|
|
30
30
|
server tools with LangChain / Python.
|
31
31
|
|
32
32
|
[Model Context Protocol (MCP)](https://modelcontextprotocol.io/),
|
33
|
-
an open
|
33
|
+
an open standard
|
34
34
|
[announced by Anthropic](https://www.anthropic.com/news/model-context-protocol),
|
35
35
|
dramatically expands LLM’s scope
|
36
36
|
by enabling external tool and resource integration, including
|
37
|
-
Google Drive, Slack, Notion, Spotify, Docker, PostgreSQL, and more…
|
37
|
+
GitHub, Google Drive, Slack, Notion, Spotify, Docker, PostgreSQL, and more…
|
38
|
+
|
39
|
+
MCP is likely to become the de facto industry standard as
|
40
|
+
[OpenAI has announced its adoption](https://techcrunch.com/2025/03/26/openai-adopts-rival-anthropics-standard-for-connecting-ai-models-to-data).
|
38
41
|
|
39
42
|
Over 2000 functional components available as MCP servers:
|
40
43
|
|
@@ -142,8 +145,23 @@ Note that the key `"url"` may be changed in the future to match
|
|
142
145
|
the MCP server configurations used by Claude for Desktop once
|
143
146
|
it introduces remote server support.
|
144
147
|
|
145
|
-
A usage example can be found [here](
|
146
|
-
|
148
|
+
A usage example can be found [here](https://github.com/hideya/langchain-mcp-tools-py-usage/blob/cf96ddc43750708ef3b244bad95714f0f2fe1d28/src/example.py#L43-L54)
|
149
|
+
|
150
|
+
### Passing HTTP Headers to SSE Connection
|
151
|
+
|
152
|
+
A new key `"headers"` has been introduced to pass HTTP headers to the SSE (Server-Sent Events) connection.
|
153
|
+
It takes `dict[str, str]` and is primarily intended to support SSE MCP servers
|
154
|
+
that require authentication via bearer tokens or other custom headers.
|
155
|
+
|
156
|
+
```python
|
157
|
+
"sse-server-name": {
|
158
|
+
"url": f"http://{sse_server_host}:{sse_server_port}/..."
|
159
|
+
"headers": {"Authorization": f"Bearer {bearer_token}"}
|
160
|
+
},
|
161
|
+
```
|
162
|
+
|
163
|
+
The key name `header` is derived from the Python SDK
|
164
|
+
[`sse_client()`](https://github.com/modelcontextprotocol/python-sdk/blob/babb477dffa33f46cdc886bc885eb1d521151430/src/mcp/client/sse.py#L24) argument name.
|
147
165
|
|
148
166
|
### Working Directory Configuration for Local MCP Servers
|
149
167
|
|
@@ -158,11 +176,12 @@ can be specified with the `"cwd"` key as follows:
|
|
158
176
|
},
|
159
177
|
```
|
160
178
|
|
161
|
-
The key name `cwd` is derived from
|
179
|
+
The key name `cwd` is derived from
|
180
|
+
Python SDK's [`StdioServerParameters`](https://github.com/modelcontextprotocol/python-sdk/blob/babb477dffa33f46cdc886bc885eb1d521151430/src/mcp/client/stdio/__init__.py#L76-L77).
|
162
181
|
|
163
182
|
### Configuration for Local MCP Server `stderr` Redirection
|
164
183
|
|
165
|
-
A new key `"errlog"` has been introduced
|
184
|
+
A new key `"errlog"` has been introduced to specify a file-like object
|
166
185
|
to which local (stdio) MCP server's stderr is redirected.
|
167
186
|
|
168
187
|
```python
|
@@ -172,13 +191,14 @@ to which local (stdio) MCP server's stderr is redirected.
|
|
172
191
|
```
|
173
192
|
|
174
193
|
A usage example can be found [here](
|
175
|
-
https://github.com/hideya/langchain-mcp-tools-py-usage/blob/
|
194
|
+
https://github.com/hideya/langchain-mcp-tools-py-usage/blob/cf96ddc43750708ef3b244bad95714f0f2fe1d28/src/example.py#L91-L108)
|
176
195
|
|
177
196
|
**NOTE: Why the key name `errlog` was chosen:**
|
178
197
|
Unlike TypeScript SDK's `StdioServerParameters`, the Python
|
179
|
-
SDK's `StdioServerParameters` doesn't include `stderr: int`.
|
180
|
-
Instead, it calls `stdio_client()` with a separate argument
|
181
|
-
`errlog: TextIO
|
198
|
+
SDK's `StdioServerParameters` doesn't include `stderr: int`.
|
199
|
+
Instead, it calls [`stdio_client()` with a separate argument
|
200
|
+
`errlog: TextIO`](https://github.com/modelcontextprotocol/python-sdk/blob/babb477dffa33f46cdc886bc885eb1d521151430/src/mcp/client/stdio/__init__.py#L96).
|
201
|
+
I once included `stderr: int` for
|
182
202
|
compatibility with the TypeScript version, but decided to
|
183
203
|
follow the Python SDK more closely.
|
184
204
|
|
@@ -5,11 +5,14 @@ This package is intended to simplify the use of
|
|
5
5
|
server tools with LangChain / Python.
|
6
6
|
|
7
7
|
[Model Context Protocol (MCP)](https://modelcontextprotocol.io/),
|
8
|
-
an open
|
8
|
+
an open standard
|
9
9
|
[announced by Anthropic](https://www.anthropic.com/news/model-context-protocol),
|
10
10
|
dramatically expands LLM’s scope
|
11
11
|
by enabling external tool and resource integration, including
|
12
|
-
Google Drive, Slack, Notion, Spotify, Docker, PostgreSQL, and more…
|
12
|
+
GitHub, Google Drive, Slack, Notion, Spotify, Docker, PostgreSQL, and more…
|
13
|
+
|
14
|
+
MCP is likely to become the de facto industry standard as
|
15
|
+
[OpenAI has announced its adoption](https://techcrunch.com/2025/03/26/openai-adopts-rival-anthropics-standard-for-connecting-ai-models-to-data).
|
13
16
|
|
14
17
|
Over 2000 functional components available as MCP servers:
|
15
18
|
|
@@ -117,8 +120,23 @@ Note that the key `"url"` may be changed in the future to match
|
|
117
120
|
the MCP server configurations used by Claude for Desktop once
|
118
121
|
it introduces remote server support.
|
119
122
|
|
120
|
-
A usage example can be found [here](
|
121
|
-
|
123
|
+
A usage example can be found [here](https://github.com/hideya/langchain-mcp-tools-py-usage/blob/cf96ddc43750708ef3b244bad95714f0f2fe1d28/src/example.py#L43-L54)
|
124
|
+
|
125
|
+
### Passing HTTP Headers to SSE Connection
|
126
|
+
|
127
|
+
A new key `"headers"` has been introduced to pass HTTP headers to the SSE (Server-Sent Events) connection.
|
128
|
+
It takes `dict[str, str]` and is primarily intended to support SSE MCP servers
|
129
|
+
that require authentication via bearer tokens or other custom headers.
|
130
|
+
|
131
|
+
```python
|
132
|
+
"sse-server-name": {
|
133
|
+
"url": f"http://{sse_server_host}:{sse_server_port}/..."
|
134
|
+
"headers": {"Authorization": f"Bearer {bearer_token}"}
|
135
|
+
},
|
136
|
+
```
|
137
|
+
|
138
|
+
The key name `header` is derived from the Python SDK
|
139
|
+
[`sse_client()`](https://github.com/modelcontextprotocol/python-sdk/blob/babb477dffa33f46cdc886bc885eb1d521151430/src/mcp/client/sse.py#L24) argument name.
|
122
140
|
|
123
141
|
### Working Directory Configuration for Local MCP Servers
|
124
142
|
|
@@ -133,11 +151,12 @@ can be specified with the `"cwd"` key as follows:
|
|
133
151
|
},
|
134
152
|
```
|
135
153
|
|
136
|
-
The key name `cwd` is derived from
|
154
|
+
The key name `cwd` is derived from
|
155
|
+
Python SDK's [`StdioServerParameters`](https://github.com/modelcontextprotocol/python-sdk/blob/babb477dffa33f46cdc886bc885eb1d521151430/src/mcp/client/stdio/__init__.py#L76-L77).
|
137
156
|
|
138
157
|
### Configuration for Local MCP Server `stderr` Redirection
|
139
158
|
|
140
|
-
A new key `"errlog"` has been introduced
|
159
|
+
A new key `"errlog"` has been introduced to specify a file-like object
|
141
160
|
to which local (stdio) MCP server's stderr is redirected.
|
142
161
|
|
143
162
|
```python
|
@@ -147,13 +166,14 @@ to which local (stdio) MCP server's stderr is redirected.
|
|
147
166
|
```
|
148
167
|
|
149
168
|
A usage example can be found [here](
|
150
|
-
https://github.com/hideya/langchain-mcp-tools-py-usage/blob/
|
169
|
+
https://github.com/hideya/langchain-mcp-tools-py-usage/blob/cf96ddc43750708ef3b244bad95714f0f2fe1d28/src/example.py#L91-L108)
|
151
170
|
|
152
171
|
**NOTE: Why the key name `errlog` was chosen:**
|
153
172
|
Unlike TypeScript SDK's `StdioServerParameters`, the Python
|
154
|
-
SDK's `StdioServerParameters` doesn't include `stderr: int`.
|
155
|
-
Instead, it calls `stdio_client()` with a separate argument
|
156
|
-
`errlog: TextIO
|
173
|
+
SDK's `StdioServerParameters` doesn't include `stderr: int`.
|
174
|
+
Instead, it calls [`stdio_client()` with a separate argument
|
175
|
+
`errlog: TextIO`](https://github.com/modelcontextprotocol/python-sdk/blob/babb477dffa33f46cdc886bc885eb1d521151430/src/mcp/client/stdio/__init__.py#L96).
|
176
|
+
I once included `stderr: int` for
|
157
177
|
compatibility with the TypeScript version, but decided to
|
158
178
|
follow the Python SDK more closely.
|
159
179
|
|
@@ -40,17 +40,14 @@ except ImportError as e:
|
|
40
40
|
class McpServerCommandBasedConfig(TypedDict):
|
41
41
|
command: str
|
42
42
|
args: NotRequired[list[str] | None]
|
43
|
-
env:
|
43
|
+
env: NotRequired[dict[str, str] | None]
|
44
44
|
cwd: NotRequired[str | None]
|
45
45
|
errlog: NotRequired[TextIO | None]
|
46
46
|
|
47
47
|
|
48
48
|
class McpServerUrlBasedConfig(TypedDict):
|
49
49
|
url: str
|
50
|
-
|
51
|
-
env: NotRequired[dict[str, str] | None]
|
52
|
-
cwd: NotRequired[str | None]
|
53
|
-
errlog: NotRequired[TextIO | None]
|
50
|
+
headers: NotRequired[dict[str, str] | None]
|
54
51
|
|
55
52
|
|
56
53
|
McpServerConfig = McpServerCommandBasedConfig | McpServerUrlBasedConfig
|
@@ -103,12 +100,13 @@ async def spawn_mcp_server_and_get_transport(
|
|
103
100
|
f'initializing with: {server_config}')
|
104
101
|
|
105
102
|
url_str = str(server_config.get('url')) # None becomes 'None'
|
103
|
+
headers = server_config.get("headers", None)
|
106
104
|
# no exception thrown even for a malformed URL
|
107
105
|
url_scheme = urlparse(url_str).scheme
|
108
106
|
|
109
107
|
if url_scheme in ('http', 'https'):
|
110
108
|
transport = await exit_stack.enter_async_context(
|
111
|
-
sse_client(url_str)
|
109
|
+
sse_client(url_str, headers=headers)
|
112
110
|
)
|
113
111
|
|
114
112
|
elif url_scheme in ('ws', 'wss'):
|
{langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2/src/langchain_mcp_tools.egg-info}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: langchain-mcp-tools
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.2
|
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
|
@@ -30,11 +30,14 @@ This package is intended to simplify the use of
|
|
30
30
|
server tools with LangChain / Python.
|
31
31
|
|
32
32
|
[Model Context Protocol (MCP)](https://modelcontextprotocol.io/),
|
33
|
-
an open
|
33
|
+
an open standard
|
34
34
|
[announced by Anthropic](https://www.anthropic.com/news/model-context-protocol),
|
35
35
|
dramatically expands LLM’s scope
|
36
36
|
by enabling external tool and resource integration, including
|
37
|
-
Google Drive, Slack, Notion, Spotify, Docker, PostgreSQL, and more…
|
37
|
+
GitHub, Google Drive, Slack, Notion, Spotify, Docker, PostgreSQL, and more…
|
38
|
+
|
39
|
+
MCP is likely to become the de facto industry standard as
|
40
|
+
[OpenAI has announced its adoption](https://techcrunch.com/2025/03/26/openai-adopts-rival-anthropics-standard-for-connecting-ai-models-to-data).
|
38
41
|
|
39
42
|
Over 2000 functional components available as MCP servers:
|
40
43
|
|
@@ -142,8 +145,23 @@ Note that the key `"url"` may be changed in the future to match
|
|
142
145
|
the MCP server configurations used by Claude for Desktop once
|
143
146
|
it introduces remote server support.
|
144
147
|
|
145
|
-
A usage example can be found [here](
|
146
|
-
|
148
|
+
A usage example can be found [here](https://github.com/hideya/langchain-mcp-tools-py-usage/blob/cf96ddc43750708ef3b244bad95714f0f2fe1d28/src/example.py#L43-L54)
|
149
|
+
|
150
|
+
### Passing HTTP Headers to SSE Connection
|
151
|
+
|
152
|
+
A new key `"headers"` has been introduced to pass HTTP headers to the SSE (Server-Sent Events) connection.
|
153
|
+
It takes `dict[str, str]` and is primarily intended to support SSE MCP servers
|
154
|
+
that require authentication via bearer tokens or other custom headers.
|
155
|
+
|
156
|
+
```python
|
157
|
+
"sse-server-name": {
|
158
|
+
"url": f"http://{sse_server_host}:{sse_server_port}/..."
|
159
|
+
"headers": {"Authorization": f"Bearer {bearer_token}"}
|
160
|
+
},
|
161
|
+
```
|
162
|
+
|
163
|
+
The key name `header` is derived from the Python SDK
|
164
|
+
[`sse_client()`](https://github.com/modelcontextprotocol/python-sdk/blob/babb477dffa33f46cdc886bc885eb1d521151430/src/mcp/client/sse.py#L24) argument name.
|
147
165
|
|
148
166
|
### Working Directory Configuration for Local MCP Servers
|
149
167
|
|
@@ -158,11 +176,12 @@ can be specified with the `"cwd"` key as follows:
|
|
158
176
|
},
|
159
177
|
```
|
160
178
|
|
161
|
-
The key name `cwd` is derived from
|
179
|
+
The key name `cwd` is derived from
|
180
|
+
Python SDK's [`StdioServerParameters`](https://github.com/modelcontextprotocol/python-sdk/blob/babb477dffa33f46cdc886bc885eb1d521151430/src/mcp/client/stdio/__init__.py#L76-L77).
|
162
181
|
|
163
182
|
### Configuration for Local MCP Server `stderr` Redirection
|
164
183
|
|
165
|
-
A new key `"errlog"` has been introduced
|
184
|
+
A new key `"errlog"` has been introduced to specify a file-like object
|
166
185
|
to which local (stdio) MCP server's stderr is redirected.
|
167
186
|
|
168
187
|
```python
|
@@ -172,13 +191,14 @@ to which local (stdio) MCP server's stderr is redirected.
|
|
172
191
|
```
|
173
192
|
|
174
193
|
A usage example can be found [here](
|
175
|
-
https://github.com/hideya/langchain-mcp-tools-py-usage/blob/
|
194
|
+
https://github.com/hideya/langchain-mcp-tools-py-usage/blob/cf96ddc43750708ef3b244bad95714f0f2fe1d28/src/example.py#L91-L108)
|
176
195
|
|
177
196
|
**NOTE: Why the key name `errlog` was chosen:**
|
178
197
|
Unlike TypeScript SDK's `StdioServerParameters`, the Python
|
179
|
-
SDK's `StdioServerParameters` doesn't include `stderr: int`.
|
180
|
-
Instead, it calls `stdio_client()` with a separate argument
|
181
|
-
`errlog: TextIO
|
198
|
+
SDK's `StdioServerParameters` doesn't include `stderr: int`.
|
199
|
+
Instead, it calls [`stdio_client()` with a separate argument
|
200
|
+
`errlog: TextIO`](https://github.com/modelcontextprotocol/python-sdk/blob/babb477dffa33f46cdc886bc885eb1d521151430/src/mcp/client/stdio/__init__.py#L96).
|
201
|
+
I once included `stderr: int` for
|
182
202
|
compatibility with the TypeScript version, but decided to
|
183
203
|
follow the Python SDK more closely.
|
184
204
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langchain_mcp_tools-0.2.1 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|