ai 4.1.60 → 4.1.62

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # ai
2
2
 
3
+ ## 4.1.62
4
+
5
+ ### Patch Changes
6
+
7
+ - c9ed3c4: feat: enable custom mcp transports
8
+ breaking change: remove internal stdio transport creation
9
+
10
+ ## 4.1.61
11
+
12
+ ### Patch Changes
13
+
14
+ - 2e1101a: feat (provider/openai): pdf input support
15
+ - Updated dependencies [2e1101a]
16
+ - @ai-sdk/provider@1.0.11
17
+ - @ai-sdk/provider-utils@2.1.13
18
+ - @ai-sdk/ui-utils@1.1.19
19
+ - @ai-sdk/react@1.1.23
20
+
3
21
  ## 4.1.60
4
22
 
5
23
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -8,8 +8,6 @@ import { ServerResponse } from 'node:http';
8
8
  import { AttributeValue, Tracer } from '@opentelemetry/api';
9
9
  import { z } from 'zod';
10
10
  import { ServerResponse as ServerResponse$1 } from 'http';
11
- import { IOType } from 'node:child_process';
12
- import { Stream } from 'node:stream';
13
11
 
14
12
  /**
15
13
  Language model that is used by the AI SDK Core functions.
@@ -674,6 +672,10 @@ interface FilePart {
674
672
  */
675
673
  data: DataContent | URL;
676
674
  /**
675
+ Optional filename of the file.
676
+ */
677
+ filename?: string;
678
+ /**
677
679
  Mime type of the file.
678
680
  */
679
681
  mimeType: string;
@@ -1706,6 +1708,153 @@ onlyBar('bar');
1706
1708
  */
1707
1709
  type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
1708
1710
 
