langchain-mcp-tools 0.2.0__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.0/src/langchain_mcp_tools.egg-info → langchain_mcp_tools-0.2.2}/PKG-INFO +47 -19
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/README.md +46 -18
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/pyproject.toml +1 -1
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools/langchain_mcp_tools.py +4 -6
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2/src/langchain_mcp_tools.egg-info}/PKG-INFO +47 -19
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/LICENSE +0 -0
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/setup.cfg +0 -0
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools/__init__.py +0 -0
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools/py.typed +0 -0
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools.egg-info/SOURCES.txt +0 -0
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools.egg-info/dependency_links.txt +0 -0
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools.egg-info/requires.txt +0 -0
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/src/langchain_mcp_tools.egg-info/top_level.txt +0 -0
- {langchain_mcp_tools-0.2.0 → langchain_mcp_tools-0.2.2}/tests/test_langchain_mcp_tools.py +0 -0
{langchain_mcp_tools-0.2.0/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
|
|
@@ -66,6 +69,9 @@ pip install langchain-mcp-tools
|
|
66
69
|
|
67
70
|
## Quick Start
|
68
71
|
|
72
|
+
A minimal but complete working usage example can be found
|
73
|
+
[in this example in the langchain-mcp-tools-py-usage repo](https://github.com/hideya/langchain-mcp-tools-py-usage/blob/main/src/example.py)
|
74
|
+
|
69
75
|
`convert_mcp_to_langchain_tools()` utility function accepts MCP server configurations
|
70
76
|
that follow the same structure as
|
71
77
|
[Claude for Desktop](https://modelcontextprotocol.io/quickstart/user),
|
@@ -102,8 +108,8 @@ The returned tools can be used with LangChain, e.g.:
|
|
102
108
|
```python
|
103
109
|
# from langchain.chat_models import init_chat_model
|
104
110
|
llm = init_chat_model(
|
105
|
-
model=
|
106
|
-
model_provider=
|
111
|
+
model="claude-3-7-sonnet-latest",
|
112
|
+
model_provider="anthropic"
|
107
113
|
)
|
108
114
|
|
109
115
|
# from langgraph.prebuilt import create_react_agent
|
@@ -113,9 +119,6 @@ agent = create_react_agent(
|
|
113
119
|
)
|
114
120
|
```
|
115
121
|
|
116
|
-
Find complete, minimal working usage examples
|
117
|
-
[here](https://github.com/hideya/langchain-mcp-tools-py-usage/blob/main/src/example.py)
|
118
|
-
|
119
122
|
For hands-on experimentation with MCP server integration,
|
120
123
|
try [this LangChain application built with the utility](https://github.com/hideya/mcp-client-langchain-py)
|
121
124
|
|
@@ -138,14 +141,32 @@ For detailed information on how to use this library, please refer to the followi
|
|
138
141
|
},
|
139
142
|
```
|
140
143
|
|
141
|
-
Note that the key
|
144
|
+
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
|
|
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.
|
165
|
+
|
145
166
|
### Working Directory Configuration for Local MCP Servers
|
146
167
|
|
147
|
-
The working directory that is used when spawning a local MCP server
|
148
|
-
can be specified with the `cwd` key as follows:
|
168
|
+
The working directory that is used when spawning a local (stdio) MCP server
|
169
|
+
can be specified with the `"cwd"` key as follows:
|
149
170
|
|
150
171
|
```python
|
151
172
|
"local-server-name": {
|
@@ -155,10 +176,13 @@ can be specified with the `cwd` key as follows:
|
|
155
176
|
},
|
156
177
|
```
|
157
178
|
|
158
|
-
|
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).
|
181
|
+
|
182
|
+
### Configuration for Local MCP Server `stderr` Redirection
|
159
183
|
|
160
|
-
A new key `errlog` has been introduced
|
161
|
-
to which MCP server's stderr is redirected.
|
184
|
+
A new key `"errlog"` has been introduced to specify a file-like object
|
185
|
+
to which local (stdio) MCP server's stderr is redirected.
|
162
186
|
|
163
187
|
```python
|
164
188
|
log_path = f"mcp-server-{server_name}.log"
|
@@ -166,18 +190,22 @@ to which MCP server's stderr is redirected.
|
|
166
190
|
mcp_servers[server_name]["errlog"] = log_file
|
167
191
|
```
|
168
192
|
|
169
|
-
|
193
|
+
A usage example can be found [here](
|
194
|
+
https://github.com/hideya/langchain-mcp-tools-py-usage/blob/cf96ddc43750708ef3b244bad95714f0f2fe1d28/src/example.py#L91-L108)
|
195
|
+
|
196
|
+
**NOTE: Why the key name `errlog` was chosen:**
|
170
197
|
Unlike TypeScript SDK's `StdioServerParameters`, the Python
|
171
|
-
SDK's `StdioServerParameters` doesn't include `stderr: int`.
|
172
|
-
Instead, it calls `stdio_client()` with a separate argument
|
173
|
-
`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
|
174
202
|
compatibility with the TypeScript version, but decided to
|
175
203
|
follow the Python SDK more closely.
|
176
204
|
|
177
205
|
## Limitations
|
178
206
|
|
179
207
|
- Currently, only text results of tool calls are supported.
|
180
|
-
-
|
208
|
+
- MCP features other than [Tools](https://modelcontextprotocol.io/docs/concepts/tools) are not supported.
|
181
209
|
|
182
210
|
## Change Log
|
183
211
|
|
@@ -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
|
|
@@ -41,6 +44,9 @@ pip install langchain-mcp-tools
|
|
41
44
|
|
42
45
|
## Quick Start
|
43
46
|
|
47
|
+
A minimal but complete working usage example can be found
|
48
|
+
[in this example in the langchain-mcp-tools-py-usage repo](https://github.com/hideya/langchain-mcp-tools-py-usage/blob/main/src/example.py)
|
49
|
+
|
44
50
|
`convert_mcp_to_langchain_tools()` utility function accepts MCP server configurations
|
45
51
|
that follow the same structure as
|
46
52
|
[Claude for Desktop](https://modelcontextprotocol.io/quickstart/user),
|
@@ -77,8 +83,8 @@ The returned tools can be used with LangChain, e.g.:
|
|
77
83
|
```python
|
78
84
|
# from langchain.chat_models import init_chat_model
|
79
85
|
llm = init_chat_model(
|
80
|
-
model=
|
81
|
-
model_provider=
|
86
|
+
model="claude-3-7-sonnet-latest",
|
87
|
+
model_provider="anthropic"
|
82
88
|
)
|
83
89
|
|
84
90
|
# from langgraph.prebuilt import create_react_agent
|
@@ -88,9 +94,6 @@ agent = create_react_agent(
|
|
88
94
|
)
|
89
95
|
```
|
90
96
|
|
91
|
-
Find complete, minimal working usage examples
|
92
|
-
[here](https://github.com/hideya/langchain-mcp-tools-py-usage/blob/main/src/example.py)
|
93
|
-
|
94
97
|
For hands-on experimentation with MCP server integration,
|
95
98
|
try [this LangChain application built with the utility](https://github.com/hideya/mcp-client-langchain-py)
|
96
99
|
|
@@ -113,14 +116,32 @@ For detailed information on how to use this library, please refer to the followi
|
|
113
116
|
},
|
114
117
|
```
|
115
118
|
|
116
|
-
Note that the key
|
119
|
+
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
|
|
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.
|
140
|
+
|
120
141
|
### Working Directory Configuration for Local MCP Servers
|
121
142
|
|
122
|
-
The working directory that is used when spawning a local MCP server
|
123
|
-
can be specified with the `cwd` key as follows:
|
143
|
+
The working directory that is used when spawning a local (stdio) MCP server
|
144
|
+
can be specified with the `"cwd"` key as follows:
|
124
145
|
|
125
146
|
```python
|
126
147
|
"local-server-name": {
|
@@ -130,10 +151,13 @@ can be specified with the `cwd` key as follows:
|
|
130
151
|
},
|
131
152
|
```
|
132
153
|
|
133
|
-
|
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).
|
156
|
+
|
157
|
+
### Configuration for Local MCP Server `stderr` Redirection
|
134
158
|
|
135
|
-
A new key `errlog` has been introduced
|
136
|
-
to which MCP server's stderr is redirected.
|
159
|
+
A new key `"errlog"` has been introduced to specify a file-like object
|
160
|
+
to which local (stdio) MCP server's stderr is redirected.
|
137
161
|
|
138
162
|
```python
|
139
163
|
log_path = f"mcp-server-{server_name}.log"
|
@@ -141,18 +165,22 @@ to which MCP server's stderr is redirected.
|
|
141
165
|
mcp_servers[server_name]["errlog"] = log_file
|
142
166
|
```
|
143
167
|
|
144
|
-
|
168
|
+
A usage example can be found [here](
|
169
|
+
https://github.com/hideya/langchain-mcp-tools-py-usage/blob/cf96ddc43750708ef3b244bad95714f0f2fe1d28/src/example.py#L91-L108)
|
170
|
+
|
171
|
+
**NOTE: Why the key name `errlog` was chosen:**
|
145
172
|
Unlike TypeScript SDK's `StdioServerParameters`, the Python
|
146
|
-
SDK's `StdioServerParameters` doesn't include `stderr: int`.
|
147
|
-
Instead, it calls `stdio_client()` with a separate argument
|
148
|
-
`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
|
149
177
|
compatibility with the TypeScript version, but decided to
|
150
178
|
follow the Python SDK more closely.
|
151
179
|
|
152
180
|
## Limitations
|
153
181
|
|
154
182
|
- Currently, only text results of tool calls are supported.
|
155
|
-
-
|
183
|
+
- MCP features other than [Tools](https://modelcontextprotocol.io/docs/concepts/tools) are not supported.
|
156
184
|
|
157
185
|
## Change Log
|
158
186
|
|
@@ -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.0 → 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
|
|
@@ -66,6 +69,9 @@ pip install langchain-mcp-tools
|
|
66
69
|
|
67
70
|
## Quick Start
|
68
71
|
|
72
|
+
A minimal but complete working usage example can be found
|
73
|
+
[in this example in the langchain-mcp-tools-py-usage repo](https://github.com/hideya/langchain-mcp-tools-py-usage/blob/main/src/example.py)
|
74
|
+
|
69
75
|
`convert_mcp_to_langchain_tools()` utility function accepts MCP server configurations
|
70
76
|
that follow the same structure as
|
71
77
|
[Claude for Desktop](https://modelcontextprotocol.io/quickstart/user),
|
@@ -102,8 +108,8 @@ The returned tools can be used with LangChain, e.g.:
|
|
102
108
|
```python
|
103
109
|
# from langchain.chat_models import init_chat_model
|
104
110
|
llm = init_chat_model(
|
105
|
-
model=
|
106
|
-
model_provider=
|
111
|
+
model="claude-3-7-sonnet-latest",
|
112
|
+
model_provider="anthropic"
|
107
113
|
)
|
108
114
|
|
109
115
|
# from langgraph.prebuilt import create_react_agent
|
@@ -113,9 +119,6 @@ agent = create_react_agent(
|
|
113
119
|
)
|
114
120
|
```
|
115
121
|
|
116
|
-
Find complete, minimal working usage examples
|
117
|
-
[here](https://github.com/hideya/langchain-mcp-tools-py-usage/blob/main/src/example.py)
|
118
|
-
|
119
122
|
For hands-on experimentation with MCP server integration,
|
120
123
|
try [this LangChain application built with the utility](https://github.com/hideya/mcp-client-langchain-py)
|
121
124
|
|
@@ -138,14 +141,32 @@ For detailed information on how to use this library, please refer to the followi
|
|
138
141
|
},
|
139
142
|
```
|
140
143
|
|
141
|
-
Note that the key
|
144
|
+
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
|
|
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.
|
165
|
+
|
145
166
|
### Working Directory Configuration for Local MCP Servers
|
146
167
|
|
147
|
-
The working directory that is used when spawning a local MCP server
|
148
|
-
can be specified with the `cwd` key as follows:
|
168
|
+
The working directory that is used when spawning a local (stdio) MCP server
|
169
|
+
can be specified with the `"cwd"` key as follows:
|
149
170
|
|
150
171
|
```python
|
151
172
|
"local-server-name": {
|
@@ -155,10 +176,13 @@ can be specified with the `cwd` key as follows:
|
|
155
176
|
},
|
156
177
|
```
|
157
178
|
|
158
|
-
|
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).
|
181
|
+
|
182
|
+
### Configuration for Local MCP Server `stderr` Redirection
|
159
183
|
|
160
|
-
A new key `errlog` has been introduced
|
161
|
-
to which MCP server's stderr is redirected.
|
184
|
+
A new key `"errlog"` has been introduced to specify a file-like object
|
185
|
+
to which local (stdio) MCP server's stderr is redirected.
|
162
186
|
|
163
187
|
```python
|
164
188
|
log_path = f"mcp-server-{server_name}.log"
|
@@ -166,18 +190,22 @@ to which MCP server's stderr is redirected.
|
|
166
190
|
mcp_servers[server_name]["errlog"] = log_file
|
167
191
|
```
|
168
192
|
|
169
|
-
|
193
|
+
A usage example can be found [here](
|
194
|
+
https://github.com/hideya/langchain-mcp-tools-py-usage/blob/cf96ddc43750708ef3b244bad95714f0f2fe1d28/src/example.py#L91-L108)
|
195
|
+
|
196
|
+
**NOTE: Why the key name `errlog` was chosen:**
|
170
197
|
Unlike TypeScript SDK's `StdioServerParameters`, the Python
|
171
|
-
SDK's `StdioServerParameters` doesn't include `stderr: int`.
|
172
|
-
Instead, it calls `stdio_client()` with a separate argument
|
173
|
-
`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
|
174
202
|
compatibility with the TypeScript version, but decided to
|
175
203
|
follow the Python SDK more closely.
|
176
204
|
|
177
205
|
## Limitations
|
178
206
|
|
179
207
|
- Currently, only text results of tool calls are supported.
|
180
|
-
-
|
208
|
+
- MCP features other than [Tools](https://modelcontextprotocol.io/docs/concepts/tools) are not supported.
|
181
209
|
|
182
210
|
## Change Log
|
183
211
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langchain_mcp_tools-0.2.0 → 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
|