mcp-use 1.34.2 → 1.34.3
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/{chunk-QNMWBM3V.js → chunk-4GUL52TF.js} +1 -1
- package/dist/{chunk-3L7F47SI.js → chunk-BJIP3NFE.js} +4 -4
- package/dist/{chunk-Z3NHDOLS.js → chunk-CQPVGLM4.js} +1 -1
- package/dist/{chunk-P2JIVJY6.js → chunk-CXHJETCQ.js} +4 -4
- package/dist/{chunk-VJAQ2A7N.js → chunk-GTLSCTCO.js} +1 -1
- package/dist/{chunk-EJOL74UE.js → chunk-J67NWN5H.js} +1 -1
- package/dist/{chunk-6DJM56C3.js → chunk-KWYZMUVB.js} +2 -2
- package/dist/chunk-KX7P6L43.js +171 -0
- package/dist/{chunk-VT4KQHJI.js → chunk-MCYFETK3.js} +2 -2
- package/dist/{chunk-DENFIIV2.js → chunk-NJPLVA2I.js} +1 -1
- package/dist/chunk-NQYSWKWJ.js +2609 -0
- package/dist/{chunk-OYFQOSSW.js → chunk-NYIMA6MZ.js} +1 -1
- package/dist/chunk-PJB2MFKZ.js +954 -0
- package/dist/chunk-PSD6ATRG.js +562 -0
- package/dist/{chunk-T3QVQIYU.js → chunk-QLKY4PK3.js} +5 -5
- package/dist/chunk-SUVUANZ3.js +594 -0
- package/dist/chunk-XHP35F4S.js +204 -0
- package/dist/chunk-ZLHL3BY6.js +2690 -0
- package/dist/{client-24ODJASB.js → client-VKWZPQCL.js} +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +6 -6
- package/dist/src/agents/index.cjs +1 -1
- package/dist/src/agents/index.js +4 -4
- package/dist/src/browser-agent.cjs +1 -1
- package/dist/src/browser-agent.js +2 -2
- package/dist/src/browser.cjs +1 -1
- package/dist/src/browser.js +4 -4
- package/dist/src/client.cjs +1 -1
- package/dist/src/client.js +4 -4
- package/dist/src/react/index.cjs +1 -1
- package/dist/src/react/index.js +4 -4
- package/dist/src/server/index.cjs +1 -1
- package/dist/src/server/index.js +7 -7
- package/dist/src/version.d.ts +1 -1
- package/dist/{stdio-CG6YESIU.js → stdio-37X7ETM7.js} +3 -3
- package/dist/{stdio-KZLWEEYB.js → stdio-CSGVA5IJ.js} +2 -2
- package/dist/stdio-FUBSRH66.js +13 -0
- package/dist/{tool-execution-helpers-GVP22F32.js → tool-execution-helpers-4LIAFMYM.js} +2 -2
- package/dist/tool-execution-helpers-HPVG5WVB.js +27 -0
- package/package.json +3 -3
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
telFetch
|
|
3
|
-
} from "./chunk-BXZHMYMM.js";
|
|
4
1
|
import {
|
|
5
2
|
generateUUID
|
|
6
3
|
} from "./chunk-MTHLLDCX.js";
|
|
7
4
|
import {
|
|
8
5
|
logger
|
|
9
6
|
} from "./chunk-QWQYAQCK.js";
|
|
7
|
+
import {
|
|
8
|
+
telFetch
|
|
9
|
+
} from "./chunk-BXZHMYMM.js";
|
|
10
10
|
import {
|
|
11
11
|
__name,
|
|
12
12
|
__require
|
|
13
13
|
} from "./chunk-3GQAWCBQ.js";
|
|
14
14
|
|
|
15
15
|
// src/version.ts
|
|
16
|
-
var VERSION = "1.34.
|
|
16
|
+
var VERSION = "1.34.3";
|
|
17
17
|
function getPackageVersion() {
|
|
18
18
|
return VERSION;
|
|
19
19
|
}
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
} from "./chunk-GKPKUKD6.js";
|
|
4
4
|
import {
|
|
5
5
|
CodeModeConnector
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XHP35F4S.js";
|
|
7
7
|
import {
|
|
8
8
|
BaseConnector
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NYIMA6MZ.js";
|
|
10
10
|
import {
|
|
11
11
|
JSONSchemaToZod
|
|
12
12
|
} from "./chunk-LG5NSHEL.js";
|
|
13
13
|
import {
|
|
14
14
|
Tel,
|
|
15
15
|
getPackageVersion
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PJB2MFKZ.js";
|
|
17
17
|
import {
|
|
18
18
|
logger
|
|
19
19
|
} from "./chunk-QWQYAQCK.js";
|
|
@@ -2356,7 +2356,7 @@ var MCPClient = class _MCPClient extends BaseMCPClient {
|
|
|
2356
2356
|
clientInfo: serverConfig.clientInfo ?? this.config.clientInfo
|
|
2357
2357
|
};
|
|
2358
2358
|
if ("command" in merged && "args" in merged) {
|
|
2359
|
-
const { StdioConnector } = await import("./stdio-
|
|
2359
|
+
const { StdioConnector } = await import("./stdio-37X7ETM7.js");
|
|
2360
2360
|
const stdioConfig = merged;
|
|
2361
2361
|
return new StdioConnector({
|
|
2362
2362
|
command: stdioConfig.command,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseConnector,
|
|
3
3
|
ConnectionManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4GUL52TF.js";
|
|
5
5
|
import {
|
|
6
6
|
Tel,
|
|
7
7
|
getPackageVersion
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CQPVGLM4.js";
|
|
9
9
|
import {
|
|
10
10
|
logger
|
|
11
11
|
} from "./chunk-QWQYAQCK.js";
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConnectionManager
|
|
3
|
+
} from "./chunk-GKPKUKD6.js";
|
|
4
|
+
import {
|
|
5
|
+
BaseConnector
|
|
6
|
+
} from "./chunk-PSD6ATRG.js";
|
|
7
|
+
import {
|
|
8
|
+
logger
|
|
9
|
+
} from "./chunk-QWQYAQCK.js";
|
|
10
|
+
import {
|
|
11
|
+
__name
|
|
12
|
+
} from "./chunk-3GQAWCBQ.js";
|
|
13
|
+
|
|
14
|
+
// src/connectors/stdio.ts
|
|
15
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
16
|
+
import process2 from "process";
|
|
17
|
+
|
|
18
|
+
// src/task_managers/stdio.ts
|
|
19
|
+
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
20
|
+
var StdioConnectionManager = class extends ConnectionManager {
|
|
21
|
+
static {
|
|
22
|
+
__name(this, "StdioConnectionManager");
|
|
23
|
+
}
|
|
24
|
+
serverParams;
|
|
25
|
+
errlog;
|
|
26
|
+
_transport = null;
|
|
27
|
+
/**
|
|
28
|
+
* Create a new stdio connection manager.
|
|
29
|
+
*
|
|
30
|
+
* @param serverParams Parameters for the stdio server process.
|
|
31
|
+
* @param errlog Stream to which the server's stderr should be piped.
|
|
32
|
+
* Defaults to `process.stderr`.
|
|
33
|
+
*/
|
|
34
|
+
constructor(serverParams, errlog = process.stderr) {
|
|
35
|
+
super();
|
|
36
|
+
this.serverParams = serverParams;
|
|
37
|
+
this.errlog = errlog;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Establish the stdio connection by spawning the server process and starting
|
|
41
|
+
* the SDK's transport. Returns the live `StdioClientTransport` instance.
|
|
42
|
+
*/
|
|
43
|
+
async establishConnection() {
|
|
44
|
+
this._transport = new StdioClientTransport(this.serverParams);
|
|
45
|
+
if (this._transport.stderr && typeof this._transport.stderr.pipe === "function") {
|
|
46
|
+
this._transport.stderr.pipe(
|
|
47
|
+
this.errlog
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
logger.debug(`${this.constructor.name} connected successfully`);
|
|
51
|
+
return this._transport;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Close the stdio connection, making sure the transport cleans up the child
|
|
55
|
+
* process and associated resources.
|
|
56
|
+
*/
|
|
57
|
+
async closeConnection(_connection) {
|
|
58
|
+
if (this._transport) {
|
|
59
|
+
try {
|
|
60
|
+
await this._transport.close();
|
|
61
|
+
} catch (e) {
|
|
62
|
+
logger.warn(`Error closing stdio transport: ${e}`);
|
|
63
|
+
} finally {
|
|
64
|
+
this._transport = null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/connectors/stdio.ts
|
|
71
|
+
var StdioConnector = class extends BaseConnector {
|
|
72
|
+
static {
|
|
73
|
+
__name(this, "StdioConnector");
|
|
74
|
+
}
|
|
75
|
+
command;
|
|
76
|
+
args;
|
|
77
|
+
env;
|
|
78
|
+
cwd;
|
|
79
|
+
errlog;
|
|
80
|
+
clientInfo;
|
|
81
|
+
constructor({
|
|
82
|
+
command = "npx",
|
|
83
|
+
args = [],
|
|
84
|
+
env,
|
|
85
|
+
errlog = process2.stderr,
|
|
86
|
+
...rest
|
|
87
|
+
} = {}) {
|
|
88
|
+
super(rest);
|
|
89
|
+
this.command = command;
|
|
90
|
+
this.args = args;
|
|
91
|
+
this.env = env;
|
|
92
|
+
this.errlog = errlog;
|
|
93
|
+
this.clientInfo = rest.clientInfo ?? {
|
|
94
|
+
name: "stdio-connector",
|
|
95
|
+
version: "1.0.0"
|
|
96
|
+
};
|
|
97
|
+
this.cwd = rest.cwd;
|
|
98
|
+
}
|
|
99
|
+
/** Establish connection to the MCP implementation. */
|
|
100
|
+
async connect() {
|
|
101
|
+
if (this.connected) {
|
|
102
|
+
logger.debug("Already connected to MCP implementation");
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
logger.debug(`Connecting to MCP implementation via stdio: ${this.command}`);
|
|
106
|
+
try {
|
|
107
|
+
let mergedEnv;
|
|
108
|
+
if (this.env) {
|
|
109
|
+
mergedEnv = {};
|
|
110
|
+
for (const [key, value] of Object.entries(process2.env)) {
|
|
111
|
+
if (value !== void 0) {
|
|
112
|
+
mergedEnv[key] = value;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
Object.assign(mergedEnv, this.env);
|
|
116
|
+
}
|
|
117
|
+
const serverParams = {
|
|
118
|
+
command: this.command,
|
|
119
|
+
args: this.args,
|
|
120
|
+
env: mergedEnv,
|
|
121
|
+
cwd: this.cwd
|
|
122
|
+
};
|
|
123
|
+
this.connectionManager = new StdioConnectionManager(
|
|
124
|
+
serverParams,
|
|
125
|
+
this.errlog
|
|
126
|
+
);
|
|
127
|
+
const transport = await this.connectionManager.start();
|
|
128
|
+
const clientOptions = {
|
|
129
|
+
...this.opts.clientOptions || {},
|
|
130
|
+
capabilities: {
|
|
131
|
+
...this.opts.clientOptions?.capabilities || {},
|
|
132
|
+
roots: { listChanged: true },
|
|
133
|
+
// Always advertise roots capability
|
|
134
|
+
// Add sampling capability if callback is provided
|
|
135
|
+
...this.opts.onSampling ?? this.opts.samplingCallback ? { sampling: {} } : {},
|
|
136
|
+
// Add elicitation capability if callback is provided
|
|
137
|
+
...this.opts.onElicitation ?? this.opts.elicitationCallback ? { elicitation: { form: {}, url: {} } } : {}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
this.client = new Client(this.clientInfo, clientOptions);
|
|
141
|
+
await this.client.connect(transport);
|
|
142
|
+
this.connected = true;
|
|
143
|
+
this.setupNotificationHandler();
|
|
144
|
+
this.setupRootsHandler();
|
|
145
|
+
this.setupSamplingHandler();
|
|
146
|
+
this.setupElicitationHandler();
|
|
147
|
+
logger.debug(
|
|
148
|
+
`Successfully connected to MCP implementation: ${this.command}`
|
|
149
|
+
);
|
|
150
|
+
this.trackConnectorInit({
|
|
151
|
+
serverCommand: this.command,
|
|
152
|
+
serverArgs: this.args,
|
|
153
|
+
publicIdentifier: `${this.command} ${this.args.join(" ")}`
|
|
154
|
+
});
|
|
155
|
+
} catch (err) {
|
|
156
|
+
logger.error(`Failed to connect to MCP implementation: ${err}`);
|
|
157
|
+
await this.cleanupResources();
|
|
158
|
+
throw err;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
get publicIdentifier() {
|
|
162
|
+
return {
|
|
163
|
+
type: "stdio",
|
|
164
|
+
"command&args": `${this.command} ${this.args.join(" ")}`
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export {
|
|
170
|
+
StdioConnector
|
|
171
|
+
};
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
HttpConnector,
|
|
4
4
|
normalizeClientInfo,
|
|
5
5
|
resolveCallbacks
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KWYZMUVB.js";
|
|
7
7
|
import {
|
|
8
8
|
Tel,
|
|
9
9
|
getPackageVersion
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CQPVGLM4.js";
|
|
11
11
|
import {
|
|
12
12
|
logger
|
|
13
13
|
} from "./chunk-QWQYAQCK.js";
|