@nqminds/mcp-client 1.0.27 → 1.0.29

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;AAyKhF,wBAAgB,OAAO,CAAC,EACtB,aAAa,EACb,WAA6B,EAC7B,YAAiB,EACjB,SAAc,GACf,EAAE,YAAY,qBAshBd"}
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;AAkNhF,wBAAgB,OAAO,CAAC,EACtB,aAAa,EACb,WAA6B,EAC7B,YAAiB,EACjB,SAAc,GACf,EAAE,YAAY,qBAshBd"}
package/dist/MCPChat.js CHANGED
@@ -2,6 +2,31 @@
2
2
  import React, { useState, useRef, useEffect, useCallback } from "react";
3
3
  import ReactMarkdown from "react-markdown";
4
4
  import remarkGfm from "remark-gfm";
5
+ /**
6
+ * Strips utm_source=openai (and any surrounding & or ?) from a URL.
7
+ */
8
+ function stripUtmSource(url) {
9
+ return url
10
+ .replace(/[?&]utm_source=openai/gi, (match) => (match.startsWith("?") ? "?" : ""))
11
+ .replace(/\?$/, "");
12
+ }
13
+ /**
14
+ * Post-processes AI response content to ensure all links open in a new tab
15
+ * and have tracking parameters removed.
16
+ * Converts HTML anchor tags (<a href="...">) into markdown links ([text](url))
17
+ * so they are handled by the ReactMarkdown custom 'a' component which adds
18
+ * target="_blank" rel="noopener noreferrer". This also prevents raw HTML
19
+ * anchor tags from breaking markdown tables.
20
+ */
21
+ function preprocessLinks(content) {
22
+ // Convert HTML anchors to markdown links (stripping utm params)
23
+ const step1 = content.replace(/<a\s[^>]*?href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/gi, (_, href, innerHtml) => {
24
+ const linkText = innerHtml.replace(/<[^>]+>/g, "").trim();
25
+ return `[${linkText || href}](${stripUtmSource(href)})`;
26
+ });
27
+ // Strip utm params from plain markdown links [text](url)
28
+ return step1.replace(/\[([^\]]*)\]\(([^)]*)\)/g, (_, text, url) => `[${text}](${stripUtmSource(url)})`);
29
+ }
5
30
  const DEFAULT_ACTIONS = [
6
31
  {
7
32
  label: "Company overview",
@@ -71,7 +96,15 @@ https://find-and-update.company-information.service.gov.uk/company/[companies_ho
71
96
  2.1.3.8. Are they a director, PSC or investor of one of the other directors, PSCs or investors of the company?
72
97
  2.1.3.9. Are there possible family relationships between directors, PSCs or investors?
73
98
  3. Check whether dissolved entities registered at the same address share directors, PSCs or investors with the company
74
- 4. Your response should include a clear summary of each risk factor identified, with a rating from low to high and a suggestion for further investigation.
99
+ 4. Use the get_company_circular_ownership tool to check whether the company has any circular ownership patterns. Also use get_ownership_analysis to gather the full ownership structure.
100
+ 4.1. Present the full ownership structure as a table (Name | Company no. | Kind | Ownership % | Control type | Notified on). This must appear regardless of whether circular ownership is found.
101
+ 4.2. If circular ownership IS detected:
102
+ 4.2.1. It MUST be the very first section of the entire response, rendered as the CIRCULAR OWNERSHIP WARNING BLOCK described in the formatting rules. Do not place any other content before it.
103
+ 4.2.2. Each detected cycle must have its own row in the cycle table inside the warning block, showing the full path with company numbers (e.g. AMCOR HOLDING (04227427) → AFP EUROPE (03051270) → AMCOR HOLDING (04227427)), cycle length, and ownership percentages in both directions.
104
+ 4.2.3. After the closing --- of the warning block, continue with the ownership analysis table and then the rest of the response.
105
+ 4.2.4. In the final risk summary table (step 5), include circular ownership as a separate HIGH-rated row.
106
+ 4.3. If no circular ownership is found, add a brief ✅ note: "No circular ownership detected" before the ownership analysis table.
107
+ 5. Your response should include a clear summary of each risk factor identified as a table with columns: Risk factor | Rating | Why / Immediate effect | Recommended next action. Ensure there is a blank line before the opening | of this table.
75
108
 
76
109
  Note that your database does not list dissolved companies so you will need to search for those on Companies House. To gather additional information on people, use Companies House people search. The same person might appear in the search results multiple times with the same name so reconcile on birth date or address.
77
110
 
@@ -466,7 +499,7 @@ export function MCPChat({ companyNumber, apiEndpoint = "/api/mcp/chat", customSt
466
499
  msg.role === "assistant" ? (React.createElement("div", { className: "mcp-chat-message-content markdown-content" },
467
500
  React.createElement(ReactMarkdown, { remarkPlugins: [remarkGfm], components: {
468
501
  a: ({ href, children }) => (React.createElement("a", { href: href, target: "_blank", rel: "noopener noreferrer" }, children)),
469
- } }, msg.content))) : (React.createElement("div", { className: "mcp-chat-message-content" }, msg.content)),
502
+ } }, preprocessLinks(msg.content)))) : (React.createElement("div", { className: "mcp-chat-message-content" }, msg.content)),
470
503
  msg.role === "assistant" && !msg.isStreaming && (React.createElement("div", { className: "mcp-chat-message-timestamp" },
471
504
  msg.timestamp.toLocaleTimeString(),
472
505
  msg.tokenInfo && (React.createElement("span", { className: "mcp-chat-token-info" }, msg.tokenInfo)))))))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nqminds/mcp-client",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "Reusable MCP client component with AI chat interface",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",