@ai-sdk/mcp 1.0.48 → 1.0.49
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/CHANGELOG.md +19 -0
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/tool/mcp-client.ts +4 -1
- package/src/tool/mcp-sse-transport.ts +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.49",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"pkce-challenge": "^5.0.0",
|
|
36
36
|
"@ai-sdk/provider": "3.0.10",
|
|
37
|
-
"@ai-sdk/provider-utils": "4.0.
|
|
37
|
+
"@ai-sdk/provider-utils": "4.0.29"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "20.17.24",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"typescript": "5.8.3",
|
|
43
43
|
"vitest": "^4.1.0",
|
|
44
44
|
"zod": "3.25.76",
|
|
45
|
-
"@
|
|
46
|
-
"@ai-
|
|
45
|
+
"@ai-sdk/test-server": "1.0.5",
|
|
46
|
+
"@vercel/ai-tsconfig": "0.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"zod": "^3.25.76 || ^4.1.8"
|
package/src/tool/mcp-client.ts
CHANGED
|
@@ -610,7 +610,10 @@ class DefaultMCPClient implements MCPClient {
|
|
|
610
610
|
_meta,
|
|
611
611
|
} of definitions.tools) {
|
|
612
612
|
const resolvedTitle = title ?? annotations?.title;
|
|
613
|
-
if (
|
|
613
|
+
if (
|
|
614
|
+
schemas !== 'automatic' &&
|
|
615
|
+
!Object.prototype.hasOwnProperty.call(schemas, name)
|
|
616
|
+
) {
|
|
614
617
|
continue;
|
|
615
618
|
}
|
|
616
619
|
|
|
@@ -161,14 +161,23 @@ export class SseMCPTransport implements MCPTransport {
|
|
|
161
161
|
const { event, data } = value;
|
|
162
162
|
|
|
163
163
|
if (event === 'endpoint') {
|
|
164
|
-
|
|
164
|
+
if (this.endpoint) {
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const endpoint = new URL(data, this.url);
|
|
165
169
|
|
|
166
|
-
if (
|
|
170
|
+
if (endpoint.origin !== this.url.origin) {
|
|
171
|
+
this.connected = false;
|
|
172
|
+
this.endpoint = undefined;
|
|
173
|
+
this.sseConnection?.close();
|
|
174
|
+
this.abortController?.abort();
|
|
167
175
|
throw new MCPClientError({
|
|
168
|
-
message: `MCP SSE Transport Error: Endpoint origin does not match connection origin: ${
|
|
176
|
+
message: `MCP SSE Transport Error: Endpoint origin does not match connection origin: ${endpoint.origin}`,
|
|
169
177
|
});
|
|
170
178
|
}
|
|
171
179
|
|
|
180
|
+
this.endpoint = endpoint;
|
|
172
181
|
this.connected = true;
|
|
173
182
|
resolve();
|
|
174
183
|
} else if (event === 'message') {
|
|
@@ -217,6 +226,7 @@ export class SseMCPTransport implements MCPTransport {
|
|
|
217
226
|
|
|
218
227
|
async close(): Promise<void> {
|
|
219
228
|
this.connected = false;
|
|
229
|
+
this.endpoint = undefined;
|
|
220
230
|
this.sseConnection?.close();
|
|
221
231
|
this.abortController?.abort();
|
|
222
232
|
this.onclose?.();
|