@nqminds/mcp-client 1.0.21 → 1.0.26

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.
@@ -1 +1 @@
1
- {"version":3,"file":"MCPChat.d.ts","sourceRoot":"","sources":["../src/MCPChat.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,KAAK,EAAyB,YAAY,EAAe,MAAM,SAAS,CAAC;AA+ChF,wBAAgB,OAAO,CAAC,EACtB,aAAa,EACb,WAA6B,EAC7B,YAAiB,EACjB,SAAc,GACf,EAAE,YAAY,qBA6fd"}
1
+ {"version":3,"file":"MCPChat.d.ts","sourceRoot":"","sources":["../src/MCPChat.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,KAAK,EAAyB,YAAY,EAAe,MAAM,SAAS,CAAC;AA+ChF,wBAAgB,OAAO,CAAC,EACtB,aAAa,EACb,WAA6B,EAC7B,YAAiB,EACjB,SAAc,GACf,EAAE,YAAY,qBA+gBd"}
package/dist/MCPChat.js CHANGED
@@ -39,6 +39,7 @@ export function MCPChat({ companyNumber, apiEndpoint = "/api/mcp/chat", customSt
39
39
  const [input, setInput] = useState("");
40
40
  const [isLoading, setIsLoading] = useState(false);
41
41
  const [thinkingSteps, setThinkingSteps] = useState([]);
42
+ const [processingStartTime, setProcessingStartTime] = useState(null);
42
43
  const [isOpen, setIsOpen] = useState(false);
43
44
  const [preparingAction, setPreparingAction] = useState(null);
44
45
  const [directPromptOpen, setDirectPromptOpen] = useState(false);
@@ -89,6 +90,7 @@ export function MCPChat({ companyNumber, apiEndpoint = "/api/mcp/chat", customSt
89
90
  setMessages((prev) => [...prev, userMessage]);
90
91
  setInput("");
91
92
  setThinkingSteps([]);
93
+ setProcessingStartTime(userMessage.timestamp);
92
94
  let thinkingStepCounter = 0;
93
95
  const addThinkingStep = (message) => {
94
96
  setThinkingSteps((prev) => [
@@ -182,7 +184,15 @@ export function MCPChat({ companyNumber, apiEndpoint = "/api/mcp/chat", customSt
182
184
  }
183
185
  }
184
186
  catch (e) {
185
- console.error("Error parsing SSE data:", e);
187
+ // Only swallow actual JSON parse failures.
188
+ // Re-throw anything else (e.g. the stream error we threw above)
189
+ // so it reaches the outer catch and surfaces to the user.
190
+ if (e instanceof SyntaxError) {
191
+ console.error("Error parsing SSE data:", e);
192
+ }
193
+ else {
194
+ throw e;
195
+ }
186
196
  }
187
197
  }
188
198
  }
@@ -321,20 +331,23 @@ export function MCPChat({ companyNumber, apiEndpoint = "/api/mcp/chat", customSt
321
331
  React.createElement("span", { className: "mcp-action-card-icon" }, action.icon),
322
332
  React.createElement("span", { className: "mcp-action-card-label" }, action.label))))),
323
333
  React.createElement("button", { className: "mcp-chat-now-button", onClick: handleChatNow }, "\uD83D\uDCAC Or just chat\u2026"))),
324
- visibleMessages.map((msg, idx) => (React.createElement("div", { key: idx, className: `mcp-chat-message ${msg.role === "user" ? "mcp-chat-message-user" : "mcp-chat-message-assistant"}` },
334
+ visibleMessages
335
+ .filter((msg) => !(msg.isStreaming && msg.content === ""))
336
+ .map((msg, idx) => (React.createElement("div", { key: idx, className: `mcp-chat-message ${msg.role === "user" ? "mcp-chat-message-user" : "mcp-chat-message-assistant"}` },
325
337
  React.createElement("div", { className: "mcp-chat-message-bubble" },
326
338
  msg.role === "assistant" ? (React.createElement("div", { className: "mcp-chat-message-content markdown-content" },
327
339
  React.createElement(ReactMarkdown, { remarkPlugins: [remarkGfm] }, msg.content))) : (React.createElement("div", { className: "mcp-chat-message-content" }, msg.content)),
328
- React.createElement("div", { className: "mcp-chat-message-timestamp" },
340
+ msg.role === "assistant" && !msg.isStreaming && (React.createElement("div", { className: "mcp-chat-message-timestamp" },
329
341
  msg.timestamp.toLocaleTimeString(),
330
- msg.role === "assistant" && msg.tokenInfo && (React.createElement("span", { className: "mcp-chat-token-info" }, msg.tokenInfo))))))),
342
+ msg.tokenInfo && (React.createElement("span", { className: "mcp-chat-token-info" }, msg.tokenInfo)))))))),
331
343
  isLoading && (React.createElement("div", { className: "mcp-chat-message mcp-chat-message-assistant" },
332
344
  React.createElement("div", { className: "mcp-chat-thinking" },
333
345
  React.createElement("div", { className: "mcp-chat-thinking-title" },
334
346
  React.createElement("span", { className: "mcp-preparing-spinner" }),
335
347
  thinkingSteps.length === 0
336
348
  ? " Thinking…"
337
- : " Processing…"),
349
+ : " Processing…",
350
+ processingStartTime && (React.createElement("span", { className: "mcp-chat-thinking-time" }, processingStartTime.toLocaleTimeString()))),
338
351
  thinkingSteps.length > 0 && (React.createElement("div", { className: "mcp-chat-thinking-steps" },
339
352
  thinkingSteps.map((step) => (React.createElement("div", { key: step.id, className: "mcp-chat-thinking-step" }, step.message))),
340
353
  React.createElement("div", { ref: thinkingEndRef })))))),
@@ -1 +1 @@
1
- {"version":3,"file":"api-helpers.d.ts","sourceRoot":"","sources":["../src/api-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,sBAAsB,IACnD,SAAS,OAAO,uBAoH/B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,KACrB,SAAS,OAAO,uBAU/B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,kBAKtC"}
1
+ {"version":3,"file":"api-helpers.d.ts","sourceRoot":"","sources":["../src/api-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,sBAAsB,IACnD,SAAS,OAAO,uBAqH/B;AAED;;GAEG;AACH,wBAAgB,qBAAqB,KACrB,SAAS,OAAO,uBAU/B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,kBAKtC"}
@@ -69,8 +69,10 @@ export function createMCPChatHandler(config) {
69
69
  if (abortController.signal.aborted) {
70
70
  return;
71
71
  }
72
- // Stream the response in chunks
73
- const chunkSize = 10;
72
+ // Stream the response in chunks.
73
+ // Use large chunks + short delay so long responses don't hit proxy send_timeout.
74
+ // 200 chars @ 15ms = ~13,000 chars/sec — a 100k response streams in ~8s.
75
+ const chunkSize = 200;
74
76
  for (let i = 0; i < response.length; i += chunkSize) {
75
77
  // Check for cancellation between chunks
76
78
  if (abortController.signal.aborted) {
@@ -78,8 +80,7 @@ export function createMCPChatHandler(config) {
78
80
  }
79
81
  const chunk = response.slice(i, i + chunkSize);
80
82
  sendEvent("content", { chunk });
81
- // Small delay for better streaming effect
82
- await new Promise((resolve) => setTimeout(resolve, 20));
83
+ await new Promise((resolve) => setTimeout(resolve, 15));
83
84
  }
84
85
  sendEvent("done", {});
85
86
  }
@@ -630,37 +630,41 @@
630
630
  Thinking steps
631
631
  ─────────────────────────────────────────────── */
632
632
  .mcp-chat-thinking {
633
- padding: 14px 18px;
634
- border-radius: 12px;
633
+ padding: 20px 24px;
634
+ border-radius: 14px;
635
635
  background: var(--mcp-card-bg);
636
636
  border: 1px solid var(--mcp-border);
637
637
  width: 100%;
638
+ min-width: fit-content;
639
+ min-height: 140px;
640
+ box-sizing: border-box;
638
641
  display: flex;
639
642
  flex-direction: column;
640
- gap: 8px;
643
+ gap: 12px;
641
644
  }
642
645
 
643
646
  .mcp-chat-thinking-title {
644
- font-size: 14px;
645
- font-weight: 600;
646
- opacity: 0.8;
647
+ font-size: 16px;
648
+ font-weight: 700;
649
+ opacity: 0.9;
647
650
  color: var(--mcp-text);
648
651
  display: flex;
649
652
  align-items: center;
650
- gap: 8px;
653
+ gap: 10px;
654
+ width: 100%;
651
655
  }
652
656
 
653
657
  .mcp-chat-thinking-steps {
654
- max-height: 120px;
658
+ max-height: 320px;
655
659
  overflow-y: auto;
656
- font-size: 13px;
657
- line-height: 1.6;
660
+ font-size: 15px;
661
+ line-height: 1.7;
658
662
  color: var(--mcp-text-secondary);
659
663
  }
660
664
 
661
665
  .mcp-chat-thinking-step {
662
- padding-bottom: 6px;
663
- margin-bottom: 6px;
666
+ padding: 6px 0;
667
+ margin-bottom: 4px;
664
668
  border-bottom: 1px solid var(--mcp-border);
665
669
  }
666
670
 
@@ -668,6 +672,13 @@
668
672
  border-bottom: none;
669
673
  }
670
674
 
675
+ .mcp-chat-thinking-time {
676
+ margin-left: auto;
677
+ font-size: 13px;
678
+ font-weight: 400;
679
+ opacity: 0.6;
680
+ }
681
+
671
682
  /* ───────────────────────────────────────────────
672
683
  Input form
673
684
  ─────────────────────────────────────────────── */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nqminds/mcp-client",
3
- "version": "1.0.21",
3
+ "version": "1.0.26",
4
4
  "description": "Reusable MCP client component with AI chat interface",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",