ai 4.2.0 → 4.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # ai
2
2
 
3
+ ## 4.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - b796152: feat (ai/core): add headers to MCP SSE transport
8
+ - 06361d6: feat (ai/core): expose JSON RPC types (MCP)
9
+
3
10
  ## 4.2.0
4
11
 
5
12
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -955,6 +955,121 @@ onlyBar('bar');
955
955
  */
956
956
  type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
957
957
 
958
+ declare const JSONRPCRequestSchema: z.ZodObject<z.objectUtil.extendShape<{
959
+ jsonrpc: z.ZodLiteral<"2.0">;
960
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
961
+ }, {
962
+ method: z.ZodString;
963
+ params: z.ZodOptional<z.ZodObject<{
964
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
965
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
966
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
967
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
968
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
969
+ }, z.ZodTypeAny, "passthrough">>>;
970
+ }>, "strict", z.ZodTypeAny, {
971
+ id: string | number;
972
+ method: string;
973
+ jsonrpc: "2.0";
974
+ params?: z.objectOutputType<{
975
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
976
+ }, z.ZodTypeAny, "passthrough"> | undefined;
977
+ }, {
978
+ id: string | number;
979
+ method: string;
980
+ jsonrpc: "2.0";
981
+ params?: z.objectInputType<{
982
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
983
+ }, z.ZodTypeAny, "passthrough"> | undefined;
984
+ }>;
985
+ type JSONRPCRequest = z.infer<typeof JSONRPCRequestSchema>;
986
+ declare const JSONRPCResponseSchema: z.ZodObject<{
987
+ jsonrpc: z.ZodLiteral<"2.0">;
988
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
989
+ result: z.ZodObject<{
990
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
991
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
992
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
993
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
994
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
995
+ }, z.ZodTypeAny, "passthrough">>;
996
+ }, "strict", z.ZodTypeAny, {
997
+ result: {
998
+ _meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
999
+ } & {
1000
+ [k: string]: unknown;
1001
+ };
1002
+ id: string | number;
1003
+ jsonrpc: "2.0";
1004
+ }, {
1005
+ result: {
1006
+ _meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1007
+ } & {
1008
+ [k: string]: unknown;
1009
+ };
1010
+ id: string | number;
1011
+ jsonrpc: "2.0";
1012
+ }>;
1013
+ type JSONRPCResponse = z.infer<typeof JSONRPCResponseSchema>;
1014
+ declare const JSONRPCErrorSchema: z.ZodObject<{
1015
+ jsonrpc: z.ZodLiteral<"2.0">;
1016
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
1017
+ error: z.ZodObject<{
1018
+ code: z.ZodNumber;
1019
+ message: z.ZodString;
1020
+ data: z.ZodOptional<z.ZodUnknown>;
1021
+ }, "strip", z.ZodTypeAny, {
1022
+ code: number;
1023
+ message: string;
1024
+ data?: unknown;
1025
+ }, {
1026
+ code: number;
1027
+ message: string;
1028
+ data?: unknown;
1029
+ }>;
1030
+ }, "strict", z.ZodTypeAny, {
1031
+ error: {
1032
+ code: number;
1033
+ message: string;
1034
+ data?: unknown;
1035
+ };
1036
+ id: string | number;
1037
+ jsonrpc: "2.0";
1038
+ }, {
1039
+ error: {
1040
+ code: number;
1041
+ message: string;
1042
+ data?: unknown;
1043
+ };
1044
+ id: string | number;
1045
+ jsonrpc: "2.0";
1046
+ }>;
1047
+ type JSONRPCError = z.infer<typeof JSONRPCErrorSchema>;
1048
+ declare const JSONRPCNotificationSchema: z.ZodObject<z.objectUtil.extendShape<{
1049
+ jsonrpc: z.ZodLiteral<"2.0">;
1050
+ }, {
1051
+ method: z.ZodString;
1052
+ params: z.ZodOptional<z.ZodObject<{
1053
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1054
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1055
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1056
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1057
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1058
+ }, z.ZodTypeAny, "passthrough">>>;
1059
+ }>, "strict", z.ZodTypeAny, {
1060
+ method: string;
1061
+ jsonrpc: "2.0";
1062
+ params?: z.objectOutputType<{
1063
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1064
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1065
+ }, {
1066
+ method: string;
1067
+ jsonrpc: "2.0";
1068
+ params?: z.objectInputType<{
1069
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1070
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1071
+ }>;
1072
+ type JSONRPCNotification = z.infer<typeof JSONRPCNotificationSchema>;
958
1073
  declare const JSONRPCMessageSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
959
1074
  jsonrpc: z.ZodLiteral<"2.0">;
960
1075
  id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -1096,11 +1211,17 @@ interface MCPTransport {
1096
1211
  */
1097
1212
  onmessage?: (message: JSONRPCMessage) => void;
1098
1213
  }
1099
- interface SSEConfig {
1214
+ type MCPTransportConfig = {
1100
1215
  type: 'sse';
1216
+ /**
1217
+ * The URL of the MCP server.
1218
+ */
1101
1219
  url: string;
1102
- }
1103
- type MCPTransportConfig = SSEConfig;
1220
+ /**
1221
+ * Additional HTTP headers to be sent with requests.
1222
+ */
1223
+ headers?: Record<string, string>;
1224
+ };
1104
1225
 
1105
1226
  type ToolSchemas = Record<string, {
1106
1227
  parameters: ToolParameters;
@@ -4240,4 +4361,4 @@ declare namespace llamaindexAdapter {
4240
4361
  };
4241
4362
  }
4242
4363
 
4243
- 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, GeneratedFile as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedFile, 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 };
4364
+ 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, GeneratedFile as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, 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
@@ -955,6 +955,121 @@ onlyBar('bar');
955
955
  */
956
956
  type ValueOf<ObjectType, ValueType extends keyof ObjectType = keyof ObjectType> = ObjectType[ValueType];
957
957
 
958
+ declare const JSONRPCRequestSchema: z.ZodObject<z.objectUtil.extendShape<{
959
+ jsonrpc: z.ZodLiteral<"2.0">;
960
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
961
+ }, {
962
+ method: z.ZodString;
963
+ params: z.ZodOptional<z.ZodObject<{
964
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
965
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
966
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
967
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
968
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
969
+ }, z.ZodTypeAny, "passthrough">>>;
970
+ }>, "strict", z.ZodTypeAny, {
971
+ id: string | number;
972
+ method: string;
973
+ jsonrpc: "2.0";
974
+ params?: z.objectOutputType<{
975
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
976
+ }, z.ZodTypeAny, "passthrough"> | undefined;
977
+ }, {
978
+ id: string | number;
979
+ method: string;
980
+ jsonrpc: "2.0";
981
+ params?: z.objectInputType<{
982
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
983
+ }, z.ZodTypeAny, "passthrough"> | undefined;
984
+ }>;
985
+ type JSONRPCRequest = z.infer<typeof JSONRPCRequestSchema>;
986
+ declare const JSONRPCResponseSchema: z.ZodObject<{
987
+ jsonrpc: z.ZodLiteral<"2.0">;
988
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
989
+ result: z.ZodObject<{
990
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
991
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
992
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
993
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
994
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
995
+ }, z.ZodTypeAny, "passthrough">>;
996
+ }, "strict", z.ZodTypeAny, {
997
+ result: {
998
+ _meta?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
999
+ } & {
1000
+ [k: string]: unknown;
1001
+ };
1002
+ id: string | number;
1003
+ jsonrpc: "2.0";
1004
+ }, {
1005
+ result: {
1006
+ _meta?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
1007
+ } & {
1008
+ [k: string]: unknown;
1009
+ };
1010
+ id: string | number;
1011
+ jsonrpc: "2.0";
1012
+ }>;
1013
+ type JSONRPCResponse = z.infer<typeof JSONRPCResponseSchema>;
1014
+ declare const JSONRPCErrorSchema: z.ZodObject<{
1015
+ jsonrpc: z.ZodLiteral<"2.0">;
1016
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
1017
+ error: z.ZodObject<{
1018
+ code: z.ZodNumber;
1019
+ message: z.ZodString;
1020
+ data: z.ZodOptional<z.ZodUnknown>;
1021
+ }, "strip", z.ZodTypeAny, {
1022
+ code: number;
1023
+ message: string;
1024
+ data?: unknown;
1025
+ }, {
1026
+ code: number;
1027
+ message: string;
1028
+ data?: unknown;
1029
+ }>;
1030
+ }, "strict", z.ZodTypeAny, {
1031
+ error: {
1032
+ code: number;
1033
+ message: string;
1034
+ data?: unknown;
1035
+ };
1036
+ id: string | number;
1037
+ jsonrpc: "2.0";
1038
+ }, {
1039
+ error: {
1040
+ code: number;
1041
+ message: string;
1042
+ data?: unknown;
1043
+ };
1044
+ id: string | number;
1045
+ jsonrpc: "2.0";
1046
+ }>;
1047
+ type JSONRPCError = z.infer<typeof JSONRPCErrorSchema>;
1048
+ declare const JSONRPCNotificationSchema: z.ZodObject<z.objectUtil.extendShape<{
1049
+ jsonrpc: z.ZodLiteral<"2.0">;
1050
+ }, {
1051
+ method: z.ZodString;
1052
+ params: z.ZodOptional<z.ZodObject<{
1053
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1054
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1055
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1056
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1057
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1058
+ }, z.ZodTypeAny, "passthrough">>>;
1059
+ }>, "strict", z.ZodTypeAny, {
1060
+ method: string;
1061
+ jsonrpc: "2.0";
1062
+ params?: z.objectOutputType<{
1063
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1064
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1065
+ }, {
1066
+ method: string;
1067
+ jsonrpc: "2.0";
1068
+ params?: z.objectInputType<{
1069
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
1070
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1071
+ }>;
1072
+ type JSONRPCNotification = z.infer<typeof JSONRPCNotificationSchema>;
958
1073
  declare const JSONRPCMessageSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
959
1074
  jsonrpc: z.ZodLiteral<"2.0">;
960
1075
  id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -1096,11 +1211,17 @@ interface MCPTransport {
1096
1211
  */
1097
1212
  onmessage?: (message: JSONRPCMessage) => void;
1098
1213
  }
1099
- interface SSEConfig {
1214
+ type MCPTransportConfig = {
1100
1215
  type: 'sse';
1216
+ /**
1217
+ * The URL of the MCP server.
1218
+ */
1101
1219
  url: string;
1102
- }
1103
- type MCPTransportConfig = SSEConfig;
1220
+ /**
1221
+ * Additional HTTP headers to be sent with requests.
1222
+ */
1223
+ headers?: Record<string, string>;
1224
+ };
1104
1225
 
1105
1226
  type ToolSchemas = Record<string, {
1106
1227
  parameters: ToolParameters;
@@ -4240,4 +4361,4 @@ declare namespace llamaindexAdapter {
4240
4361
  };
4241
4362
  }
4242
4363
 
4243
- 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, GeneratedFile as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedFile, 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 };
4364
+ 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, GeneratedFile as Experimental_GeneratedImage, Experimental_LanguageModelV1Middleware, FilePart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelResponseMetadata, ImagePart, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, 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.js CHANGED
@@ -7006,9 +7006,13 @@ var JSONRPCMessageSchema = import_zod9.z.union([
7006
7006
 
7007
7007
  // core/tool/mcp/mcp-sse-transport.ts
7008
7008
  var SseMCPTransport = class {
7009
- constructor({ url }) {
7009
+ constructor({
7010
+ url,
7011
+ headers
7012
+ }) {
7010
7013
  this.connected = false;
7011
7014
  this.url = new URL(url);
7015
+ this.headers = headers;
7012
7016
  }
7013
7017
  async start() {
7014
7018
  return new Promise((resolve, reject) => {
@@ -7019,10 +7023,10 @@ var SseMCPTransport = class {
7019
7023
  const establishConnection = async () => {
7020
7024
  var _a17, _b, _c;
7021
7025
  try {
7026
+ const headers = new Headers(this.headers);
7027
+ headers.set("Accept", "text/event-stream");
7022
7028
  const response = await fetch(this.url.href, {
7023
- headers: {
7024
- Accept: "text/event-stream"
7025
- },
7029
+ headers,
7026
7030
  signal: (_a17 = this.abortController) == null ? void 0 : _a17.signal
7027
7031
  });
7028
7032
  if (!response.ok || !response.body) {
@@ -7111,7 +7115,7 @@ var SseMCPTransport = class {
7111
7115
  });
7112
7116
  }
7113
7117
  try {
7114
- const headers = new Headers();
7118
+ const headers = new Headers(this.headers);
7115
7119
  headers.set("Content-Type", "application/json");
7116
7120
  const init = {
7117
7121
  method: "POST",