1711
+ declare const JSONRPCMessageSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
1712
+ jsonrpc: z.ZodLiteral<"2.0">;
1713
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
1714
+ }, {
1715
+ method: z.ZodString;
1716
+ params: z.ZodOptional<z.ZodObject<{
1717
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1718
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1719
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1720
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1721
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1722
+ }, z.ZodTypeAny, "passthrough">>>;
1723
+ }>, "strict", z.ZodTypeAny, {
1724
+ id: string | number;
1725
+ method: string;
1726
+ jsonrpc: "2.0";
1727
+ params?: z.objectOutputType<{
1728
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1729
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1730
+ }, {
1731
+ id: string | number;
1732
+ method: string;
1733
+ jsonrpc: "2.0";
1734
+ params?: z.objectInputType<{
1735
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1736
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1737
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1738
+ jsonrpc: z.ZodLiteral<"2.0">;
1739
+ }, {
1740
+ method: z.ZodString;
1741
+ params: z.ZodOptional<z.ZodObject<{
1742
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1743
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1744
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1745
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1746
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1747
+ }, z.ZodTypeAny, "passthrough">>>;
1748
+ }>, "strict", z.ZodTypeAny, {
1749
+ method: string;
1750
+ jsonrpc: "2.0";
1751
+ params?: z.objectOutputType<{
1752
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1753
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1754
+ }, {
1755
+ method: string;
1756
+ jsonrpc: "2.0";
1757
+ params?: z.objectInputType<{
1758
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1759
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1760
+ }>, z.ZodObject<{
1761
+ jsonrpc: z.ZodLiteral<"2.0">;
1762
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
1763
+ result: z.ZodObject<{
1764
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1765
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1766
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1767
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1768
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1769
+ }, z.ZodTypeAny, "passthrough">>;
1770
+ }, "strict", z.ZodTypeAny, {
1771
+ result: {
1772
+ _meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1773
+ } & {
1774
+ [k: string]: unknown;
1775
+ };
1776
+ id: string | number;
1777
+ jsonrpc: "2.0";
1778
+ }, {
1779
+ result: {
1780
+ _meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1781
+ } & {
1782
+ [k: string]: unknown;
1783
+ };
1784
+ id: string | number;
1785
+ jsonrpc: "2.0";
1786
+ }>, z.ZodObject<{
1787
+ jsonrpc: z.ZodLiteral<"2.0">;
1788
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
1789
+ error: z.ZodObject<{
1790
+ code: z.ZodNumber;
1791
+ message: z.ZodString;
1792
+ data: z.ZodOptional<z.ZodUnknown>;
1793
+ }, "strip", z.ZodTypeAny, {
1794
+ code: number;
1795
+ message: string;
1796
+ data?: unknown;
1797
+ }, {
1798
+ code: number;
1799
+ message: string;
1800
+ data?: unknown;
1801
+ }>;
1802
+ }, "strict", z.ZodTypeAny, {
1803
+ error: {
1804
+ code: number;
1805
+ message: string;
1806
+ data?: unknown;
1807
+ };
1808
+ id: string | number;
1809
+ jsonrpc: "2.0";
1810
+ }, {
1811
+ error: {
1812
+ code: number;
1813
+ message: string;
1814
+ data?: unknown;
1815
+ };
1816
+ id: string | number;
1817
+ jsonrpc: "2.0";
1818
+ }>]>;
1819
+ type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;
1820
+
1821
+ /**
1822
+ * Transport interface for MCP (Model Context Protocol) communication.
1823
+ * Maps to the `Transport` interface in the MCP spec.
1824
+ */
1825
+ interface MCPTransport {
1826
+ /**
1827
+ * Initialize and start the transport
1828
+ */
1829
+ start(): Promise<void>;
1830
+ /**
1831
+ * Send a JSON-RPC message through the transport
1832
+ * @param message The JSON-RPC message to send
1833
+ */
1834
+ send(message: JSONRPCMessage): Promise<void>;
1835
+ /**
1836
+ * Clean up and close the transport
1837
+ */
1838
+ close(): Promise<void>;
1839
+ /**
1840
+ * Event handler for transport closure
1841
+ */
1842
+ onclose?: () => void;
1843
+ /**
1844
+ * Event handler for transport errors
1845
+ */
1846
+ onerror?: (error: Error) => void;
1847
+ /**
1848
+ * Event handler for received messages
1849
+ */
1850
+ onmessage?: (message: JSONRPCMessage) => void;
1851
+ }
1852
+ interface SSEConfig {
1853
+ type: 'sse';
1854
+ url: string;
1855
+ }
1856
+ type MCPTransportConfig = SSEConfig;
1857
+
1709
1858
  type ToolSchemas = Record<string, {
1710
1859
  parameters: ToolParameters;
1711
1860
  }> | 'automatic' | undefined;
@@ -1720,19 +1869,6 @@ type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS e
1720
1869
  execute: (args: unknown, options: ToolExecutionOptions) => PromiseLike<CallToolResult>;
1721
1870
  };
1722
1871
  };
1723
- interface McpStdioServerConfig {
1724
- command: string;
1725
- args?: string[];
1726
- env?: Record<string, string>;
1727
- stderr?: IOType | Stream | number;
1728
- cwd?: string;
1729
- type: 'stdio';
1730
- }
1731
- interface McpSSEServerConfig {
1732
- type: 'sse';
1733
- url: string;
1734
- }
1735
- type TransportConfig = McpStdioServerConfig | McpSSEServerConfig;
1736
1872
  declare const CallToolResultSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
1737
1873
  _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1738
1874
  }, {
@@ -2449,7 +2585,7 @@ type CallToolResult = z.infer<typeof CallToolResultSchema>;
2449
2585
 
2450
2586
  interface MCPClientConfig {
2451
2587
  /** Transport configuration for connecting to the MCP server */
2452
- transport: TransportConfig;
2588
+ transport: MCPTransportConfig | MCPTransport;
2453
2589
  /** Optional callback for uncaught errors */
2454
2590
  onUncaughtError?: (error: unknown) => void;
2455
2591
  /** Optional client name, defaults to 'ai-sdk-mcp-client' */
@@ -4079,4 +4215,4 @@ declare namespace llamaindexAdapter {
4079
4215
  };
4080
4216
  }
4081
4217
 
4082
- export { AssistantContent, AssistantResponse, CallWarning, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolCallUnion, CoreToolChoice, CoreToolMessage, CoreToolResultUnion, CoreUserMessage, DataContent, DataStreamOptions, DataStreamWriter, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedImage as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LanguageModelV1Middleware, llamaindexAdapter as LlamaIndexAdapter, LogProbs, MCPClientError, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, Provider, ProviderMetadata, RepairTextFunction, RetryError, StepResult, StreamData, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextPart, TextStreamPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolResultPart, ToolResultUnion, ToolSet, UserContent, appendClientMessage, appendResponseMessages, convertToCoreMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDataStream, createDataStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, experimental_wrapLanguageModel, extractReasoningMiddleware, generateObject, generateText, pipeDataStreamToResponse, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, tool, wrapLanguageModel };
4218
+ export { AssistantContent, AssistantResponse, CallWarning, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolCallUnion, CoreToolChoice, CoreToolMessage, CoreToolResultUnion, CoreUserMessage, DataContent, DataStreamOptions, DataStreamWriter, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedImage as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LanguageModelV1Middleware, llamaindexAdapter as LlamaIndexAdapter, LogProbs, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, Provider, ProviderMetadata, RepairTextFunction, RetryError, StepResult, StreamData, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextPart, TextStreamPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolResultPart, ToolResultUnion, ToolSet, UserContent, appendClientMessage, appendResponseMessages, convertToCoreMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDataStream, createDataStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, experimental_wrapLanguageModel, extractReasoningMiddleware, generateObject, generateText, pipeDataStreamToResponse, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, tool, wrapLanguageModel };
package/dist/index.d.ts CHANGED
@@ -8,8 +8,6 @@ import { ServerResponse } from 'node:http';
8
8
  import { AttributeValue, Tracer } from '@opentelemetry/api';
9
9
  import { z } from 'zod';
10
10
  import { ServerResponse as ServerResponse$1 } from 'http';
11
- import { IOType } from 'node:child_process';
12
- import { Stream } from 'node:stream';
13
11
 
14
12
  /**
15
13
  Language model that is used by the AI SDK Core functions.
@@ -674,6 +672,10 @@ interface FilePart {
674
672
  */
675
673
  data: DataContent | URL;
676
674
  /**
675
+ Optional filename of the file.
676
+ */
677
+ filename?: string;
678
+ /**
677
679
  Mime type of the file.
678
680
  */
679
681
  mimeType: string;
@@ -1706,6 +1708,153 @@ onlyBar('bar');
1706
1708
  */
1707
1709
  type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
1708
1710
 
1711
+ declare const JSONRPCMessageSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
1712
+ jsonrpc: z.ZodLiteral<"2.0">;
1713
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
1714
+ }, {
1715
+ method: z.ZodString;
1716
+ params: z.ZodOptional<z.ZodObject<{
1717
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1718
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1719
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1720
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1721
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1722
+ }, z.ZodTypeAny, "passthrough">>>;
1723
+ }>, "strict", z.ZodTypeAny, {
1724
+ id: string | number;
1725
+ method: string;
1726
+ jsonrpc: "2.0";
1727
+ params?: z.objectOutputType<{
1728
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1729
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1730
+ }, {
1731
+ id: string | number;
1732
+ method: string;
1733
+ jsonrpc: "2.0";
1734
+ params?: z.objectInputType<{
1735
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1736
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1737
+ }>, z.ZodObject<z.objectUtil.extendShape<{
1738
+ jsonrpc: z.ZodLiteral<"2.0">;
1739
+ }, {
1740
+ method: z.ZodString;
1741
+ params: z.ZodOptional<z.ZodObject<{
1742
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1743
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1744
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1745
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1746
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1747
+ }, z.ZodTypeAny, "passthrough">>>;
1748
+ }>, "strict", z.ZodTypeAny, {
1749
+ method: string;
1750
+ jsonrpc: "2.0";
1751
+ params?: z.objectOutputType<{
1752
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1753
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1754
+ }, {
1755
+ method: string;
1756
+ jsonrpc: "2.0";
1757
+ params?: z.objectInputType<{
1758
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1759
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1760
+ }>, z.ZodObject<{
1761
+ jsonrpc: z.ZodLiteral<"2.0">;
1762
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
1763
+ result: z.ZodObject<{
1764
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1765
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1766
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1767
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1768
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1769
+ }, z.ZodTypeAny, "passthrough">>;
1770
+ }, "strict", z.ZodTypeAny, {
1771
+ result: {
1772
+ _meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1773
+ } & {
1774
+ [k: string]: unknown;
1775
+ };
1776
+ id: string | number;
1777
+ jsonrpc: "2.0";
1778
+ }, {
1779
+ result: {
1780
+ _meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1781
+ } & {
1782
+ [k: string]: unknown;
1783
+ };
1784
+ id: string | number;
1785
+ jsonrpc: "2.0";
1786
+ }>, z.ZodObject<{
1787
+ jsonrpc: z.ZodLiteral<"2.0">;
1788
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
1789
+ error: z.ZodObject<{
1790
+ code: z.ZodNumber;
1791
+ message: z.ZodString;
1792
+ data: z.ZodOptional<z.ZodUnknown>;
1793
+ }, "strip", z.ZodTypeAny, {
1794
+ code: number;
1795
+ message: string;
1796
+ data?: unknown;
1797
+ }, {
1798
+ code: number;
1799
+ message: string;
1800
+ data?: unknown;
1801
+ }>;
1802
+ }, "strict", z.ZodTypeAny, {
1803
+ error: {
1804
+ code: number;
1805
+ message: string;
1806
+ data?: unknown;
1807
+ };
1808
+ id: string | number;
1809
+ jsonrpc: "2.0";
1810
+ }, {
1811
+ error: {
1812
+ code: number;
1813
+ message: string;
1814
+ data?: unknown;
1815
+ };
1816
+ id: string | number;
1817
+ jsonrpc: "2.0";
1818
+ }>]>;
1819
+ type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;
1820
+
1821
+ /**
1822
+ * Transport interface for MCP (Model Context Protocol) communication.
1823
+ * Maps to the `Transport` interface in the MCP spec.
1824
+ */
1825
+ interface MCPTransport {
1826
+ /**
1827
+ * Initialize and start the transport
1828
+ */
1829
+ start(): Promise<void>;
1830
+ /**
1831
+ * Send a JSON-RPC message through the transport
1832
+ * @param message The JSON-RPC message to send
1833
+ */
1834
+ send(message: JSONRPCMessage): Promise<void>;
1835
+ /**
1836
+ * Clean up and close the transport
1837
+ */
1838
+ close(): Promise<void>;
1839
+ /**
1840
+ * Event handler for transport closure
1841
+ */
1842
+ onclose?: () => void;
1843
+ /**
1844
+ * Event handler for transport errors
1845
+ */
1846
+ onerror?: (error: Error) => void;
1847
+ /**
1848
+ * Event handler for received messages
1849
+ */
1850
+ onmessage?: (message: JSONRPCMessage) => void;
1851
+ }
1852
+ interface SSEConfig {
1853
+ type: 'sse';
1854
+ url: string;
1855
+ }
1856
+ type MCPTransportConfig = SSEConfig;
1857
+
1709
1858
  type ToolSchemas = Record<string, {
1710
1859
  parameters: ToolParameters;
1711
1860
  }> | 'automatic' | undefined;
@@ -1720,19 +1869,6 @@ type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS e
1720
1869
  execute: (args: unknown, options: ToolExecutionOptions) => PromiseLike<CallToolResult>;
1721
1870
  };
1722
1871
  };
1723
- interface McpStdioServerConfig {
1724
- command: string;
1725
- args?: string[];
1726
- env?: Record<string, string>;
1727
- stderr?: IOType | Stream | number;
1728
- cwd?: string;
1729
- type: 'stdio';
1730
- }
1731
- interface McpSSEServerConfig {
1732
- type: 'sse';
1733
- url: string;
1734
- }
1735
- type TransportConfig = McpStdioServerConfig | McpSSEServerConfig;
1736
1872
  declare const CallToolResultSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
1737
1873
  _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1738
1874
  }, {
@@ -2449,7 +2585,7 @@ type CallToolResult = z.infer<typeof CallToolResultSchema>;
2449
2585
 
2450
2586
  interface MCPClientConfig {
2451
2587
  /** Transport configuration for connecting to the MCP server */
2452
- transport: TransportConfig;
2588
+ transport: MCPTransportConfig | MCPTransport;
2453
2589
  /** Optional callback for uncaught errors */
2454
2590
  onUncaughtError?: (error: unknown) => void;
2455
2591
  /** Optional client name, defaults to 'ai-sdk-mcp-client' */
@@ -4079,4 +4215,4 @@ declare namespace llamaindexAdapter {
4079
4215
  };
4080
4216
  }
4081
4217
 
4082
- export { AssistantContent, AssistantResponse, CallWarning, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolCallUnion, CoreToolChoice, CoreToolMessage, CoreToolResultUnion, CoreUserMessage, DataContent, DataStreamOptions, DataStreamWriter, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedImage as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LanguageModelV1Middleware, llamaindexAdapter as LlamaIndexAdapter, LogProbs, MCPClientError, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, Provider, ProviderMetadata, RepairTextFunction, RetryError, StepResult, StreamData, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextPart, TextStreamPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolResultPart, ToolResultUnion, ToolSet, UserContent, appendClientMessage, appendResponseMessages, convertToCoreMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDataStream, createDataStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, experimental_wrapLanguageModel, extractReasoningMiddleware, generateObject, generateText, pipeDataStreamToResponse, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, tool, wrapLanguageModel };
4218
+ export { AssistantContent, AssistantResponse, CallWarning, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolCallUnion, CoreToolChoice, CoreToolMessage, CoreToolResultUnion, CoreUserMessage, DataContent, DataStreamOptions, DataStreamWriter, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedImage as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LanguageModelV1Middleware, llamaindexAdapter as LlamaIndexAdapter, LogProbs, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, Provider, ProviderMetadata, RepairTextFunction, RetryError, StepResult, StreamData, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextPart, TextStreamPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolResultPart, ToolResultUnion, ToolSet, UserContent, appendClientMessage, appendResponseMessages, convertToCoreMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createDataStream, createDataStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, experimental_wrapLanguageModel, extractReasoningMiddleware, generateObject, generateText, pipeDataStreamToResponse, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, tool, wrapLanguageModel };