@mcpstack/agent-sdk 1.0.0-pr.18.bbb0c016bc21.17.1 → 1.0.0
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/README.md +23 -46
- package/dist/app/index.d.mts +9 -25
- package/dist/app/index.d.ts +9 -25
- package/dist/app/index.js +95 -403
- package/dist/app/index.js.map +1 -1
- package/dist/app/index.mjs +95 -403
- package/dist/app/index.mjs.map +1 -1
- package/dist/index.d.mts +9 -25
- package/dist/index.d.ts +9 -25
- package/dist/index.js +95 -403
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -403
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +9 -25
- package/dist/react/index.d.ts +9 -25
- package/dist/react/index.js +95 -403
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +95 -403
- package/dist/react/index.mjs.map +1 -1
- package/dist/react-embed/index.js +95 -403
- package/dist/react-embed/index.js.map +1 -1
- package/dist/react-embed/index.mjs +95 -403
- package/dist/react-embed/index.mjs.map +1 -1
- package/dist/react-native/index.d.mts +9 -25
- package/dist/react-native/index.d.ts +9 -25
- package/dist/react-native/index.js +95 -403
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/index.mjs +95 -403
- package/dist/react-native/index.mjs.map +1 -1
- package/package.json +3 -6
|
@@ -109,7 +109,7 @@ interface McpStackAgentConfig {
|
|
|
109
109
|
oauthClientMetadataUrl?: string;
|
|
110
110
|
/**
|
|
111
111
|
* Callback to get the auth token for MCP Stack API requests.
|
|
112
|
-
* If provided, called before each
|
|
112
|
+
* If provided, called before each chat API request.
|
|
113
113
|
* Use this when your session token may expire and needs refresh (e.g., dashboard playground).
|
|
114
114
|
* If not provided, uses the static `apiKey` value.
|
|
115
115
|
*/
|
|
@@ -574,9 +574,8 @@ type EventHandler<T> = (data: T) => void;
|
|
|
574
574
|
* Framework-agnostic — works in any JavaScript environment.
|
|
575
575
|
*
|
|
576
576
|
* Handles:
|
|
577
|
-
* - Communication with the MCP Stack
|
|
578
|
-
* -
|
|
579
|
-
* - MCP server auth/session helpers for legacy and explicit auth flows
|
|
577
|
+
* - Communication with the MCP Stack chat API (SSE streaming)
|
|
578
|
+
* - Tool execution via MCP server (browser-side, with user's auth token)
|
|
580
579
|
* - Conversation state management
|
|
581
580
|
* - Event emission for UI updates
|
|
582
581
|
*/
|
|
@@ -643,11 +642,6 @@ declare class McpStackAgent {
|
|
|
643
642
|
submitFeedback(input: SubmitConversationFeedbackRequest): Promise<ConversationFeedback>;
|
|
644
643
|
/** Convert client tools to the API schema format. */
|
|
645
644
|
private clientToolsToSchemas;
|
|
646
|
-
private clientToolsToAgUiTools;
|
|
647
|
-
private buildAgUiContext;
|
|
648
|
-
private buildAgUiForwardedProps;
|
|
649
|
-
private buildAgUiUserRunInput;
|
|
650
|
-
private buildAgUiToolResultRunInput;
|
|
651
645
|
private resolveExternalUserId;
|
|
652
646
|
private buildExternalUserContext;
|
|
653
647
|
/** Latest runtime budget snapshot for the current SDK identity. */
|
|
@@ -747,28 +741,18 @@ declare class McpStackAgent {
|
|
|
747
741
|
private resolveToken;
|
|
748
742
|
/**
|
|
749
743
|
* The core orchestration loop:
|
|
750
|
-
* 1. Send message to
|
|
751
|
-
* 2. Stream
|
|
752
|
-
* 3. If
|
|
753
|
-
* 4.
|
|
744
|
+
* 1. Send message to chat API
|
|
745
|
+
* 2. Stream response
|
|
746
|
+
* 3. If tool_call → execute tool via MCP → send result → continue
|
|
747
|
+
* 4. If message_end → done
|
|
754
748
|
*/
|
|
755
749
|
private runChatLoop;
|
|
756
|
-
private
|
|
757
|
-
private callAgUiApi;
|
|
758
|
-
private processAgUiStream;
|
|
759
|
-
private recordToolResult;
|
|
760
|
-
private recordToolError;
|
|
761
|
-
private serializeToolContent;
|
|
762
|
-
private parseToolContent;
|
|
763
|
-
private parseToolArguments;
|
|
764
|
-
private getRecordField;
|
|
765
|
-
private getStringField;
|
|
766
|
-
private getNumberField;
|
|
750
|
+
private callChatApi;
|
|
767
751
|
private fetchConversationMessages;
|
|
768
752
|
private applyConversationPage;
|
|
769
753
|
private mapReplayMessage;
|
|
770
754
|
/**
|
|
771
|
-
* Process
|
|
755
|
+
* Process an SSE stream from the chat API.
|
|
772
756
|
* Returns when the stream ends (either message_end or tool_call).
|
|
773
757
|
*/
|
|
774
758
|
private processSseStream;
|
|
@@ -109,7 +109,7 @@ interface McpStackAgentConfig {
|
|
|
109
109
|
oauthClientMetadataUrl?: string;
|
|
110
110
|
/**
|
|
111
111
|
* Callback to get the auth token for MCP Stack API requests.
|
|
112
|
-
* If provided, called before each
|
|
112
|
+
* If provided, called before each chat API request.
|
|
113
113
|
* Use this when your session token may expire and needs refresh (e.g., dashboard playground).
|
|
114
114
|
* If not provided, uses the static `apiKey` value.
|
|
115
115
|
*/
|
|
@@ -574,9 +574,8 @@ type EventHandler<T> = (data: T) => void;
|
|
|
574
574
|
* Framework-agnostic — works in any JavaScript environment.
|
|
575
575
|
*
|
|
576
576
|
* Handles:
|
|
577
|
-
* - Communication with the MCP Stack
|
|
578
|
-
* -
|
|
579
|
-
* - MCP server auth/session helpers for legacy and explicit auth flows
|
|
577
|
+
* - Communication with the MCP Stack chat API (SSE streaming)
|
|
578
|
+
* - Tool execution via MCP server (browser-side, with user's auth token)
|
|
580
579
|
* - Conversation state management
|
|
581
580
|
* - Event emission for UI updates
|
|
582
581
|
*/
|
|
@@ -643,11 +642,6 @@ declare class McpStackAgent {
|
|
|
643
642
|
submitFeedback(input: SubmitConversationFeedbackRequest): Promise<ConversationFeedback>;
|
|
644
643
|
/** Convert client tools to the API schema format. */
|
|
645
644
|
private clientToolsToSchemas;
|
|
646
|
-
private clientToolsToAgUiTools;
|
|
647
|
-
private buildAgUiContext;
|
|
648
|
-
private buildAgUiForwardedProps;
|
|
649
|
-
private buildAgUiUserRunInput;
|
|
650
|
-
private buildAgUiToolResultRunInput;
|
|
651
645
|
private resolveExternalUserId;
|
|
652
646
|
private buildExternalUserContext;
|
|
653
647
|
/** Latest runtime budget snapshot for the current SDK identity. */
|
|
@@ -747,28 +741,18 @@ declare class McpStackAgent {
|
|
|
747
741
|
private resolveToken;
|
|
748
742
|
/**
|
|
749
743
|
* The core orchestration loop:
|
|
750
|
-
* 1. Send message to
|
|
751
|
-
* 2. Stream
|
|
752
|
-
* 3. If
|
|
753
|
-
* 4.
|
|
744
|
+
* 1. Send message to chat API
|
|
745
|
+
* 2. Stream response
|
|
746
|
+
* 3. If tool_call → execute tool via MCP → send result → continue
|
|
747
|
+
* 4. If message_end → done
|
|
754
748
|
*/
|
|
755
749
|
private runChatLoop;
|
|
756
|
-
private
|
|
757
|
-
private callAgUiApi;
|
|
758
|
-
private processAgUiStream;
|
|
759
|
-
private recordToolResult;
|
|
760
|
-
private recordToolError;
|
|
761
|
-
private serializeToolContent;
|
|
762
|
-
private parseToolContent;
|
|
763
|
-
private parseToolArguments;
|
|
764
|
-
private getRecordField;
|
|
765
|
-
private getStringField;
|
|
766
|
-
private getNumberField;
|
|
750
|
+
private callChatApi;
|
|
767
751
|
private fetchConversationMessages;
|
|
768
752
|
private applyConversationPage;
|
|
769
753
|
private mapReplayMessage;
|
|
770
754
|
/**
|
|
771
|
-
* Process
|
|
755
|
+
* Process an SSE stream from the chat API.
|
|
772
756
|
* Returns when the stream ends (either message_end or tool_call).
|
|
773
757
|
*/
|
|
774
758
|
private processSseStream;
|