@mcpstack/agent-sdk 1.0.0-pr.16.7572c080abaa.13.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/LICENSE +21 -0
- package/README.md +254 -0
- package/dist/app/index.d.mts +969 -0
- package/dist/app/index.d.ts +969 -0
- package/dist/app/index.js +4025 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/index.mjs +3977 -0
- package/dist/app/index.mjs.map +1 -0
- package/dist/index.d.mts +639 -0
- package/dist/index.d.ts +639 -0
- package/dist/index.js +2649 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2620 -0
- package/dist/index.mjs.map +1 -0
- package/dist/react/index.d.mts +982 -0
- package/dist/react/index.d.ts +982 -0
- package/dist/react/index.js +4722 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/index.mjs +4700 -0
- package/dist/react/index.mjs.map +1 -0
- package/dist/react-embed/index.d.mts +361 -0
- package/dist/react-embed/index.d.ts +361 -0
- package/dist/react-embed/index.js +6500 -0
- package/dist/react-embed/index.js.map +1 -0
- package/dist/react-embed/index.mjs +6454 -0
- package/dist/react-embed/index.mjs.map +1 -0
- package/dist/react-native/index.d.mts +982 -0
- package/dist/react-native/index.d.ts +982 -0
- package/dist/react-native/index.js +4075 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/index.mjs +4053 -0
- package/dist/react-native/index.mjs.map +1 -0
- package/package.json +96 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
interface ClientToolParameter {
|
|
5
|
+
type: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
enum?: string[];
|
|
9
|
+
items?: ClientToolParameter;
|
|
10
|
+
properties?: Record<string, ClientToolParameter>;
|
|
11
|
+
additionalProperties?: boolean | ClientToolParameter;
|
|
12
|
+
}
|
|
13
|
+
interface ClientToolDefinition {
|
|
14
|
+
description: string;
|
|
15
|
+
parameters: Record<string, ClientToolParameter>;
|
|
16
|
+
selection?: ClientToolSelection;
|
|
17
|
+
execute: (params: Record<string, unknown>) => Promise<unknown>;
|
|
18
|
+
}
|
|
19
|
+
type ClientToolsMap$1 = Record<string, ClientToolDefinition>;
|
|
20
|
+
interface ClientToolSelection {
|
|
21
|
+
categories?: string[];
|
|
22
|
+
alwaysInclude?: boolean;
|
|
23
|
+
includeWhen?: string[];
|
|
24
|
+
risk?: 'low' | 'medium' | 'high' | string;
|
|
25
|
+
serverPreferred?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface McpStackEmbeddedAuthIdentity {
|
|
28
|
+
subject?: string;
|
|
29
|
+
email?: string;
|
|
30
|
+
organizationId?: string;
|
|
31
|
+
displayName?: string;
|
|
32
|
+
avatarUrl?: string;
|
|
33
|
+
}
|
|
34
|
+
interface McpStackAppTokenAuthConfig {
|
|
35
|
+
mode: 'app-token';
|
|
36
|
+
appId?: string;
|
|
37
|
+
getToken: () => Promise<string | undefined> | string | undefined;
|
|
38
|
+
}
|
|
39
|
+
interface McpStackStorageLike {
|
|
40
|
+
getItem(key: string): string | null;
|
|
41
|
+
setItem(key: string, value: string): void;
|
|
42
|
+
removeItem(key: string): void;
|
|
43
|
+
}
|
|
44
|
+
interface ChatMessage {
|
|
45
|
+
id: string;
|
|
46
|
+
role: 'user' | 'assistant' | 'tool_call' | 'tool_result' | 'error';
|
|
47
|
+
content: string;
|
|
48
|
+
toolName?: string;
|
|
49
|
+
toolLabel?: string;
|
|
50
|
+
toolCallId?: string;
|
|
51
|
+
timestamp: Date;
|
|
52
|
+
toolCallStatus?: 'calling' | 'completed' | 'error';
|
|
53
|
+
toolCallStartTime?: number;
|
|
54
|
+
toolCallDuration?: number;
|
|
55
|
+
toolResult?: string;
|
|
56
|
+
toolError?: string;
|
|
57
|
+
errorCode?: string;
|
|
58
|
+
metadataJson?: string | null;
|
|
59
|
+
}
|
|
60
|
+
interface McpServerAuthConfig {
|
|
61
|
+
authType: 'none' | 'apiKey' | 'bearer' | 'oauth2';
|
|
62
|
+
issuer?: string;
|
|
63
|
+
authorizationServerUrl?: string;
|
|
64
|
+
authorizationServerMetadataUrl?: string;
|
|
65
|
+
authorizationEndpoint?: string;
|
|
66
|
+
loginUrl?: string;
|
|
67
|
+
tokenEndpoint?: string;
|
|
68
|
+
tokenUrl?: string;
|
|
69
|
+
registrationEndpoint?: string;
|
|
70
|
+
clientId?: string;
|
|
71
|
+
scopes?: string[];
|
|
72
|
+
resource?: string;
|
|
73
|
+
callbackUrl?: string;
|
|
74
|
+
protectedResourceMetadataUrl?: string;
|
|
75
|
+
clientIdMetadataDocumentSupported?: boolean;
|
|
76
|
+
resourceParameterSupported?: boolean;
|
|
77
|
+
registrationPreference?: McpClientRegistrationPreference;
|
|
78
|
+
clientMode?: McpResolvedClientMode;
|
|
79
|
+
authRecipe?: McpAuthRecipe;
|
|
80
|
+
manualOverrides?: string[];
|
|
81
|
+
discovered?: boolean;
|
|
82
|
+
}
|
|
83
|
+
type McpAuthRecipe = 'sqlos' | 'auth0' | 'entra' | 'workos' | 'manual';
|
|
84
|
+
type McpClientRegistrationPreference = 'auto' | 'preregistered' | 'cimd' | 'dcr' | 'manual';
|
|
85
|
+
type McpResolvedClientMode = 'preregistered' | 'cimd' | 'dcr' | 'manual';
|
|
86
|
+
/** OAuth token response from token endpoint */
|
|
87
|
+
interface OAuthTokenResponse {
|
|
88
|
+
accessToken: string;
|
|
89
|
+
refreshToken?: string;
|
|
90
|
+
expiresIn?: number;
|
|
91
|
+
tokenType?: string;
|
|
92
|
+
resolvedAuthConfig?: McpServerAuthConfig;
|
|
93
|
+
}
|
|
94
|
+
interface AgentBudgetSnapshot {
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
currency: string;
|
|
97
|
+
identityType: 'identified' | 'anonymous' | string;
|
|
98
|
+
externalUserId: string;
|
|
99
|
+
displayName: string;
|
|
100
|
+
budgetSource: 'explicit' | 'default_user' | 'anonymous' | 'none' | string;
|
|
101
|
+
windowStartUtc: string;
|
|
102
|
+
windowEndUtc: string;
|
|
103
|
+
agentMonthlyBudgetUsd?: number | null;
|
|
104
|
+
agentCurrentMonthSpendUsd: number;
|
|
105
|
+
agentRemainingBudgetUsd?: number | null;
|
|
106
|
+
userMonthlyBudgetUsd?: number | null;
|
|
107
|
+
userCurrentMonthSpendUsd: number;
|
|
108
|
+
userRemainingBudgetUsd?: number | null;
|
|
109
|
+
organizationCreditsRemainingUsd?: number | null;
|
|
110
|
+
effectiveRemainingUsd?: number | null;
|
|
111
|
+
status: 'healthy' | 'warning' | 'blocked' | 'disabled' | string;
|
|
112
|
+
}
|
|
113
|
+
interface SseError {
|
|
114
|
+
code: string;
|
|
115
|
+
message: string;
|
|
116
|
+
budget?: AgentBudgetSnapshot | null;
|
|
117
|
+
}
|
|
118
|
+
type AudioInputStatus = 'idle' | 'requesting_permission' | 'connecting' | 'listening' | 'transcribing' | 'sending' | 'error';
|
|
119
|
+
interface AudioInputState {
|
|
120
|
+
status: AudioInputStatus;
|
|
121
|
+
isSupported: boolean;
|
|
122
|
+
isEnabled: boolean;
|
|
123
|
+
transcript: string;
|
|
124
|
+
partialTranscript: string;
|
|
125
|
+
error: SseError | null;
|
|
126
|
+
sessionId?: string | null;
|
|
127
|
+
conversationId?: string | null;
|
|
128
|
+
maxSessionSeconds?: number | null;
|
|
129
|
+
inputLevel?: number;
|
|
130
|
+
isSpeaking?: boolean;
|
|
131
|
+
speechMs?: number;
|
|
132
|
+
silenceMs?: number;
|
|
133
|
+
autoSubmitEnabled?: boolean;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
type ClientToolsMap = ClientToolsMap$1;
|
|
137
|
+
type AppAgentUserIdentity = McpStackEmbeddedAuthIdentity;
|
|
138
|
+
interface KeyValueStore {
|
|
139
|
+
getItem(key: string): Promise<string | null> | string | null;
|
|
140
|
+
setItem(key: string, value: string): Promise<void> | void;
|
|
141
|
+
removeItem(key: string): Promise<void> | void;
|
|
142
|
+
}
|
|
143
|
+
interface OAuthSessionRequest {
|
|
144
|
+
authorizeUrl: string;
|
|
145
|
+
redirectUri: string;
|
|
146
|
+
preferEphemeralSession?: boolean;
|
|
147
|
+
}
|
|
148
|
+
type OAuthSessionResult = {
|
|
149
|
+
type: 'success';
|
|
150
|
+
url: string;
|
|
151
|
+
} | {
|
|
152
|
+
type: 'cancel' | 'dismiss';
|
|
153
|
+
} | {
|
|
154
|
+
type: 'error';
|
|
155
|
+
message?: string;
|
|
156
|
+
};
|
|
157
|
+
interface AppAgentPlatform {
|
|
158
|
+
storage?: {
|
|
159
|
+
durable: KeyValueStore;
|
|
160
|
+
secure?: KeyValueStore;
|
|
161
|
+
};
|
|
162
|
+
auth?: {
|
|
163
|
+
openOAuthSession(request: OAuthSessionRequest): Promise<OAuthSessionResult>;
|
|
164
|
+
dismissOAuthSession?(): Promise<void> | void;
|
|
165
|
+
};
|
|
166
|
+
lifecycle?: {
|
|
167
|
+
onForegroundChange?(listener: (isForeground: boolean) => void): () => void;
|
|
168
|
+
onConnectivityChange?(listener: (isOnline: boolean) => void): () => void;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
interface AppAgentConnection {
|
|
172
|
+
url: string;
|
|
173
|
+
name: string;
|
|
174
|
+
authStatus: 'connected' | 'needs_auth';
|
|
175
|
+
canSignOut: boolean;
|
|
176
|
+
}
|
|
177
|
+
interface AppAgentConfig {
|
|
178
|
+
apiKey: string;
|
|
179
|
+
agentId: string;
|
|
180
|
+
serviceUrl?: string;
|
|
181
|
+
initialConnections?: AppAgentConnection[];
|
|
182
|
+
oauthCallbackUrl?: string;
|
|
183
|
+
oauthClientMetadataUrl?: string;
|
|
184
|
+
getAuthToken?: () => Promise<string | undefined>;
|
|
185
|
+
appSessionKey?: string | null;
|
|
186
|
+
userIdentity?: AppAgentUserIdentity;
|
|
187
|
+
auth?: McpStackAppTokenAuthConfig;
|
|
188
|
+
useCookies?: boolean;
|
|
189
|
+
externalUserId?: string;
|
|
190
|
+
appContext?: Record<string, unknown>;
|
|
191
|
+
clientTools?: ClientToolsMap;
|
|
192
|
+
platform?: AppAgentPlatform;
|
|
193
|
+
onAuthRequired?: (mcpServerUrl: string, authConfig: McpServerAuthConfig) => Promise<OAuthTokenResponse | undefined>;
|
|
194
|
+
conversation?: {
|
|
195
|
+
namespace?: string;
|
|
196
|
+
historyPageSize?: number;
|
|
197
|
+
};
|
|
198
|
+
feedbackSource?: string;
|
|
199
|
+
storage?: McpStackStorageLike | null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
interface McpStackChatProps extends AppAgentConfig {
|
|
203
|
+
/**
|
|
204
|
+
* Display mode:
|
|
205
|
+
* - 'floating': chat popup with a fixed button (default)
|
|
206
|
+
* - 'inline': embedded assistant that fills its container
|
|
207
|
+
*/
|
|
208
|
+
mode?: 'floating' | 'inline';
|
|
209
|
+
/** Chat window title */
|
|
210
|
+
title?: string;
|
|
211
|
+
/** Welcome message shown when no messages exist */
|
|
212
|
+
welcomeMessage?: string;
|
|
213
|
+
/** Input placeholder text */
|
|
214
|
+
placeholder?: string;
|
|
215
|
+
/** Whether the widget starts open (floating mode only) */
|
|
216
|
+
defaultOpen?: boolean;
|
|
217
|
+
/** Called when a tool call completes or a turn settles after tool activity. */
|
|
218
|
+
onToolActivity?: () => void;
|
|
219
|
+
}
|
|
220
|
+
declare function McpStackChat({ mode, title, welcomeMessage, placeholder, defaultOpen, onToolActivity, ...agentConfig }: McpStackChatProps): react_jsx_runtime.JSX.Element;
|
|
221
|
+
|
|
222
|
+
interface McpServerStatus {
|
|
223
|
+
url: string;
|
|
224
|
+
name: string;
|
|
225
|
+
authStatus: 'connected' | 'needs_auth';
|
|
226
|
+
canSignOut?: boolean;
|
|
227
|
+
}
|
|
228
|
+
interface McpServerStatusBarProps {
|
|
229
|
+
servers: McpServerStatus[];
|
|
230
|
+
onAuthClick?: (serverUrl: string, serverName: string) => void;
|
|
231
|
+
onSignOutClick?: (serverUrl: string, serverName: string) => void;
|
|
232
|
+
authButtonLabel?: string;
|
|
233
|
+
}
|
|
234
|
+
declare function McpServerStatusBar({ servers, onAuthClick, onSignOutClick, authButtonLabel, }: McpServerStatusBarProps): react_jsx_runtime.JSX.Element | null;
|
|
235
|
+
|
|
236
|
+
interface ChatWindowProps {
|
|
237
|
+
messages: ChatMessage[];
|
|
238
|
+
streamingContent: string;
|
|
239
|
+
isLoading: boolean;
|
|
240
|
+
isLoadingHistory?: boolean;
|
|
241
|
+
isThinking?: boolean;
|
|
242
|
+
error: SseError | null;
|
|
243
|
+
budget?: AgentBudgetSnapshot | null;
|
|
244
|
+
hasOlderMessages?: boolean;
|
|
245
|
+
title?: string;
|
|
246
|
+
welcomeMessage?: string;
|
|
247
|
+
placeholder?: string;
|
|
248
|
+
mcpServers?: McpServerStatus[];
|
|
249
|
+
mcpAuthButtonLabel?: string;
|
|
250
|
+
onSend: (message: string) => void;
|
|
251
|
+
onLoadOlderMessages?: () => void | Promise<void>;
|
|
252
|
+
onClose?: () => void;
|
|
253
|
+
onNewConversation?: () => void;
|
|
254
|
+
onMcpAuthClick?: (serverUrl: string, serverName: string) => void;
|
|
255
|
+
onMcpSignOutClick?: (serverUrl: string, serverName: string) => void;
|
|
256
|
+
voice?: AudioInputState & {
|
|
257
|
+
onStart: () => void;
|
|
258
|
+
onStop: () => void;
|
|
259
|
+
onCancel: () => void;
|
|
260
|
+
};
|
|
261
|
+
/** 'floating' = fixed card (default), 'inline' = fill container */
|
|
262
|
+
variant?: 'floating' | 'inline';
|
|
263
|
+
}
|
|
264
|
+
declare function ChatWindow({ messages, streamingContent, isLoading, isLoadingHistory, isThinking, error, budget, hasOlderMessages, title, welcomeMessage, placeholder, mcpServers, mcpAuthButtonLabel, onSend, onLoadOlderMessages, onClose, onNewConversation, onMcpAuthClick, onMcpSignOutClick, voice, variant, }: ChatWindowProps): react_jsx_runtime.JSX.Element;
|
|
265
|
+
|
|
266
|
+
interface MessageListProps {
|
|
267
|
+
messages: ChatMessage[];
|
|
268
|
+
streamingContent: string;
|
|
269
|
+
welcomeMessage?: string;
|
|
270
|
+
isThinking?: boolean;
|
|
271
|
+
blockingError?: SseError | null;
|
|
272
|
+
hasOlderMessages?: boolean;
|
|
273
|
+
isLoadingHistory?: boolean;
|
|
274
|
+
onLoadOlderMessages?: () => void | Promise<void>;
|
|
275
|
+
}
|
|
276
|
+
declare function MessageList({ messages, streamingContent, welcomeMessage, isThinking, blockingError, hasOlderMessages, isLoadingHistory, onLoadOlderMessages, }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
277
|
+
|
|
278
|
+
interface MessageBubbleProps {
|
|
279
|
+
message: ChatMessage;
|
|
280
|
+
}
|
|
281
|
+
declare function MessageBubble({ message }: MessageBubbleProps): react_jsx_runtime.JSX.Element | null;
|
|
282
|
+
|
|
283
|
+
interface InputAreaProps {
|
|
284
|
+
onSend: (message: string) => void;
|
|
285
|
+
disabled?: boolean;
|
|
286
|
+
placeholder?: string;
|
|
287
|
+
voice?: AudioInputState & {
|
|
288
|
+
onStart: () => void;
|
|
289
|
+
onStop: () => void;
|
|
290
|
+
onCancel: () => void;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
declare function InputArea({ onSend, disabled, placeholder, voice }: InputAreaProps): react_jsx_runtime.JSX.Element;
|
|
294
|
+
|
|
295
|
+
interface WidgetButtonProps {
|
|
296
|
+
isOpen: boolean;
|
|
297
|
+
onClick: () => void;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Floating action button that toggles the chat window.
|
|
301
|
+
*/
|
|
302
|
+
declare function WidgetButton({ isOpen, onClick }: WidgetButtonProps): react_jsx_runtime.JSX.Element;
|
|
303
|
+
|
|
304
|
+
type OAuthPopupPhase = 'prompt' | 'preparing' | 'waiting' | 'exchanging' | 'blocked' | 'canceled' | 'error';
|
|
305
|
+
interface OAuthPopupViewState {
|
|
306
|
+
serverName: string;
|
|
307
|
+
serverUrl: string;
|
|
308
|
+
phase: OAuthPopupPhase;
|
|
309
|
+
statusMessage?: string | null;
|
|
310
|
+
errorMessage?: string | null;
|
|
311
|
+
hostIdentityLabel?: string | null;
|
|
312
|
+
}
|
|
313
|
+
interface OAuthPopupProps extends OAuthPopupViewState {
|
|
314
|
+
onPrimaryAction?: () => void;
|
|
315
|
+
onClose: () => void;
|
|
316
|
+
}
|
|
317
|
+
declare function OAuthPopup({ serverName, phase, statusMessage, errorMessage, hostIdentityLabel, onPrimaryAction, onClose, }: OAuthPopupProps): react_jsx_runtime.JSX.Element;
|
|
318
|
+
|
|
319
|
+
interface EnhancedToolCallCardProps {
|
|
320
|
+
toolName: string;
|
|
321
|
+
toolCallId: string;
|
|
322
|
+
status: 'calling' | 'completed' | 'error';
|
|
323
|
+
startTime: number;
|
|
324
|
+
duration?: number;
|
|
325
|
+
result?: string;
|
|
326
|
+
error?: string;
|
|
327
|
+
}
|
|
328
|
+
declare function EnhancedToolCallCard({ toolName, toolCallId: _toolCallId, status, startTime, duration, result, error, }: EnhancedToolCallCardProps): react_jsx_runtime.JSX.Element;
|
|
329
|
+
|
|
330
|
+
interface MarkdownRendererProps {
|
|
331
|
+
content: string;
|
|
332
|
+
}
|
|
333
|
+
declare function MarkdownRenderer({ content }: MarkdownRendererProps): react_jsx_runtime.JSX.Element;
|
|
334
|
+
|
|
335
|
+
declare function ThinkingIndicator(): react_jsx_runtime.JSX.Element;
|
|
336
|
+
|
|
337
|
+
declare function StreamingCursor(): react_jsx_runtime.JSX.Element;
|
|
338
|
+
|
|
339
|
+
interface IconProps {
|
|
340
|
+
size?: number;
|
|
341
|
+
color?: string;
|
|
342
|
+
className?: string;
|
|
343
|
+
}
|
|
344
|
+
declare function DatabaseIcon({ size, color, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
345
|
+
declare function EditIcon({ size, color, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
346
|
+
declare function TrashIcon({ size, color, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
347
|
+
declare function ToolWrenchIcon({ size, color, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
348
|
+
declare function CheckCircleIcon({ size, color, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
349
|
+
declare function XCircleIcon({ size, color, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
350
|
+
declare function SpinnerIcon({ size, color, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
351
|
+
declare function ChevronIcon({ size, color, className, direction }: IconProps & {
|
|
352
|
+
direction?: 'up' | 'down';
|
|
353
|
+
}): react_jsx_runtime.JSX.Element;
|
|
354
|
+
declare function SendIcon({ size, color, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
355
|
+
declare function PlusIcon({ size, color, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
356
|
+
declare function CloseIcon({ size, color, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
357
|
+
declare function ChatBubbleIcon({ size, color, className }: IconProps): react_jsx_runtime.JSX.Element;
|
|
358
|
+
/** Pattern-match tool name to an appropriate icon */
|
|
359
|
+
declare function getToolIcon(toolName: string): React.FC<IconProps>;
|
|
360
|
+
|
|
361
|
+
export { ChatBubbleIcon, ChatWindow, type ChatWindowProps, CheckCircleIcon, ChevronIcon, CloseIcon, DatabaseIcon, EditIcon, EnhancedToolCallCard, type EnhancedToolCallCardProps, InputArea, type InputAreaProps, MarkdownRenderer, type McpServerStatus, McpServerStatusBar, type McpServerStatusBarProps, McpStackChat, type McpStackChatProps, MessageBubble, type MessageBubbleProps, MessageList, type MessageListProps, OAuthPopup, type OAuthPopupProps, PlusIcon, SendIcon, SpinnerIcon, StreamingCursor, ThinkingIndicator, ToolWrenchIcon, TrashIcon, WidgetButton, type WidgetButtonProps, XCircleIcon, getToolIcon };
|