@ai-sdk/mcp 2.0.0-beta.21 → 2.0.0-beta.23
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 +14 -0
- package/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -1
- package/dist/index.mjs.map +1 -1
- package/dist/mcp-stdio/index.js +2 -1
- package/dist/mcp-stdio/index.js.map +1 -1
- package/dist/mcp-stdio/index.mjs +2 -1
- package/dist/mcp-stdio/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/tool/mcp-client.ts +13 -0
- package/src/tool/types.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/mcp
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a98bf66: feat(mcp): surface 'serverInfo' exposed from the MCP server
|
|
8
|
+
|
|
9
|
+
## 2.0.0-beta.22
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [176466a]
|
|
14
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
15
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
16
|
+
|
|
3
17
|
## 2.0.0-beta.21
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -280,6 +280,12 @@ type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS e
|
|
|
280
280
|
inputSchema: FlexibleSchema<infer INPUT>;
|
|
281
281
|
} ? McpToolBase<INPUT, CallToolResult> : never;
|
|
282
282
|
} : Record<string, McpToolBase<unknown, CallToolResult>>;
|
|
283
|
+
declare const ClientOrServerImplementationSchema: z.ZodObject<{
|
|
284
|
+
name: z.ZodString;
|
|
285
|
+
version: z.ZodString;
|
|
286
|
+
title: z.ZodOptional<z.ZodString>;
|
|
287
|
+
}, z.core.$loose>;
|
|
288
|
+
type Configuration = z.infer<typeof ClientOrServerImplementationSchema>;
|
|
283
289
|
declare const BaseParamsSchema: z.ZodObject<{
|
|
284
290
|
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
285
291
|
}, z.core.$loose>;
|
|
@@ -479,6 +485,11 @@ interface MCPClientConfig {
|
|
|
479
485
|
}
|
|
480
486
|
declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
|
|
481
487
|
interface MCPClient {
|
|
488
|
+
/**
|
|
489
|
+
* Information about the connected MCP server, as reported during initialization.
|
|
490
|
+
* @see https://modelcontextprotocol.io/specification/2025-11-25/schema#implementation
|
|
491
|
+
*/
|
|
492
|
+
readonly serverInfo: Configuration;
|
|
482
493
|
tools<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(options?: {
|
|
483
494
|
schemas?: TOOL_SCHEMAS;
|
|
484
495
|
}): Promise<McpToolSet<TOOL_SCHEMAS>>;
|
|
@@ -519,4 +530,4 @@ interface MCPClient {
|
|
|
519
530
|
close: () => Promise<void>;
|
|
520
531
|
}
|
|
521
532
|
|
|
522
|
-
export { type ElicitResult, ElicitResultSchema, type ElicitationRequest, ElicitationRequestSchema, type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type ListToolsResult, type MCPClient, type ClientCapabilities as MCPClientCapabilities, type MCPClientConfig, type MCPTransport, type OAuthClientInformation, type OAuthClientMetadata, type OAuthClientProvider, type OAuthTokens, UnauthorizedError, auth, createMCPClient, type MCPClient as experimental_MCPClient, type ClientCapabilities as experimental_MCPClientCapabilities, type MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient };
|
|
533
|
+
export { type Configuration, type ElicitResult, ElicitResultSchema, type ElicitationRequest, ElicitationRequestSchema, type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type ListToolsResult, type MCPClient, type ClientCapabilities as MCPClientCapabilities, type MCPClientConfig, type MCPTransport, type OAuthClientInformation, type OAuthClientMetadata, type OAuthClientProvider, type OAuthTokens, UnauthorizedError, auth, createMCPClient, type MCPClient as experimental_MCPClient, type ClientCapabilities as experimental_MCPClientCapabilities, type MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -280,6 +280,12 @@ type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS e
|
|
|
280
280
|
inputSchema: FlexibleSchema<infer INPUT>;
|
|
281
281
|
} ? McpToolBase<INPUT, CallToolResult> : never;
|
|
282
282
|
} : Record<string, McpToolBase<unknown, CallToolResult>>;
|
|
283
|
+
declare const ClientOrServerImplementationSchema: z.ZodObject<{
|
|
284
|
+
name: z.ZodString;
|
|
285
|
+
version: z.ZodString;
|
|
286
|
+
title: z.ZodOptional<z.ZodString>;
|
|
287
|
+
}, z.core.$loose>;
|
|
288
|
+
type Configuration = z.infer<typeof ClientOrServerImplementationSchema>;
|
|
283
289
|
declare const BaseParamsSchema: z.ZodObject<{
|
|
284
290
|
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
285
291
|
}, z.core.$loose>;
|
|
@@ -479,6 +485,11 @@ interface MCPClientConfig {
|
|
|
479
485
|
}
|
|
480
486
|
declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
|
|
481
487
|
interface MCPClient {
|
|
488
|
+
/**
|
|
489
|
+
* Information about the connected MCP server, as reported during initialization.
|
|
490
|
+
* @see https://modelcontextprotocol.io/specification/2025-11-25/schema#implementation
|
|
491
|
+
*/
|
|
492
|
+
readonly serverInfo: Configuration;
|
|
482
493
|
tools<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(options?: {
|
|
483
494
|
schemas?: TOOL_SCHEMAS;
|
|
484
495
|
}): Promise<McpToolSet<TOOL_SCHEMAS>>;
|
|
@@ -519,4 +530,4 @@ interface MCPClient {
|
|
|
519
530
|
close: () => Promise<void>;
|
|
520
531
|
}
|
|
521
532
|
|
|
522
|
-
export { type ElicitResult, ElicitResultSchema, type ElicitationRequest, ElicitationRequestSchema, type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type ListToolsResult, type MCPClient, type ClientCapabilities as MCPClientCapabilities, type MCPClientConfig, type MCPTransport, type OAuthClientInformation, type OAuthClientMetadata, type OAuthClientProvider, type OAuthTokens, UnauthorizedError, auth, createMCPClient, type MCPClient as experimental_MCPClient, type ClientCapabilities as experimental_MCPClientCapabilities, type MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient };
|
|
533
|
+
export { type Configuration, type ElicitResult, ElicitResultSchema, type ElicitationRequest, ElicitationRequestSchema, type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type ListToolsResult, type MCPClient, type ClientCapabilities as MCPClientCapabilities, type MCPClientConfig, type MCPTransport, type OAuthClientInformation, type OAuthClientMetadata, type OAuthClientProvider, type OAuthTokens, UnauthorizedError, auth, createMCPClient, type MCPClient as experimental_MCPClient, type ClientCapabilities as experimental_MCPClientCapabilities, type MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient };
|
package/dist/index.js
CHANGED
|
@@ -84,7 +84,8 @@ var SUPPORTED_PROTOCOL_VERSIONS = [
|
|
|
84
84
|
var ToolMetaSchema = import_v4.z.optional(import_v4.z.record(import_v4.z.string(), import_v4.z.unknown()));
|
|
85
85
|
var ClientOrServerImplementationSchema = import_v4.z.looseObject({
|
|
86
86
|
name: import_v4.z.string(),
|
|
87
|
-
version: import_v4.z.string()
|
|
87
|
+
version: import_v4.z.string(),
|
|
88
|
+
title: import_v4.z.optional(import_v4.z.string())
|
|
88
89
|
});
|
|
89
90
|
var BaseParamsSchema = import_v4.z.looseObject({
|
|
90
91
|
_meta: import_v4.z.optional(import_v4.z.object({}).loose())
|
|
@@ -1667,6 +1668,7 @@ var DefaultMCPClient = class {
|
|
|
1667
1668
|
this.requestMessageId = 0;
|
|
1668
1669
|
this.responseHandlers = /* @__PURE__ */ new Map();
|
|
1669
1670
|
this.serverCapabilities = {};
|
|
1671
|
+
this._serverInfo = { name: "", version: "" };
|
|
1670
1672
|
this.isClosed = true;
|
|
1671
1673
|
this.onUncaughtError = onUncaughtError;
|
|
1672
1674
|
this.clientCapabilities = capabilities != null ? capabilities : {};
|
|
@@ -1697,6 +1699,9 @@ var DefaultMCPClient = class {
|
|
|
1697
1699
|
version
|
|
1698
1700
|
};
|
|
1699
1701
|
}
|
|
1702
|
+
get serverInfo() {
|
|
1703
|
+
return this._serverInfo;
|
|
1704
|
+
}
|
|
1700
1705
|
async init() {
|
|
1701
1706
|
try {
|
|
1702
1707
|
await this.transport.start();
|
|
@@ -1723,6 +1728,7 @@ var DefaultMCPClient = class {
|
|
|
1723
1728
|
});
|
|
1724
1729
|
}
|
|
1725
1730
|
this.serverCapabilities = result.capabilities;
|
|
1731
|
+
this._serverInfo = result.serverInfo;
|
|
1726
1732
|
await this.notification({
|
|
1727
1733
|
method: "notifications/initialized"
|
|
1728
1734
|
});
|