@mcp-use/client 2.0.1-canary.0 → 2.0.1
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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/core/config.d.ts +8 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/node.d.ts.map +1 -1
- package/dist/index-browser.js +1 -1
- package/dist/index-browser.js.map +1 -1
- package/dist/index.js +29 -7
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/transport/stdio.d.ts +22 -1
- package/dist/transport/stdio.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1009,6 +1009,7 @@ var init_stdio = __esm({
|
|
|
1009
1009
|
env;
|
|
1010
1010
|
cwd;
|
|
1011
1011
|
errlog;
|
|
1012
|
+
stderr;
|
|
1012
1013
|
clientInfo;
|
|
1013
1014
|
protocolNegotiation;
|
|
1014
1015
|
/**
|
|
@@ -1021,6 +1022,7 @@ var init_stdio = __esm({
|
|
|
1021
1022
|
args = [],
|
|
1022
1023
|
env,
|
|
1023
1024
|
errlog = process2.stderr,
|
|
1025
|
+
stderr = "pipe",
|
|
1024
1026
|
...rest
|
|
1025
1027
|
} = {}) {
|
|
1026
1028
|
super(rest);
|
|
@@ -1028,6 +1030,7 @@ var init_stdio = __esm({
|
|
|
1028
1030
|
this.args = args;
|
|
1029
1031
|
this.env = env;
|
|
1030
1032
|
this.errlog = errlog;
|
|
1033
|
+
this.stderr = stderr;
|
|
1031
1034
|
this.clientInfo = rest.clientInfo ?? {
|
|
1032
1035
|
name: "stdio-connector",
|
|
1033
1036
|
version: "1.0.0"
|
|
@@ -1053,7 +1056,8 @@ var init_stdio = __esm({
|
|
|
1053
1056
|
// The SDK layers explicit values over getDefaultEnvironment(). Passing
|
|
1054
1057
|
// the configured env through avoids exposing unrelated parent secrets.
|
|
1055
1058
|
env: this.env,
|
|
1056
|
-
cwd: this.cwd
|
|
1059
|
+
cwd: this.cwd,
|
|
1060
|
+
stderr: this.stderr
|
|
1057
1061
|
};
|
|
1058
1062
|
this.connectionManager = new StdioConnectionManager(
|
|
1059
1063
|
serverParams,
|
|
@@ -1143,6 +1147,10 @@ var init_stdio = __esm({
|
|
|
1143
1147
|
serverParams;
|
|
1144
1148
|
errlog;
|
|
1145
1149
|
_transport = null;
|
|
1150
|
+
_stderrSource = null;
|
|
1151
|
+
_onErrlogError = (error) => {
|
|
1152
|
+
logger.warn(`Error writing child stderr to errlog: ${error}`);
|
|
1153
|
+
};
|
|
1146
1154
|
/**
|
|
1147
1155
|
* Creates a connection manager for a local server process.
|
|
1148
1156
|
*
|
|
@@ -1155,16 +1163,29 @@ var init_stdio = __esm({
|
|
|
1155
1163
|
this.errlog = errlog;
|
|
1156
1164
|
}
|
|
1157
1165
|
async establishConnection() {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
this.
|
|
1161
|
-
|
|
1162
|
-
|
|
1166
|
+
const stderr = this.serverParams.stderr ?? "pipe";
|
|
1167
|
+
this._transport = new StdioClientTransport({
|
|
1168
|
+
...this.serverParams,
|
|
1169
|
+
stderr
|
|
1170
|
+
});
|
|
1171
|
+
const childStderr = this._transport.stderr;
|
|
1172
|
+
if (stderr === "pipe" && childStderr && "pipe" in childStderr) {
|
|
1173
|
+
this._stderrSource = childStderr;
|
|
1174
|
+
this._stderrSource.on("error", (error) => {
|
|
1175
|
+
logger.warn(`Error forwarding child stderr: ${error}`);
|
|
1176
|
+
});
|
|
1177
|
+
this.errlog.on("error", this._onErrlogError);
|
|
1178
|
+
this._stderrSource.pipe(this.errlog, { end: false });
|
|
1163
1179
|
}
|
|
1164
1180
|
logger.debug(`${this.constructor.name} connected successfully`);
|
|
1165
1181
|
return this._transport;
|
|
1166
1182
|
}
|
|
1167
1183
|
async closeConnection(_connection) {
|
|
1184
|
+
if (this._stderrSource) {
|
|
1185
|
+
this._stderrSource.unpipe(this.errlog);
|
|
1186
|
+
this.errlog.off("error", this._onErrlogError);
|
|
1187
|
+
this._stderrSource = null;
|
|
1188
|
+
}
|
|
1168
1189
|
if (this._transport) {
|
|
1169
1190
|
try {
|
|
1170
1191
|
await this._transport.close();
|
|
@@ -1198,7 +1219,7 @@ init_connector_telemetry();
|
|
|
1198
1219
|
init_logging();
|
|
1199
1220
|
|
|
1200
1221
|
// src/utils/version.ts
|
|
1201
|
-
var VERSION = "2.0.1
|
|
1222
|
+
var VERSION = "2.0.1";
|
|
1202
1223
|
function getPackageVersion() {
|
|
1203
1224
|
return VERSION;
|
|
1204
1225
|
}
|
|
@@ -5485,6 +5506,7 @@ var MCPClient = class _MCPClient extends BaseMCPClient {
|
|
|
5485
5506
|
args: stdioConfig.args,
|
|
5486
5507
|
env: stdioConfig.env,
|
|
5487
5508
|
cwd: stdioConfig.cwd,
|
|
5509
|
+
...stdioConfig.stderr !== void 0 && { stderr: stdioConfig.stderr },
|
|
5488
5510
|
protocolNegotiation: stdioConfig.protocolNegotiation,
|
|
5489
5511
|
clientInfo: normalizeClientInfo(merged.clientInfo),
|
|
5490
5512
|
roots: stdioConfig.roots,
|