@stackone/transport 2.33.2 → 2.34.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/dist/index.d.cts CHANGED
@@ -6,6 +6,7 @@ import * as redis from "redis";
6
6
  import * as tls$1 from "tls";
7
7
  import { Readable } from "node:stream";
8
8
  import { z } from "@stackone/utils";
9
+ import { Client, ClientOptions, StreamableHTTPClientTransportOptions, Transport } from "@modelcontextprotocol/client";
9
10
 
10
11
  //#region \0rolldown/runtime.js
11
12
  //#endregion
@@ -1001,6 +1002,124 @@ declare const convertError: (response?: Partial<AxiosResponse>, _context?: Reque
1001
1002
  retryAfter: number | null;
1002
1003
  };
1003
1004
  //#endregion
1005
+ //#region src/mcpClient/types.d.ts
1006
+ type McpClientInfo = {
1007
+ name: string;
1008
+ version: string;
1009
+ };
1010
+ type McpClientConfig = {
1011
+ serverUrl: string;
1012
+ headers?: Record<string, string>;
1013
+ clientInfo?: McpClientInfo;
1014
+ timeout?: number;
1015
+ requestConfig?: RequestConfig;
1016
+ context?: RequestContext;
1017
+ };
1018
+ type McpToolContentBlock = {
1019
+ type: string;
1020
+ [key: string]: unknown;
1021
+ };
1022
+ type McpCallToolParams = {
1023
+ name: string;
1024
+ arguments?: Record<string, unknown>;
1025
+ };
1026
+ type McpCallToolResult = {
1027
+ content: McpToolContentBlock[];
1028
+ structuredContent?: Record<string, unknown>;
1029
+ isError: boolean;
1030
+ };
1031
+ type McpToolDefinition = {
1032
+ name: string;
1033
+ description?: string;
1034
+ inputSchema: Record<string, unknown>;
1035
+ outputSchema?: Record<string, unknown>;
1036
+ annotations?: Record<string, unknown>;
1037
+ [key: string]: unknown;
1038
+ };
1039
+ type McpListToolsParams = {
1040
+ cursor?: string;
1041
+ };
1042
+ type McpListToolsResult = {
1043
+ tools: McpToolDefinition[];
1044
+ nextCursor?: string;
1045
+ };
1046
+ type McpServerInfo = {
1047
+ name?: string;
1048
+ title?: string;
1049
+ version?: string;
1050
+ description?: string;
1051
+ websiteUrl?: string;
1052
+ instructions?: string;
1053
+ iconUrl?: string;
1054
+ };
1055
+ interface IMcpClient {
1056
+ callTool: (params: McpCallToolParams) => Promise<McpCallToolResult>;
1057
+ listTools: (params?: McpListToolsParams) => Promise<McpListToolsResult>;
1058
+ getServerInfo: () => Promise<McpServerInfo>;
1059
+ close: () => Promise<void>;
1060
+ }
1061
+ //#endregion
1062
+ //#region src/mcpClient/mcpClient.d.ts
1063
+ type McpSdkDependencies = {
1064
+ createClient: (clientInfo: McpClientInfo, options: ClientOptions) => Client;
1065
+ createTransport: (url: URL, options: StreamableHTTPClientTransportOptions) => Transport;
1066
+ };
1067
+ declare class McpClient implements IMcpClient {
1068
+ private readonly config;
1069
+ private readonly sdk;
1070
+ private connectedClient?;
1071
+ constructor(config: McpClientConfig, sdk?: McpSdkDependencies);
1072
+ callTool({
1073
+ name,
1074
+ arguments: toolArguments
1075
+ }: McpCallToolParams): Promise<McpCallToolResult>;
1076
+ listTools(params?: McpListToolsParams): Promise<McpListToolsResult>;
1077
+ getServerInfo(): Promise<McpServerInfo>;
1078
+ private resolveIconUrl;
1079
+ close(): Promise<void>;
1080
+ private getConnectedClient;
1081
+ private connect;
1082
+ private buildRequestOptions;
1083
+ }
1084
+ //#endregion
1085
+ //#region src/mcpClient/probeMcpServer.d.ts
1086
+ type McpServerProbe = {
1087
+ requiresAuthorization: boolean;
1088
+ oauth?: {
1089
+ scopes?: string[];
1090
+ authorizationServers?: string[];
1091
+ dynamicRegistration?: boolean;
1092
+ resourceMetadataUrl?: string;
1093
+ };
1094
+ resource?: {
1095
+ name?: string;
1096
+ documentationUrl?: string;
1097
+ };
1098
+ server?: McpServerInfo;
1099
+ };
1100
+ type McpServerProber = (serverUrl: string) => Promise<McpServerProbe>;
1101
+ type AuthorizationChallenge = {
1102
+ resourceMetadataUrl?: string;
1103
+ scope?: string;
1104
+ };
1105
+ type ResourceMetadata = {
1106
+ scopes_supported?: string[];
1107
+ resource_name?: string;
1108
+ resource_documentation?: string;
1109
+ authorization_servers?: string[];
1110
+ };
1111
+ type AuthorizationServerMetadata = {
1112
+ registration_endpoint?: string;
1113
+ scopes_supported?: string[];
1114
+ };
1115
+ type ProbeDependencies = {
1116
+ createClient: (serverUrl: string) => IMcpClient;
1117
+ fetchAuthorizationChallenge: (serverUrl: string) => Promise<AuthorizationChallenge | undefined>;
1118
+ discoverResourceMetadata: (serverUrl: string, resourceMetadataUrl?: string) => Promise<ResourceMetadata>;
1119
+ discoverAuthorizationServer: (authorizationServerUrl: string) => Promise<AuthorizationServerMetadata | undefined>;
1120
+ };
1121
+ declare const probeMcpServer: (serverUrl: string, dependencies?: ProbeDependencies) => Promise<McpServerProbe>;
1122
+ //#endregion
1004
1123
  //#region src/memoryStore/index.d.ts
