@nqminds/mcp-client 1.0.5 → 1.0.7
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/MCPChat.d.ts.map +1 -1
- package/dist/MCPChat.js +3 -5
- package/dist/openai-client.d.ts.map +1 -1
- package/dist/openai-client.js +40 -1
- package/package.json +1 -1
package/dist/MCPChat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MCPChat.d.ts","sourceRoot":"","sources":["../src/MCPChat.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EAAyB,YAAY,EAAe,MAAM,SAAS,CAAC;AAEhF,wBAAgB,OAAO,CAAC,EACtB,aAAa,EACb,WAA6B,EAC7B,YAAiB,EACjB,SAAc,EACf,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"MCPChat.d.ts","sourceRoot":"","sources":["../src/MCPChat.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EAAyB,YAAY,EAAe,MAAM,SAAS,CAAC;AAEhF,wBAAgB,OAAO,CAAC,EACtB,aAAa,EACb,WAA6B,EAC7B,YAAiB,EACjB,SAAc,EACf,EAAE,YAAY,qBAmVd"}
|
package/dist/MCPChat.js
CHANGED
|
@@ -206,11 +206,9 @@ export function MCPChat({ companyNumber, apiEndpoint = "/api/mcp/chat", customSt
|
|
|
206
206
|
"Currently viewing: ",
|
|
207
207
|
React.createElement("strong", null, companyNumber))),
|
|
208
208
|
React.createElement("p", { className: "mcp-chat-welcome-subtitle" }, "Try asking:"),
|
|
209
|
-
React.createElement("ul", { className: "mcp-chat-suggestions" },
|
|
210
|
-
React.createElement("li", null, "\
|
|
211
|
-
|
|
212
|
-
React.createElement("li", null, "\u201CGet company info\u201D"),
|
|
213
|
-
React.createElement("li", null, "\u201CShow me financial data from 2020\u201D")))))),
|
|
209
|
+
React.createElement("ul", { className: "mcp-chat-suggestions" }, companyNumber && (React.createElement(React.Fragment, null,
|
|
210
|
+
React.createElement("li", null, "\u201CGet company info\u201D"),
|
|
211
|
+
React.createElement("li", null, "\u201CShow me financial data from 2020\u201D")))))),
|
|
214
212
|
messages.map((msg, idx) => (React.createElement("div", { key: idx, className: `mcp-chat-message ${msg.role === "user" ? "mcp-chat-message-user" : "mcp-chat-message-assistant"}` },
|
|
215
213
|
React.createElement("div", { className: "mcp-chat-message-bubble" },
|
|
216
214
|
msg.role === "assistant" ? (React.createElement("div", { className: "mcp-chat-message-content markdown-content" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-client.d.ts","sourceRoot":"","sources":["../src/openai-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,MAAM,CAA4B;gBAE9B,MAAM,EAAE,eAAe;
|
|
1
|
+
{"version":3,"file":"openai-client.d.ts","sourceRoot":"","sources":["../src/openai-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,MAAM,CAA4B;gBAE9B,MAAM,EAAE,eAAe;YAwErB,mBAAmB;IAoB3B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAoMrH,YAAY,IAAI,IAAI;IAMd,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
|
package/dist/openai-client.js
CHANGED
|
@@ -33,6 +33,43 @@ export class MCPClientOpenAI {
|
|
|
33
33
|
}, {
|
|
34
34
|
capabilities: {},
|
|
35
35
|
});
|
|
36
|
+
// Initialize conversation with system message
|
|
37
|
+
this.conversationHistory = [
|
|
38
|
+
{
|
|
39
|
+
type: "message",
|
|
40
|
+
role: "system",
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: "input_text",
|
|
44
|
+
text: `You are a helpful assistant with access to Companies House data through specialized tools.
|
|
45
|
+
|
|
46
|
+
CRITICAL CONTEXT AWARENESS RULES:
|
|
47
|
+
1. Carefully track ALL entities you mention in your responses (company numbers, names, people, dates, etc.)
|
|
48
|
+
2. When the user refers to "that company," "the person," "those results," or uses similar references, ALWAYS look back at what you just discussed in the immediately preceding messages
|
|
49
|
+
3. If you mentioned specific company numbers, names, or other identifiers, remember them for follow-up questions
|
|
50
|
+
4. Before saying "I don't have a record of X," review your recent responses to check if you did mention it
|
|
51
|
+
5. Maintain awareness of the conversation flow - if you just provided information about something, the user's next question likely refers to it
|
|
52
|
+
|
|
53
|
+
RESPONSE FORMATTING RULES:
|
|
54
|
+
- NEVER show raw JSON data to users unless they explicitly ask for "JSON", "raw data", or similar
|
|
55
|
+
- Always present data in natural, human-readable format using clear sentences and bullet points
|
|
56
|
+
- Convert dates to readable format (e.g., "15 March 2023" instead of "2023-03-15")
|
|
57
|
+
- Format addresses as natural text, not as structured fields
|
|
58
|
+
- Present lists of items as bulleted lists or comma-separated values
|
|
59
|
+
- Use tables/structured format only when it significantly improves readability
|
|
60
|
+
- When showing company officers or PSCs, write like: "John Smith (born March 1975, British nationality)" rather than showing field names
|
|
61
|
+
- Only include the most relevant information - don't dump all available fields
|
|
62
|
+
|
|
63
|
+
When responding:
|
|
64
|
+
- Be concise and direct
|
|
65
|
+
- Use tools to fetch accurate, up-to-date Companies House data
|
|
66
|
+
- Track key identifiers (company numbers, PSC names, etc.) across the conversation
|
|
67
|
+
- If unclear what the user is referring to, check your previous response first before asking for clarification
|
|
68
|
+
- Never expose internal implementation details like "MCP Server" or tool names to users`,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
];
|
|
36
73
|
}
|
|
37
74
|
async compactConversation() {
|
|
38
75
|
try {
|
|
@@ -229,7 +266,9 @@ export class MCPClientOpenAI {
|
|
|
229
266
|
return finalResponse;
|
|
230
267
|
}
|
|
231
268
|
clearHistory() {
|
|
232
|
-
|
|
269
|
+
// Keep the system message (first item) when clearing history
|
|
270
|
+
const systemMessage = this.conversationHistory[0];
|
|
271
|
+
this.conversationHistory = systemMessage ? [systemMessage] : [];
|
|
233
272
|
}
|
|
234
273
|
async cleanup() {
|
|
235
274
|
await this.client.close();
|