1005
1124
  declare class MemoryStore<T> implements ICacheClient {
1006
1125
  private config;
@@ -1174,4 +1293,4 @@ type LockEntry = {
1174
1293
  unlock: Unlock;
1175
1294
  };
1176
1295
  //#endregion
1177
- export { type AxiosErrorWithRequestMetadata, type AxiosErrorWithRetryCount, CUSTOM_ERROR_CONFIG_SCHEMA, type CertificatesInput, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorInterceptor, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeader, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type HttpTransportInstanceConfig, type ICacheClient, type IHttpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Interceptor, type InterceptorConfigs, type InterceptorDependencies, type InterceptorDependencyInjector, type InterceptorManager, type Lock, type LockEntry, LockManager, MemoryStore, type MemoryStoreConfig, type OnFulfilledInterceptors, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestInterceptor, type RequestInterceptorConfig, type RequestInterceptorTuple, type RequestParameter, RequestParameterLocations, type ResponseInterceptor, type ResponseInterceptorConfig, type ResponseInterceptorTuple, type ResponseType, ScriptManager, type SigningCredentials, type SigningOptions, type SigningRequest, type SigningStrategy, type StreamHttpResponse, SubscriptionManager, type TransportInitializationOptions, TransportManagersUnavailableError, type Unlock, buildHttpClientInstance, buildHttpsAgent, convertError, createAuthorizationHeaders, getRetryAfterWaitTime, getSigningStrategy, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, registerSigningStrategy, serializeHttpResponseError, shutdownTransportSystem, superNormalizeHeaders, translateCustomError };
1296
+ export { type AuthorizationChallenge, type AxiosErrorWithRequestMetadata, type AxiosErrorWithRetryCount, CUSTOM_ERROR_CONFIG_SCHEMA, type CertificatesInput, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorInterceptor, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeader, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type HttpTransportInstanceConfig, type ICacheClient, type IHttpClient, type IMcpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Interceptor, type InterceptorConfigs, type InterceptorDependencies, type InterceptorDependencyInjector, type InterceptorManager, type Lock, type LockEntry, LockManager, type McpCallToolParams, type McpCallToolResult, McpClient, type McpClientConfig, type McpClientInfo, type McpListToolsParams, type McpListToolsResult, type McpSdkDependencies, type McpServerInfo, type McpServerProbe, type McpServerProber, type McpToolContentBlock, type McpToolDefinition, MemoryStore, type MemoryStoreConfig, type OnFulfilledInterceptors, type ProbeDependencies, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestInterceptor, type RequestInterceptorConfig, type RequestInterceptorTuple, type RequestParameter, RequestParameterLocations, type ResponseInterceptor, type ResponseInterceptorConfig, type ResponseInterceptorTuple, type ResponseType, ScriptManager, type SigningCredentials, type SigningOptions, type SigningRequest, type SigningStrategy, type StreamHttpResponse, SubscriptionManager, type TransportInitializationOptions, TransportManagersUnavailableError, type Unlock, buildHttpClientInstance, buildHttpsAgent, convertError, createAuthorizationHeaders, getRetryAfterWaitTime, getSigningStrategy, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, probeMcpServer, registerSigningStrategy, serializeHttpResponseError, shutdownTransportSystem, superNormalizeHeaders, translateCustomError };
package/dist/index.d.mts CHANGED
@@ -3,6 +3,7 @@ import { z } from "@stackone/utils";
3
3
  import * as redis from "redis";
4
4
  import { AxiosError, AxiosInstance, AxiosInterceptorManager, AxiosInterceptorOptions, AxiosResponse, CreateAxiosDefaults, InternalAxiosRequestConfig } from "axios";
5
5
  import https from "node:https";
6
+ import { Client, ClientOptions, StreamableHTTPClientTransportOptions, Transport } from "@modelcontextprotocol/client";
6
7
  import { ILogger } from "@stackone/logger";
7
8
  import http, { AgentOptions } from "node:http";
8
9
  import * as tls$1 from "tls";
@@ -1000,6 +1001,124 @@ declare const convertError: (response?: Partial<AxiosResponse>, _context?: Reque
1000
1001
  retryAfter: number | null;
1001
1002
  };
1002
1003
  //#endregion
1004
+ //#region src/mcpClient/types.d.ts
1005
+ type McpClientInfo = {
1006
+ name: string;
1007
+ version: string;
1008
+ };
1009
+ type McpClientConfig = {
1010
+ serverUrl: string;
1011
+ headers?: Record<string, string>;
1012
+ clientInfo?: McpClientInfo;
1013
+ timeout?: number;
1014
+ requestConfig?: RequestConfig;
1015
+ context?: RequestContext;
1016
+ };
1017
+ type McpToolContentBlock = {
1018
+ type: string;
1019
+ [key: string]: unknown;
1020
+ };
1021
+ type McpCallToolParams = {
1022
+ name: string;
1023
+ arguments?: Record<string, unknown>;
1024
+ };
1025
+ type McpCallToolResult = {
1026
+ content: McpToolContentBlock[];
1027
+ structuredContent?: Record<string, unknown>;
1028
+ isError: boolean;
1029
+ };
1030
+ type McpToolDefinition = {
1031
+ name: string;
1032
+ description?: string;
1033
+ inputSchema: Record<string, unknown>;
1034
+ outputSchema?: Record<string, unknown>;
1035
+ annotations?: Record<string, unknown>;
1036
+ [key: string]: unknown;
1037
+ };
1038
+ type McpListToolsParams = {
1039
+ cursor?: string;
1040
+ };
1041
+ type McpListToolsResult = {
1042
+ tools: McpToolDefinition[];
1043
+ nextCursor?: string;
1044
+ };
1045
+ type McpServerInfo = {
1046
+ name?: string;
1047
+ title?: string;
1048
+ version?: string;
1049
+ description?: string;
1050
+ websiteUrl?: string;
1051
+ instructions?: string;
1052
+ iconUrl?: string;
1053
+ };
1054
+ interface IMcpClient {
1055
+ callTool: (params: McpCallToolParams) => Promise<McpCallToolResult>;
1056
+ listTools: (params?: McpListToolsParams) => Promise<McpListToolsResult>;
1057
+ getServerInfo: () => Promise<McpServerInfo>;
1058
+ close: () => Promise<void>;
1059
+ }
1060
+ //#endregion
1061
+ //#region src/mcpClient/mcpClient.d.ts
1062
+ type McpSdkDependencies = {
1063
+ createClient: (clientInfo: McpClientInfo, options: ClientOptions) => Client;
1064
+ createTransport: (url: URL, options: StreamableHTTPClientTransportOptions) => Transport;
1065
+ };
1066
+ declare class McpClient implements IMcpClient {
1067
+ private readonly config;
1068
+ private readonly sdk;
1069
+ private connectedClient?;
1070
+ constructor(config: McpClientConfig, sdk?: McpSdkDependencies);
1071
+ callTool({
1072
+ name,
1073
+ arguments: toolArguments
1074
+ }: McpCallToolParams): Promise<McpCallToolResult>;
1075
+ listTools(params?: McpListToolsParams): Promise<McpListToolsResult>;
1076
+ getServerInfo(): Promise<McpServerInfo>;
1077
+ private resolveIconUrl;
1078
+ close(): Promise<void>;
1079
+ private getConnectedClient;
1080
+ private connect;
1081
+ private buildRequestOptions;
1082
+ }
1083
+ //#endregion
1084
+ //#region src/mcpClient/probeMcpServer.d.ts
1085
+ type McpServerProbe = {
1086
+ requiresAuthorization: boolean;
1087
+ oauth?: {
1088
+ scopes?: string[];
1089
+ authorizationServers?: string[];
1090
+ dynamicRegistration?: boolean;
1091
+ resourceMetadataUrl?: string;
1092
+ };
1093
+ resource?: {
1094
+ name?: string;
1095
+ documentationUrl?: string;
1096
+ };
1097
+ server?: McpServerInfo;
1098
+ };
1099
+ type McpServerProber = (serverUrl: string) => Promise<McpServerProbe>;
1100
+ type AuthorizationChallenge = {
1101
+ resourceMetadataUrl?: string;
1102
+ scope?: string;
1103
+ };
1104
+ type ResourceMetadata = {
1105
+ scopes_supported?: string[];
1106
+ resource_name?: string;
1107
+ resource_documentation?: string;
1108
+ authorization_servers?: string[];
1109
+ };
1110
+ type AuthorizationServerMetadata = {
1111
+ registration_endpoint?: string;
1112
+ scopes_supported?: string[];
1113
+ };
1114
+ type ProbeDependencies = {
1115
+ createClient: (serverUrl: string) => IMcpClient;
1116
+ fetchAuthorizationChallenge: (serverUrl: string) => Promise<AuthorizationChallenge | undefined>;
1117
+ discoverResourceMetadata: (serverUrl: string, resourceMetadataUrl?: string) => Promise<ResourceMetadata>;
1118
+ discoverAuthorizationServer: (authorizationServerUrl: string) => Promise<AuthorizationServerMetadata | undefined>;
1119
+ };
1120
+ declare const probeMcpServer: (serverUrl: string, dependencies?: ProbeDependencies) => Promise<McpServerProbe>;
1121
+ //#endregion
1003
1122
  //#region src/memoryStore/index.d.ts
1004
1123
  declare class MemoryStore<T> implements ICacheClient {
1005
1124
  private config;
@@ -1173,4 +1292,4 @@ type LockEntry = {
1173
1292
  unlock: Unlock;
1174
1293
  };
1175
1294
  //#endregion
1176
- export { type AxiosErrorWithRequestMetadata, type AxiosErrorWithRetryCount, CUSTOM_ERROR_CONFIG_SCHEMA, type CertificatesInput, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorInterceptor, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeader, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type HttpTransportInstanceConfig, type ICacheClient, type IHttpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Interceptor, type InterceptorConfigs, type InterceptorDependencies, type InterceptorDependencyInjector, type InterceptorManager, type Lock, type LockEntry, LockManager, MemoryStore, type MemoryStoreConfig, type OnFulfilledInterceptors, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestInterceptor, type RequestInterceptorConfig, type RequestInterceptorTuple, type RequestParameter, RequestParameterLocations, type ResponseInterceptor, type ResponseInterceptorConfig, type ResponseInterceptorTuple, type ResponseType, ScriptManager, type SigningCredentials, type SigningOptions, type SigningRequest, type SigningStrategy, type StreamHttpResponse, SubscriptionManager, type TransportInitializationOptions, TransportManagersUnavailableError, type Unlock, buildHttpClientInstance, buildHttpsAgent, convertError, createAuthorizationHeaders, getRetryAfterWaitTime, getSigningStrategy, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, registerSigningStrategy, serializeHttpResponseError, shutdownTransportSystem, superNormalizeHeaders, translateCustomError };
1295
+ export { type AuthorizationChallenge, type AxiosErrorWithRequestMetadata, type AxiosErrorWithRetryCount, CUSTOM_ERROR_CONFIG_SCHEMA, type CertificatesInput, type ConcurrencyConfig, ConcurrencyManager, type CustomErrorConfig, type ErrorInterceptor, type ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, type HttpHeader, type HttpHeaders, type HttpMethod, HttpMethods, type HttpParameters, type HttpQueryParamValue, type HttpQueryParams, type HttpResponse, HttpResponseError, HttpTransportFactory, type HttpTransportInstanceConfig, type ICacheClient, type IHttpClient, type IMcpClient, type IRequestClient, type InitializedTransportManagers, InstanceManager, type Interceptor, type InterceptorConfigs, type InterceptorDependencies, type InterceptorDependencyInjector, type InterceptorManager, type Lock, type LockEntry, LockManager, type McpCallToolParams, type McpCallToolResult, McpClient, type McpClientConfig, type McpClientInfo, type McpListToolsParams, type McpListToolsResult, type McpSdkDependencies, type McpServerInfo, type McpServerProbe, type McpServerProber, type McpToolContentBlock, type McpToolDefinition, MemoryStore, type MemoryStoreConfig, type OnFulfilledInterceptors, type ProbeDependencies, type PruneCount, type PubSubListener, type QueryArrayFormat, QueryArrayFormats, QueueManager, type RateLimitConfig, RateLimitManager, RedisClient, type RedisClientConfig, type RedisClientType, RequestClientFactory, type RequestConfig, type RequestContext, type RequestInterceptor, type RequestInterceptorConfig, type RequestInterceptorTuple, type RequestParameter, RequestParameterLocations, type ResponseInterceptor, type ResponseInterceptorConfig, type ResponseInterceptorTuple, type ResponseType, ScriptManager, type SigningCredentials, type SigningOptions, type SigningRequest, type SigningStrategy, type StreamHttpResponse, SubscriptionManager, type TransportInitializationOptions, TransportManagersUnavailableError, type Unlock, buildHttpClientInstance, buildHttpsAgent, convertError, createAuthorizationHeaders, getRetryAfterWaitTime, getSigningStrategy, getTransportInstance, getTransportManagers, initializeTransportSystem, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, isTransportSystemReady, parseRequestParameters, probeMcpServer, registerSigningStrategy, serializeHttpResponseError, shutdownTransportSystem, superNormalizeHeaders, translateCustomError };